9. Linear algebraΒΆ

Currently, Cytnx supports the following linear algebra functions. See the API documentation for more details.

func

Inplace

CPU

GPU

Called by Tn

Tn

CyTn (xlinalg)

Add

x

Y

Y

Y

Y

Y

Sub

x

Y

Y

Y

Y

Y

Mul

x

Y

Y

Y

Y

Y

Div

x

Y

Y

Y

Y

Y

Cpr

x

Y

Y

Y

Y

x

Mod

x

Y

Y

Y

Y

Y

+,+=[tn]

x

Y

Y

Y

Y

Y

-,-=[tn]

x

Y

Y

Y

Y

Y

*,*=[tn]

x

Y

Y

Y

Y

Y

/,/=[tn]

x

Y

Y

Y

Y

Y

==[tn]

x

Y

Y

Y

Y

x

Svd

x

Y

Y

Y

Y

Y

(*)Svd_truncate

x

Y

Y

N

Y

Y

InvM

InvM_

Y

Y

Y

Y

N

Inv

Inv_

Y

Y

Y

Y

N

Conj

Conj_

Y

Y

Y

Y

Y

Exp

Exp_

Y

Y

Y

Y

N

Expf

Expf_

Y

Y

Y

Y

N

Eigh

x

Y

Y

Y

Y

N

ExpH

x

Y

Y

N

Y

Y

ExpM

x

Y

N

N

Y

Y

Matmul

x

Y

Y

N

Y

N

Diag

x

Y

Y

N

Y

N

(*)Tensordot

x

Y

Y

N

Y

N

Outer

x

Y

Y

N

Y

N

Vectordot

x

Y

Y

N

Y

N

Tridiag

x

Y

N

N

Y

N

Kron

x

Y

N

N

Y

N

Norm

x

Y

Y

Y

Y

N

(*)Dot

x

Y

Y

N

Y

N

Eig

x

Y

N

N

Y

N

Pow

Pow_

Y

Y

Y

Y

Y

Abs

Abs_

Y

N

Y

Y

N

Qr

x

Y

N

N

Y

Y

Det

x

Y

N

N

Y

N

Min

x

Y

N

Y

Y

N

Max

x

Y

N

Y

Y

N

(*Trace)

x

Y

N

Y

Y

Y

Inplace: If the function applies inplacely to the input tensor, and the corresponding function to use if it does.

CPU/GPU: If it is supported for input tensors on that device.

Called by Tn: If the function can be called as a member function of the tensor object, e.g. Tensor1.add(Tensor2)

Tn: If the function supports the Cytnx.Tensor as input.

CyTn: If the function supports the Cytnx.UniTensor as input.

(*): This is a high level linalg.

Many linear algebra functions can be used with Tensors and UniTensors. Most of the linear algebra algorithms take a matrix as an input. We use Rowrank to specify how to cast the input UniTensor into a matrix. See Rowrank as well for an example of how to calculate a singular value decomposition of a UniTensor.