2

is it possible to get Moore-Penrose generalized inverse of a matrix A by ilnumerics? and what the pinv means in ilnumerics? pinv mean inverse a matrix ?

07012220
  • 85
  • 1
  • 7

1 Answers1

1

Yes, it is possible with ILNumerics!

Here is a commented example:

// Matrix A
ILArray<double> A = new double[,] { { 1, 2 }, { 3, 4 } };

// The Moore-Penrose pseudoinverse
ILArray<double> Ainv = pinv(A);

// Check for: A * A^-1 = I
ILArray<double> AtimesAinv = multiply(A, Ainv);

// difference of I = eye(2,2) - the inverse
ILArray<double> diff = eye(2, 2) - AtimesAinv;

// max norm of the difference
double normalized = (double)norm(diff)[0];

// Arbitrary epsilon to make the comparison
double epsilon = 1e-10;
Assert.AreEqual(true, normalized <= epsilon);

Please check the documentation for more information at the following link: ILNumerics API Doc - pinv.

kurtyka
  • 81
  • 8