Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: xplore
See also: inv svd

Quantlet: ginv
Description: calculates a pseudo-inverse of x, such that x*ginv(x)*x = x.

Usage: xginv = ginv(x)
Input:
x n x p matrix to be inverted
Output:
xginv p x n matrix, a pseudo-inverse of x

Example:
library("xplore")
x1 = #(1, 2, 3)
x2 = #(1.0001, 2, 3)
x = x1~x2			; define 2 x 3 matrix
ginv(x)
x*ginv(x)*x - x   	; check the result

Result:
Contents of xginv
[1,]   -10000   1538.6   2307.9
[2,]    10000  -1538.5  -2307.7

Contents of _tmp
[1,] -4.5408e-13 -4.5497e-13
[2,] -9.0949e-13 -9.1038e-13
[3,] -3.638e-12 -3.6393e-12



Author: S. Sperlich, P. Ruckdeschel, W. Haerdle, 20021020
(C) MD*TECH Method and Data Technologies, 05.02.2006