jittor.linalg

这里是Jittor的线性代数函数的API文档,您可以通过from jittor import linalg来获取该模块。

基本函数简介

基本线性代数运算API

  • linalg.inv(a)

    对a进行求逆运算

  • linalg.pinv(a)

    对a进行广义求逆运算。该运算不要求原矩阵a可逆。

  • linalg.slogdet(a)

    对a求取slogdet。会返回值以及符号。

  • linalg.det(a)

    对a求行列式。

  • linalg.solve(a,b)

    求解线性方程Ax=b的解。

分解API

  • linalg.cholesky(a)

    对a进行cholesky分解。

  • linalg.qr(a)

    对a进行qr分解。

  • linalg.svd

    对a进行奇异值分解。

特征值API

  • linalg.eig(a)

    求取a的特征值以及特征向量。

  • linalg.eigh(a)

    针对埃尔米特矩阵或者对称矩阵求特征值以及特征向量。

目前的linalg库支持

jittor.linalg.cholesky(x)[源代码]

do Cholesky decomposition of x in the form of below formula: x = LL^T x must be a Hermite and positive-definite matrix. L is a lower-triangular matrix. :param x (…,M,M): :return: L (…,M,M).

jittor.linalg.det(x)[源代码]

calculate the determinant of x. :param x (…,M,M): :return:|x| (…,1)

jittor.linalg.eigh(x)[源代码]

calculate the eigenvalues and eigenvectors of x. :param x (…,M,M): :return:w, v. w (…,M) : the eigenvalues. v (…,M,M) : normalized eigenvectors.

jittor.linalg.einsum(string, *args)[源代码]

do the einsum operation. Using the implementation in https://github.com/HIPS/autograd :param string, args: :return: return values depend on the input string kinds.

jittor.linalg.inv(x)[源代码]

calculate the inverse of x. :param x (…,M,M): :return:x^-1 (…,M,M).

jittor.linalg.pinv(x)[源代码]

calculate the pseudo-inverse of a x. :param x (…,M,N) :return: x’s pinv (…N,M)

jittor.linalg.qr(x)[源代码]

do the qr factorization of x in the below formula: x = QR where Q is orthogonal matrix and R is upper-triangle matrix. :param x (…,M,M): :return:q,r as the result of qr factorization.They are both in the shape of (…,M,M).

jittor.linalg.slogdet(x)[源代码]

calculate the sign and log of the determinant of x. :param x (…,M,M): :return sign, x’s logdet. sign array decides the sign of determinant and their values can be -1,0,1.Only Real number now.0 means det is 0 and logdet is -inf. logdet in shape (…,1).

jittor.linalg.solve(a, b)[源代码]

Solve a linear matrix equation Ax = B.This is done by calculating x = A^-1B.So A must not be singular. :param a:(…,M,M) :param b:(…,M) :return:solution of Ax = b formula.x in the shape of (…M)

jittor.linalg.svd(x)[源代码]

calculate the Singular Value Decomposition of x.It follows the below fomula: x = usv* only support full matrices == False ver now, which means: x’s shape (…,M,K) u’s shape (…,M,K) s’s shape (…,K) v’s shape (…,K,N) where K is min(M,N). :param x: :return:u,s,v.