Linear Algebra module

This module contains useful algorithms such as matrix decompositions, computing matrix norms and solutions to linear equations.

Functions

sppy.linalg.norm(A, ord=None)

This function returns the Frobenius norm of the input A, which is defined as sqrt(sum A_ij^2).

Parameters:
  • A – A csarray object.
  • ord – The type of norm required, currently ignored.
Returns:

The Frobenius norm of A.

sppy.linalg.rsvd(A, k, p=10, q=2, omega=None)

Compute the randomised SVD using the algorithm on page 9 of Halko et al., Finding Structure with randomness: stochastic algorithms for constructing approximate matrix decompositions, 2009.

Finds the partial SVD of a sparse or dense matrix A, resolving the largest k singular vectors/values, using exponent q and k+p projections. Returns the left and right singular vectors, and the singular values. The resulting matrix can be approximated using A ~ U s V.T. To improve the approximation quality for a fixed k, increase p or q.

Parameters:
  • A – A sparse or dense matrix or GeneralLinearOperator
  • k – The number of singular values and random projections
  • p – The oversampling parameter
  • q – The exponent for the projections.
  • omega – An initial matrix to perform random projections onto with at least k columns
Return U:

The left singular vectors

Return s:

The singular values

Return V:

The right singular vectors

sppy.linalg.biCGSTAB(A, b, maxIter=1000, tol=1e-06)

Solve the linear system of equations given by A x = b where A is a csarray and b is a numpy array of the same dtype. Uses the Iterative stabilized bi-conjugate gradient method.

Parameters:
  • A – A csarray object of size n x n
  • b – A numpy array of length n of the same dtype as A.
  • maxIter – The maximum number of iteartions of the method
  • tol – The error tolerance
Return x:

A numpy array corresponding to the solution vector.

Return i:

The output code: 0 = success, 1 = numerical Issue, 2 = no convergence, 3 = invalid input

Table Of Contents

Previous topic

Compressed Sparse Array

Next topic

Input/Output

This Page