Construct a sparse matrix and assign values from (SymTriMatrixN) matrix u.
Construct a sparse matrix and assign values from (SymTriMatrixN) matrix u.
the matrix of values to assign
Construct a sparse matrix and assign values from (MatrixN) matrix u.
Construct a sparse matrix and assign values from (MatrixN) matrix u.
the matrix of values to assign
Construct a sparse matrix and assign values from matrix u.
Construct a sparse matrix and assign values from matrix u.
the matrix of values to assign
Construct a matrix from repeated real values.
Construct a matrix from repeated real values.
the (row, column) dimensions
the first value (necessary due to type erasure)
the rest of the repeated values
Construct a matrix from repeated values.
Construct a matrix from repeated values.
the (row, column) dimensions
the repeated values
Construct a dim1 by dim1 square sparse matrix with x assigned on the diagonal and 0 assigned off the diagonal.
Construct a dim1 by dim1 square sparse matrix with x assigned on the diagonal and 0 assigned off the diagonal. To obtain an identity matrix, let x = 1.
the row and column dimension
the scalar value to assign on the diagonal
Construct a dim1 by dim2 sparse matrix and assign each element the value x.
Construct a dim1 by dim2 sparse matrix and assign each element the value x.
the row dimension
the column dimesion
the scalar value to assign
Construct a dim1 by dim1 square sparse matrix.
Construct a dim1 by dim1 square sparse matrix.
the row and column dimension
Construct a dim1 by dim2 sparse matrix from an array of sorted-linked-maps.
Construct a dim1 by dim2 sparse matrix from an array of sorted-linked-maps.
the row dimension
the column dimension
the array of sorted-linked-maps
the first/row dimension
the second/column dimension
Multiply this sparse matrix by scalar x.
Multiply this sparse matrix by scalar x.
the scalar to multiply by
Multiply this sparse matrix by vector u.
Multiply this sparse matrix by vector u.
the vector to multiply by
Multiply this sparse matrix by matrix b.
Multiply this sparse matrix by matrix b.
the matrix to multiply by (requires sameCrossDimensions)
Multiply this sparse matrix by sparse matrix b, by performing a merge operation on the rows on this sparse matrix and the transpose of the b matrix.
Multiply this sparse matrix by sparse matrix b, by performing a merge operation on the rows on this sparse matrix and the transpose of the b matrix.
the matrix to multiply by (requires sameCrossDimensions)
Multiply this sparse matrix by vector u to produce another matrix (a_ij * b_j)
Multiply this sparse matrix by vector u to produce another matrix (a_ij * b_j)
the vector to multiply by
Multiply in-place this sparse matrix by vector u to produce another matrix (a_ij * b_j)
Multiply in-place this sparse matrix by vector u to produce another matrix (a_ij * b_j)
the vector to multiply by
Multiply in-place this sparse matrix by scalar x.
Multiply in-place this sparse matrix by scalar x.
the scalar to multiply by
Multiply in-place this sparse matrix by matrix b.
Multiply in-place this sparse matrix by matrix b.
the matrix to multiply by (requires sameCrossDimensions)
Multiply in-place this sparse matrix by sparse matrix b, by performing a merge operation on the rows on this sparse matrix and the transpose of the b matrix.
Multiply in-place this sparse matrix by sparse matrix b, by performing a merge operation on the rows on this sparse matrix and the transpose of the b matrix.
the matrix to multiply by (requires sameCrossDimensions)
Add this sparse matrix and scalar x.
Add this sparse matrix and scalar x. Note: every element will be likely filled, hence the return type is a dense matrix.
the scalar to add
Add this sparse matrix and matrix b.
Add this sparse matrix and matrix b.
the matrix to add (requires sameCrossDimensions)
Add this sparse matrix and sparse matrix b.
Add this sparse matrix and sparse matrix b.
the matrix to add (requires sameCrossDimensions)
Concatenate this sparse matrix and vector u.
Concatenate this sparse matrix and vector u.
the vector to be concatenated as the new last row in matrix
Add in-place this sparse matrix and scalar x.
Add in-place this sparse matrix and scalar x.
the scalar to add
Add in-place this sparse matrix and matrix b.
Add in-place this sparse matrix and matrix b.
the matrix to add (requires sameCrossDimensions)
Add in-place this sparse matrix and sparse matrix b.
Add in-place this sparse matrix and sparse matrix b.
the matrix to add (requires sameCrossDimensions)
From this sparse matrix subtract scalar x.
From this sparse matrix subtract scalar x. Note: every element will be likely filled, hence the return type is a dense matrix.
the scalar to subtract
From this sparse matrix substract matrix b.
From this sparse matrix substract matrix b.
the matrix to subtract (requires sameCrossDimensions)
From this sparse matrix substract matrix b.
From this sparse matrix substract matrix b.
the sparse matrix to subtract (requires sameCrossDimensions)
From this sparse matrix subtract in-place scalar x.
From this sparse matrix subtract in-place scalar x.
the scalar to subtract
From this sparse matrix substract in-place matrix b.
From this sparse matrix substract in-place matrix b.
the matrix to subtract (requires sameCrossDimensions)
From this sparse matrix substract in-place sparse matrix b.
From this sparse matrix substract in-place sparse matrix b.
the sparse matrix to subtract (requires sameCrossDimensions)
Divide this sparse matrix by scalar x.
Divide this sparse matrix by scalar x.
the scalar to divide by
Divide in-place this sparse matrix by scalar x.
Divide in-place this sparse matrix by scalar x.
the scalar to divide by
Get a slice this matrix row-wise at index i and column-wise on range jr.
Get a slice this matrix row-wise at index i and column-wise on range jr. Ex: u = a(2, 3..5)
the row index
the column range
Get a slice this matrix row-wise on range ir and column-wise at index j.
Get a slice this matrix row-wise on range ir and column-wise at index j. Ex: u = a(2..4, 3)
the row range
the column index
Get a slice this matrix row-wise on range ir and column-wise on range jr.
Get a slice this matrix row-wise on range ir and column-wise on range jr. Ex: b = a(2..4, 3..5)
the row range
the column range
Get this sparse matrix's vector at the i-th index position (i-th row).
Get this sparse matrix's vector at the i-th index position (i-th row).
the row index
Get this sparse matrix's element at the i,j-th index position.
Get this sparse matrix's element at the i,j-th index position.
the row index
the column index
Clean values in matrix at or below the threshold by setting them to zero.
Clean values in matrix at or below the threshold by setting them to zero. Iterative algorithms give approximate values and if very close to zero, may throw off other calculations, e.g., in computing eigenvectors.
the cutoff threshold (a small value)
whether to use relative or absolute cutoff
Get column 'col' from the matrix, returning it as a vector.
Get column 'col' from the matrix, returning it as a vector.
the column to extract from the matrix
the position to start extracting from
the first/row dimension
the second/column dimension
Compute the determinant of this sparse matrix.
Compute the determinant of this sparse matrix.
Form a matrix [Ip, this, Iq] where Ir is a r by r identity matrix, by positioning the three matrices Ip, this and Iq along the diagonal.
Form a matrix [Ip, this, Iq] where Ir is a r by r identity matrix, by positioning the three matrices Ip, this and Iq along the diagonal.
the size of identity matrix Ip
the size of identity matrix Iq
Combine this sparse matrix with matrix b, placing them along the diagonal and filling in the bottom left and top right regions with zeroes; [this, b].
Combine this sparse matrix with matrix b, placing them along the diagonal and filling in the bottom left and top right regions with zeroes; [this, b].
the matrix to combine with this matrix
Dimension 1
Dimension 1
Dimension 2
Dimension 2
Show the flaw by printing the error message.
Show the flaw by printing the error message.
the method where the error occurred
the error message
Iterate over the matrix row by row.
Get the kth diagonal of this sparse matrix.
Get the kth diagonal of this sparse matrix. Assumes dim2 >= dim1.
how far above the main diagonal, e.g., (-1, 0, 1) for (sub, main, super)
Invert this sparse matrix (requires a squareMatrix) and use partial pivoting.
Invert this sparse matrix (requires a squareMatrix) and use partial pivoting.
Invert in-place this sparse matrix (requires a squareMatrix).
Invert in-place this sparse matrix (requires a squareMatrix). This version uses partial pivoting.
Check whether this sparse matrix is nonnegative (has no negative elements).
Check whether this sparse matrix is nonnegative (has no negative elements).
Check whether this sparse matrix is rectangular (all rows have the same number of columns).
Check whether this sparse matrix is rectangular (all rows have the same number of columns).
Check whether this matrix is square (same row and column dimensions).
Check whether this matrix is square (same row and column dimensions).
Check whether this matrix is symmetric.
Check whether this matrix is symmetric.
Check whether this matrix dimensions are less than or equal to (le) those of the other Matrix.
Check whether this matrix dimensions are less than or equal to (le) those of the other Matrix.
the other matrix
Decompose this sparse matrix into the product of lower and upper triangular matrices (l, u) using the LU Decomposition algorithm.
Decompose this sparse matrix into the product of lower and upper triangular matrices (l, u) using the LU Decomposition algorithm. This version uses partial pivoting.
Decompose in-place this sparse matrix into the product of lower and upper triangular matrices (l, u) using the LU Decomposition algorithm.
Decompose in-place this sparse matrix into the product of lower and upper triangular matrices (l, u) using the LU Decomposition algorithm. This version uses partial pivoting.
Find the magnitude of this matrix, the element value farthest from zero.
Find the magnitude of this matrix, the element value farthest from zero.
Find the maximum element in this sparse matrix.
Find the maximum element in this sparse matrix.
the ending row index (exclusive) for the search
Find the minimum element in this sparse matrix.
Find the minimum element in this sparse matrix.
the ending row index (exclusive) for the search
Compute the 1-norm of this matrix, i.
Compute the 1-norm of this matrix, i.e., the maximum 1-norm of the column vectors. This is useful for comparing matrices (a - b).norm1
Compute the (right) nullspace of this m by n matrix (requires n = m + 1) by performing Gauss-Jordan reduction and extracting the negation of the last column augmented by 1.
Compute the (right) nullspace of this m by n matrix (requires n = m + 1) by performing Gauss-Jordan reduction and extracting the negation of the last column augmented by 1. The nullspace of matrix a is "this vector v times any scalar s", i.e., a*(v*s) = 0. The left nullspace of matrix a is the same as the right nullspace of a.t (a transpose).
Compute the (right) nullspace in-place of this m by n matrix (requires n = m + 1) by performing Gauss-Jordan reduction and extracting the negation of the last column augmented by 1.
Compute the (right) nullspace in-place of this m by n matrix (requires n = m + 1) by performing Gauss-Jordan reduction and extracting the negation of the last column augmented by 1. The nullspace of matrix a is "this vector v times any scalar s", i.e., a*(v*s) = 0. The left nullspace of matrix a is the same as the right nullspace of a.t (a transpose).
Return 1 if the condition is true else 0
Range for the storage array on dimension 1 (rows)
Range for the storage array on dimension 1 (rows)
Range for the storage array on dimension 2 (columns)
Range for the storage array on dimension 2 (columns)
Determine the rank of this m by n matrix by taking the upper triangular matrix from the LU Decomposition and counting the number of non-zero diagonal elements.
Determine the rank of this m by n matrix by taking the upper triangular matrix from the LU Decomposition and counting the number of non-zero diagonal elements.
Use Guass-Jordan reduction on this sparse matrix to make the left part embed an identity matrix.
Use Guass-Jordan reduction on this sparse matrix to make the left part embed an identity matrix. A constraint on this m by n matrix is that n >= m.
Use Guass-Jordan reduction in-place on this sparse matrix to make the left part embed an identity matrix.
Use Guass-Jordan reduction in-place on this sparse matrix to make the left part embed an identity matrix. A constraint on this m by n matrix is that n >= m.
Check whether this matrix and the other matrix have the same cross dimensions.
Check whether this matrix and the other matrix have the same cross dimensions.
the other matrix
Check whether this matrix and the other Matrix have the same dimensions.
Check whether this matrix and the other Matrix have the same dimensions.
the other matrix
Select columns from this matrix according to the given index/basis.
Select columns from this matrix according to the given index/basis. Ex: Can be used to divide a matrix into a basis and a non-basis.
the column index positions (e.g., (0, 2, 5))
Select rows from this matrix according to the given index/basis.
Select rows from this matrix according to the given index/basis.
the row index positions (e.g., (0, 2, 5))
Set this matrix's ith row starting at column j to the vector u.
Set this matrix's ith row starting at column j to the vector u.
the row index
the vector value to assign
the starting column index
Set all the values in this matrix as copies of the values in 2D array u.
Set all the values in this matrix as copies of the values in 2D array u.
the 2D array of values to assign
Set all the elements in this matrix to the scalar x.
Set all the elements in this matrix to the scalar x.
the scalar value to assign
Set all the elements in this matrix to the scalar x.
Set all the elements in this matrix to the scalar x.
the scalar value to assign
Set column 'col' of the matrix to a vector.
Set column 'col' of the matrix to a vector.
the column to set
the vector to assign to the column
Set the main diagonal of this matrix to the scalar x.
Set the main diagonal of this matrix to the scalar x. Assumes dim2 >= dim1.
the scalar to set the diagonal to
Set the kth diagonal of this matrix to the vector u.
Set the kth diagonal of this matrix to the vector u. Assumes dim2 >= dim1.
the vector to set the diagonal to
how far above the main diagonal, e.g., (-1, 0, 1) for (sub, main, super)
Set all the lower triangular elements in this matrix to the scalar x.
Set all the lower triangular elements in this matrix to the scalar x.
the scalar value to assign
Show all elements in this sparse matrix.
Slice this sparse matrix row-wise r_from to r_end and column-wise c_from to c_end.
Slice this sparse matrix row-wise r_from to r_end and column-wise c_from to c_end.
the start of the row slice
the end of the row slice
the start of the column slice
the end of the column slice
Slice this sparse matrix row-wise from to end.
Slice this sparse matrix row-wise from to end.
the start row of the slice
the end row of the slice
Slice this sparse matrix excluding the given row and column.
Slice this sparse matrix excluding the given row and column.
the row to exclude
the column to exclude
Solve for x in the equation a*x = b where a is this sparse matrix (see lud above).
Solve for x in the equation a*x = b where a is this sparse matrix (see lud above).
the constant vector.
Solve for x in the equation l*u*x = b (see lud above).
Solve for x in the equation l*u*x = b (see lud above).
the lower and upper triangular matrices
the constant vector
Solve for x in the equation l*u*x = b (see lud above).
Solve for x in the equation l*u*x = b (see lud above).
the lower triangular matrix
the upper triangular matrix
the constant vector
Multiply this sparse matrix by sparse matrix b using the Strassen matrix multiplication algorithm.
Multiply this sparse matrix by sparse matrix b using the Strassen matrix multiplication algorithm. Both matrices (this and b) must be square. Although the algorithm is faster than the traditional cubic algorithm, its requires more memory and is often less stable (due to round-off errors). FIX: could be make more efficient using a virtual slice (vslice) method.
the matrix to multiply by (it has to be a square matrix)
http://en.wikipedia.org/wiki/Strassen_algorithm
Compute the sum of this sparse matrix, i.
Compute the sum of this sparse matrix, i.e., the sum of its elements.
Compute the abs sum of this matrix, i.
Compute the abs sum of this matrix, i.e., the sum of the absolute value of its elements. This is useful for comparing matrices (a - b).sumAbs
Compute the sum of the lower triangular region of this sparse matrix.
Compute the sum of the lower triangular region of this sparse matrix.
Transpose this sparse matrix (rows => columns).
Transpose this sparse matrix (rows => columns).
Show the non-zero elements in this sparse matrix.
Show the non-zero elements in this sparse matrix.
Compute the trace of this sparse matrix, i.
Compute the trace of this sparse matrix, i.e., the sum of the elements on the main diagonal. Should also equal the sum of the eigenvalues.
Eigen.scala
Set a slice this matrix row-wise at index i and column-wise on range jr.
Set a slice this matrix row-wise at index i and column-wise on range jr. Ex: a(2, 3..5) = u
the row index
the column range
the vector to assign
Set a slice this matrix row-wise on range ir and column-wise at index j.
Set a slice this matrix row-wise on range ir and column-wise at index j. Ex: a(2..4, 3) = u
the row range
the column index
the vector to assign
Set a slice this matrix row-wise on range ir and column-wise on range jr.
Set a slice this matrix row-wise on range ir and column-wise on range jr. Ex: a(2..4, 3..5) = b
the row range
the column range
the matrix to assign
Set this sparse matrix's row at the i-th index position to the sorted-linked-map u.
Set this sparse matrix's row at the i-th index position to the sorted-linked-map u.
the row index
the sorted-linked-map of non-zreo values to assign
Set this sparse matrix's row at the i-th index position to the vector u.
Set this sparse matrix's row at the i-th index position to the vector u.
the row index
the vector value to assign
Set this sparse matrix's element at the i,j-th index position to the scalar x.
Set this sparse matrix's element at the i,j-th index position to the scalar x. Only store x if it is non-zero.
the row index
the column index
the scalar value to assign
Raise this sparse matrix to the pth power (for some integer p >= 2).
Raise this sparse matrix to the pth power (for some integer p >= 2). Caveat: should be replace by a divide and conquer algorithm.
the power to raise this matrix to
The SparseMatrixC class stores and operates on Matrices of Complex numbers. Rather than storing the matrix as a 2 dimensional array, it is stored as an array of sorted-linked-maps, which record all the non-zero values for each particular row, along with their j-index as (j, v) pairs. Note: _npp versions of methods are not appropriate for sparse matrices (i.e., always use partial pivoting).