math.linalg

class tinychain.math.linalg.LinearAlgebra[source]

Bases: Library

NAME = 'linalg'
VERSION = Version(0.0.0)
det = <tinychain.reflect.stub.StateFunctionStub object>
householder = <tinychain.reflect.stub.StateFunctionStub object>
plu = <tinychain.reflect.stub.StateFunctionStub object>
qr = <tinychain.reflect.stub.StateFunctionStub object>
slogdet = <tinychain.reflect.stub.StateFunctionStub object>
svd = <tinychain.reflect.stub.StateFunctionStub object>
svd_matrix = <tinychain.reflect.stub.StateFunctionStub object>
svd_parallel = <tinychain.reflect.stub.StateFunctionStub object>
class tinychain.math.linalg.PLUFactorization(*args, **kwargs)[source]

Bases: Map

PLU factorization of a given [N, N] matrix.

cast(dtype)

Attempt to cast this State into the given dtype.

eq(other)

Return a Bool indicating whether all the keys and values in this map are equal to the given other.

hash()

Return the SHA256 hash of this State as an Id.

is_none()

Return Bool(true) if this State is Nil.

is_some()

Return Bool(true) if this State is not Nil.

This is defined as self.is_none().logical_not().

property l: Tensor

Lower-triangular matrix as an [N, N] Tensor

len()

Return the number of elements in this Map.

ne(other)

Return a Bool indicating whether the keys and values in this Map are not equal to the given other.

property num_permutations: UInt

The number of permutations calculated during the factorization

property p: Tensor

Permutation matrix as an [N, N] Tensor

property u: Tensor

Upper-triangular matrix as an [N, N] Tensor

tinychain.math.linalg.diagonal(tensor)[source]

Return the diagonal of the given tensor of matrices

tinychain.math.linalg.norm(x)[source]

Helper function to compute the norm of a matrix x

tinychain.math.linalg.with_diagonal(matrix, diag)[source]

Construct a view of the given matrix with the diagonal set to diag.