﻿ Matrix.PseudoInverse Method (Single[][])

Computes the pseudo-inverse of a matrix.

Namespace:  Accord.Math
Assembly:  Accord.Math (in Accord.Math.dll) Version: 3.8.0
Syntax
```public static float[][] PseudoInverse(
this float[][] matrix
)```

Parameters

matrix
Type: SystemSingle

Type: Single

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Examples
```// Declare a non-invertible matrix as
double[,] matrix =
{
{ 6.0, 1.0, 2.0 },
{ 0.0, 8.0, 1.0 },
};

// Let's check that this matrix really cannot be
// inverted using standard matrix inversion:
bool isSingular = matrix.IsSingular(); // should be true

// Compute the pseudo-inverse using
double[,] pinv = matrix.PseudoInverse();

// We can write the result with
string strInv = pinv.ToCSharp();

// The result should be:
// new double[,]
// {
//     { 0.193548387096774, 0.0161290322580645, -0.0806451612903226 },
//     { 0.010752688172043, 0.139784946236559, -0.032258064516129 },
//     { -0.0860215053763441, -0.118279569892473, 0.258064516129032 }
// };

// We can confirm this is indeed the pseudo-inverse
// by checking whether "matrix * pinv(matrix) * matrix"
// equals the original matrix:
double[,] r = matrix.Dot(pinv.Dot(matrix));

// Again we write the result:
string strA = r.ToCSharp();

// The result should be:
// new double[,]
// {
//  { 6.0, 1.0, 2.0 },
//  { 0.0, 8.0, 1.0 },
// };```