naginterfaces.library.matop.real_gen_pseudinv(t, a)[source]

real_gen_pseudinv calculates the rank and pseudo-inverse of an real matrix, , using a factorization with column interchanges.

For full information please refer to the NAG Library document for f01bl


The tolerance used to decide when elements can be regarded as zero (see Further Comments).

afloat, array-like, shape

The rectangular matrix .

afloat, ndarray, shape

The transpose of the pseudo-inverse of .

aijmaxfloat, ndarray, shape

contains the element of largest modulus in the reduced matrix at the th stage. If , then only the first elements of have values assigned to them; the remaining elements are unused. The ratio usually gives an indication of the condition number of the original matrix (see Further Comments).


, the rank of as determined using the tolerance .

incint, ndarray, shape

The record of the column interchanges in the Householder factorization.

(errno )

Inverse not found. Incorrect .

(errno )

Invalid tolerance, too large: .

(errno )

Invalid tolerance, : .

(errno )

On entry, and .

Constraint: .


No equivalent traditional C interface for this routine exists in the NAG Library.

Householder’s factorization with column interchanges is used in the decomposition , where is with its columns permuted, is the first columns of an orthogonal matrix and is an upper-trapezoidal matrix of rank . The pseudo-inverse of is given by where

If the matrix is found to be of maximum rank, , is a nonsingular upper-triangular matrix and the pseudo-inverse of simplifies to . The transpose of the pseudo-inverse of is overwritten on .


Peters, G and Wilkinson, J H, 1970, The least squares problem and pseudo-inverses, Comput. J. (13), 309–316

Wilkinson, J H and Reinsch, C, 1971, Handbook for Automatic Computation II, Linear Algebra, Springer–Verlag