g_inverse.cpp File Reference

Determines the generalized inverse matrix of an input matrix by using singular value decomposition. More...

#include <cmath>
#include <SharkDefs.h>
#include <LinAlg/LinAlg.h>

Go to the source code of this file.

Functions

unsigned g_inverse (const Array2D< double > &amatA, Array2D< double > &bmatA, unsigned maxIterations, double tolerance, bool ignoreThreshold)
 Calculates the generalized inverse matrix of input matrix "amatA".
void invertSymmPositiveDefinite (Array2D< double > &I, const Array2D< double > &ArrSymm)
 Inverts a symmetric positive definite matrix.
void g_inverseCholesky (const Array2D< double > &A, Array2D< double > &outA, double thresholdFactor)
 Returns the generalized inverse matrix of input matrix "A" according to the paper: Fast computation of Moore-Penrose inverse matrices. Neural Information Processing-Letters and Reviews 8(2), pp. 25-29, 2005.
void g_inverseMoorePenrose (const Array2D< double > &A, Array2D< double > &outA)
 Returns the generalized inverse matrix of input matrix "A" using Cholesky decomposition assuming that $ A^T A $ has full rank.


Detailed Description

Determines the generalized inverse matrix of an input matrix by using singular value decomposition.

Author:
M. Kreutz
Date:
1998
Copyright (c) 1998-2000:
Institut für Neuroinformatik
Ruhr-Universität Bochum
D-44780 Bochum, Germany
Phone: +49-234-32-25558
Fax: +49-234-32-14209
eMail: Shark-admin@neuroinformatik.ruhr-uni-bochum.de
www: http://www.neuroinformatik.ruhr-uni-bochum.de

This file is part of Shark. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

Definition in file g_inverse.cpp.


Function Documentation

unsigned g_inverse ( const Array2D< double > &  amatA,
Array2D< double > &  bmatA,
unsigned  maxIterations,
double  tolerance,
bool  ignoreThreshold 
)

Calculates the generalized inverse matrix of input matrix "amatA".

Given an input matrix $ X $ this function uses singular value decomposition to determine the generalized inverse matrix $ X' $, so that

$ XX'X = X $

If $ X $ is singular, i.e. $ det(X) = 0 $ or $ X $ is non-square then $ X' $ is not unique.

Parameters:
amatA $ m \times n $ input matrix.
bmatA $ n \times m $ generalized inverse matrix.
maxIterations Number of iterations after which the SVD calculation algorithm gives up, if the solution has still not converged. Default ist 200 Iterations.
tolerance singular values less than this value will be considered zero. Default is 1e-10.
ignoreThreshold If set to false, the method throws an exception if the threshold maxIterations is exceeded. Otherwise it uses the approximate intermediate results in the further calculations. The default is true.
Returns:
none.
Please follow the link to view the source code of the example. The example can be executed in the example directory of package LinAlg.

Author:
M. Kreutz
Date:
1998
Changes
none
Status
stable
See also:
svd.cpp
Examples:
g_inverse_matrix.cpp.

Definition at line 91 of file g_inverse.cpp.

References svd(), svdrank(), and svdsort().

Referenced by Matrix::inverse(), and invert().

void g_inverseCholesky ( const Array2D< double > &  A,
Array2D< double > &  outA,
double  thresholdFactor 
)

Returns the generalized inverse matrix of input matrix "A" according to the paper: Fast computation of Moore-Penrose inverse matrices. Neural Information Processing-Letters and Reviews 8(2), pp. 25-29, 2005.

Returns the generalized inverse matrix of input matrix using Cholesky decomposition.

Parameters:
A The input matrix.
Returns:
The generalized inverse matrix.
Exceptions:
check_exception the type of the exception will be "size mismatch" and indicates that A is not a square matrix
Author:
T. Suttorp
Date:
2008
Changes
none
Status
stable

Definition at line 254 of file g_inverse.cpp.

References invertSymm(), invertSymmPositiveDefinite(), matMat(), and transpose().

Referenced by Matrix::inverseCholesky().

void g_inverseMoorePenrose ( const Array2D< double > &  A,
Array2D< double > &  outA 
)

Returns the generalized inverse matrix of input matrix "A" using Cholesky decomposition assuming that $ A^T A $ has full rank.

Returns the generalized inverse matrix of input matrix $ A $ using Cholesky decomposition assuming that $ A^T A $ has full rank.

Parameters:
A The input matrix.
Returns:
The generalized inverse matrix.
Exceptions:
check_exception the type of the exception will be "size mismatch" and indicates that A is not a square matrix
Author:
T. Suttorp
Date:
2008
Changes
none
Status
stable

Definition at line 364 of file g_inverse.cpp.

References invertSymmPositiveDefinite(), matMat(), and transpose().

Referenced by Matrix::inverseMoorePenrose().

void invertSymmPositiveDefinite ( Array2D< double > &  I,
const Array2D< double > &  ArrSymm 
)

Inverts a symmetric positive definite matrix.

Definition at line 198 of file g_inverse.cpp.

References CholeskyDecomposition(), and matMat().

Referenced by g_inverseCholesky(), g_inverseMoorePenrose(), and Matrix::inverseSymmPositiveDefinite().