Skip to content

Tessero\Sparse\CsrMatrix

← All classes

AI assistant

Build this with Claude Code, Cursor or Copilot

Copy a Tessero-tuned prompt for Tessero\Sparse\CsrMatrix, grounded in 16 real API signatures , into your IDE's AI. No chatbot, just exact context.

fromDense static
fromDense(mixed $dense): self
fromTriplets static
fromTriplets(Tessero\NDArray|array $row, Tessero\NDArray|array $col, Tessero\NDArray|array $values, array $shape): self

From coordinate triplets (scipy.sparse.coo_matrix(...).tocsr()); duplicates are summed.

fromArrays static
fromArrays(mixed $indptr, mixed $indices, mixed $data, array $shape): self

Wrap existing CSR arrays (validated).

identity static
identity(int $n): self
shape
shape(): array
nnz
nnz(): int
indptr
indptr(): Tessero\NDArray
indices
indices(): Tessero\NDArray
data
data(): Tessero\NDArray
toDense
toDense(): Tessero\NDArray
dot
dot(mixed $x): Tessero\NDArray

A @ x for a dense vector (n,) or matrix (n, k).

transpose
transpose(): self
scale
scale(float $alpha): self
diagonal
diagonal(): Tessero\NDArray

Main diagonal as a dense vector.

cg
cg(mixed $b, mixed $x0 = null, float $rtol = 1.0E-5, float $atol = 0.0, ?int $maxiter = null, bool $throw = false): array

Conjugate gradients (scipy.sparse.linalg.cg) with Jacobi preconditioning; A must be SPD.

bicgstab
bicgstab(mixed $b, mixed $x0 = null, float $rtol = 1.0E-5, float $atol = 0.0, ?int $maxiter = null, bool $throw = false): array

BiCGSTAB for general square systems (scipy.sparse.linalg.bicgstab).