RealSparseMatrix
Factories
identity(const List<integer> shape, as_real | as_sparsematrix type) -> RealSparseMatrix
Creates an identity matrix (or array; possibly rectangular) with the specified shape and type.
Parameters
- shape: The shape of the container to create.
- type: The type of the container to create.
matrix(const RealMatrix array, as_sparsematrix type) -> RealSparseMatrix
Converts a container to a sparse matrix with the same elements.
Arrays support elementwise operations, matrices support matrix algebra (e.g., operator *).
Parameters
- array: The input RealMatrix.
- type: The type of the container to create (here, a sparse matrix).
matrix(const Operator operator, as_real | as_sparsematrix type_tag) -> RealSparseMatrix
Converts the operator to its sparse matrix representation.
Parameters
- operator: The operator to convert.
- type_tag: A global constant tagging the object type.
matrix(const RealArray array, as_sparsematrix type) -> RealSparseMatrix
Converts a container to a sparse matrix with the same elements.
Arrays support elementwise operations, matrices support matrix algebra (e.g., operator *).
Parameters
- array: The input RealArray.
- type: The type of the container to create (here, a sparse matrix).
matrix(const RealSparseMatrix array, as_sparsematrix type) -> RealSparseMatrix
Converts a container to a sparse matrix with the same elements.
Arrays support elementwise operations, matrices support matrix algebra (e.g., operator *).
Parameters
- array: The input RealSparseMatrix.
- type: The type of the container to create (here, a sparse matrix).
matrix(const List list, as_real | as_sparsematrix type) -> RealSparseMatrix
Converts a list or list of list to a sparse matrix.
Parameters
- list: The list containing the values.
- type: The type of the container to create.
uninitialized(const List<integer> shape, as_real | as_sparsematrix type) -> RealSparseMatrix
Creates a container with the specified shape and type.
Parameters
- shape: The shape of the container to create.
- type: The type of the container to create.
zeros(const List<integer> shape, as_real | as_sparsematrix type) -> RealSparseMatrix
Creates a container with the specified shape and type, filled with zeros.
Parameters
- shape: The shape of the container to create.
- type: The type of the container to create.
Constructors
RealSparseMatrix() -> RealSparseMatrix
Creates an empty RealSparseMatrix.
RealSparseMatrix(integer m) -> RealSparseMatrix
Creates an m x 1 RealSparseMatrix. The array comes out uninitialized.
Parameters
- m: The number of rows.
RealSparseMatrix(integer m, integer n) -> RealSparseMatrix
Creates an m x n RealSparseMatrix. The array comes out uninitialized.
Parameters
- m: The number of rows.
- n: The number of columns.
Symbols
| Name | Description |
|---|---|
* | Matrix multiplication operator. |
*= | Matrix-scalar multiplication-assignment compound operator. |
+ | Matrix addition operator. |
+= | Matrix addition-assignment compound operator. |
- | Matrix subtraction operator. |
-= | Matrix subtraction-assignment compound operator. |
/ | Matrix-scalar division operator. |
/= | Matrix-scalar division-assignment compound operator. |
= | Matrix assignment operator. |
[] | Gets or sets the element at row inds[0] and column inds[1] of the RealSparseMatrix. |
Members
| Name | Description |
|---|---|
| block | Get a block (sub-RealSparseMatrix) of the RealSparseMatrix. |
| bottom_left_corner | Get the bottom-left corner of the RealSparseMatrix. |
| bottom_right_corner | Get the bottom-right corner of the RealSparseMatrix. |
| bottom_rows | Get the bottom rows of the RealSparseMatrix. |
| col | Get a column of the RealSparseMatrix. |
| cols | Returns the number of columns of a RealSparseMatrix. |
| compress | Turns the RealSparseMatrix into the compressed format. |
| container_type | Returns the underlying container type of the RealSparseMatrix. |
| diagonal | Returns the diagonal elements of the RealSparseMatrix as a column-vector. |
| insert | Inserts values into a sparse matrix. |
| is_approx | Returns true if the RealSparseMatrix lhs is approximately equal to the RealSparseMatrix rhs, within the specified tolerance. |
| is_array | Whether the container is an array (which supports elementwise operations). |
| is_bool | Whether the underlying scalar type of the RealSparseMatrix is bool. |
| is_column_vector | Returns true if the container is a column-vector. |
| is_complex | Whether the underlying scalar type of the RealSparseMatrix is complex. |
| is_compressed | Checks if the RealSparseMatrix is in compressed format. |
| is_dense | Whether the container is dense. |
| is_integer | Whether the underlying scalar type of the RealSparseMatrix is integer. |
| is_matrix | Whether the container is a matrix (which supports matrix algebra). |
| is_real | Whether the underlying scalar type of the RealSparseMatrix is real. |
| is_row_vector | Returns true if the container is a row-vector. |
| is_scalar | Returns true if the container is a scalar (or a container containing a single element). |
| is_sparse | Whether the container is sparse. |
| is_vector | Returns true if the container is a vector. |
| left_cols | Get the left columns of the RealSparseMatrix. |
| middle_cols | Get the middle columns of the RealSparseMatrix. |
| middle_rows | Get the middle rows of the RealSparseMatrix. |
| nonzeros | Returns the number of non-zero elements in the RealSparseMatrix. |
| prune | Prunes the RealSparseMatrix lhs. |
| real | Returns the real component of a RealSparseMatrix. |
| right_cols | Get the right columns of the RealSparseMatrix. |
| row | Get a row of the RealSparseMatrix. |
| rows | Returns the number of rows of a RealSparseMatrix. |
| scalar_type | Returns the underlying scalar type of the RealSparseMatrix. |
| set_identity | Sets the RealSparseMatrix lhs to the identity matrix. |
| set_zero | Sets all elements of the RealSparseMatrix lhs to 0. |
| shape | Returns the shape of a RealSparseMatrix. |
| size | Returns the number of elements of a RealSparseMatrix. |
| top_left_corner | Get the top-left corner of the RealSparseMatrix. |
| top_right_corner | Get the top-right corner of the RealSparseMatrix. |
| top_rows | Get the top rows of the RealSparseMatrix. |