twodlearn.linalg module

class twodlearn.linalg.Cholesky(input, name=None)[source]

Bases: twodlearn.core.common.TdlModel

Tdl autoinitialization with arguments:

input[source]

(InputParameter)

linop[source]

(LazzyProperty)

value[source]

(Submodel)

input[source]
linop[source]
log_abs_determinant()[source]
matmul(x, adjoint=False, adjoint_arg=False, name='matmul')[source]
matvec(x, adjoint=False, name='matvec')[source]
shape_tensor()[source]

Shape determined at runtime

solve(rhs, adjoint=False, adjoint_arg=False, name='solve')[source]
solvevec(rhs, adjoint=False, name='solve')[source]
value[source]
class twodlearn.linalg.DynamicScaledIdentity(**kargs)[source]

Bases: twodlearn.core.common.TdlModel

scaled identity [batched] matrix whose size depends on the shape of the input

Tdl autoinitialization with arguments:

tolerance[source]

(InputArgument)

multipliers[source]

(InputParameter) tensor whose elements represent the multiplier factors for the identity matrices.

property batch_shape[source]
multipliers[source]

tensor whose elements represent the multiplier factors for the identity matrices.

tolerance[source]
twodlearn.linalg.M_times_Mt(M)[source]

Compute M @ M^t

Parameters

M – (batched) matrix M

Returns

solution of M @ M^t

Return type

tf.Tensor

twodlearn.linalg.Mt_times_M(M)[source]

Compute M^t @ M

Parameters

M – (batched) matrix M

Returns

solution of M^t @ M

Return type

tf.Tensor

class twodlearn.linalg.PDMatrix(**kargs)[source]

Bases: twodlearn.core.common.TdlModel

Positive definite matrix

Tdl autoinitialization with arguments:

linop[source]

(LazzyProperty)

shape[source]

(InputArgument) shape of the distribution. The shape assumes the last two dimentions corresponds to the shape of a square matrix

cholesky[source]

(LazzyProperty)

domain_dimension[source]

(InputArgument)

raw[source]

(SimpleParameter)

tolerance[source]

(InputArgument)

value[source]

(OutputValue)

batch_shape[source]

(InputArgument)

batch_shape[source]
cholesky[source]
domain_dimension[source]
linop[source]
raw[source]
shape[source]

shape of the distribution. The shape assumes the last two dimentions corresponds to the shape of a square matrix

tolerance[source]
value[source]
class twodlearn.linalg.PDMatrixDiag(**kargs)[source]

Bases: twodlearn.linalg.PDMatrix

Tdl autoinitialization with arguments:

linop[source]

(LazzyProperty)

shape[source]

(InputArgument) shape of the distribution. The shape assumes the last two dimentions corresponds to the shape of a square matrix

cholesky[source]

(LazzyProperty)

domain_dimension[source]

(InputArgument)

raw[source]

(SimpleParameter) square root of the diagonal part for the matrices

tolerance[source]

(InputArgument)

value[source]

(OutputValue)

batch_shape[source]

(InputArgument)

linop[source]
raw[source]

square root of the diagonal part for the matrices

class twodlearn.linalg.PDScaledIdentity(**kargs)[source]

Bases: twodlearn.linalg.PDMatrixDiag

Tdl autoinitialization with arguments:

raw[source]

(InputParameter) multiplier for the identities

shape[source]

(InputArgument) shape of the distribution. The shape assumes the last two dimentions corresponds to the shape of a square matrix

linop[source]

(SubmodelInit) Autoinit with arguments [‘domain_dimension’]

cholesky[source]

(LazzyProperty)

domain_dimension[source]

(InputArgument)

tolerance[source]

(InputArgument)

value[source]

(OutputValue)

batch_shape[source]

(InputArgument)

domain_dimension[source]
linop[source]

Autoinit with arguments [‘domain_dimension’]

raw[source]

multiplier for the identities

twodlearn.linalg.diagonal_M_times_Mt(M)[source]

Compute M @ M^t for diagonal linop M.

Parameters

M – (batched) diagonal linear operator

Returns

solution of M @ M^t

Return type

tf.Tensor

twodlearn.linalg.is_diagonal(x)[source]
twodlearn.linalg.is_diagonal_linop(M)[source]
twodlearn.linalg.is_scaled_identity(x)[source]
twodlearn.linalg.solvemat(M_cholesky, A)[source]

Compute inv(M) @ A

Parameters
  • M_cholesky – cholesky decomposition of matrix M

  • A (tf.Tensor) – (batched) Matrix.

Returns

solution of inv(M) @ A

Return type

tf.Tensor

twodlearn.linalg.solvevec(M_cholesky, x)[source]

compute inv(M) @ x

Parameters
  • M_cholesky – cholesky decomposition of matrix M.

  • x (tf.Tensor) – (batched) vector

Returns

solution of inv(M) @ x

Return type

tf.Tensor