index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
8.19k
signature
stringlengths
2
42.8k
embed_func_code
listlengths
768
768
724,701
scipy.sparse._compressed
maximum
Element-wise maximum between this and another array/matrix.
def maximum(self, other): return self._maximum_minimum(other, np.maximum, '_maximum_', lambda x: np.asarray(x) > 0)
(self, other)
[ 0.02863944321870804, 0.008881190791726112, 0.010179813951253891, 0.059370629489421844, -0.0323871485888958, -0.056302741169929504, -0.04671558737754822, 0.028604580089449883, 0.04786604642868042, -0.03557705506682396, 0.020429354161024094, 0.008924768306314945, -0.004050572402775288, -0.03...
724,702
scipy.sparse._base
mean
Compute the arithmetic mean along the specified axis. Returns the average of the array/matrix elements. The average is taken over all elements in the array/matrix by default, otherwise over the specified axis. `float64` intermediate and return values are used for integer inputs...
def mean(self, axis=None, dtype=None, out=None): """ Compute the arithmetic mean along the specified axis. Returns the average of the array/matrix elements. The average is taken over all elements in the array/matrix by default, otherwise over the specified axis. `float64` intermediate and return val...
(self, axis=None, dtype=None, out=None)
[ -0.03882504999637604, -0.019730132073163986, 0.03697715327143669, 0.05247252434492111, 0.07999846339225769, -0.007237589918076992, -0.020095860585570335, -0.0031135110184550285, 0.03759311884641647, 0.008859310299158096, -0.013426113873720169, -0.026448000222444534, 0.0004776135610882193, ...
724,703
scipy.sparse._data
min
Return the minimum of the array/matrix or maximum along an axis. This takes all elements into account, not just the non-zero ones. Parameters ---------- axis : {-2, -1, 0, 1, None} optional Axis along which the sum is computed. The default is to compute ...
def min(self, axis=None, out=None): """ Return the minimum of the array/matrix or maximum along an axis. This takes all elements into account, not just the non-zero ones. Parameters ---------- axis : {-2, -1, 0, 1, None} optional Axis along which the sum is computed. The default is to ...
(self, axis=None, out=None)
[ 0.0014364273520186543, 0.0035554913338273764, 0.03404733166098595, -0.007039828225970268, 0.04753107205033302, 0.02853287383913994, 0.02456602081656456, -0.017841940745711327, 0.007382258307188749, -0.03835216537117958, -0.028906432911753654, -0.024423712864518166, -0.02853287383913994, -0...
724,704
scipy.sparse._compressed
minimum
Element-wise minimum between this and another array/matrix.
def minimum(self, other): return self._maximum_minimum(other, np.minimum, '_minimum_', lambda x: np.asarray(x) < 0)
(self, other)
[ 0.009026172570884228, -0.029673434793949127, 0.044001515954732895, 0.049070652574300766, 0.015405702404677868, -0.010345183312892914, 0.012396978214383125, 0.009931376203894615, 0.04231180250644684, -0.01231938973069191, 0.025414668023586273, -0.025311216711997986, 0.022586984559893608, -0...
724,705
scipy.sparse._compressed
multiply
Point-wise multiplication by another array/matrix, vector, or scalar.
def multiply(self, other): """Point-wise multiplication by another array/matrix, vector, or scalar. """ # Scalar multiplication. if isscalarlike(other): return self._mul_scalar(other) # Sparse matrix or vector. if issparse(other): if self.shape == other.shape: oth...
(self, other)
[ 0.005738673731684685, -0.0544036366045475, 0.0654461607336998, 0.05331151932477951, -0.03328936547040939, -0.08534697443246841, -0.04030723124742508, 0.010951513424515724, 0.06394955515861511, -0.0017279222374781966, -0.06645738333463669, -0.01862667314708233, 0.030275927856564522, 0.05428...
724,706
scipy.sparse._data
nanmax
Return the maximum of the array/matrix or maximum along an axis, ignoring any NaNs. This takes all elements into account, not just the non-zero ones. .. versionadded:: 1.11.0 Parameters ---------- axis : {-2, -1, 0, 1, None} optional Axis along whic...
def nanmax(self, axis=None, out=None): """ Return the maximum of the array/matrix or maximum along an axis, ignoring any NaNs. This takes all elements into account, not just the non-zero ones. .. versionadded:: 1.11.0 Parameters ---------- axis : {-2, -1, 0, 1, None} optional Axi...
(self, axis=None, out=None)
[ -0.0033131965901702642, 0.037829041481018066, 0.05614854022860527, 0.018445715308189392, -0.009502338245511055, -0.03397040814161301, -0.031806688755750656, 0.017291730269789696, 0.0569058433175087, -0.07746118307113647, -0.03544894978404045, -0.008573741652071476, -0.02939053252339363, -0...
724,707
scipy.sparse._data
nanmin
Return the minimum of the array/matrix or minimum along an axis, ignoring any NaNs. This takes all elements into account, not just the non-zero ones. .. versionadded:: 1.11.0 Parameters ---------- axis : {-2, -1, 0, 1, None} optional Axis along whic...
def nanmin(self, axis=None, out=None): """ Return the minimum of the array/matrix or minimum along an axis, ignoring any NaNs. This takes all elements into account, not just the non-zero ones. .. versionadded:: 1.11.0 Parameters ---------- axis : {-2, -1, 0, 1, None} optional Axi...
(self, axis=None, out=None)
[ -0.014684729278087616, 0.012016396038234234, 0.05667540803551674, 0.009988462552428246, 0.04817231744527817, -0.0025082335341721773, 0.015485229901969433, 0.013314984738826752, 0.03824611380696297, -0.04578860476613045, -0.0304190032184124, -0.045219361782073975, -0.0030908198095858097, -0...
724,708
scipy.sparse._csc
nonzero
Nonzero indices of the array/matrix. Returns a tuple of arrays (row,col) containing the indices of the non-zero elements of the array. Examples -------- >>> from scipy.sparse import csr_array >>> A = csr_array([[1,2,0],[0,0,3],[4,0,5]]) >>> A.nonzero() (...
def nonzero(self): # CSC can't use _cs_matrix's .nonzero method because it # returns the indices sorted for self transposed. # Get row and col indices, from _cs_matrix.tocoo major_dim, minor_dim = self._swap(self.shape) minor_indices = self.indices major_indices = np.empty(len(minor_indices), dt...
(self)
[ -0.009637109935283661, -0.010567556135356426, 0.01847393997013569, 0.0048547121696174145, 0.03590654954314232, -0.043003011494874954, -0.04697548970580101, 0.04419861361384392, 0.003979707136750221, -0.011194282211363316, -0.047554004937410355, 0.027614491060376167, -0.0013486651005223393, ...
724,709
scipy.sparse._data
power
This function performs element-wise power. Parameters ---------- n : scalar n is a non-zero scalar (nonzero avoids dense ones creation) If zero power is desired, special case it to use `np.ones` dtype : If dtype is not specified, the current dtype will ...
def power(self, n, dtype=None): """ This function performs element-wise power. Parameters ---------- n : scalar n is a non-zero scalar (nonzero avoids dense ones creation) If zero power is desired, special case it to use `np.ones` dtype : If dtype is not specified, the current dt...
(self, n, dtype=None)
[ -0.014853494241833687, -0.022501463070511818, 0.10474196821451187, 0.003018103539943695, 0.04930096119642258, -0.004857860039919615, -0.054646410048007965, -0.04771177098155022, -0.006740506738424301, 0.03806828707456589, -0.018853554502129555, 0.02517418935894966, 0.052407100796699524, 0....
724,710
scipy.sparse._compressed
prune
Remove empty space after all non-zero elements.
def prune(self): """Remove empty space after all non-zero elements. """ major_dim = self._swap(self.shape)[0] if len(self.indptr) != major_dim + 1: raise ValueError('index pointer has invalid length') if len(self.indices) < self.nnz: raise ValueError('indices array has fewer than nnz...
(self)
[ -0.03896642103791237, 0.02506839856505394, -0.04249195381999016, -0.04249195381999016, -0.0013046793173998594, -0.03178546577692032, -0.042009513825178146, -0.0006569785182364285, 0.021301643922924995, -0.05113878846168518, -0.04111885279417038, -0.016644228249788284, 0.037370651960372925, ...
724,711
scipy.sparse._data
rad2deg
Element-wise rad2deg. See `numpy.rad2deg` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,712
scipy.sparse._base
reshape
reshape(self, shape, order='C', copy=False) Gives a new shape to a sparse array/matrix without changing its data. Parameters ---------- shape : length-2 tuple of ints The new shape should be compatible with the original shape. order : {'C', 'F'}, optional ...
def reshape(self, *args, **kwargs): """reshape(self, shape, order='C', copy=False) Gives a new shape to a sparse array/matrix without changing its data. Parameters ---------- shape : length-2 tuple of ints The new shape should be compatible with the original shape. order : {'C', 'F'}, op...
(self, *args, **kwargs)
[ -0.016101298853754997, 0.00208154134452343, 0.03539671003818512, -0.05446796864271164, 0.004926586989313364, -0.03534067049622536, 0.008606350049376488, 0.048453330993652344, 0.09884928166866302, -0.0059119039215147495, -0.07277338951826096, -0.024525528773665428, 0.0014779759803786874, 0....
724,713
scipy.sparse._compressed
resize
Resize the array/matrix in-place to dimensions given by ``shape`` Any elements that lie within the new shape will remain at the same indices, while non-zero elements lying outside the new shape are removed. Parameters ---------- shape : (int, int) number of ...
def resize(self, *shape): shape = check_shape(shape) if hasattr(self, 'blocksize'): bm, bn = self.blocksize new_M, rm = divmod(shape[0], bm) new_N, rn = divmod(shape[1], bn) if rm or rn: raise ValueError("shape must be divisible into {} blocks. " ...
(self, *shape)
[ 0.01225120946764946, -0.05963047966361046, -0.025989215821027756, -0.022123543545603752, -0.04535722732543945, -0.037050988525152206, 0.004135774448513985, 0.03699151426553726, -0.030885735526680946, -0.006517128087580204, -0.013807390816509724, -0.025453967973589897, 0.018505670130252838, ...
724,714
scipy.sparse._data
rint
Element-wise rint. See `numpy.rint` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,715
scipy.sparse._matrix
set_shape
Set the shape of the matrix in-place
def set_shape(self, shape): """Set the shape of the matrix in-place""" # Make sure copy is False since this is in place # Make sure format is unchanged because we are doing a __dict__ swap new_self = self.reshape(shape, copy=False).asformat(self.format) self.__dict__ = new_self.__dict__
(self, shape)
[ 0.013760684058070183, -0.00460691237822175, 0.019285546615719795, -0.005048729479312897, -0.03853677585721016, -0.030781378969550133, -0.014181053265929222, 0.04859134182333946, 0.020280707627534866, 0.015570848248898983, -0.020520919933915138, -0.019628705456852913, 0.007313580252230167, ...
724,716
scipy.sparse._base
setdiag
Set diagonal or off-diagonal elements of the array/matrix. Parameters ---------- values : array_like New values of the diagonal elements. Values may have any length. If the diagonal is longer than values, then the remaining diagonal entries will not...
def setdiag(self, values, k=0): """ Set diagonal or off-diagonal elements of the array/matrix. Parameters ---------- values : array_like New values of the diagonal elements. Values may have any length. If the diagonal is longer than values, then the remaining diagonal entries...
(self, values, k=0)
[ -0.0106398556381464, 0.007275914307683706, 0.008019991219043732, 0.020335134118795395, -0.04184653237462044, -0.02347184158861637, -0.028533346951007843, -0.0032057687640190125, 0.002020592335611582, 0.048512037843465805, -0.05204083397984505, 0.011263632215559483, 0.06255593150854111, 0.0...
724,717
scipy.sparse._data
sign
Element-wise sign. See `numpy.sign` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,718
scipy.sparse._data
sin
Element-wise sin. See `numpy.sin` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,719
scipy.sparse._data
sinh
Element-wise sinh. See `numpy.sinh` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,720
scipy.sparse._compressed
sort_indices
Sort the indices of this array/matrix *in place*
def sort_indices(self): """Sort the indices of this array/matrix *in place* """ if not self.has_sorted_indices: _sparsetools.csr_sort_indices(len(self.indptr) - 1, self.indptr, self.indices, self.data) self.has_sorted_indices = True
(self)
[ -0.036322493106126785, 0.02666761912405491, -0.018870890140533447, 0.04907738417387009, 0.019757943227887154, -0.017311543226242065, -0.0026378161273896694, 0.04340024292469025, -0.0011549198534339666, -0.0549786239862442, -0.07346668094396591, -0.06076781079173088, 0.04791954532265663, 0....
724,721
scipy.sparse._compressed
sorted_indices
Return a copy of this array/matrix with sorted indices
def sorted_indices(self): """Return a copy of this array/matrix with sorted indices """ A = self.copy() A.sort_indices() return A # an alternative that has linear complexity is the following # although the previous option is typically faster # return self.toother().toother()
(self)
[ -0.0511104017496109, -0.017918623983860016, -0.028041940182447433, 0.020105542615056038, 0.0003050552913919091, -0.024691015481948853, 0.010414318181574345, 0.05202749744057655, 0.008668310008943081, -0.04444383084774017, -0.06924066692590714, -0.03922344371676445, 0.01966463029384613, 0.0...
724,722
scipy.sparse._data
sqrt
Element-wise sqrt. See `numpy.sqrt` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,723
scipy.sparse._compressed
sum
Sum the array/matrix elements over a given axis. Parameters ---------- axis : {-2, -1, 0, 1, None} optional Axis along which the sum is computed. The default is to compute the sum of all the array/matrix elements, returning a scalar (i.e., `axis` = `...
def sum(self, axis=None, dtype=None, out=None): """Sum the array/matrix over the given axis. If the axis is None, sum over both rows and columns, returning a scalar. """ # The _spbase base class already does axis=0 and axis=1 efficiently # so we only do the case axis=None here if (not hasattr(s...
(self, axis=None, dtype=None, out=None)
[ -0.043811649084091187, -0.01856060139834881, -0.003037230111658573, 0.05003448948264122, 0.03007105179131031, -0.011663323268294334, -0.05035822093486786, -0.024297840893268585, 0.031815603375434875, -0.015026533044874668, -0.008916102349758148, -0.04136567935347557, 0.00963100977241993, 0...
724,724
scipy.sparse._compressed
sum_duplicates
Eliminate duplicate entries by adding them together This is an *in place* operation.
def sum_duplicates(self): """Eliminate duplicate entries by adding them together This is an *in place* operation. """ if self.has_canonical_format: return self.sort_indices() M, N = self._swap(self.shape) _sparsetools.csr_sum_duplicates(M, N, self.indptr, self.indices, ...
(self)
[ -0.0192066952586174, -0.014691558666527271, 0.02651774324476719, 0.06967202574014664, -0.0043892334215343, -0.0565781332552433, -0.039906859397888184, -0.017114102840423584, 0.06185736879706383, 0.014439753256738186, -0.08523188531398773, -0.040149983018636703, 0.02627461962401867, 0.00290...
724,725
scipy.sparse._data
tan
Element-wise tan. See `numpy.tan` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,726
scipy.sparse._data
tanh
Element-wise tanh. See `numpy.tanh` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,727
scipy.sparse._compressed
toarray
Return a dense ndarray representation of this sparse array/matrix. Parameters ---------- order : {'C', 'F'}, optional Whether to store multidimensional data in C (row-major) or Fortran (column-major) order in memory. The default is 'None', which prov...
def toarray(self, order=None, out=None): if out is None and order is None: order = self._swap('cf')[0] out = self._process_toarray_args(order, out) if not (out.flags.c_contiguous or out.flags.f_contiguous): raise ValueError('Output array must be C or F contiguous') # align ideal order wi...
(self, order=None, out=None)
[ -0.026284128427505493, 0.0511319674551487, -0.007159013766795397, -0.05526130273938179, 0.010404134169220924, -0.026481619104743004, -0.003070072503760457, 0.00436049047857523, 0.0607910230755806, -0.04797212406992912, 0.007531552109867334, -0.06556669622659683, 0.018160106614232063, -0.04...
724,728
scipy.sparse._base
tobsr
Convert this array/matrix to Block Sparse Row format. With copy=False, the data/indices may be shared between this array/matrix and the resultant bsr_array/matrix. When blocksize=(R, C) is provided, it will be used for construction of the bsr_array/matrix.
def tobsr(self, blocksize=None, copy=False): """Convert this array/matrix to Block Sparse Row format. With copy=False, the data/indices may be shared between this array/matrix and the resultant bsr_array/matrix. When blocksize=(R, C) is provided, it will be used for construction of the bsr_array/mat...
(self, blocksize=None, copy=False)
[ 0.00912811141461134, -0.039329323917627335, -0.0053930738940835, -0.023052047938108444, -0.057942114770412445, -0.037938714027404785, -0.035995423793792725, 0.0164644755423069, 0.01588505320250988, -0.02492402493953705, -0.057728175073862076, -0.04296630620956421, -0.01741829141974449, 0.0...
724,729
scipy.sparse._compressed
tocoo
Convert this array/matrix to COOrdinate format. With copy=False, the data/indices may be shared between this array/matrix and the resultant coo_array/matrix.
def tocoo(self, copy=True): major_dim, minor_dim = self._swap(self.shape) minor_indices = self.indices major_indices = np.empty(len(minor_indices), dtype=self.indices.dtype) _sparsetools.expandptr(major_dim, self.indptr, major_indices) coords = self._swap((major_indices, minor_indices)) return s...
(self, copy=True)
[ 0.011853286065161228, -0.034144673496484756, 0.03407256305217743, -0.05837405100464821, 0.012322008609771729, -0.0322517529129982, -0.0029565610457211733, 0.019866647198796272, 0.021885761991143227, -0.011997507885098457, -0.02125478908419609, -0.04827847704291344, -0.04052652046084404, -0...
724,730
scipy.sparse._csc
tocsc
Convert this array/matrix to Compressed Sparse Column format. With copy=False, the data/indices may be shared between this array/matrix and the resultant csc_array/matrix.
def tocsc(self, copy=False): if copy: return self.copy() else: return self
(self, copy=False)
[ -0.02570953220129013, 0.008007550612092018, 0.016827760264277458, -0.02886166051030159, -0.030486974865198135, 0.006099036894738674, -0.002216339111328125, 0.019733626395463943, 0.07085718214511871, -0.020455988124012947, -0.015054687857627869, 0.00189620116725564, -0.014800219796597958, 0...
724,731
scipy.sparse._csc
tocsr
Convert this array/matrix to Compressed Sparse Row format. With copy=False, the data/indices may be shared between this array/matrix and the resultant csr_array/matrix.
def tocsr(self, copy=False): M,N = self.shape idx_dtype = self._get_index_dtype((self.indptr, self.indices), maxval=max(self.nnz, N)) indptr = np.empty(M + 1, dtype=idx_dtype) indices = np.empty(self.nnz, dtype=idx_dtype) data = np.empty(self.nnz, dtype=upcast(self.dt...
(self, copy=False)
[ -0.03960351645946503, -0.012469804845750332, 0.0451984740793705, -0.06673722714185715, 0.007167395204305649, -0.0072953845374286175, 0.01327430922538042, 0.016510607674717903, 0.05481594800949097, 0.022123847156763077, -0.04483278840780258, -0.03477649390697479, 0.034026842564344406, -0.00...
724,732
scipy.sparse._base
todense
Return a dense representation of this sparse array/matrix. Parameters ---------- order : {'C', 'F'}, optional Whether to store multi-dimensional data in C (row-major) or Fortran (column-major) order in memory. The default is 'None', which provides no...
def todense(self, order=None, out=None): """ Return a dense representation of this sparse array/matrix. Parameters ---------- order : {'C', 'F'}, optional Whether to store multi-dimensional data in C (row-major) or Fortran (column-major) order in memory. The default is 'None'...
(self, order=None, out=None)
[ 0.02807600051164627, 0.03388238698244095, 0.04634487256407738, -0.024411603808403015, 0.022641364485025406, -0.035758841782808304, -0.01851670630276203, 0.03246619552373886, 0.02627035602927208, -0.04429139569401741, -0.07063256204128265, -0.05080587789416313, -0.021933268755674362, -0.026...
724,733
scipy.sparse._base
todia
Convert this array/matrix to sparse DIAgonal format. With copy=False, the data/indices may be shared between this array/matrix and the resultant dia_array/matrix.
def todia(self, copy=False): """Convert this array/matrix to sparse DIAgonal format. With copy=False, the data/indices may be shared between this array/matrix and the resultant dia_array/matrix. """ return self.tocoo(copy=copy).todia(copy=False)
(self, copy=False)
[ -0.009751247242093086, 0.023034026846289635, 0.10907340794801712, -0.0004461085773073137, 0.006044016219675541, -0.04125392436981201, 0.007880061864852905, 0.00001645454358367715, 0.02145274356007576, 0.006764378398656845, -0.06261882185935974, -0.03187164291739464, -0.021927129477262497, ...
724,734
scipy.sparse._base
todok
Convert this array/matrix to Dictionary Of Keys format. With copy=False, the data/indices may be shared between this array/matrix and the resultant dok_array/matrix.
def todok(self, copy=False): """Convert this array/matrix to Dictionary Of Keys format. With copy=False, the data/indices may be shared between this array/matrix and the resultant dok_array/matrix. """ return self.tocoo(copy=copy).todok(copy=False)
(self, copy=False)
[ 0.0015417387476190925, -0.016944799572229385, -0.026060784235596657, 0.0028145823162049055, -0.018284866586327553, -0.011046739295125008, -0.016230683773756027, 0.027206894010305405, 0.0691545307636261, -0.03381906822323799, -0.04799557104706764, -0.05240368843078613, -0.0033281277865171432,...
724,735
scipy.sparse._base
tolil
Convert this array/matrix to List of Lists format. With copy=False, the data/indices may be shared between this array/matrix and the resultant lil_array/matrix.
def tolil(self, copy=False): """Convert this array/matrix to List of Lists format. With copy=False, the data/indices may be shared between this array/matrix and the resultant lil_array/matrix. """ return self.tocsr(copy=False).tolil(copy=copy)
(self, copy=False)
[ -0.0035968769807368517, -0.016066497191786766, 0.062336940318346024, 0.04615434259176254, -0.004353761672973633, -0.010422236286103725, -0.012771034613251686, 0.00942198745906353, 0.0026323513593524694, 0.03968844562768936, -0.03711637854576111, -0.10166815668344498, 0.0021512049715965986, ...
724,736
scipy.sparse._base
trace
Returns the sum along diagonals of the sparse array/matrix. Parameters ---------- offset : int, optional Which diagonal to get, corresponding to elements a[i, i+offset]. Default: 0 (the main diagonal).
def trace(self, offset=0): """Returns the sum along diagonals of the sparse array/matrix. Parameters ---------- offset : int, optional Which diagonal to get, corresponding to elements a[i, i+offset]. Default: 0 (the main diagonal). """ return self.diagonal(k=offset).sum()
(self, offset=0)
[ -0.06130930781364441, 0.015518700703978539, 0.0789853185415268, 0.037648506462574005, 0.027888426557183266, -0.0444335900247097, -0.02526138350367546, 0.000027506630431162193, -0.05330638960003853, 0.01235232874751091, -0.05278445780277252, 0.002444369252771139, 0.08128180354833603, -0.003...
724,737
scipy.sparse._csc
transpose
Reverses the dimensions of the sparse array/matrix. Parameters ---------- axes : None, optional This argument is in the signature *solely* for NumPy compatibility reasons. Do not pass in anything except for the default value. copy : bool, opt...
def transpose(self, axes=None, copy=False): if axes is not None and axes != (1, 0): raise ValueError("Sparse arrays/matrices do not support " "an 'axes' parameter because swapping " "dimensions is the only logical permutation.") M, N = self.shape r...
(self, axes=None, copy=False)
[ -0.046646591275930405, 0.029476290568709373, 0.019312052056193352, -0.07238389551639557, -0.04047544673085213, -0.00968325138092041, 0.014084729366004467, 0.017624063417315483, 0.07441674172878265, 0.0392049178481102, -0.0033011084888130426, -0.04657398909330368, 0.000206744676688686, 0.02...
724,738
scipy.sparse._data
trunc
Element-wise trunc. See `numpy.trunc` for more information.
def _create_method(op): def method(self): result = op(self._deduped_data()) return self._with_data(result, copy=True) method.__doc__ = (f"Element-wise {name}.\n\n" f"See `numpy.{name}` for more information.") method.__name__ = name return method
(self)
[ 0.02686699666082859, -0.09872221946716309, 0.05016572028398514, -0.018103739246726036, -0.02989303320646286, -0.018750924617052078, -0.01798129826784134, -0.0048451549373567104, 0.01626712828874588, -0.0005717545282095671, 0.023438656702637672, -0.014308075420558453, 0.0821402445435524, -0...
724,739
markov_clustering.modularity
delta_matrix
Compute delta matrix where delta[i,j]=1 if i and j belong to same cluster and i!=j :param matrix: The adjacency matrix :param clusters: The clusters returned by get_clusters :returns: delta matrix
def delta_matrix(matrix, clusters): """ Compute delta matrix where delta[i,j]=1 if i and j belong to same cluster and i!=j :param matrix: The adjacency matrix :param clusters: The clusters returned by get_clusters :returns: delta matrix """ if isspmatrix(matrix): delta = dok...
(matrix, clusters)
[ 0.0487743504345417, 0.01797044649720192, 0.0043686931021511555, 0.056020207703113556, -0.009976571425795555, -0.012472967617213726, 0.010084718465805054, 0.06705120950937271, -0.011905195191502571, 0.05346072465181351, -0.06384284794330597, 0.01795242168009281, -0.028154300525784492, 0.014...
724,740
scipy.sparse._dok
dok_matrix
Dictionary Of Keys based sparse matrix. This is an efficient structure for constructing sparse matrices incrementally. This can be instantiated in several ways: dok_matrix(D) where D is a 2-D ndarray dok_matrix(S) with another sparse array or matrix S (equival...
class dok_matrix(spmatrix, _dok_base): """ Dictionary Of Keys based sparse matrix. This is an efficient structure for constructing sparse matrices incrementally. This can be instantiated in several ways: dok_matrix(D) where D is a 2-D ndarray dok_matrix(S) ...
(arg1, shape=None, dtype=None, copy=False)
[ 0.019073350355029106, -0.012426871806383133, -0.0013611657777801156, 0.032463621348142624, 0.025340309366583824, -0.02201220393180847, -0.05363893136382103, 0.05044706538319588, 0.07080494612455368, -0.041260719299316406, -0.06410980969667435, -0.009760495275259018, 0.027578508481383324, 0...
724,741
scipy.sparse._base
__abs__
null
def __abs__(self): return abs(self.tocsr())
(self)
[ 0.002553544705733657, 0.012369068339467049, 0.09109150618314743, 0.059819746762514114, 0.007292147725820541, -0.048614319413900375, -0.012334589846432209, -0.027927374467253685, 0.026168983429670334, 0.014730827882885933, -0.03575393557548523, -0.009412559680640697, 0.07274908572435379, 0....
724,742
scipy.sparse._dok
__add__
null
def __add__(self, other): if isscalarlike(other): res_dtype = upcast_scalar(self.dtype, other) new = self._dok_container(self.shape, dtype=res_dtype) # Add this scalar to each element. for key in itertools.product(*[range(d) for d in self.shape]): aij = self._dict.get(key...
(self, other)
[ -0.013282615691423416, -0.04269477725028992, 0.02634553238749504, 0.061149463057518005, 0.010811005719006062, -0.03037334233522415, -0.05060392990708351, -0.0004250940401107073, 0.04174274951219559, -0.011003241874277592, -0.015754226595163345, -0.034254685044288635, 0.00906714703887701, 0...
724,744
scipy.sparse._dok
__contains__
null
def __contains__(self, key): return key in self._dict
(self, key)
[ 0.0488039068877697, -0.0646294429898262, -0.05326228588819504, 0.04574090242385864, -0.0004068056005053222, -0.01388563122600317, 0.0065897186286747456, -0.012745511718094349, 0.03968295454978943, -0.043528731912374496, -0.035496845841407776, 0.0007753235986456275, 0.08031884580850601, -0....
724,745
scipy.sparse._dok
__delitem__
null
def __delitem__(self, key, /): del self._dict[key]
(self, key, /)
[ 0.04638677462935448, -0.003993322141468525, -0.023296164348721504, -0.009703880175948143, -0.04830528050661087, -0.030953064560890198, -0.04744880273938179, 0.05848022177815437, 0.07304032146930695, -0.0005711628473363817, -0.03720534220337868, 0.020863769575953484, 0.037582192569971085, 0...
724,747
scipy.sparse._base
__eq__
null
def __eq__(self, other): return self.tocsr().__eq__(other)
(self, other)
[ 0.027358656749129295, -0.019362568855285645, 0.05371994897723198, 0.06266181170940399, -0.039206620305776596, -0.07511163502931595, -0.06262741982936859, 0.004642889369279146, 0.04962733015418053, 0.004728869069367647, -0.029129832983016968, -0.0395161472260952, 0.09361440688371658, 0.0512...
724,748
scipy.sparse._base
__ge__
null
def __ge__(self, other): return self.tocsr().__ge__(other)
(self, other)
[ 0.016831591725349426, -0.032809656113386154, 0.05551352724432945, 0.06285388022661209, -0.03864779323339462, -0.05196284502744675, -0.049163270741701126, -0.038408804684877396, 0.046295415610075, -0.011147089302539825, -0.022396601736545563, -0.05500141158699989, 0.05643533915281296, -0.00...
724,749
scipy.sparse._dok
__getitem__
null
def __getitem__(self, key): if self.ndim == 2: return super().__getitem__(key) if isinstance(key, tuple) and len(key) == 1: key = key[0] INT_TYPES = (int, np.integer) if isinstance(key, INT_TYPES): if key < 0: key += self.shape[-1] if key < 0 or key >= self.sh...
(self, key)
[ 0.024487759917974472, -0.03676723316311836, -0.05025685578584671, 0.0408959798514843, 0.03584182262420654, -0.015616285614669323, 0.0017863073153421283, 0.017404817044734955, 0.06371088325977325, -0.05064837262034416, -0.01790311373770237, -0.0010127227287739515, 0.027744488790631294, -0.0...
724,750
scipy.sparse._base
__gt__
null
def __gt__(self, other): return self.tocsr().__gt__(other)
(self, other)
[ -0.013690647669136524, -0.0007288206252269447, 0.02848205156624317, 0.04086555168032646, -0.020759563893079758, -0.06435980647802353, -0.06374063342809677, -0.013191868551075459, 0.034484609961509705, -0.03178431838750839, -0.0075074974447488785, -0.028155265375971794, 0.06955399364233017, ...
724,753
scipy.sparse._dok
__imul__
null
def __imul__(self, other): if isscalarlike(other): self._dict.update((k, v * other) for k, v in self.items()) return self return NotImplemented
(self, other)
[ 0.03938274830579758, -0.0670374184846878, 0.03792541101574898, 0.06859884411096573, -0.04274849593639374, -0.06242252141237259, 0.0005752353463321924, -0.03402183577418327, 0.018129942938685417, 0.029580432921648026, 0.0136798657476902, 0.004662605002522469, 0.030100909993052483, 0.0565237...
724,754
scipy.sparse._dok
__init__
null
def __init__(self, arg1, shape=None, dtype=None, copy=False): _spbase.__init__(self) is_array = isinstance(self, sparray) if isinstance(arg1, tuple) and isshape(arg1, allow_1d=is_array): self._shape = check_shape(arg1, allow_1d=is_array) self._dict = {} self.dtype = getdtype(dtype, d...
(self, arg1, shape=None, dtype=None, copy=False)
[ -0.007587589789181948, -0.0007623865967616439, 0.07283337414264679, -0.01686963252723217, 0.0011029153829440475, -0.016878994181752205, -0.03578009828925133, 0.018021110445261, 0.03946857154369354, 0.0026095504872500896, -0.03512478247284889, 0.01932237483561039, -0.055196087807416916, 0.0...
724,755
scipy.sparse._dok
__ior__
null
def __ior__(self, other): if isinstance(other, _dok_base): self._dict |= other._dict else: self._dict |= other return self
(self, other)
[ -0.02148890495300293, -0.031242363154888153, 0.008119190111756325, 0.06443194299936295, -0.0476372167468071, -0.030686017125844955, -0.02858232893049717, 0.011483350768685341, 0.07837539166212082, -0.02352304942905903, 0.05706034600734711, -0.01613406464457512, 0.024270640686154366, 0.0667...
724,757
scipy.sparse._base
__iter__
null
def __iter__(self): for r in range(self.shape[0]): yield self[r]
(self)
[ 0.019931353628635406, -0.06728961318731308, -0.06790288537740707, 0.012478389777243137, -0.016311341896653175, 0.014301171526312828, -0.01595360040664673, 0.023014750331640244, 0.05584185943007469, 0.0376821830868721, 0.008909485302865505, -0.00281722005456686, 0.037137050181627274, 0.0794...
724,758
scipy.sparse._dok
__itruediv__
null
def __itruediv__(self, other): if isscalarlike(other): self._dict.update((k, v / other) for k, v in self.items()) return self return NotImplemented
(self, other)
[ 0.024785708636045456, -0.06568034738302231, 0.009236854501068592, 0.06848963350057602, -0.007898888550698757, -0.05191841349005699, -0.009334646165370941, -0.06034626439213753, 0.03579169884324074, 0.03561389818787575, 0.047011055052280426, 0.01888265460729599, 0.03225342556834221, 0.05767...
724,759
scipy.sparse._base
__le__
null
def __le__(self, other): return self.tocsr().__le__(other)
(self, other)
[ -0.0249216016381979, -0.010399744845926762, 0.05588896572589874, 0.07296138256788254, -0.031224997714161873, -0.05578591302037239, -0.044793616980314255, -0.028871959075331688, 0.04156462848186493, -0.014908304437994957, -0.012160230427980423, -0.04829741269350052, 0.08058729022741318, 0.0...
724,761
scipy.sparse._base
__lt__
null
def __lt__(self, other): return self.tocsr().__lt__(other)
(self, other)
[ -0.01783354952931404, 0.004780476447194815, 0.040074631571769714, 0.04563490301370621, -0.01552807167172432, -0.0322088822722435, -0.01646891050040722, -0.02649604342877865, 0.022410601377487183, -0.027614878490567207, -0.015392455272376537, -0.051059555262327194, 0.06733351945877075, 0.02...
724,764
scipy.sparse._base
__ne__
null
def __ne__(self, other): return self.tocsr().__ne__(other)
(self, other)
[ -0.005020529963076115, 0.008099730126559734, 0.058126967400312424, 0.054270364344120026, -0.09589385986328125, -0.07998103648424149, -0.07282374054193497, 0.009624130092561245, 0.07021792978048325, -0.005250710062682629, -0.017658714205026627, -0.03425773233175278, 0.04304800555109978, 0.0...
724,765
scipy.sparse._dok
__neg__
null
def __neg__(self): if self.dtype.kind == 'b': raise NotImplementedError( 'Negating a sparse boolean matrix is not supported.' ) new = self._dok_container(self.shape, dtype=self.dtype) new._dict.update((k, -v) for k, v in self.items()) return new
(self)
[ 0.04853971675038338, -0.045146048069000244, 0.034313738346099854, -0.017859598621726036, -0.040518321096897125, -0.042575087398290634, -0.05957769975066185, 0.03410806134343147, 0.030388740822672844, -0.016094205901026726, -0.06252573430538177, 0.02200741320848465, -0.0022324498277157545, ...
724,767
scipy.sparse._dok
__or__
null
def __or__(self, other): if isinstance(other, _dok_base): return self._dict | other._dict return self._dict | other
(self, other)
[ 0.000024662916985107586, -0.04615060240030289, 0.007758075371384621, 0.05324270948767662, -0.029717667028307915, -0.05113237723708153, -0.036187052726745605, 0.0014886942226439714, 0.11271263659000397, -0.02051522210240364, 0.07105947285890579, -0.017410263419151306, 0.024562913924455643, ...
724,769
scipy.sparse._dok
__radd__
null
def __radd__(self, other): return self + other # addition is comutative
(self, other)
[ -0.08663414418697357, -0.03943101316690445, 0.03055368736386299, 0.0968305841088295, -0.02108810469508171, -0.06474386900663376, -0.06010911986231804, -0.0018093343824148178, 0.042746640741825104, -0.0329601913690567, 0.0009659439092501998, -0.008797109127044678, 0.05615175887942314, 0.082...
724,771
scipy.sparse._dok
__reduce__
null
def __reduce__(self): # this approach is necessary because __setstate__ is called after # __setitem__ upon unpickling and since __init__ is not called there # is no shape attribute hence it is not possible to unpickle it. return dict.__reduce__(self)
(self)
[ 0.01840362511575222, -0.038940008729696274, -0.016288068145513535, 0.04423749819397926, -0.011841959320008755, -0.01928080804646015, -0.03539687767624855, -0.02755383960902691, 0.05627725273370743, -0.013106132857501507, 0.012074153870344162, 0.05713723599910736, 0.012022554874420166, 0.05...
724,773
scipy.sparse._dok
__reversed__
null
def __reversed__(self): return self._dict.__reversed__()
(self)
[ 0.010970577597618103, 0.036645349115133286, -0.019029922783374786, -0.027566250413656235, -0.051382437348365784, -0.04526391252875328, -0.04394810274243355, 0.02784585952758789, 0.10158064216375351, -0.04095463082194328, -0.021710889413952827, 0.009778124280273914, -0.0186022836714983, 0.0...
724,776
scipy.sparse._dok
__ror__
null
def __ror__(self, other): if isinstance(other, _dok_base): return self._dict | other._dict return self._dict | other
(self, other)
[ -0.023465139791369438, -0.03136754781007767, 0.012372370809316635, 0.0538470484316349, -0.021856989711523056, -0.047483619302511215, -0.049904488027095795, 0.0041543846018612385, 0.11509504169225693, -0.03385758399963379, 0.060314226895570755, -0.0013271550415083766, 0.032820068299770355, ...
724,777
scipy.sparse._base
__round__
null
def __round__(self, ndigits=0): return round(self.tocsr(), ndigits=ndigits)
(self, ndigits=0)
[ -0.06801453232765198, 0.005975100211799145, 0.06592842191457748, 0.0746685191988945, 0.012183989398181438, -0.03666886314749718, -0.019116723909974098, -0.012363826856017113, 0.012876363471150398, 0.009819126687943935, -0.016320250928401947, -0.002468269318342209, 0.07840914279222488, 0.03...
724,780
scipy.sparse._dok
__setitem__
null
def __setitem__(self, key, value): if self.ndim == 2: return super().__setitem__(key, value) if isinstance(key, tuple) and len(key) == 1: key = key[0] INT_TYPES = (int, np.integer) if isinstance(key, INT_TYPES): if key < 0: key += self.shape[-1] if key < 0 or ...
(self, key, value)
[ 0.020558349788188934, -0.014556045643985271, -0.05157943069934845, 0.04596259444952011, 0.0032787814270704985, -0.02597327157855034, -0.05319472774863243, 0.029112091287970543, 0.03895073011517525, -0.03950139880180359, -0.03540808707475662, -0.032764870673418045, 0.0482754111289978, -0.00...
724,783
scipy.sparse._dok
__truediv__
null
def __truediv__(self, other): if isscalarlike(other): res_dtype = upcast_scalar(self.dtype, other) new = self._dok_container(self.shape, dtype=res_dtype) new._dict.update(((k, v / other) for k, v in self.items())) return new return self.tocsr() / other
(self, other)
[ -0.026523860171437263, -0.04392007738351822, 0.04681944474577904, 0.0450655072927475, 0.02407192438840866, -0.02528894506394863, -0.00913211889564991, -0.08132552355527878, 0.027472419664263725, 0.05294033885002136, 0.041163887828588486, -0.007266320753842592, 0.05265397951006889, 0.011329...
724,784
scipy.sparse._base
_add_dense
null
def _add_dense(self, other): return self.tocoo()._add_dense(other)
(self, other)
[ -0.0434139259159565, -0.01869875378906727, 0.06450556963682175, 0.10152705013751984, -0.0034654224291443825, -0.03941437229514122, -0.05233599990606308, 0.0027625099755823612, 0.04129450395703316, -0.0352780856192112, -0.03503879904747009, -0.0342867448925972, 0.01191319152712822, 0.035517...
724,785
scipy.sparse._base
_add_sparse
null
def _add_sparse(self, other): return self.tocsr()._add_sparse(other)
(self, other)
[ -0.053230155259370804, -0.009647544473409653, 0.04486445337533951, 0.09074088931083679, -0.01342560350894928, -0.029313692823052406, -0.050767671316862106, 0.023612869903445244, 0.06722921878099442, -0.0366336815059185, -0.02970161847770214, -0.042570631951093674, 0.05093633383512497, 0.03...
724,789
scipy.sparse._dok
_get_arrayXarray
null
def _get_arrayXarray(self, row, col): # inner indexing i, j = map(np.atleast_2d, np.broadcast_arrays(row, col)) newdok = self._dok_container(i.shape, dtype=self.dtype) for key in itertools.product(range(i.shape[0]), range(i.shape[1])): v = self._dict.get((i[key], j[key]), 0) if v: ...
(self, row, col)
[ 0.07454735040664673, -0.049435872584581375, -0.012930535711348057, 0.05689435824751854, 0.02007043920457363, -0.022169308736920357, 0.0061982241459190845, 0.006591762416064739, 0.04879871755838394, -0.05119742453098297, 0.011909211054444313, -0.02280646562576294, -0.00236942688934505, -0.0...
724,790
scipy.sparse._dok
_get_arrayXint
null
def _get_arrayXint(self, row, col): row = row.squeeze() return self._get_columnXarray(row, [col])
(self, row, col)
[ 0.01513324212282896, -0.025227762758731842, 0.04041224718093872, 0.07207932323217392, 0.07481218874454498, 0.00024940064758993685, 0.033887531608343124, 0.04017312079668045, 0.06558876484632492, -0.05479395017027855, 0.027226170524954796, -0.060191359370946884, 0.0058756605722010136, -0.03...
724,791
scipy.sparse._dok
_get_arrayXslice
null
def _get_arrayXslice(self, row, col): col = list(range(*col.indices(self.shape[1]))) return self._get_columnXarray(row, col)
(self, row, col)
[ 0.005703633185476065, -0.03045964613556862, -0.04069339483976364, 0.05263564735651016, 0.04355815798044205, -0.0002178770664613694, 0.05536234751343727, 0.0051427618600428104, 0.04635388404130936, -0.04856285825371742, 0.056570377200841904, -0.028992749750614166, -0.006592399440705776, -0....
724,792
scipy.sparse._dok
_get_columnXarray
null
def _get_columnXarray(self, row, col): # outer indexing newdok = self._dok_container((len(row), len(col)), dtype=self.dtype) for i, r in enumerate(row): for j, c in enumerate(col): v = self._dict.get((r, c), 0) if v: newdok._dict[i, j] = v return newdok
(self, row, col)
[ 0.07970713078975677, -0.015537822619080544, 0.001947883632965386, 0.07883838564157486, 0.04582616686820984, -0.023510344326496124, 0.03576323390007019, 0.04763605073094368, 0.040360331535339355, -0.0590020976960659, 0.029953518882393837, 0.0006311957258731127, -0.017908765003085136, -0.029...
724,794
scipy.sparse._dok
_get_int
null
def _get_int(self, idx): return self._dict.get(idx, self.dtype.type(0))
(self, idx)
[ 0.04354977235198021, -0.048980921506881714, 0.02371937222778797, 0.037749841809272766, 0.059474438428878784, 0.010803629644215107, 0.056021302938461304, 0.0378839448094368, -0.011155648157000542, -0.07335404306650162, -0.0300892386585474, 0.020869694650173187, -0.02115466259419918, -0.0622...
724,795
scipy.sparse._dok
_get_intXarray
null
def _get_intXarray(self, row, col): col = col.squeeze() return self._get_columnXarray([row], col)
(self, row, col)
[ 0.0009266347042284906, -0.030728403478860855, 0.04594741761684418, 0.05582013353705406, 0.07966496795415878, 0.0166965052485466, 0.03668960928916931, 0.03662128746509552, 0.059475429356098175, -0.050080977380275726, 0.026099499315023422, -0.0652487501502037, 0.002063577063381672, -0.039593...
724,796
scipy.sparse._dok
_get_intXint
null
def _get_intXint(self, row, col): return self._dict.get((row, col), self.dtype.type(0))
(self, row, col)
[ 0.05113879591226578, -0.05073320120573044, 0.06590922176837921, 0.05610733851790428, 0.08111903816461563, 0.0021240937057882547, 0.05512714758515358, 0.05603973940014839, 0.002693405607715249, -0.0686807855963707, -0.01224390510469675, -0.002644818741828203, -0.002674393355846405, -0.04877...
724,797
scipy.sparse._dok
_get_intXslice
null
def _get_intXslice(self, row, col): return self._get_sliceXslice(slice(row, row + 1), col)
(self, row, col)
[ -0.013102062977850437, -0.040549203753471375, 0.0024272410664707422, 0.06379696726799011, 0.07122147083282471, 0.019434727728366852, 0.06611502915620804, 0.03903742879629135, 0.03712251037359238, -0.06379696726799011, 0.036719370633363724, -0.026355303823947906, -0.005950520280748606, -0.0...
724,798
scipy.sparse._dok
_get_sliceXarray
null
def _get_sliceXarray(self, row, col): row = list(range(*row.indices(self.shape[0]))) return self._get_columnXarray(row, col)
(self, row, col)
[ 0.005867379251867533, -0.035479579120874405, -0.04167387634515762, 0.03947145864367485, 0.02987029403448105, 0.00599212571978569, 0.055198099464178085, 0.007007302716374397, 0.03754434362053871, -0.04439248889684677, 0.06245919689536095, -0.022110212594270706, -0.0013840390602126718, -0.03...
724,799
scipy.sparse._dok
_get_sliceXint
null
def _get_sliceXint(self, row, col): return self._get_sliceXslice(row, slice(col, col + 1))
(self, row, col)
[ -0.003559848992154002, -0.040052518248558044, 0.010013129562139511, 0.07700071483850479, 0.07038715481758118, 0.010434913448989391, 0.06977979093790054, 0.04858940839767456, 0.040929827839136124, -0.06407728046178818, 0.033590804785490036, -0.03089139237999916, -0.013530801050364971, -0.04...
724,800
scipy.sparse._dok
_get_sliceXslice
null
def _get_sliceXslice(self, row, col): row_start, row_stop, row_step = row.indices(self.shape[0]) col_start, col_stop, col_step = col.indices(self.shape[1]) row_range = range(row_start, row_stop, row_step) col_range = range(col_start, col_stop, col_step) shape = (len(row_range), len(col_range)) #...
(self, row, col)
[ 0.03399074822664261, -0.05016002058982849, -0.05806829780340195, 0.0552094392478466, 0.010665037669241428, -0.012298672460019588, 0.048674896359443665, 0.027827488258481026, 0.03813052549958229, -0.0524248331785202, 0.05227632075548172, 0.019733568653464317, -0.0140251275151968, -0.0144799...
724,801
scipy.sparse._base
_getcol
Returns a copy of column j of the array, as an (m x 1) sparse array (column vector).
def _getcol(self, j): """Returns a copy of column j of the array, as an (m x 1) sparse array (column vector). """ if self.ndim == 1: raise ValueError("getcol not provided for 1d arrays. Use indexing A[j]") # Subclasses should override this method for efficiency. # Post-multiply by a (n x...
(self, j)
[ 0.02696586400270462, -0.0031100749038159847, 0.007271694019436836, 0.039495278149843216, 0.07535471022129059, -0.011923438869416714, 0.06833253800868988, 0.037320900708436966, 0.037178318947553635, -0.04330935329198837, -0.005293365567922592, 0.03108292631804943, -0.007850933820009232, -0....
724,803
scipy.sparse._dok
_getnnz
Number of stored values, including explicit zeros. Parameters ---------- axis : None, 0, or 1 Select between the number of values across the whole array, in each column, or in each row. See also -------- count_nonzero : Number of non-zero entries...
def _getnnz(self, axis=None): if axis is not None: raise NotImplementedError( "_getnnz over an axis is not implemented for DOK format." ) return len(self._dict)
(self, axis=None)
[ -0.03567013144493103, 0.006449286825954914, 0.0053848824463784695, 0.03815094754099846, 0.04881175607442856, 0.05853388085961342, -0.02727222815155983, 0.02081875130534172, 0.09487450122833252, -0.030758783221244812, 0.005883560050278902, -0.018689941614866257, 0.010937387123703957, -0.081...
724,804
scipy.sparse._base
_getrow
Returns a copy of row i of the array, as a (1 x n) sparse array (row vector).
def _getrow(self, i): """Returns a copy of row i of the array, as a (1 x n) sparse array (row vector). """ if self.ndim == 1: raise ValueError("getrow not meaningful for a 1d array") # Subclasses should override this method for efficiency. # Pre-multiply by a (1 x m) row vector 'a' conta...
(self, i)
[ -0.0059455870650708675, -0.026511175557971, 0.011159271001815796, 0.03907100111246109, 0.032601334154605865, 0.006316056940704584, 0.026438888162374496, 0.04340820759534836, 0.030143585056066513, -0.023348627611994743, -0.010680370964109898, 0.010355080477893353, -0.018089765682816505, 0.0...
724,805
scipy.sparse._base
_imag
null
def _imag(self): return self.tocsr()._imag()
(self)
[ 0.039804283529520035, -0.031116565689444542, 0.11719765514135361, 0.09421500563621521, 0.019002217799425125, -0.04728056490421295, 0.02320762723684311, -0.036793000996112823, 0.009760702028870583, 0.03807366266846657, 0.04478847235441208, -0.008281021378934383, 0.040808044373989105, 0.0177...
724,807
scipy.sparse._dok
_matmul_multivector
null
def _matmul_multivector(self, other): result_dtype = upcast(self.dtype, other.dtype) # vector @ multivector if self.ndim == 1: # works for other 1d or 2d return sum(v * other[j] for j, v in self._dict.items()) # matrix @ multivector M = self.shape[0] new_shape = (M,) if other.ndi...
(self, other)
[ 0.05612648278474808, -0.027436429634690285, 0.04283808171749115, 0.07317575067281723, -0.030660031363368034, -0.0663345530629158, -0.018356619402766228, -0.014792748726904392, 0.026218624785542488, 0.04677803814411163, -0.03488653153181076, -0.010217025876045227, -0.0023662131279706955, 0....
724,808
scipy.sparse._base
_matmul_sparse
null
def _matmul_sparse(self, other): return self.tocsr()._matmul_sparse(other)
(self, other)
[ -0.009632720611989498, -0.018714508041739464, 0.09510482847690582, 0.06748930364847183, -0.042766183614730835, -0.06401153653860092, -0.052304212003946304, 0.009606895968317986, 0.049377378076314926, -0.004799143876880407, -0.05192544311285019, -0.03491538390517235, 0.05678054317831993, 0....
724,809
scipy.sparse._dok
_matmul_vector
null
def _matmul_vector(self, other): res_dtype = upcast(self.dtype, other.dtype) # vector @ vector if self.ndim == 1: if issparse(other): if other.format == "dok": keys = self.keys() & other.keys() else: keys = self.keys() & other.tocoo().coords[0]...
(self, other)
[ 0.04095754399895668, -0.03344322741031647, 0.041464533656835556, 0.04537559673190117, -0.022615371271967888, -0.0790904313325882, -0.0447961799800396, -0.012901082634925842, 0.04620851203799248, 0.05051792412996292, -0.03358808159828186, -0.009071498177945614, 0.02609187364578247, 0.030509...
724,810
scipy.sparse._dok
_mul_scalar
null
def _mul_scalar(self, other): res_dtype = upcast_scalar(self.dtype, other) # Multiply this scalar by every element. new = self._dok_container(self.shape, dtype=res_dtype) new._dict.update(((k, v * other) for k, v in self.items())) return new
(self, other)
[ 0.024133753031492233, -0.06909149140119553, 0.04712977260351181, 0.06405787914991379, -0.04175139591097832, -0.037200458347797394, -0.011282529681921005, -0.019238049164414406, 0.03744179382920265, 0.030236145481467247, 0.006869500502943993, 0.000060805745306424797, 0.05554211139678955, 0....
724,813
scipy.sparse._base
_real
null
def _real(self): return self.tocsr()._real()
(self)
[ -0.01298174075782299, 0.016224943101406097, 0.1188637837767601, 0.10371097177267075, 0.05289188399910927, -0.03534464165568352, -0.016948632895946503, -0.04910368099808693, 0.022103803232312202, 0.03021627478301525, 0.012820920906960964, -0.02306872233748436, 0.029858896508812904, 0.021496...
724,816
scipy.sparse._dok
_set_arrayXarray
null
def _set_arrayXarray(self, row, col, x): row = list(map(int, row.ravel())) col = list(map(int, col.ravel())) x = x.ravel() self._dict.update(zip(zip(row, col), x)) for i in np.nonzero(x == 0)[0]: key = (row[i], col[i]) if self._dict[key] == 0: # may have been superseded b...
(self, row, col, x)
[ 0.04236230626702309, -0.013876371085643768, -0.004729552194476128, 0.07958320528268814, 0.002778894966468215, -0.031554486602544785, -0.04728647321462631, 0.03535623475909233, 0.030124306678771973, -0.041203681379556656, -0.015170774422585964, -0.024331171065568924, 0.033419154584407806, -...
724,817
scipy.sparse._index
_set_arrayXarray_sparse
null
def _set_arrayXarray_sparse(self, row, col, x): # Fall back to densifying x x = np.asarray(x.toarray(), dtype=self.dtype) x, _ = _broadcast_arrays(x, row) self._set_arrayXarray(row, col, x)
(self, row, col, x)
[ 0.010693310759961605, 0.0009466700139455497, 0.027592333033680916, 0.09874430298805237, 0.028771929442882538, -0.02943865954875946, -0.02807101048529148, 0.0003753023047465831, 0.061031367629766464, -0.04273905232548714, -0.04034566506743431, -0.06633100658655167, 0.028293251991271973, -0....
724,818
scipy.sparse._dok
_set_int
null
def _set_int(self, idx, x): if x: self._dict[idx] = x elif idx in self._dict: del self._dict[idx]
(self, idx, x)
[ 0.027766207233071327, -0.0069159213453531265, -0.007774537894874811, 0.052490945905447006, -0.004278131760656834, 0.00807355809956789, -0.023921655490994453, 0.07046636193990707, -0.027868727222085, -0.0757291242480278, -0.04025672748684883, 0.0075609516352415085, 0.0038979481905698776, -0...
724,819
scipy.sparse._dok
_set_intXint
null
def _set_intXint(self, row, col, x): key = (row, col) if x: self._dict[key] = x elif key in self._dict: del self._dict[key]
(self, row, col, x)
[ 0.037637557834386826, -0.02068694494664669, 0.03818600997328758, 0.08007407188415527, 0.01626504585146904, -0.00975217204540968, -0.0020641954615712166, 0.07047615200281143, -0.014911053702235222, -0.06410039216279984, -0.033541303128004074, -0.018784500658512115, 0.015553771518170834, -0....
724,820
scipy.sparse._base
_setdiag
This part of the implementation gets overridden by the different formats.
def _setdiag(self, values, k): """This part of the implementation gets overridden by the different formats. """ M, N = self.shape if k < 0: if values.ndim == 0: # broadcast max_index = min(M+k, N) for i in range(max_index): self[i - k, i] =...
(self, values, k)
[ -0.024453241378068924, 0.0026067672297358513, 0.003039434552192688, 0.013578437268733978, -0.057069044560194016, -0.03299465402960777, -0.010573443956673145, -0.006328567862510681, 0.001864129095338285, 0.01970035769045353, -0.0438091866672039, 0.03840192034840584, 0.04005509614944458, 0.0...
724,822
scipy.sparse._base
_sub_sparse
null
def _sub_sparse(self, other): return self.tocsr()._sub_sparse(other)
(self, other)
[ 0.008608070202171803, 0.00217267032712698, 0.04480822756886482, 0.03975243121385574, -0.029607797041535378, -0.05865383893251419, -0.014093443751335144, 0.04024809971451759, 0.08347019553184509, -0.04718742519617081, -0.014646937139332294, -0.008058707229793072, 0.040016788989305496, -0.01...
724,826
scipy.sparse._dok
astype
null
def astype(self, dtype, casting='unsafe', copy=True): dtype = np.dtype(dtype) if self.dtype != dtype: result = self._dok_container(self.shape, dtype=dtype) data = np.array(list(self._dict.values()), dtype=dtype) result._dict = dict(zip(self._dict, data)) return result elif co...
(self, dtype, casting='unsafe', copy=True)
[ 0.039462748914957047, -0.010399464517831802, 0.03865287825465202, -0.03712517023086548, -0.03754850849509239, 0.016657549887895584, 0.004845414310693741, 0.034603528678417206, 0.04605214297771454, 0.007794997189193964, -0.03854244202375412, 0.0073624528013169765, -0.0030692226719111204, 0....
724,827
scipy.sparse._dok
clear
null
def clear(self): return self._dict.clear()
(self)
[ 0.01989387534558773, 0.01452014409005642, -0.010066164657473564, -0.03644939512014389, -0.016274483874440193, -0.02011529542505741, -0.08277759701013565, 0.0232322309166193, 0.07255814224481583, -0.0018501473823562264, -0.05266426503658295, -0.00523747131228447, 0.012365542352199554, 0.050...
724,829
scipy.sparse._dok
conjtransp
Return the conjugate transpose.
def conjtransp(self): """Return the conjugate transpose.""" if self.ndim == 1: new = self.tocoo() new.data = new.data.conjugate() return new M, N = self.shape new = self._dok_container((N, M), dtype=self.dtype) new._dict = {(right, left): np.conj(val) for (left, right), val i...
(self)
[ -0.022302702069282532, -0.017978709191083908, 0.03406676650047302, -0.03711281716823578, -0.020289506763219833, -0.04061402752995491, 0.003691587597131729, -0.012875696644186974, 0.08003764599561691, -0.0311257503926754, -0.010950031690299511, -0.01701587624847889, 0.0006209175917319953, 0...
724,830
scipy.sparse._base
conjugate
Element-wise complex conjugation. If the array/matrix is of non-complex data type and `copy` is False, this method does nothing and the data is not copied. Parameters ---------- copy : bool, optional If True, the result is guaranteed to not share data with self. ...
def conjugate(self, copy=True): """Element-wise complex conjugation. If the array/matrix is of non-complex data type and `copy` is False, this method does nothing and the data is not copied. Parameters ---------- copy : bool, optional If True, the result is guaranteed to not share data w...
(self, copy=True)
[ -0.00770609499886632, -0.0339786671102047, 0.059826284646987915, 0.029895618557929993, -0.023762285709381104, -0.030911998823285103, -0.0008006190182641149, -0.005629523657262325, 0.05821409448981285, -0.0026592379435896873, -0.013212951831519604, -0.03799161687493324, -0.04587733373045921, ...
724,831
scipy.sparse._dok
copy
Returns a copy of this array/matrix. No data/indices will be shared between the returned value and current array/matrix.
def copy(self): new = self._dok_container(self.shape, dtype=self.dtype) new._dict.update(self._dict) return new
(self)
[ 0.0353788286447525, -0.033997371792793274, -0.011102213524281979, -0.03716461732983589, -0.06192979961633682, 0.03558099642395973, -0.011826637201011181, 0.010697884485125542, 0.0991281121969223, 0.01979529857635498, -0.006684071850031614, -0.029785605147480965, -0.014918073080480099, 0.03...
724,832
scipy.sparse._dok
count_nonzero
Number of non-zero entries, equivalent to np.count_nonzero(a.toarray()) Unlike the nnz property, which return the number of stored entries (the length of the data attribute), this method counts the actual number of non-zero entries in data.
def count_nonzero(self): return sum(x != 0 for x in self.values())
(self)
[ -0.018912198022007942, -0.039881933480501175, 0.012456674128770828, 0.028222553431987762, 0.0617947056889534, 0.023095857352018356, -0.026936592534184456, 0.017986305058002472, 0.040807824581861496, 0.021261218935251236, -0.04204234853386879, 0.05483337119221687, 0.06899608671665192, -0.04...
724,833
scipy.sparse._dok
diagonal
null
def diagonal(self, k=0): if self.ndim == 2: return super().diagonal(k) raise ValueError("diagonal requires two dimensions")
(self, k=0)
[ -0.04932877793908119, 0.0011983581352978945, 0.04922419413924217, 0.03677869960665703, -0.029684418812394142, -0.029527543112635612, 0.0023139205295592546, 0.005102826748043299, -0.006575717590749264, 0.03907954692840576, -0.004314089193940163, 0.025814812630414963, 0.031828392297029495, 0...