chkginv {lazy.mat}R Documentation

Check if the the second matrix is a generalized inverse of the first one, or vice versa.

Description

Check if the the second matrix is a generalized inverse of the first one, or vice versa.

Usage

chkginv(A, Ainv, eps = NULL, print = 0)

Arguments

A

matrix

Ainv

Possible generalized inverse of A

eps

criterion for zero

print

= 1 to print the result

Details

This function checks if the following four conditons are met.
g1) A - A %*% Ainv %*% A
g2) Ainv - Ainv %*% A %*% Ainv
g3) A %*% Ainv - t(A %*% Ainv)
g4) Ainv %*% A - t(Ainv %*% A)
In addition, when the input matrix is square, the following two conditons are added.
g01) I - A %*% Ainv
g02) I - Ainv %*% A

For each condition above, the maximum of the absolute values will be compared to eps to see if it can be regaeded as zero. The default value of eps is max(abs(c(diag(Ainv),diag(A)))) * sqrt(.Machine$double.eps) .

Value

A list of:
check=list(g01,g02,g1,g2,g3,g4) and maxad=list(d01,d02,d1,d2,d3,d4)

Examples

chkginv( demomat(3,3), matSwp(demomat(3,3)) )

# called from Ginv or matSwp
A=demomat(9,4)/100; A=t(A)%*%A; Ainv=Ginv(A,chkginv=2)


[Package lazy.mat version 0.1.3 Index]