Linear Algebra

Matrix and vector products

cupy.cross

Returns the cross product of two vectors.

cupy.dot

Returns a dot product of two arrays.

cupy.vdot

Returns the dot product of two vectors.

cupy.inner

Returns the inner product of two arrays.

cupy.outer

Returns the outer product of two vectors.

cupy.matmul

Returns the matrix product of two arrays and is the implementation of the @ operator introduced in Python 3.5 following PEP465.

cupy.tensordot

Returns the tensor dot product of two arrays along specified axes.

cupy.einsum

Evaluates the Einstein summation convention on the operands.

cupy.linalg.matrix_power

Raise a square matrix to the (integer) power n.

cupy.kron

Returns the kronecker product of two arrays.

cupyx.scipy.linalg.kron

Kronecker product.

Decompositions

cupy.linalg.cholesky

Cholesky decomposition.

cupy.linalg.qr

QR decomposition.

cupy.linalg.svd

Singular Value Decomposition.

Matrix eigenvalues

cupy.linalg.eigh

Eigenvalues and eigenvectors of a symmetric matrix.

cupy.linalg.eigvalsh

Calculates eigenvalues of a symmetric matrix.

Norms etc.

cupy.linalg.det

Returns the determinant of an array.

cupy.linalg.norm

Returns one of matrix norms specified by ord parameter.

cupy.linalg.matrix_rank

Return matrix rank of array using SVD method

cupy.linalg.slogdet

Returns sign and logarithm of the determinant of an array.

cupy.trace

Returns the sum along the diagonals of an array.

Solving linear equations

cupy.linalg.solve

Solves a linear matrix equation.

cupy.linalg.tensorsolve

Solves tensor equations denoted by ax = b.

cupy.linalg.lstsq

Return the least-squares solution to a linear matrix equation.

cupy.linalg.inv

Computes the inverse of a matrix.

cupy.linalg.pinv

Compute the Moore-Penrose pseudoinverse of a matrix.

cupy.linalg.tensorinv

Computes the inverse of a tensor.

cupyx.scipy.linalg.lu_factor

LU decomposition.

cupyx.scipy.linalg.lu_solve

Solve an equation system, a * x = b, given the LU factorization of a

cupyx.scipy.linalg.solve_triangular

Solve the equation a x = b for x, assuming a is a triangular matrix.

Special Matrices

cupy.tri

Creates an array with ones at and below the given diagonal.

cupy.tril

Returns a lower triangle of an array.

cupy.triu

Returns an upper triangle of an array.

cupyx.scipy.linalg.tri

Construct (N, M) matrix filled with ones at and below the k-th diagonal.

cupyx.scipy.linalg.tril

Make a copy of a matrix with elements above the k-th diagonal zeroed.

cupyx.scipy.linalg.triu

Make a copy of a matrix with elements below the k-th diagonal zeroed.

cupyx.scipy.linalg.toeplitz

Construct a Toeplitz matrix.

cupyx.scipy.linalg.circulant

Construct a circulant matrix.

cupyx.scipy.linalg.hankel

Construct a Hankel matrix.

cupyx.scipy.linalg.hadamard

Construct an Hadamard matrix.

cupyx.scipy.linalg.leslie

Create a Leslie matrix.

cupyx.scipy.linalg.block_diag

Create a block diagonal matrix from provided arrays.

cupyx.scipy.linalg.companion

Create a companion matrix.

cupyx.scipy.linalg.helmert

Create an Helmert matrix of order n.

cupyx.scipy.linalg.hilbert

Create a Hilbert matrix of order n.

cupyx.scipy.linalg.dft

Discrete Fourier transform matrix.

cupyx.scipy.linalg.fiedler

Returns a symmetric Fiedler matrix

cupyx.scipy.linalg.fiedler_companion

Returns a Fiedler companion matrix

cupyx.scipy.linalg.convolution_matrix

Construct a convolution matrix.