taichi.linalg
#
Taichi support module for sparse matrix operations.
- class taichi.linalg.SparseMatrix(n=None, m=None, sm=None, dtype=f32)#
Taichi’s Sparse Matrix class
A sparse matrix allows the programmer to solve a large linear system.
- Parameters:
n (int) – the first dimension of a sparse matrix.
m (int) – the second dimension of a sparse matrix.
sm (SparseMatrix) – another sparse matrix that will be built from.
- shape(self)#
The shape of the sparse matrix.
- transpose(self)#
Sparse Matrix transpose.
- Returns:
The transposed sparse mastrix.
- class taichi.linalg.SparseMatrixBuilder(num_rows=None, num_cols=None, max_num_triplets=0, dtype=f32)#
A python wrap around sparse matrix builder.
Use this builder to fill the sparse matrix.
- Parameters:
num_rows (int) – the first dimension of a sparse matrix.
num_cols (int) – the second dimension of a sparse matrix.
max_num_triplets (int) – the maximum number of triplets.
- build(self, dtype=f32, _format='CSR')#
Create a sparse matrix using the triplets
- print_triplets(self)#
Print the triplets stored in the builder
- class taichi.linalg.sparse_matrix_builder#