taichi.linalg.sparse_matrix

Module Contents

Classes

SparseMatrix

Taichi's Sparse Matrix class

SparseMatrixBuilder

A python wrap around sparse matrix builder.

Attributes

sparse_matrix_builder

class taichi.linalg.sparse_matrix.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.

transpose(self)

Sparse Matrix transpose.

Returns

The transposed sparse mastrix.

shape(self)

The shape of the sparse matrix.

class taichi.linalg.sparse_matrix.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.

get_addr(self)

Get the address of the sparse matrix

print_triplets(self)

Print the triplets stored in the builder

build(self, dtype=f32, _format='CSR')

Create a sparse matrix using the triplets

taichi.linalg.sparse_matrix.sparse_matrix_builder