| | |
- __builtin__.object
-
- CMWC4096
- DoubleVector
- FloatVector
- LCG
- NullType
- PairOfUInt32
- PairUInt32Real32
- PairUInt32Real64
- PySparseTensor
- PySparseTensor
- PySwigIterator
- PyTensorIndex
- PyTensorIndex
- StringIntPair
- StringList
- StringMap
- StringMapList
- StringSet
- StringStringList
- StringStringPair
- StringVector
- VectorOfInt32
- VectorOfInt64
- VectorOfPairsOfUInt32
- VectorOfPairsUInt32Real32
- VectorOfPairsUInt32Real64
- VectorOfUInt32
- VectorOfUInt64
- VectorOfVectorsOfPairsOfUInt32
- _SparseMatrix32
-
- _NearestNeighbor32
- _TAM32
- _SparseMatrix64
-
- _NearestNeighbor64
- _TAM64
- _Domain32(__builtin__.object)
-
- PyDomain
- PyDomain
class CMWC4096(__builtin__.object) |
| |
Proxy of C++ CMWC4096 class |
| |
Methods defined here:
- __init__(self, *args, **kwargs)
- __init__(self, seed) -> CMWC4096
- __repr__ = _swig_repr(self)
- next(*args)
- next(self) -> unsigned long long
next(self, upperBoundNotInclusive) -> unsigned long long
- nextDouble(*args, **kwargs)
- nextDouble(self) -> double
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_CMWC4096>
|
Domain = class PyDomain(_Domain32) |
| |
C++ includes: PySparseTensor.hpp |
| |
- Method resolution order:
- PyDomain
- _Domain32
- __builtin__.object
Methods defined here:
- __getitem__(*args, **kwargs)
- __getitem__(self, i) -> std::vector<(nta::UInt32,std::allocator<(nta::UInt32)>)>
std::vector<nta::UInt32> PyDomain::__getitem__(int i) const
- __init__(self, *args)
- __init__(self, lowerHalfSpace) -> PyDomain
__init__(self, lower, upper) -> PyDomain
PyDomain::PyDomain(const
TIV &lower, const TIV &upper)
- __repr__ = _swig_repr(self)
- __str__(*args, **kwargs)
- __str__(self) -> string
std::string
PyDomain::__str__() const
- doesInclude(*args, **kwargs)
- doesInclude(self, x) -> bool
bool
PyDomain::doesInclude(const TIV &x) const
- getDimensions(*args, **kwargs)
- getDimensions(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getDimensions() const
- getLowerBound(*args, **kwargs)
- getLowerBound(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getLowerBound() const
- getNumOpenDims(*args, **kwargs)
- getNumOpenDims(self) -> UInt32
nta::UInt32
PyDomain::getNumOpenDims() const
- getOpenDimensions(*args, **kwargs)
- getOpenDimensions(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getOpenDimensions() const
- getSliceBounds(*args, **kwargs)
- getSliceBounds(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getSliceBounds() const
- getUpperBound(*args, **kwargs)
- getUpperBound(self) -> PyTensorIndex
PyTensorIndex
PyDomain::getUpperBound() const
Data descriptors defined here:
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_PyDomain>
Methods inherited from _Domain32:
- empty(*args, **kwargs)
- empty(self) -> bool
bool nta::Domain< UInt
>::empty() const
- getNClosedDims(*args, **kwargs)
- getNClosedDims(self) -> unsigned int
UInt nta::Domain<
UInt >::getNClosedDims() const
- getNOpenDims(*args, **kwargs)
- getNOpenDims(self) -> unsigned int
UInt nta::Domain<
UInt >::getNOpenDims() const
- hasClosedDims(*args, **kwargs)
- hasClosedDims(self) -> bool
bool nta::Domain<
UInt >::hasClosedDims() const
- includes(*args, **kwargs)
- includes(self, d) -> bool
bool nta::Domain< UInt
>::includes(const Domain &d) const
Not strict inclusion.
- rank(*args, **kwargs)
- rank(self) -> unsigned int
UInt nta::Domain< UInt
>::rank() const
- size_elts(*args, **kwargs)
- size_elts(self) -> unsigned int
UInt nta::Domain< UInt
>::size_elts() const
Data descriptors inherited from _Domain32:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class DoubleVector(__builtin__.object) |
| |
Proxy of C++ DoubleVector class |
| |
Methods defined here:
- __delitem__(*args, **kwargs)
- __delitem__(self, i)
- __delslice__(*args, **kwargs)
- __delslice__(self, i, j)
- __getitem__(*args, **kwargs)
- __getitem__(self, i) -> std::vector<(double)>::value_type
- __getslice__(*args, **kwargs)
- __getslice__(self, i, j) -> DoubleVector
- __init__(self, *args)
- __init__(self) -> DoubleVector
__init__(self, ?) -> DoubleVector
__init__(self, size) -> DoubleVector
__init__(self, size, value) -> DoubleVector
- __iter__(self)
- __len__(*args, **kwargs)
- __len__(self) -> std::vector<(double)>::size_type
- __nonzero__(*args, **kwargs)
- __nonzero__(self) -> bool
- __repr__ = _swig_repr(self)
- __setitem__(*args, **kwargs)
- __setitem__(self, i, x)
- __setslice__(*args, **kwargs)
- __setslice__(self, i, j, v)
- append(*args, **kwargs)
- append(self, x)
- assign(*args, **kwargs)
- assign(self, n, x)
- back(*args, **kwargs)
- back(self) -> std::vector<(double)>::value_type
- begin(*args)
- begin(self) -> std::vector<(double)>::iterator
begin(self) -> std::vector<(double)>::const_iterator
- capacity(*args, **kwargs)
- capacity(self) -> std::vector<(double)>::size_type
- clear(*args, **kwargs)
- clear(self)
- empty(*args, **kwargs)
- empty(self) -> bool
- end(*args)
- end(self) -> std::vector<(double)>::iterator
end(self) -> std::vector<(double)>::const_iterator
- erase(*args)
- erase(self, pos) -> std::vector<(double)>::iterator
erase(self, first, last) -> std::vector<(double)>::iterator
- front(*args, **kwargs)
- front(self) -> std::vector<(double)>::value_type
- get_allocator(*args, **kwargs)
- get_allocator(self) -> std::vector<(double)>::allocator_type
- insert(*args)
- insert(self, pos, x) -> std::vector<(double)>::iterator
insert(self, pos, n, x)
- iterator(*args, **kwargs)
- iterator(self, PYTHON_SELF) -> PySwigIterator
- pop(*args, **kwargs)
- pop(self) -> std::vector<(double)>::value_type
- pop_back(*args, **kwargs)
- pop_back(self)
- push_back(*args, **kwargs)
- push_back(self, x)
- rbegin(*args)
- rbegin(self) -> std::vector<(double)>::reverse_iterator
rbegin(self) -> std::vector<(double)>::const_reverse_iterator
- rend(*args)
- rend(self) -> std::vector<(double)>::reverse_iterator
rend(self) -> std::vector<(double)>::const_reverse_iterator
- reserve(*args, **kwargs)
- reserve(self, n)
- resize(*args)
- resize(self, new_size)
resize(self, new_size, x)
- size(*args, **kwargs)
- size(self) -> std::vector<(double)>::size_type
- swap(*args, **kwargs)
- swap(self, v)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_DoubleVector>
|
class FloatVector(__builtin__.object) |
| |
Proxy of C++ FloatVector class |
| |
Methods defined here:
- __delitem__(*args, **kwargs)
- __delitem__(self, i)
- __delslice__(*args, **kwargs)
- __delslice__(self, i, j)
- __getitem__(*args, **kwargs)
- __getitem__(self, i) -> std::vector<(float)>::value_type
- __getslice__(*args, **kwargs)
- __getslice__(self, i, j) -> FloatVector
- __init__(self, *args)
- __init__(self) -> FloatVector
__init__(self, ?) -> FloatVector
__init__(self, size) -> FloatVector
__init__(self, size, value) -> FloatVector
- __iter__(self)
- __len__(*args, **kwargs)
- __len__(self) -> std::vector<(float)>::size_type
- __nonzero__(*args, **kwargs)
- __nonzero__(self) -> bool
- __repr__ = _swig_repr(self)
- __setitem__(*args, **kwargs)
- __setitem__(self, i, x)
- __setslice__(*args, **kwargs)
- __setslice__(self, i, j, v)
- append(*args, **kwargs)
- append(self, x)
- assign(*args, **kwargs)
- assign(self, n, x)
- back(*args, **kwargs)
- back(self) -> std::vector<(float)>::value_type
- begin(*args)
- begin(self) -> std::vector<(float)>::iterator
begin(self) -> std::vector<(float)>::const_iterator
- capacity(*args, **kwargs)
- capacity(self) -> std::vector<(float)>::size_type
- clear(*args, **kwargs)
- clear(self)
- empty(*args, **kwargs)
- empty(self) -> bool
- end(*args)
- end(self) -> std::vector<(float)>::iterator
end(self) -> std::vector<(float)>::const_iterator
- erase(*args)
- erase(self, pos) -> std::vector<(float)>::iterator
erase(self, first, last) -> std::vector<(float)>::iterator
- front(*args, **kwargs)
- front(self) -> std::vector<(float)>::value_type
- get_allocator(*args, **kwargs)
- get_allocator(self) -> std::vector<(float)>::allocator_type
- insert(*args)
- insert(self, pos, x) -> std::vector<(float)>::iterator
insert(self, pos, n, x)
- iterator(*args, **kwargs)
- iterator(self, PYTHON_SELF) -> PySwigIterator
- pop(*args, **kwargs)
- pop(self) -> std::vector<(float)>::value_type
- pop_back(*args, **kwargs)
- pop_back(self)
- push_back(*args, **kwargs)
- push_back(self, x)
- rbegin(*args)
- rbegin(self) -> std::vector<(float)>::reverse_iterator
rbegin(self) -> std::vector<(float)>::const_reverse_iterator
- rend(*args)
- rend(self) -> std::vector<(float)>::reverse_iterator
rend(self) -> std::vector<(float)>::const_reverse_iterator
- reserve(*args, **kwargs)
- reserve(self, n)
- resize(*args)
- resize(self, new_size)
resize(self, new_size, x)
- size(*args, **kwargs)
- size(self) -> std::vector<(float)>::size_type
- swap(*args, **kwargs)
- swap(self, v)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_FloatVector>
|
class LCG(__builtin__.object) |
| |
Proxy of C++ LCG class |
| |
Methods defined here:
- __init__(self, *args, **kwargs)
- __init__(self, seed) -> LCG
- __repr__ = _swig_repr(self)
- next(*args)
- next(self) -> unsigned long long
next(self, upperBoundNotInclusive) -> unsigned long long
- nextDouble(*args, **kwargs)
- nextDouble(self) -> double
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete_LCG>
|
NN32 = class _NearestNeighbor32(_SparseMatrix32) |
| |
Proxy of C++ _NearestNeighbor32 class |
| |
- Method resolution order:
- _NearestNeighbor32
- _SparseMatrix32
- __builtin__.object
Methods defined here:
- LpNearest(*args, **kwargs)
- LpNearest(self, p, row, k=1, take_root=True) -> PyObject
- __getstate__(self)
- Used by the pickling mechanism to get state that will be saved.
- __init__(self, *args)
- Constructs a new NearestNeighbor from the following available arguments:
NearestNeighbor(): An empty sparse matrix with 0 rows and columns.
NearestNeighbor(nrows, ncols): A zero sparse matrix with the
specified rows and columns.
NearestNeighbor(NearestNeighbor): Copies an existing sparse matrix.
NearestNeighbor(string): Loads a NearestNeighbor from its serialized form.
NearestNeighbor(numpy.array): Loads a NearestNeighbor from a numpy array.
NearestNeighbor([[...],[...]]): Creates an array from a list of lists.
- __repr__ = _swig_repr(self)
- __setstate__(self, tup)
- Used by the pickling mechanism to restore state that was saved.
- __str__(self)
- closestDot(*args, **kwargs)
- closestDot(self, row) -> PyObject
- closestLp_w(*args, **kwargs)
- closestLp_w(self, p, row) -> PyObject
- projLpNearest(*args, **kwargs)
- projLpNearest(self, p, py_x, k=1, take_root=False) -> PyObject
- projRbf(*args, **kwargs)
- projRbf(self, p, k, py_x) -> PyObject
- rowDist(*args, **kwargs)
- rowDist(self, row, xIn) -> Real
- vecLpDist(*args, **kwargs)
- vecLpDist(self, p, xIn, take_root=True) -> PyObject
Data descriptors defined here:
- stddev_
- thisown
- The membership flag
Data and other attributes defined here:
- __swig_destroy__ = <built-in function delete__NearestNeighbor32>
Methods inherited from _SparseMatrix32:
- __abs__(self)
- __add__(self, other)
- __div__(self, other)
- __eq__(*args, **kwargs)
- __eq__(self, other) -> bool
- __getitem__(self, index)
- __iadd__(self, other)
- __idiv__(self, other)
- __imul__(self, other)
- __isub__(self, other)
- __mul__(self, other)
- __neg__(self)
- __radd__(self, other)
- __rmul__(self, other)
- __rsub__(self, other)
- __setitem__(self, index, value)
- __sub__(self, other)
- abs(*args, **kwargs)
- abs(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::abs()
- add(*args)
- add(self, val)
add(self, other)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::add(const
SparseMatrix &other)
- addCol(*args, **kwargs)
- addCol(self, col)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::addCol(InputIterator x_begin)
Adds a column to this SparseMatrix, from an input iterator on a dense
array of values.
Mutating, can increase the number of non-zeros, O(nnzr + K)
Parameters:
-----------
x_begin: [InputIterator<size_type>] input iterator for values
Exceptions: Not enough memory (error) TODO add flag for case where
row is already "clean"
- addColNZ(*args, **kwargs)
- addColNZ(self, ind, nz)
- addOuter(*args, **kwargs)
- addOuter(self, rows, cols, val=1.0)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::addOuter(const
std::vector< size_type > &rows, const std::vector< size_type > &cols,
const value_type &val=1.0)
- addRow(*args, **kwargs)
- addRow(self, row)
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::addRow(InputIterator x_begin)
Adds a row to this SparseMatrix, from an iterator into a dense
container.
The iterator needs to span nCols() values.
Mutating, can increase the number of non-zeros, O(nnzr + K)
Parameters:
-----------
x: [InputIterator<value_type>] input iterator for row values
Exceptions: Not enough memory (error) TODO add flag for case where
row is already "clean"
- addRowNZ(*args, **kwargs)
- addRowNZ(self, ind, nz, zero_permissive=False)
- addToTranspose(*args)
- addToTranspose(self, sm)
addToTranspose(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::addToTranspose()
Inline version, that adds this to its transpose.
- addTwoCols(*args, **kwargs)
- addTwoCols(self, src_col, dst_col)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::addTwoCols(size_type src_col, size_type dst_col)
- addTwoRows(*args, **kwargs)
- addTwoRows(self, src_row, dst_row)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::addTwoRows(size_type src_row, size_type dst_row)
- append(*args, **kwargs)
- append(self, other, zero_permissive=False)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::append(const
self_type &other, bool zero_permissive=false)
- axby(*args)
- axby(self, row, a, b, xIn)
axby(self, a, b, xIn)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::axby(value_type
a, value_type b, InputIterator x)
Computes linear combination of each row and vector x, with
coefficients a and b.
Calls axby in a loop. The number of non-zeros can change, which can
trigger reallocation of the matrix.
Parameters:
-----------
a: [value_type] coefficient that multiplies matrix row
b: [value_type] coefficient that multiplies vector x
x: [InputIterator<value_type>] input vector
Exceptions: Not enough memory (error)
- colAbs(*args, **kwargs)
- colAbs(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colAbs(size_type idx)
- colAdd(*args, **kwargs)
- colAdd(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colAdd(size_type idx, const value_type &val)
- colBandwidth(*args, **kwargs)
- colBandwidth(self, col) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colBandwidth(size_type col) const
- colBandwidths(*args, **kwargs)
- colBandwidths(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colBandwidths(OutputIterator it) const
- colElementCube(*args, **kwargs)
- colElementCube(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementCube(size_type idx)
- colElementDivide(*args, **kwargs)
- colElementDivide(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementDivide(size_type idx, const value_type &val)
- colElementMultiply(*args, **kwargs)
- colElementMultiply(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementMultiply(size_type idx, const value_type &val)
- colElementNZExp(*args, **kwargs)
- colElementNZExp(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementNZExp(size_type idx)
- colElementNZInverse(*args, **kwargs)
- colElementNZInverse(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementNZInverse(size_type idx)
- colElementNZLog(*args, **kwargs)
- colElementNZLog(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementNZLog(size_type idx)
- colElementNZLogk(*args, **kwargs)
- colElementNZLogk(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementNZLogk(size_type idx, const value_type &val)
- colElementNZPow(*args, **kwargs)
- colElementNZPow(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementNZPow(size_type idx, const value_type &val)
- colElementSqrt(*args, **kwargs)
- colElementSqrt(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementSqrt(size_type idx)
- colElementSquare(*args, **kwargs)
- colElementSquare(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colElementSquare(size_type idx)
- colMax(*args)
- colMax(self, col, col_max_i, col_max)
colMax(self, row_index) -> PyObject
colMax(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colMax(OutputIterator1 indices, OutputIterator2 maxima) const
- colMin(*args)
- colMin(self, col, col_min_i, col_min)
colMin(self, row_index) -> PyObject
colMin(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colMin(OutputIterator1 indices, OutputIterator2 minima) const
- colNegate(*args, **kwargs)
- colNegate(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colNegate(size_type idx)
- colNonZeros(*args, **kwargs)
- colNonZeros(self, col) -> PyObject
- colProd(*args, **kwargs)
- colProd(self, col) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type
value_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colProd(size_type col) const
Computes the product of the non-zeros for a given column.
Non-mutating, O(nnzr)
Parameters:
-----------
row: [size_type] the index of the column to multiply
[value_type]: the product of the column
Exceptions: If col < 0 || col >= nCols().
- colProds(*args, **kwargs)
- colProds(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colProds(OutputIterator prods) const
Computes the prod of each column in the SparseMatrix.
Non-mutating, O(nnz)
Parameters:
-----------
prods: [OutputIterator] iterator to storage for the prod of each
column
Exceptions: None. TODO make faster
- colSubtract(*args, **kwargs)
- colSubtract(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colSubtract(size_type idx, const value_type &val)
- colSum(*args, **kwargs)
- colSum(self, col) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type
value_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colSum(size_type col) const
Computes the sum of the non-zeros for a given column.
Non-mutating, O(nnzr)
Parameters:
-----------
col: [size_type] the index of the column to sum
[value_type]: the sum of the column
Exceptions: If col < 0 || col >= nCols().
- colSums(*args, **kwargs)
- colSums(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::colSums(OutputIterator sums) const
Computes the sum of each column in the SparseMatrix.
Non-mutating, O(nnz)
Parameters:
-----------
sums: [OutputIterator] iterator to storage for the sum of each column
Exceptions: None.
- compact(*args, **kwargs)
- compact(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::compact()
Compacts the memory for this SparseMatrix.
This reduces the number of cache misses, and can make a sizable
runtime difference (up to 30% on shona, depending on the operation).
All the non-zeros are allocated contiguously. Non-mutating algorithms
can run on the compact representation.
Mutating, O(nnz)
Exceptions: Not eneough memory (error) TODO make even more compact by
having WHOLE state in one chunk
- copy(*args, **kwargs)
- copy(self, other)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::copy(const
SparseMatrix< UI2, R2, I2, RP2, DTZ2 > &other)
Copies the given sparse matrix into this one.
Mutating, discards the current state of this sparse matrix, O(nnz).
Parameters:
-----------
other: [ SparseMatrix] the SparseMatrix instance to copy
- decompact(*args, **kwargs)
- decompact(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::decompact()
"De-compacts" this SparseMatrix, that is, each row is allocated
separately.
All the non-zeros inside a given row are still allocated contiguously.
This is more efficient when changing the number of non-zeros on each
row (rather than reallocating the whole contiguous array of all the
non-zeros in the SparseMatrix. We decompact before mutating the non-
zeros, and we recompact once the non-zeros don't change anymore.
Mutating, O(nnz)
Exceptions: Not enough memory (error)
- deleteCol(*args, **kwargs)
- deleteCol(self, del_col)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::deleteCol(size_type del_col)
TODO isolate memmove.
- deleteCols(*args, **kwargs)
- deleteCols(self, colIndices)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::deleteCols(InputIterator del_it, InputIterator del_end)
Deletes specified columns.
The indices of the columns are passed in a range [del..del_end). The
range can be contiguous (std::vector) or not (std::list, std::map).
The matrix can end up empty if all the columns are removed. If the
list of columns to remove is empty, the matrix is unchanged.
WARNING: the columns indices need to be passed without duplicates, in
strictly increasing order.
Parameters:
-----------
del: [InputIterator<size_type>] iterator to the beginning of the
range that contains the indices of the columns to be deleted
del_end: [InputIterator<size_type>] iterator to one past the end of
the range that contains the indices of the columns to be deleted
Exceptions: If a column index < 0 || >= nCols().
If column indices are not passed in strictly increasing order.
If del_end - del < 0 || del_end - del > nCols().
- deleteRow(*args, **kwargs)
- deleteRow(self, del_row)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::deleteRow(size_type del_row)
- deleteRows(*args, **kwargs)
- deleteRows(self, rowIndices)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::deleteRows(InputIterator del_it, InputIterator del_end)
Deletes specified rows.
The indices of the rows are passed in a range [del..del_end). The
range can be contiguous (std::vector) or not (std::list, std::map).
The matrix can end up empty if all the rows are removed. If the list
of rows to remove is empty, the matrix is unchanged.
WARNING: the row indices need to be passed without duplicates, in
strictly increasing order.
Parameters:
-----------
del: [InputIterator<size_type>] iterator to the beginning of the
range that contains the indices of the rows to be deleted
del_end: [InputIterator<size_type>] iterator to one past the end of
the range that contains the indices of the rows to be deleted
Exceptions: If a row index < 0 || >= nRows().
If row indices are not passed in strictly increasing order.
If del_end - del < 0 || del_end - del > nRows(). TODO add option to
pass indices in any order, with repetitions
- divide(*args, **kwargs)
- divide(self, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::divide(const
value_type &val)
- duplicateRow(*args, **kwargs)
- duplicateRow(self, row)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::duplicateRow(size_type row)
- elementCube(*args, **kwargs)
- elementCube(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::elementCube()
- elementNZDivide(*args, **kwargs)
- elementNZDivide(self, other)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::elementNZDivide(const SparseMatrix &other)
- elementNZExp(*args, **kwargs)
- elementNZExp(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::elementNZExp()
- elementNZInverse(*args, **kwargs)
- elementNZInverse(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::elementNZInverse()
- elementNZLog(*args, **kwargs)
- elementNZLog(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::elementNZLog()
- elementNZLogk(*args, **kwargs)
- elementNZLogk(self, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::elementNZLogk(const value_type &val)
- elementNZMultiply(*args, **kwargs)
- elementNZMultiply(self, other)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::elementNZMultiply(const SparseMatrix &other)
- elementNZPow(*args, **kwargs)
- elementNZPow(self, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::elementNZPow(const value_type &val)
- elementSqrt(*args, **kwargs)
- elementSqrt(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::elementSqrt()
- elementSquare(*args, **kwargs)
- elementSquare(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::elementSquare()
- equals(*args, **kwargs)
- equals(self, B) -> bool
bool
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::equals(const
SparseMatrix &B) const
Tests whether two instances of class SparseMatrix are equal or not.
Two matrices are considered different if any of the following
conditions is met:
the number of rows is different
the number of columns is different
the number of non-zeros is different
any non-zero is different
Parameters:
-----------
B: [ SparseMatrix] the matrix to compare to
Parameters:
-----------
[bool]: whether the two matrices are equal or not
Exceptions: None.
- firstNonZeroOnCol(*args, **kwargs)
- firstNonZeroOnCol(self, col) -> std::pair<(nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type,nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type)>
std::pair<size_type, value_type> nta::SparseMatrix< UI, Real_stor, I,
Real_prec, DTZ >::firstNonZeroOnCol(size_type col) const
- firstNonZeroOnRow(*args, **kwargs)
- firstNonZeroOnRow(self, row) -> std::pair<(nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type,nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type)>
std::pair<size_type, value_type> nta::SparseMatrix< UI, Real_stor, I,
Real_prec, DTZ >::firstNonZeroOnRow(size_type row) const
- fromBinary(*args, **kwargs)
- fromBinary(self, inStream)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::fromBinary(std::istream &inStream)
Reads this SparseMatrix from binary representation.
WARNING this is not platform independent!
TODO handle type information? TODO persist isZero_ ??
- fromCSR(*args, **kwargs)
- fromCSR(self, inStreamParam, zero_permissive=False) -> std::istream
std::istream&
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::fromCSR(std::istream &inStreamParam, bool zero_permissive=false)
Populates this SparseMatrix from a stream in csr format.
The pairs (index, value) can be in any order for each row. Mutating,
discards the previous state of this SparseMatrix. Can handle large
sparse matrices.
Format: 'csr' totalbytes nrows ncols nnz nnzr1 j1 val1 j2 val2 ...
nnzr2 ...
where nnzr is the total number of non-zeros in the matrix, nnzr1 is
the number of non-zeros on the first row, j1 is the column index of
the first non-zeroon the first row, val1 is the value of the first
non-zero on the first row.
Parameters:
-----------
inStream: [std::istream] the stream to initialize from
Parameters:
-----------
[std::istream]: the stream after the matrix has been read
WARNING: for each row, the indices must be in increasing order,
without duplicates, and no zeros.
WARNING: values in the stream smaller than epsilon will be rounded out
WARNING: doesn't work if float == complex (because of MemStream)
Exceptions: Bad stream (check)
Stream does not start with 'csr' tag (check)
nrows < 0 in stream (check)
ncols <= 0 in stream (check)
nnz < 0 || nnz > nrows * ncols in stream (check)
nnzr < 0 || nnzr > ncols for any row (check)
column index j < 0 || >= ncols for any row (check)
Not enough memory (error) TODO save distance from isZero_??
- fromDense(*args, **kwargs)
- fromDense(self, matrix)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::fromDense(size_type nrows, size_type ncols, InputIterator dense)
Populates this SparseMatrix from a dense array of value_type.
The dense array needs to be in row-major order, contiguous. The non-
zeros are stored in increasing order of column index in the rows of
this sparse matrix.
Mutating, discards the previous state of this SparseMatrix.
Parameters:
-----------
nrows: [size_type > 0] number of rows in dense array
ncols: [size_type > 0] number of columns in dense array
dense: [InputIterator] dense array of values
Exceptions: nrows < 0 (check)
ncols <= 0 (check)
Not enough memory (error)
- fromPyString(*args, **kwargs)
- fromPyString(self, s) -> bool
- get(*args, **kwargs)
- get(self, row, col) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type
value_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::get(size_type
row, size_type col) const
Returns the value of the element at row index i and column index j.
This is slow, because the rows are arrays, and a linear scan of the
row is needed to find the right index.
Non-mutating, O(log(nnzr))
Parameters:
-----------
row: [0 <= size_type < nRows()] the index of the row
col: [0 <= size_type < nCols()] the index of the column
Parameters:
-----------
[value_type]: the value at (row, col) in this sparse matrix
Exceptions: If row < 0 or row >= nRows()
If col < 0 or col >= nCols()
- getAllNonZeros(*args, **kwargs)
- getAllNonZeros(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::getAllNonZeros(OutputIterator1 nz_i, OutputIterator1 nz_j,
OutputIterator2 nz_val) const
Returns all the non-zeros in this matrix to three ranges, one for the
row indices of the non-zeros, one for the col indices, and one for the
value of the non-zeros.
- getCol(*args, **kwargs)
- getCol(self, col) -> PyObject
- getElements(*args, **kwargs)
- getElements(self, py_i, py_j) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::getElements(InputIterator1 i_begin, InputIterator1 i_end,
InputIterator1 j_begin, OutputIterator1 v_begin) const
Get from 2 ranges, one for the row indices, one for the column
indices, returning the values in the third range.
TODO make faster
- getIsNearlyZeroFunction(*args, **kwargs)
- getIsNearlyZeroFunction(self) -> nta::IsNearlyZero<(nta::DistanceToZero<(nta::Real32)>)>
const IsNearlyZero<DTZ>& nta::SparseMatrix< UI, Real_stor, I,
Real_prec, DTZ >::getIsNearlyZeroFunction() const
- getNonZerosSorted(*args, **kwargs)
- getNonZerosSorted(self, n=-1, ascending_values=True) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::getNonZerosSorted(OutputIterator out_begin, int n=-1,
StrictWeakOrdering o=ijv::greater_value()) const
Sort all values according to predicate.
Return values and i,j indices.
- getOuter(*args, **kwargs)
- getOuter(self, py_i, py_j) -> _SparseMatrix32
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::getOuter(const
Container1 &c1, const Container2 &c2, Other &other) const
A more convenient form of getOuter, useful for example, when we can't
subtract the iterators to know the sizes of the ranges.
- getRow(*args, **kwargs)
- getRow(self, row) -> PyObject
- getSlice(*args, **kwargs)
- getSlice(self, i_begin, i_end, j_begin, j_end) -> _SparseMatrix32
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::getSlice(size_type src_first_row, size_type src_row_end, size_type
src_first_col, size_type src_col_end, Other &other) const
Gets a Domain from this to a new SparseMatrix.
The relative positions of the non-zero elements are preserved.
This method is not fast.
Parameters:
-----------
src: [ Domain2D] the source domain to extract from this sparse matrix
Parameters:
-----------
[SparseMatrix]: the extracted slice
TODO faster method, when Other as the same type as this, and where we
can access the internals, instead of going through get/set. Use at
least row-wise bulk operations.
- increment(*args, **kwargs)
- increment(self, i, j, delta, resizeYesNo=False)
- isColZero(*args, **kwargs)
- isColZero(self, col) -> bool
bool
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::isColZero(size_type col) const
Returns true if column col is all zeros, false otherwise.
Parameters:
-----------
col: [size_type] the column
Parameters:
-----------
[bool]: whether the column is all zeros or not
Exceptions: If col < 0 || col >= nCols() (assert)
- isCompact(*args, **kwargs)
- isCompact(self) -> bool
bool
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::isCompact()
const
Returns whether this sparse matrix is stored "compactly" or not.
When stored "compactly", all the non-zeros are in a single block of
memory. When not stored "compactly", each row is a contiguous chunk
of memory, but the rows are located at separate memory addresses.
Methods compact()/decompact() can be used to switch from one mode to
the other. Having all the non-zeros stored in one single, contiguous
array in memory can speed up some operations by favoring cache
coherence.
Non-mutating, O(1).
[bool] whether this matrix is stored "compactly" or not
- isRowZero(*args, **kwargs)
- isRowZero(self, row) -> bool
bool
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::isRowZero(size_type row) const
Returns true if row is all zeros, false otherwise.
Parameters:
-----------
row: [size_type] the row
Parameters:
-----------
[bool]: whether the row is all zeros or not
Exceptions: If row < 0 || row >= nRows() (assert)
- isSymmetric(*args, **kwargs)
- isSymmetric(self) -> bool
- isZero(*args, **kwargs)
- isZero(self) -> bool
bool
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::isZero() const
Returns whether this sparse matrix is zero or not.
This is computed, rather than maintained incrementally.
Non-mutating, O(nrows).
Parameters:
-----------
[bool]: whether the matrix is zero or not
- lastNonZeroOnCol(*args, **kwargs)
- lastNonZeroOnCol(self, col) -> std::pair<(nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type,nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type)>
std::pair<size_type, value_type> nta::SparseMatrix< UI, Real_stor, I,
Real_prec, DTZ >::lastNonZeroOnCol(size_type col) const
- lastNonZeroOnRow(*args, **kwargs)
- lastNonZeroOnRow(self, row) -> std::pair<(nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type,nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type)>
std::pair<size_type, value_type> nta::SparseMatrix< UI, Real_stor, I,
Real_prec, DTZ >::lastNonZeroOnRow(size_type row) const
- leftVecProd(*args, **kwargs)
- leftVecProd(self, xIn) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::leftVecProd(InputIterator x, OutputIterator y) const
Computes the product of vector x by this SparseMatrix on the left
side, and puts the result in vector y.
x and y need to be iterators to cointguous arrays in memory (like
std::vector, not like std::list).
Non-mutating, O(nnz)
Parameters:
-----------
x: [InputIterator<value_type>] input vector (size = number of rows)
y: [OutputIterator<value_type>] result (size = number of columns)
Exceptions: None TODO rename vecProd methods TODO make faster
- lerp(*args, **kwargs)
- lerp(self, a, b, B)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::lerp(value_type
a, value_type b, const SparseMatrix &B)
Computes the linear interpolation of this sparse matrix and B, with
coefficients a and b respectively.
The result is stored in this matrix: this = a * this + b * B.
Mutating, O(nnz1 + nnz2)
Parameters:
-----------
a: [value_type] a coefficient
b: [value_type] b coefficient
B: [const SparseMatrix<size_type, value_type>] B matrix
TODO: add flag so B can be transposed?
Exceptions If this matrix and B don't have the same number of rows.
If this matrix and B don't have the same number of columns.
- map(*args, **kwargs)
- map(self, B, C)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::map(const
SparseMatrix &B, SparseMatrix &C) const
For each row i of this SparseMatrix, finds this row in B, and if it is
found as row j of B, puts a 1 at (i, j) in C.
Assumes that the rows of B are unique.
- max(*args)
- max(self, max_row, max_col, max_val)
max(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::max(size_type
&max_row, size_type &max_col, value_type &max_val) const
Returns the row, column and value of the maximum among the non-zeros
of the SparseMatrix.
Non-mutating, O(nnz).
Parameters:
-----------
max_i: [size_type&] row of the max
max_j: [size_type&] column of the max
max_val: [value_type&] value of the max
Exceptions: None
- min(*args)
- min(self, min_row, min_col, min_val)
min(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::min(size_type
&min_row, size_type &min_col, value_type &min_val) const
Returns the row, column and value of the minimum among the non-zeros
of the SparseMatrix.
Non-mutating, O(nnz).
Parameters:
-----------
min_i: [size_type&] row of the min
min_j: [size_type&] column of the min
min_val: [value_type&] value of the min
Exceptions: None
- multiply(*args)
- multiply(self, B, C)
multiply(self, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::multiply(const
value_type &val)
- nCols(*args, **kwargs)
- nCols(self) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::nCols() const
Returns the number of colums in this SparseMatrix.
Non-mutating, O(1).
Parameters:
-----------
[size_type: >= 0] number of columns
- nNonZeroCols(*args, **kwargs)
- nNonZeroCols(self) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::nNonZeroCols()
const
Returns the number of columns that are not zero.
- nNonZeroRows(*args, **kwargs)
- nNonZeroRows(self) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::nNonZeroRows()
const
Returns the number of rows that are not zero.
- nNonZeros(*args, **kwargs)
- nNonZeros(self) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::nNonZeros()
const
Returns the number of non-zeros in this SparseMatrix.
This is computed rather than stored and maintained incrementally. This
is slow, but we can't add the nnzr_[i] because there might be less
non-zeros... So far, nobody has seen this method on the critical path
in a profile.
Non-mutating, O(nnz).
Parameters:
-----------
[size_type: >= 0] number of non-zeros
- nNonZerosOnCol(*args, **kwargs)
- nNonZerosOnCol(self, col) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::nNonZerosOnCol(size_type col) const
Returns the number of non-zeros on 'col'-th column.
Non-mutating, O(log(nnzr)).
Parameters:
-----------
col: [SizeType >= 0 < nCols] index of the column to access
Parameters:
-----------
[size_type: >= 0] number of non-zeros on 'col'-th column
Exceptions: If col < 0 || col >= nCols() (assert)
- nNonZerosOnRow(*args, **kwargs)
- nNonZerosOnRow(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::nNonZerosOnRow(size_type row) const
Returns the number of non-zeros on 'row'-th row.
Non-mutating, O(nnzr).
Parameters:
-----------
row: [SizeType >= 0 < nrows] index of the row to access
Parameters:
-----------
[size_type: >= 0] number of non-zeros on 'row'-th row
Exceptions: If row < 0 || row >= nRows() (assert)
- nNonZerosPerCol(*args, **kwargs)
- nNonZerosPerCol(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::nNonZerosPerCol(OutputIterator it) const
Returns the number of non-zeros on each column of this SparseMatrix.
Non-mutating, O(nnz).
Parameters:
-----------
it: [OutputIterator] an iterator to storage for the number of non-
zeros per column (needs nCols() space).
- nNonZerosPerRow(*args, **kwargs)
- nNonZerosPerRow(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::nNonZerosPerRow(OutputIterator it) const
Returns the number of non-zeros on each row of this SparseMatrix.
Non-mutating, O(nRows).
Parameters:
-----------
it: [OutputIterator] an iterator to storage for the number of non-
zeros per row (needs nRows() space).
- nRows(*args, **kwargs)
- nRows(self) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::nRows() const
Returns the number of rows in this SparseMatrix.
Non-mutating, O(1).
Parameters:
-----------
[size_type: >= 0] number of rows
- negate(*args, **kwargs)
- negate(self)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::negate()
- normalize(*args, **kwargs)
- normalize(self, val=1.0, exact=False)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::normalize(const
value_type &val=1.0, bool exact=false)
- normalizeCol(*args, **kwargs)
- normalizeCol(self, col, val=1.0, exact=False)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::normalizeCol(size_type col, const value_type &val=1.0, bool
exact=false)
- normalizeCols(*args, **kwargs)
- normalizeCols(self, val=1.0, exact=False)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::normalizeCols(const value_type &val=1.0, bool exact=false)
Normalizes all the columns of this SparseMatrix.
There is an issue when normalizing sparse matrices where the result
after normalization could not equal 1, because some values disappear
below the threshold used to determine whether a number is a zero or
not.
Mutating
Parameters:
-----------
val: [value_type] the value that should be used in the normalization
exact: [bool (false)]: whether to make the rows exactly match to 1
after normalization or not
Exceptions: None
- normalizeRow(*args, **kwargs)
- normalizeRow(self, row, val=1.0, exact=False)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::normalizeRow(size_type row, const value_type &val=1.0, bool
exact=false)
- normalizeRows(*args, **kwargs)
- normalizeRows(self, val=1.0, exact=False)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::normalizeRows(const value_type &val=1.0, bool exact=false)
Normalizes all the rows of this SparseMatrix.
There is an issue when normalizing sparse matrices where the result
after normalization could not equal 1, because some values disappear
below the threshold used to determine whether a number is a zero or
not.
Mutating
Parameters:
-----------
val: [value_type] the value that should be used in the normalization
exact: [bool (false)]: whether to make the rows exactly match to 1
after normalization or not
Exceptions: None
- prod(*args, **kwargs)
- prod(self) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type
value_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::prod() const
- replaceNZ(*args, **kwargs)
- replaceNZ(self, val=1.0)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ >::replaceNZ(const
value_type &val=1.0)
Replaces the non-zeros by the specified value.
- reshape(*args, **kwargs)
- reshape(self, new_nrows, new_ncols)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::reshape(size_type new_nrows, size_type new_ncols)
Reshapes this matrix to the new number of rows and columns specified.
The new number of elements in the matrix must be the same as the old
number of elements: new_nrows * new_ncols = nrows * ncols.
Parameters:
-----------
new_nrows: [size_type] the new number of rows
new_ncols: [size_type] the new number of columns
- resize(*args, **kwargs)
- resize(self, new_nrows, new_ncols, setToZero=False)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::resize(size_type new_nrows, size_type new_ncols, bool
setToZero=false)
Resizes this sparse matrix with rows and/or columns of zeros.
Rows and columns can be added at the same time, or separately.
Parameters:
-----------
new_nrows: [size_type > 0] the new number of rows
new_ncols: [size_type > 0] the new number of columns
Exceptions: None.
- rightVecProd(*args, **kwargs)
- rightVecProd(self, xIn) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rightVecProd(InputIterator x, OutputIterator y) const
Computes the product of vector x by this SparseMatrix on the right
side, and puts the result in vector y.
x and y need to be iterators to cointguous arrays in memory (like
std::vector, not like std::list).
Non-mutating, O(nnz)
Parameters:
-----------
x: [InputIterator<value_type>] input vector (size = number of
columns)
y: [OutputIterator<value_type>] result (size = number of rows)
Exceptions: None
- rowAbs(*args, **kwargs)
- rowAbs(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowAbs(size_type idx)
- rowAdd(*args, **kwargs)
- rowAdd(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowAdd(size_type idx, const value_type &val)
- rowBandwidth(*args, **kwargs)
- rowBandwidth(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::size_type
size_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowBandwidth(size_type row) const
- rowBandwidths(*args, **kwargs)
- rowBandwidths(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowBandwidths(OutputIterator it) const
- rowElementCube(*args, **kwargs)
- rowElementCube(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementCube(size_type idx)
- rowElementDivide(*args, **kwargs)
- rowElementDivide(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementDivide(size_type idx, const value_type &val)
- rowElementMultiply(*args, **kwargs)
- rowElementMultiply(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementMultiply(size_type idx, const value_type &val)
- rowElementNZExp(*args, **kwargs)
- rowElementNZExp(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementNZExp(size_type idx)
- rowElementNZInverse(*args, **kwargs)
- rowElementNZInverse(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementNZInverse(size_type idx)
- rowElementNZLog(*args, **kwargs)
- rowElementNZLog(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementNZLog(size_type idx)
- rowElementNZLogk(*args, **kwargs)
- rowElementNZLogk(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementNZLogk(size_type idx, const value_type &val)
- rowElementNZPow(*args, **kwargs)
- rowElementNZPow(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementNZPow(size_type idx, const value_type &val)
- rowElementSqrt(*args, **kwargs)
- rowElementSqrt(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementSqrt(size_type idx)
- rowElementSquare(*args, **kwargs)
- rowElementSquare(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowElementSquare(size_type idx)
- rowMax(*args)
- rowMax(self, row, row_max_j, row_max)
rowMax(self, row_index) -> PyObject
rowMax(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowMax(OutputIterator1 indices, OutputIterator2 values) const
- rowMin(*args)
- rowMin(self, row, row_min_j, row_min)
rowMin(self, row_index) -> PyObject
rowMin(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowMin(OutputIterator1 indices, OutputIterator2 values) const
- rowNegate(*args, **kwargs)
- rowNegate(self, idx)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowNegate(size_type idx)
- rowNonZeros(*args, **kwargs)
- rowNonZeros(self, row) -> PyObject
- rowProd(*args, **kwargs)
- rowProd(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type
value_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowProd(size_type row) const
Computes the product of the non-zeros for a given row.
Non-mutating, O(nnzr)
Parameters:
-----------
row: [size_type] the index of the row to multiply
[value_type]: the product of the row
Exceptions: If row < 0 || row >= nRows().
- rowProds(*args, **kwargs)
- rowProds(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowProds(OutputIterator prods) const
Computes the prod of each row in the SparseMatrix.
Non-mutating, O(nnz)
Parameters:
-----------
prods: [OutputIterator] iterator to storage for the prod of each row
Exceptions: None.
- rowSubtract(*args, **kwargs)
- rowSubtract(self, idx, val)
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowSubtract(size_type idx, const value_type &val)
- rowSum(*args, **kwargs)
- rowSum(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::value_type
value_type
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowSum(size_type row) const
Computes the sum of the non-zeros for a given row.
Non-mutating, O(nnzr)
Parameters:
-----------
row: [size_type] the index of the row to sum
[value_type]: the sum of the row
Exceptions: If row < 0 || row >= nRows().
- rowSums(*args, **kwargs)
- rowSums(self) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowSums(OutputIterator sums) const
Computes the sum of each row in the SparseMatrix.
Non-mutating, O(nnz)
Parameters:
-----------
sums: [OutputIterator] iterator to storage for the sum of each row
Exceptions: None.
- rowVecProd(*args, **kwargs)
- rowVecProd(self, xIn, lb=Epsilon) -> PyObject
void
nta::SparseMatrix< UI, Real_stor, I, Real_prec, DTZ
>::rowVecProd(InputIterator x, OutputIterator y, const value_type &lb)
const
Computes the product of all the values in vector x by all the non zero
values on each row of this sparse matrix.
TODO optimize
- row_nz_index_begin(*args)
- row_nz_index_begin(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::const_row_nz_index_iterator
row_nz_index_begin(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::row_nz_index_iterator
row_nz_index_iterator nta::SparseMatrix< UI, Real_stor, I, Real_prec,
DTZ >::row_nz_index_begin(size_type row)
Not documented.
Don't use, unless you really, really know what you are doing
- row_nz_index_end(*args)
- row_nz_index_end(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::const_row_nz_index_iterator
row_nz_index_end(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::DistanceToZero<(float)>)>::row_nz_index_iterator
row_nz_index_iterator nta::SparseMatrix< UI, Real_stor, I, Real_prec,
DTZ >::row_nz_index_end(size_type row)
Not documented.
Don't use, unless you really, really know what you are doing
- row_nz_value_begin(*args)
- row_nz_value_begin(self, row) -> nta::SparseMatrix<(unsigned int,float,int,double,nta::Di
| |