a problem in computation of pseudoinverses
TRANSCRIPT
![Page 1: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/1.jpg)
A problem in computation of pseudoinverses
Predrag S. Stanimirovi�cc *, Milan B. Tasi�cc
Department of Mathematics, Faculty of Science, Vi�sseo�radska 33, 18000 Nis, Yugoslavia
Abstract
In this paper we describe implementation of three methods for computing general-
ized inverses in the programming packages MATHEMATICA and DELPHI. Grevile�smethod, the limit representation and the determinantal representation of generalized
inverses are considered. A major problem arising in the implementation of these
methods is very rapid increment of arithmetic operations. We describe a few different
algorithms to avoid this common problem.
� 2002 Elsevier Science Inc. All rights reserved.
Keywords: Pseudoinverse; MATHEMATICA; DELPHI; Limit representation; Partitioning
method; Determinantal representation
1. Introduction
A common problem arising in the implementation of various methods for
numerical computation of generalized inverses is a rapid magnification of
floating point operations.
In a recursive implementation the partitioning method [5], a major problem
is repetitive computation of generalized inverses of some matrices. In the
algorithm for the implementation of the limit representation of generalizedinverses, proposed in [14], recomputations are involved in a few expressions
which deal with block matrices containing identical blocks. Finally, imple-
mentation of the general determinantal representation leads to multiplicative
*Corresponding author.
E-mail addresses: [email protected] (P.S. Stanimirovi�cc), [email protected] (M.B. Tasi�cc).
0096-3003/02/$ - see front matter � 2002 Elsevier Science Inc. All rights reserved.
PII: S0096 -3003 (02 )00061-9
Applied Mathematics and Computation 135 (2003) 443–469
www.elsevier.com/locate/amc
![Page 2: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/2.jpg)
recomputations of the same minors of two given matrices. Moreover, this
method requires also computation of a significant number of different minors.We describe corresponding algorithms to eliminate these difficulties. The
first approach uses a possibility of the package MATHEMATICA to define
functions which remember all values that they find. The second algorithm uses
the function Mod to simulate access to a few block matrices. The third ap-
proach is based on the construction of several databases by means of the
language DELPHI.
2. Implementation of the partitioning method
Grevile [5] proposed a recursive algorithm which relates the pseudoinverse
of a matrix R augmented by an appropriate vector r with the pseudoinverse Ry
of R.
Algorithm 1. Consider any m� n matrix A. Let Ai be the submatrix of Aconsisting of the first i columns of A. If the ith column of A is denoted by ai,then Ai is partitioned as Ai ¼ ½Ai�1jai�.
Step 1. Initial value:
Ay1 ¼ ay1 ¼
1a�1a1a�1; a1 6¼ 0;
a�1; a1 ¼ 0:
�Step 2. Recursive step: For each column ai, 26 i6 n of A compute
Ayi ¼
Ayi�1 � dib�ib�i
� �;
where
Step 2.1. di ¼ Ayi�1ai;
Step 2.2. ci ¼ ai � Ai�1di ¼ ðI � Ai�1Ayi�1Þai;
Step 2.3.
bi ¼1c�i cici; ci 6¼ 0;
11þd�i di
ðAyi�1Þ
�di; ci ¼ 0:
(
Step 3. The stopping criterion: Ay ¼ Ayn.
Grevile�s algorithm is estimated as relatively complicated and numerically
stable in [11]. A major problem arising in a recursive implementation of Al-
gorithm 1 arises from multiplicative recomputations of several matrices. In
view of Step 2 of Algorithm 1, for each i 2 f2; . . . ; ng, the Moore–Penroseinverse Ay
i must be computed n� iþ 1 times. Moreover, in view of Step 2.1 and
Step 2.3, it is also necessary to generate the inverse Ayi�1 in the computation of
the values di and bi. The total number of different values that will be produced
444 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 3: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/3.jpg)
is comparatively small, but these values must be recomputed many times. In
order to obviate this problem, we use possibility of the programming packageMATHEMATICA to define functions which remember values that they gen-
erate (about MATHEMATICA see, for example [15,16]).
Firstly we describe a few auxiliary procedures.
(A) Generate the jth column aj of A:
Col½a List;j � :¼ Transpose½fTranspose½a�½½j��g�
(B) The submatrix Aj ¼ ½a1; . . . aj� which contains first j6 n columns of the
matrix A ¼ An ¼ ½a1; . . . an� is generated as follows:
TakeFirstI½a List;j � :¼ Return½Transpose½Take½Transpose½a�;j���;
Step 2 of Algorithm 1 is implemented by the following memo functionswhich remember before computed values.
Implementation of Step 2.1
Implementation of Step 2.2
DD[a_List,i_]:¼DD[a,i]¼Module[{s¼ {}},
s¼Simplify[A[a,i-1].Col[a,i]];
If[Length[s]¼ ¼1, Return[s[[1]]], Return[s] ];
]
CC[a_List,i_]:¼CC[a,i]¼Module[{s¼ {},vr},
vr¼Variables[DD[a,i]];
If[vr¼!¼ {},
If[Length[Dimensions[DD[a,i]]]¼ ¼1,
s¼Col[a,i]-TakeFirstI[a,i-1]DD[a,i],
s¼Col[a,i]-TakeFirstI[a,i-1].DD[a,i]
],
If[Length[DD[a,i]]¼ ¼0,
s¼Col[a,i]-TakeFirstI[a,i-1]DD[a,i],
s¼Col[a,i]-TakeFirstI[a,i-1].DD[a,i]
]
];
Return[Simplify[s]]
]
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 445
![Page 4: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/4.jpg)
Implementation of Step 2.3
Implementation of Step 1, Step 2, and Step 3
B[a_List,i_]:¼B[a,i]¼Module[{nul,m1,j,k,n1,s¼ {}},
{m1,n1}¼Dimensions[CC[a,i]];
nul¼Table[0,{j,1,m1},{k,1,n1}];
If[CC[a,i]¼!¼nul,
s¼(1/(Transpose[CC[a,i]].CC[a,i])[[1,1]])CC[a,i],
If[Length[Dimensions[DD[a,i]]]¼ ¼1,
s¼(1/(1+DD[a,i]DD[a,i]))Transpose[{A[a,i-1]}]
DD[a,i],
s¼(1/(1+Transpose[DD[a,i]].DD[a,i])[[1,1]])
Transpose[A[a,i-1]].DD[a,i]
] ];
Return[Simplify[s]];
]
A[a_List,i_]:¼A[a,i]¼Module[{b¼a,vr},
If[i¼ ¼1,
If[Col[a,i]¼ ¼Col[a,i]�0, b¼Transpose[a][[1]],
b¼(1/(Transpose[a][[i]].Col[a,i])[[1]])
Transpose[a][[1]]
],
vr¼Variables[DD[a,i]];
If[vr¼!¼ {},
If[Length[Dimensions[DD[a,i]]]¼ ¼1,
b¼ {A[a,i-1]}-DD[a,i]Transpose[B[a,i]],
b¼A[a,i-1]-DD[a,i].Transpose[B[a,i]]
],
If[Length[DD[a,i]]¼ ¼0,
b¼ {A[a,i-1]}-DD[a,i]Transpose[B[a,i]],
b¼A[a,i-1]-DD[a,i].Transpose[B[a,i]]
] ];
b¼Append[b,Transpose[B[a,i]][[1]]]
];
Return[Simplify[b]]
]
446 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 5: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/5.jpg)
As it is deduced in [15,16], it is usually faster to find a particular value than
its recomputation, but it takes more memory space to store all before com-
puted values. Our numerical experience is that the recursive implementation
based on the memorization is faster with respect to the iterative one. Moreover,
in the recursive implementation it is used a simple and natural algorithm, and it
is very computationally attractive.
3. Implementation of the limit representation
In [19,20] it is introduced an iterative method for the implementation of the
limit representation of the Moore–Penrose inverse which is established in [3]
and [4]. In [14] we introduce the following generalization of this method.
Lemma 3.1 [14]. Let given two arbitrary p � q complex matrices R and S andp � 1 complex vector y. Assume that the elements of the vector y are denoted byyt, t ¼ 1; . . . ; p. Let the rows of the matrices R and S and the unit matrix Ip aredenoted by rt, st and it, t ¼ 1; . . . ; p, respectively. Then the following iterativemethods:
catþ1 ¼ ca
t �cat s
�tþ1rtþ1ca
t
a þ stþ1cat r
�tþ1
; ca0 ¼ Iq; a > 0;
xatþ1 ¼ xat þcat r
�tþ1
a þ stþ1cat r
�tþ1
ytþ1
�� stþ1xat
�; xa0 ¼~00;
X atþ1 ¼ X a
t þcat r
�tþ1
a þ stþ1cat r
�tþ1
itþ1
�� stþ1X a
t
�; X a
0 ¼ O; t ¼ 0; . . . ; p � 1
ð3:1Þ
produce the following resulting matrices:
X ap ¼ ðaIq þ R�SÞ�1R�; xap ¼ ðaIq þ R�SÞ�1R�y; ca
p ¼ ðaIq þ R�SÞ�1a:
In [14] it is given the following computational scheme, which ensures indi-rectly decreasing of the values for a.
Algorithm 2. The iterative processes (3.1) satisfy
X apN ¼ X a=N
p ; capN ¼ ca=N
p ; N ¼ 1; 2; . . . ; ð3:2Þ
where
X apN ¼ ðaIq þ R�
pNSpN Þ�1R�
pN ; capN ¼ ðaIq þ R�
pNSpN�1a
Partitioning[a_List]:¼Block[{m,n}, {m,n}¼Dimensions[a]; A[a,n] ];
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 447
![Page 6: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/6.jpg)
and R�pN , spN are the following block matrices:
R�pN ¼ R�
N ¼ R� � � � R�½ �; SpN ¼ SN ¼S� � �S
24
35:
A major problem in the implementation of the limit representation is implied
by magnification of the order of block matrices RN and SN . In order to avoid this
problem, in [14] we recommend to use the MATHEMATICA function Mod.
Input parameters in the algorithm are:r ; s : input matrices R and S;it : a prescribed number of iterations;
alpha : a starting value of the parameter a.
Since the convergence of the limit algorithm is very poor [17], we recom-
mend an implementation of the algorithm in pieces of a prescribed number of
iterations. The stopping criterion of the algorithm is kXtþ1 � Xtk6 �; where � is
a small real number, Xtþ1 and Xt are two successive iterations and kXk is a
selected matrix norm. For example, for X ¼ ðxijÞ we use the norm kXk ¼ffiffiffiffiffiffiffiffiffiffiffiPx2ij
q, which is implemented in the following function:
An improved implementation is based on the following result.
{p,q}¼Dimensions[r];
in¼IdentityMatrix[q]; im¼IdentityMatrix[p];
g0¼in; x0¼in-in;
i¼1;
While[i<¼it,
j¼i;
If[i>p,j¼Mod[i,p];If[j¼ ¼0,j¼p]];
g1¼g0-(g0.Transpose[{r[[j]]}].{s[[j]]}.g0)/
(alpha+({s[[j]]}.g0.Transpose[{r[[j]]}])[[1,1]]);
x1¼x0+g0.Transpose[{r[[j]]}].({im[[j]]}-{s[[j]]}.x0)/
(alpha+({s[[j]]}.g0.Transpose[{r[[j]]}])[[1,1]]);
g0¼g1; x0¼x1; i¼i+1
];
Return[x1];
norm[a_]:¼Block[{m,n,i,j,s},
{m,n}¼Dimensions[a];
s¼Sum[m[[i,j]] ^2,{i,m},{j,n}];
Return[N[Sqrt[s],20]]
]
448 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 7: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/7.jpg)
Theorem 3.1. Let given arbitrary p � q complex matrices R and S. If b is anarbitrary prescribed number of iterations, c ¼ Quotient½b; p�, d ¼ Mod½b; p�, thenthe iterative sequences defined in (3.1) produce the following values:
ca=cpþd ¼ ca
b ¼acIq
�þ Rd � Sd
��1 ac;
X a=cpþd ¼ X a
b ¼ acIn
�þ Rd � Sd
��1
Rd � Id ;ð3:3Þ
where Rd and Sd are d � q submatrices of R and S which contains first d rows of Rand S, respectively, and R�
d is n� d matrix, equal to the conjugate and transposeof the submatrix Rd .
Proof. According to (3.2), after the first p iterations we obtain the following:
ca=cp ¼ ca
pc; X a=cp ¼ X a
pc:
Performing remaining d iterations we obtain
ca=cpþd ¼ ca
pcþd ¼ cab; X a=c
pþd ¼ X apcþd ¼ X a
b :
This completes the proof. �
Now the iterative step Step 2 can be improved as follows.
4. Implementation of general determinantal representation
For 16 k6 n, let us denote the collection of strictly increasing sequences of kintegers chosen from f1; . . . ; ng, by
Qk;n ¼ a : af ¼ ða1; . . . ; akÞ; 16 a1 < � � � < ak 6 ng:
c¼Quotient[it,m]; d¼Mod[it,m];
alpha¼alpha/c;
While[norm[x1-x0]>¼eps,
i¼1;
While[i<¼p+d,
j¼i;
If[i>m,j¼Mod[i,m];If[j¼ ¼0,j¼m];
g1¼g0-(g0.Transpose[s[[j]]].s[[j]].g0)/
(alpha+(s[[j]].g0.Transpose[s[[j]]])[[1,1]]);
x1¼x0+g0.Transpose[s[[j]]].(im[[j]]-s[[j]].x0)/
(alpha+(s[[j]].g0.Transpose[s[[j]]])[[1,1]]);
g0¼g1; x0¼x1; i¼i+1
] ];
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 449
![Page 8: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/8.jpg)
Let N ¼ Qr;m � Qr;n: For fixed a 2 Qk;m, b 2 Qk;n, 16 k6 r, let
IðaÞ ¼ I : I 2 Qr;m; I � af g; JðbÞ ¼ J : J 2 Qr;n; J � bf g;Nða; bÞ ¼ IðaÞ �JðbÞ:
If A is the square matrix, then the coefficient of aij in Laplace�s expansion of jAjis denoted by ðo=oaijÞ=jAj:
The determinantal representation of f1; 2g-inverses is investigated in [1,2,6,10,12]. Using an arbitrary n� m matrix R of rank r, an arbitrary f1; 2g-in-verse of A can be expressed as follows:
ðAð1;2ÞÞij ¼ TrðCrðRAÞÞ� ��1 �
Xða;bÞ2Nðj;iÞ
Rba
��� ��� o
oajiAa
b
��� ���: ð4:1Þ
Particularly, the determinantal representations for the Moore–Penrose inverse,
group inverse and the weighted Moore–Penrose inverse are introduced in thepapers [1,8,9]. For any integer t satisfying 16 t6 rankðAÞ we define the set
Nt ¼ Qt;m � Qt;n. For fixed a;b 2 Qt;n, let
ItðaÞ ¼ I : I 2 Qt;m; I � af g; JtðbÞ ¼ J : J 2 Qt;n; J � bf g;Ntða; bÞ ¼ ItðaÞ �JtðbÞ:
The representation of the Drazin inverse is based on the usage of minors of the
order rk ¼ rankðAkÞ, k ¼ indðAÞ, selected from the matrices A and Al, lP k[13]:
ðADÞij ¼ TrðCrk ðAlþ1ÞÞ� ��1
Xða;bÞ2Nrk ðj;iÞ
ðAlÞba��� ��� o
oajiAa
b
��� ���: ð4:2Þ
Consequently, determinantal representations of generalized inverses is an im-
portant problem which has no effective implementation. We assume that A and
R are m� n complex matrices which satisfy rankðRÞ6 rankðAÞ ¼ r. The gen-eralized determinant of A of the order t can be expressed in this wayX
ðc;dÞ2Nt
Rcd
�� �� Acd
�� �� ¼ TrðCtðRAÞÞ; t6 rankðRÞ: ð4:3Þ
The general determinantal representation of the order t for A which compre-hends representations (4.1) and (4.2) can be written as follows:
xij ¼ TrðCtðRAÞÞ� ��1
Xða;bÞ2Ntðj;iÞ
Rab
��� ��� o
oajiAðsÞab��� ���; 16 i6 n
16 j6m
� �; ð4:4Þ
where t6 rc6 rankðRÞ and the critical rank rc is the greatest integer satisfying
TrðCtðRAÞÞ 6¼ 0.
450 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 9: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/9.jpg)
(A) The generalized determinant of the order t, defined in (4.3), can be
computed by means of the following function GDetR. The formal parameters aand r denote the matrices A and R, respectively, and the parameter t denotes
the size of selected minors.
(B) The function MatrixComp generates the submatrix of a given matrix A,
obtained by deleting its ith row and jth column.
The submatrix of a determined by the rows p ¼ fp1; . . . ; ptg and columns
q ¼ fq1; . . . ; qtg can be simply generated by the expression a[[p,q]].
(C) The set of all combinations of the order t from the set f1; . . . ; ng can be
generated by the expression KSubsets[Range[n],t], where the function
KSubsets is available in the package DiscreteMath�Combinatorica�.(D) Finally, by the function RInverse[a_,r_,t_] we implement the
general determinantal representation of the order t6 rankðRðsÞÞ, given by (4.4).
The formal parameters a and r represent the input matrices A and R, respec-
tively. The simplest for computation and appropriate initial value for the
critical rank rc of selected minors is rc ¼ minfm; ng. Then in the while cycle the
value of rc is decreased until the condition TrðCrcðRAÞÞ 6¼ 0 is satisfied:
The code of the function RInverse is as follows:
GDetR[a_, r_,t_Integer]:¼Block[{f,s,k,l,ma,mc},
ma¼Minors[a,t]; mc¼Minors[r,t];
{f,s}¼Dimensions[ma];
Sum[Conjugate[mc[[k,l]]] ma[[k,l]], {k,f}, {l,s}]
]/; MatrixQ[a] && MatrixQ[r] && Dimensions[a]¼ ¼Dimensions[r]
MatrixComp[a_, i_Integer, j_Integer]:¼Block[{b¼Drop[a,{i}]},
b¼Transpose[Drop[Transpose[b],{j}]];
]/; MatrixQ[a]
{m,n}¼Dimensions[a]; rc¼Min[m,n]; d¼GDetR[a,r,rc];
While[d¼¼0, rc– –; d¼GDetR[a,r,rc] ];
RInverse[a_, r_,t_]:¼Block[{p,q,rc,m,n,d,w,v,i,j,k,pr,pr1,awv,mr,mrr,mc,
s,inv,am},
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 451
![Page 10: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/10.jpg)
inv¼Transpose[a];
{m,n}¼Dimensions[a];
rc¼Min[m,n]; d¼GDetR[a,r,rc];
While[d¼ ¼0, rc– –; d¼GDetR[a,r,rc]];
If[t>rc,
Print[��Order of minors must be less than or equal to
��,rc];Return[];
];
d¼GDetR[a,r,t];
If[d¼ ¼0, Print[��Singular generalized determinant��];Return[]];
For[v¼1, v<¼n, v++,
For[w¼1, w<¼m, w++,
s¼0;
p¼KSubsets[Range[m],t]; (* Generate the set
fa : a 2 Qt;mg *)q¼KSubsets[Range[n],t]; (* Generate the set
fb : b 2 Qt;ng *)While[p!¼ {},
While[q!¼ {},
pr¼1; pr1¼1;
While[pr<¼t && First[p][[pr]]¼!¼w, pr++];
While[pr1<¼t && First[q][[pr1]]¼!¼v, pr1++];
If[pr<¼t && pr1<¼t,
mr¼a[[ First[p],First[q] ]]; (* mr ¼ jAabj *)
mrr¼r[[ First[p],First[q] ]];
mc¼Conjugate[Det[mrr]]; (* mc ¼ jRabj *)
If[t>1,
am¼Det[MatrixComp[mr,pr,pr1]], (* then *)
am¼1 (* else *)
];
(* Compute awv ¼ jRabj o
oajijAa
bj *)awv¼(-1)̂ (pr+pr1) am*mc, (* then *)
awv¼0 (* else *)
];
s+¼awv; q¼Rest[q];
];
q¼KSubsets[Range[n],t]; p¼Rest[p];
452 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 11: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/11.jpg)
Clear that the number of possible combinations increases very rapidly as
dimensions of matrices A and R increase. Also, the implementation of repre-
sentation (4.3) and (4.4) requires plural recomputations of identical minors. As
a solution of this problem we recommend usage of a few databases. Our main
idea in overcoming of this difficulty is possibility to place input matrices and
computed values in a database, instead of in memory variables.
Main idea used in such an approach is described in the following major steps:
Step 1. Initial values. Compute 2� 2 minors of the matrices A and R, andstore these values in a database.
Step 2. Recursive step. Each minor of the order d can be computed using the
development on its top row and the stored values of ðd � 1Þ � ðd � 1Þ minors
in a database. Required values of the minors of the order d � 1 are not com-
puted every time when are need, but they are simply extracted from a database.
Step 3. Stopping criterion. Process terminates in the case when all of the stored
minors are identical to zero or their order is equal to a prescribed integer t.The stopping criterion imposed in Step 3 suggests a way for explicit deter-
mination of the rank of a given matrix A: in the case when all of the stored
values of minors of the order d equals to zero, we give rankðAÞ ¼ d � 1. In this
way, we implement one of the useful properties of a ‘‘good’’ numerical algo-
rithm for computation of generalized inverses recommended in [7].
As an implementation language for database manipulations we use the
programming language DELPHI 5.0. In our implementation we use the fol-
lowing databases:
KOMBIN :DB, called in the program as Table 1: a database which storesgenerated combinations of the rows,
KOMBIN1:DB, called as Table 6: a database which stores generated com-
binations of the columns,
MATRIX :DB, called as Table 2: a database for elements of the matrices Aand R,
ACTUAL:DB, called as Table 3: a database for just computed values, and
which finally stores elements of the matrix G,
MINORS:DB, called as Table 4: a database for computed minors of the orderd � 1,
PREMINORS:DB, called as Table 5: a database for previous computed mi-
nors of the order d � 2.
];
inv[[v,w]]¼s/d;
] ];
Return[Simplify[inv]]
]/; MatrixQ[a] && MatrixQ[r] && Dimensions[a]¼ ¼Dimen-
sions[r]
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 453
![Page 12: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/12.jpg)
In each iteration the contents of Table 4 is copied in Table 5, the contents of
Table 3 is copied in Table 4, and the contents of Table 5 is deleted. Combinationsin databases Table 1 and Table 6 are stored as strings separated by a symbol
different from the decimal digits 0; . . . ; 9. For example, we use the symbol �,�.Databases MATRIX :DB, MINORS:DB, PREMINORS:DB and ACTUAL:DB are
defined as follows:
The sign � is a key for a search in these bases. The sign A denotes an alpha-
numeric field, and the sign N denotes a numerical field. The alphanumeric fieldVr kol is of the form i=j, which denotes an arbitrary ði; jÞth element of the
matrix. The numeric fields Value and Value R store corresponding values for
ði; jÞth elements of matrices A and R, respectively.
Example 4.1. [Matrices]
A ¼0 1 �1 02 0 7 0
1 1 �1 1
24
35; R ¼
1 �3 2 00 0 �2 1
1 0 �1 0
24
35
are stored in the base MATRIX :DB in this way:
Field_Name Type Size Key
1 Vr kol A 10 *
2 Value N
3 Value R N
Vr_kol Value Value_R
1/1 0 1
1/2 1 )31/3 )1 2
1/4 0 0
2/1 2 0
2/2 0 0
2/3 7 )22/4 0 1
3/1 1 1
3/2 1 0
3/3 )1 )13/4 1 0
454 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 13: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/13.jpg)
Databases KOMBIN :DB i KOMBIN1:DB are used in the following form:
A primary index key in these bases is Key¼ ‘‘Dim;Rbr’’, and the secondary one
is Key¼ ‘‘Dim;Kom’’. The field Dim denotes the dimension of the corre-
sponding combination, Rbr denotes its ordinal number, and Kom represents
the combination. An arbitrary combination is represented by its elements
separated by a sign �,�.
Example 4.2. For the matrices A and R given in Example 4.1, databases
KOMBIIN :DB i KOMBIN1:DB contains the following data:
For example, the second combination of the order 3 of columns can be de-
rived using the key Key¼ ‘‘3;2’’ for the base KOMBIN1:DB. The result is the
Field_Name Type Size Key
1 Dim A 3 *
2 Rbr A 7 *
3 Kom A 255
KOMBIN.DB
Dim Rbr Kom
2 1 1,2
2 2 1,3
2 3 2,3
3 1 1,2,3
KOMBIN1.DB
Dim Rbr Kom
2 1 1,2
2 2 1,3
2 3 1,4
2 4 2,3
2 5 2,4
2 6 3,4
3 1 1,2,3
3 2 1,2,4
3 3 1,3,4
3 4 2,3,4
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 455
![Page 14: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/14.jpg)
string �1,2,4�. Ordinal number of the combination �2,3� of the rows can be given
using the key Key¼ ‘‘2;2,3’’ for a search in the database KOMBIN :DB. The resultis 3.
In the following function gener we write combinations of the rows and
columns, respectively in the bases KOMBIN :DB and KOMBIN1:DB. Also, in
these databases are stored dimensions and ordinal numbers of stored combi-
nations. The combinations of the rows are generated using the parameter
baz ¼ 1, and the combinations of the columns are generated using baz ¼ 6.
Combinations are generated using the above described algorithm.
procedure TDetForm.gener(k,n,baz:Integer);
type TNiz¼Array[1..91] of Integer;
var c:Tniz; z,i,brk:Integer;
k1,br1,pr1,prm,ddim,bbrk:string;
begin
If k<n then
begin
for I:¼1 to k do c[I]:¼I;
z:¼k; brk:¼0;
while z�1 do
begin
brk:¼brk+1; prm:¼ ��;for I:¼1 to k-1 do prm:¼prm+IntToStr(c[I]])+�,�;prm:¼prm+IntToStr(c[k]); ddim:¼IntToStr(k);
bbrk:¼IntToStr(brk);
case baz of
1:withTable1do
begin
append;
fieldbyname(�dim�).asstring:¼ddim;
fieldbyname(�rbr�).asstring:¼bbrk;
fieldbyname(�kom�).asstring:¼prm;
end;
6:with Table 6 do
begin
append;
fieldbyname(�dim�).asstring:¼ddim;
fieldbyname(�rbr�).asstring:¼bbrk;
456 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 15: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/15.jpg)
Minors jAabj and jRa
bj, ða; bÞ 2 Nd of the order d are computed in the pro-
cedure calc, using before computed minors of the order d � 1, which are stored
in the base MINORS:DB. Values of minors of the order d � 1 can be taken from
the base MINORS:DB in the procedure readBaz. Procedure readBaz takes the
following formal parameters:
k1,k2:string; – parameters containing combinations of the rows and col-
umns, respectively, in the corresponding minor of the order d � 1.
dd:integer; – parameter representing actual dimension (equal to d � 1) ofminors computed in the previous step.
fieldbyname(�kom�).asstring:¼prm;
end;
end;
if c[k]¼n then z:¼z-1 else z:¼k;
if z�1 then for I:¼k downto z do c[I]:¼c[z]+I-z+1;
end;
end
else begin
brk:¼1; prm:¼ ��;for I:¼1 to k-1 do prm:¼prm+IntToStr(I)+�,�;prm:¼prm+IntToStr(k); ddim:¼IntToStr(k);
bbrk:¼IntToStr(brk);
case baz of
1:with Table 1 do
begin
append;
fieldbyname(�dim�).asstring:¼ddim;
fieldbyname(�rbr�).asstring:¼bbrk;
fieldbyname(�kom�).asstring:¼prm;
end;
6:with Table 6 do
begin
append;
fieldbyname(�dim�).asstring:¼ddim;
fieldbyname(�rbr�).asstring:¼bbrk;
fieldbyname(�kom�).asstring:¼prm;
end;
end;
end;
end;
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 457
![Page 16: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/16.jpg)
var mt,mt1:real; – these output parameters represent values of minors of the
order d � 1, which are taken from the base MINORS:DB (i.e. Table 4).
We now describe two auxiliary procedures. Procedure pozition(word, sub-word:string; var element:integer) gives a position of the substring subword in the
string word. The string word contains elements of a combination separated by
the sign �,�. The result is placed in the output parameter element.
procedure TDetForm.readBaz(k1,k2:string;dd:integer; var
mt,mt1:real);
var i,j,fd,where:string;
begin
if dd¼1 then where:¼k1+�/�+k2else begin
fd:¼IntToStr(dd);
table 1.indexfieldnames:¼ �Dim;Kom�;table 6.indexfieldnames:¼ �Dim;Kom�;table 1.FindKey([fd,k1]);
i:¼Table 1.Fields[1].AsString;
table 6.FindKey([fd,k2]);
j:¼Table 6.Fields[1].AsString;
where:¼i+�/�+j;table 1.indexfieldnames:¼ �Dim;Rbr�;table 6.indexfieldnames:¼ �Dim;Rbr�;
end;
Table 4.Open; Table 4.FindKey([where]);
mt:¼Table 4.Fields[1].AsFloat; mt1:¼Table
4.Fields[2].AsFloat;
end;
procedure TDetForm.pozition(word,subword:string;var
element:integer);
var d1,d2,count:integer;
j1,v1,j2,v2:string;
work,ok:boolean;
begin
d1:¼length(word);
d2:¼length(subword);
j1:¼copy(subword,1,1);
j2:¼copy(subword,2,d2-1);
458 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 17: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/17.jpg)
For example, the expression pozition(‘1,2,10,11,12,13’,‘11’,element) producesthe result element ¼ 4, i.e. position of the string �11� in the string �1,2,10,11,12,13�.
Procedure take(word:string;br:integer;var o1,wordo1:string); gives the ele-
ment in the position br in the string word, which is a representation of a
combination. Also, in the output variable wordo1 is stored the string obtained
deleting the substring o1 from the string word. For example, take(‘1,2,10,11,12,13’,4,o1,wordo1) gives the following results: o1¼ ‘11’ and wordo1¼ ‘1,2,10,12,13’.
count:¼1; ok:¼false; work:¼true; element:¼1;
while work do
begin
v1:¼copy(word,count,1);
v2:¼copy(word,count+1,d2-1);
if v1¼ �,� then element:¼element+1
else if j1¼v1 then
if j2¼v2 then
begin
work:¼False;
ok:¼true;
end;
count:¼count+1;
if count>d1 then work:¼false
end;
if not ok then element:¼0;
end;
procedure TDetForm.take(word:string;br:integer;var o1,
wordo1:string);
var d1,u,count:integer;
sign:string;
work:boolean;
begin
d1:¼length(word);
u:¼0; o1:¼ ��; wordo1:¼ ��; count:¼1;
while u<>br-1 do
begin
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 459
![Page 18: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/18.jpg)
In the procedure calc are used the following formal parameters:
i,j:integer; – ordinal number of a combination of the rows and the columns,
respectively.
d:integer; – the order of the minor whose value computes.
var s,s1:real; – values of the resulting minors of the order d, corresponding to
A and R, respectively.
If the ordinal numbers of the combinations a and b of the order d are equal
to I and J, respectively, then we write jAIJ jd instead of jAabj.
sign:¼copy(word,count,1);
if sign¼ �,� then u:¼u+1;
wordo1:¼wordo1+sign;
count:¼count+1
end;
sign:¼copy(word,count,1); work:¼true;
while work do
begin
o1:¼o1+sign;
count:¼count+1;
sign:¼copy(word,count,1);
if sign¼ �,� then work:¼false; if sign¼ �� then work:-
¼false;
end;
if count>¼d1
then wordo1:¼copy(wordo1,1,length(wordo1)-1)
else wordo1:¼wordo1+copy(word,count+1,d1-count)
end;
procedure TDetForm.calc(i,j,d:integer;var s,s1:real);
var t,sgn,poc,d1:integer;Rij,Aij,mt,mt1:real;
ist,jst,dst,sign,vr,kol,a1,ost,a2,tt,zk:string;
begin
s:¼0; s1:¼0;
ist:¼IntToStr(i); jst:¼IntToStr(j);
dst:¼IntToStr(d);
Table 1.FindKey([dst,ist]);
vr:¼Table 1.Fields[2].AsString;
Table 6.FindKey([dst,jst]);
kol:¼Table 6.Fields[2].AsString;
d1:¼length(vr); a1:¼ ��; poc:¼0;
460 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 19: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/19.jpg)
Example 4.3. Consider matrices A and R as in Example 4.1. Their minors jA13j3
and jR13j3 are computed in the procedure calc(1,3,3,mt,mt1). In the output
variable mt is contained a value of the corresponding minor of A, and in the
variable mt1 is stored analogous value of R. In the base KOMBIN :DB is stored
the first combination of the order 3 (equal to the combination �1,2,3�). Simi-
larly, in the base KOMBIN1:DB is stored the third combination of the order 3
(i.e. the combination �1,3,4�). Consequently, we must compute the minor
jA13j3 ¼ A
1; 2; 31; 3; 4
� �3
:
Using the development on the first row in this minor, we obtain
jA13j3 ¼ 1 � 0 � A
2; 33; 4
� �2
þ ð�1Þ � ð�1Þ � A2; 31; 4
� �2
þ 1 � 0 � A2; 31; 3
� �2
:
while sign <> �,� dobegin
poc:¼poc+1; a1:¼a1+copy(vr,poc,1);
sign:¼copy(vr,poc+1,1)
end;
poc:¼poc+1; ost:¼copy(vr,poc+1,d1-poc); sgn:¼1;
for t:¼1 to d do
begin
take(kol,t,a2,zk); tt:¼a1+ �/�+a2;Table 2.FindKey([tt]);
Aij:¼Table 2.Fields[1].AsFloat;
Rij:¼Table 2.Fields[2].AsFloat.
readBaz(ost,zk,d-1,mt,mt1);
s:¼s+sgn*Aij*mt;s1:¼s1+sgn*Rij*mt1;
sgn:¼(-1)*sgn;
end;
Table 3.Open;
with Table 3 do
begin
append;
fieldbyname(�vr_kol�).AsString:¼ist+�/�+jst;fieldbyname(�value�).AsFloat:¼s;
fieldbyname(�value_R�).AsFloat:¼s1;
refresh;
end;
end;
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 461
![Page 20: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/20.jpg)
Instead of the recomputation of the minor
A2; 33; 4
� �2
it is sufficient to read corresponding value from the base MINORS:DB. This isdone by the following call of the procedure readBaz(‘2,3’,‘3,4’,2,t,t1).
Corresponding minor in the base MINORS:DB can be found by means of the
key Key¼ ‘‘3/6’’, because of �2,3� is third combinations of the rows contained in
A of the order 2, and �3,4� is sixth combination of the order 2 of the columns
contained in A. We obtain mt ¼ 7, a mt1 ¼ 1. In this way, we get
A2; 33; 4
� �2
¼ Keyð3=6Þ ¼ 7;
A2; 31; 4
� �2
¼ Keyð3=3Þ ¼ 2;
A2; 31; 3
� �2
¼ Keyð3=2Þ ¼ 0;
and
jA13j3 ¼ A
1; 2; 31; 3; 4
� �3
¼ 2:
In this case, the base MINORS:DB contains the following data:
Procedure FindGij places in the resulting base elements of the matrix G,
computed according to (4.4). Combinations I and J of the order d are taken
from the databases KOMBIN :DB and KOMBIN1:DB, respectively, using the
key,
Key ¼ \d; I"; and Key ¼ \d; J":
In the function MAK are computed values of the algebraic complements
o
oajijAIJ j
� �d�1
; i ¼ 1; . . . ;m; j ¼ 1; . . . ; n:
Formal parameters used in this function are:
vik: string; – string of the form �i=j�, where i is the ordinal number of the row,
and j is the ordinal number of the column.
Vr_kol Value Value_R
1/1 7 6
1/2 )2 )31/3 2 3
1/4 7 )3
462 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 21: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/21.jpg)
d : integer; – dimension of the submatrix Aab.
function TDetForm.MAK(vik:string; d:integer):real;
var i,j,cr,ii,jj:integer;
ist,jst,rst,vr,kol,d_j,b_i,ipre,jpre,
m1,where1:string;ddd:real;
begin
cr:¼pos(�/�,vik);ist:¼copy(vik,1,cr-1); i¼StrToInt(ist);
jst:¼copy(vik,cr+1,r-cr); j¼StrToInt(jst);
rst:¼IntToStr(d);
Table 1.FindKey([rst,ist]);
vr:¼Table 1.fields[2].AsString;
Table 6.FindKey([rst,jst]);
kol:¼Table 6.fields[2].AsString;
cr:¼poz(vr,jst);
if cr¼0 then MAK:¼0
else begin
jj:¼cr;
take(vr,cr,m1,d_j);
cr:¼poz(kol,ist);
if cr¼0 then MAK:¼0
else begin
ii:¼cr; take(kol,cr,m1,b_i);
rst:¼IntToStr(r-1);
Table 1.Indexfieldnames:¼ �Dim;Kom�;Table 6.Indexfieldnames:¼ �Dim;Kom�;Table 1.findKey([rst,d_j]);
ipre:¼Table 1.fields[1].AsString;
Table 6.FindKey([rst,b_i]);
jpre:¼Table 6.Fields[1].AsString;
where1:¼ipre+�/�+jpre;Table 1.Indexfieldnames:¼ �Dim;Rbr�;Table 6.Indexfieldnames:¼ �Dim;Rbr�;Table 5.FindKey([where1]);
ddd:¼Table 5.fields[1].AsFloat;
MAK:¼pow(ii,jj)*ddd; (* pow(ii,jj) computes
ð�1Þiiþjj *)end;
end;
end;
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 463
![Page 22: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/22.jpg)
In the procedure FindGij we compute elements of generalized inverses and
place them in the corresponding base ACTUAL:DB or Table 3. Elements gij,i ¼ 1; . . . ; n, j ¼ 1; . . . ;m are denoted by Gij.
procedure TDetForm.FindGij;
var detRA,s,GIJ:real;
i,j,Ndim,Mdim,rang:integer;where:string;
begin
(* Compute DetðR;rÞðAÞ ¼ detRA *)
detRA:¼0;
with Table 4 do
begin
first;
while not(eof) do
begin
detRA:¼detRA+fields[1].AsFloat*fields[2].As-
Float; next;
end;
end;
table 4.close; table 3.close; DelTreQuery.execsql;
table 3.open ; table 4.open;
rang:¼StrToInt(edit2.text); Ndim:¼StrT-
oInt(NField.text); Mdim:¼StrToInt(MField.text);
for i:¼1 to Mdim do
for j:¼1 to Ndim do
begin (* Compute gij denoted by Gij *)
s:¼0;
with Table 4 do
begin
first;
while not eof do
begin
where:¼Fields[0].AsString;
s:¼s+Fields[2].AsFloat*MAK(where,j,i,rang);
next;
end;
end;
Gij:¼s/detRA; (* Gij is computed *)
(* Store the value Gij *)
where:¼inttostr(i)+�/�+inttostr(j);
464 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 23: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/23.jpg)
Example 4.4. Consider the matrices A and R as in Example 4.1. The value G21can be computed as follows: Variable detRA gives the value 33 passing through
the base MINORS.DB:
In Fields[2]. AsFloat is contained value of the minor jRIJ j3 . In the beginning,
the string �1=1�¼ where ¼ Fields½0�:AsString gives the first combination of therows of the order 3, equal to �1; 2; 3� and the first combination of the columns,
identical to �1; 2; 3�. In this way, we get
jR11j3 ¼ R
1; 2; 31; 2; 3
� �3
¼ 6:
Now, we get s ¼ 0þ 6 � MAK(�1/1�,1,1,3). In the function MAK we delete thestring �1� from the string �1,2,3, and obtain �2,3� and the string �2� from the string
�1,2,3�, which gives the combination �1,3�. The sign corresponding to the minor
A2; 31; 3
� �2
is ð�1Þ1þ2 ¼ ð�1Þ, and the value is
A2; 31; 3
� �2
¼ jA32j2 ¼ �9:
This value is selected as element �3/2� from the base PREMINORS:DB, usingthe key Key¼ ’’2;�3/2’’�. In this case, the function MAK gives us the value
ð�1Þ � ð�9Þ ¼ 9. Continuing in the same manner, we get
jR12j3 ¼ R
1; 2; 31; 2; 4
� �3
¼ �3
s ¼ 6 � ð�1Þ � ð�9Þ þ ð�3Þ � MAKð‘1=2’; 2; 1; 3Þ:
detRA:¼detRA+fields[1].AsFloat*fields[2].AsFloat;
with Table 3 do
begin
append;
fieldbyname(�vr_kol�).AsString:¼where;
fieldbyname(�value�).AsFloat:¼Gij;
fieldbyname(�value_R�).AsFloat:¼0;
refresh;
end;
end;
end;
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 465
![Page 24: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/24.jpg)
Since MAKð‘1=2’; 2; 1; 3Þ ¼ ð�1Þ1þ2 � 2 we get s ¼ 6 � ð�1Þ � ð�9Þþ ð�3Þ �ð�1Þ � 2. Finally, we obtain
s ¼ 6 � ð�1Þ � ð�9Þ þ ð�3Þ � ð�1Þ � 2þ 3 � ð�1Þ � 0
þ ð�3Þ � 1 � 7 ¼ 39
Consequently, for i ¼ 2; j ¼ 1, Gij ¼ 39=33.
5. Examples
Example 5.1. Consider the matrix
A ¼
�1 0 1 2
�1 1 0 �1
0 �1 1 3
0 1 �1 �3
1 �1 0 1
1 0 �1 �2
26666666664
37777777775:
Applying the Algorithm 1 we get
Ay ¼
� 534
� 317
134
� 134
317
534
451
13102
� 5102
5102
� 13102
� 451
7102
5102
151
� 151
� 5102
� 7102
117
� 134
334
� 334
134
� 117
2666664
3777775:
Example 5.2. Consider the following matrix, generated substituting the value
a ¼ 1 in the test matrix recommended in [18]:
A ¼
1 2 3 4 11 3 4 6 2
2 3 4 5 3
3 4 5 6 4
4 5 6 7 6
6 6 7 7 8
26666664
37777775:
466 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 25: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/25.jpg)
Using the matrix
R ¼
0 1 2 3 0
0 2 3 5 1
1 2 3 4 2
2 3 4 5 3
3 4 5 6 5
5 5 6 6 7
266666664
377777775
in the representation (4.3) and (4.4), we obtain the following {1,2}-inverse of A:
G ¼
0:5 �0:125 �1 0:875 �0:625 0:375
�1 1:875 �4:5 2:875 �0:625 0:375
1:25 �1:626 3:25 �1:875 0:125 �0:125
�0:25 0:375 �0:25 0:125 0:125 �0:125
�0:5 �0:25 1:5 �1:25 0:75 �0:25
266666664
377777775:
Also, using R ¼ A in (4.3), (4.4) we obtain the following Moore–Penrose in-
verse of A (see [18])
Ay ¼
4 �1 �8 7 �5 3
�8 15 �36 23 �5 3
10 �13 26 �15 1 �1
�2 3 �2 1 1 �1
�4 �2 12 �10 6 �2
266666664
377777775:
Example 5.3. Consider the following matrix:
A ¼
1 2 3 4 1 1 3 4 6 2
1 3 4 6 2 2 3 4 5 3
2 3 4 5 3 3 4 5 6 4
3 4 5 6 4 4 5 6 7 6
4 5 6 7 6 6 6 7 7 8
6 6 7 7 8 1 2 3 4 1
3 4 1 1 3 4 6 2 1 2
4 6 2 2 3 4 5 3 1 3
4 5 3 3 4 5 6 4 2 3
5 6 4 4 5 6 7 6 3 4
6 7 6 6 6 7 7 8 4 5
2666666666666666664
3777777777777777775
:
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 467
![Page 26: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/26.jpg)
Representation (4.3) and (4.4) produces the result
Ay ¼
14384885
� 576434195
� 5167334195
96756839
� 1336434195
4252102585
� 235758620
� 26641102585
186391410340
� 36119136780
31511136780
� 130119540
� 251834195
� 167771136780
� 2909727356
31393136780
1834195
� 375319540
2219634195
� 14121136780
� 26113136780
� 13963136780
442919540
� 611334195
� 94719136780
1929727356
� 29237136780
� 901102585
� 1486958620
� 24392102585
621347410340
� 180443136780
61367136780
� 321919540
1871334195
� 89801136780
1028527356
� 15843136780
100968390
350319540
� 1340768390
� 62379136780
72643136780
� 14257136780
� 28999770
� 35934195
7076968390
� 1330113678
2455768390
11062102585
348714655
4469102585
� 109286102585
3205934195
� 1250634195
� 8977
� 32406839
2274713678
� 90206839
481913678
� 422341034
� 12552931
920941034
7509141034
� 126106839
566713678
1211954
360977
� 1318977
21131954
� 322977
355862
24955862
� 25435862
� 12952931
13911954
� 152977
� 3153908
10806839
79327356
� 393127356
� 93327356
� 43620517
5115862
� 39520517
� 6150541034
1980513678
� 188913678
9534885
� 1655934195
8191968390
� 54126839
1445768390
1009205170
� 278814655
54983205170
156883205170
� 3099134195
332368390
� 3153908
10806839
� 2656327356
2342527356
� 93327356
� 43620517
5115862
� 39520517
� 2047141034
612713678
� 186913678
0BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB@
1CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCA
:
6. Conclusions
We investigate the magnification of floating point operations caused by
recomputations of the same quantities in three methods for generalized in-
verses computations. Each of these algorithms has a distinct source for this
difficulty. Also, proposed solutions are adjusted to these causes. We recom-
mend these solutions as usual tools how to avoid similar problems in all similarsituations.
References
[1] R.B. Bapat, K.P.S.B. Rao, K.M. Prasad, Generalized inverses over integral domains, Linear
Algebra Appl. 140 (1990) 181–196.
[2] R.B. Bapat, Generalized inverses with proportional minors, Linear Algebra Appl. 211 (1994)
27–35.
[3] A. Ben-Israel, T.N.E. Grevile, Generalized inverses: theory and applications, Wiley–
Interscience, New York, 1974.
[4] A. Ben-Israel, On matrices of index zero or one, SIAM J. Appl. Math. 17 (1969) 1118–1121.
[5] T.N.E. Grevile, Some applications of the pseudo-inverse of matrix, SIAM Rev. 3 (1960) 15–22.
[6] J. Miao, Reflexive generalized inverses and their minors, Linear Multilinear Algebra 35 (1993)
153–163.
468 P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469
![Page 27: A problem in computation of pseudoinverses](https://reader036.vdocuments.mx/reader036/viewer/2022080103/575021e11a28ab877ea1fc09/html5/thumbnails/27.jpg)
[7] B. Noble, Methods for computing the Moore–Penrose generalized inverse, and related matters,
in: M.Z. Nashed (Ed.), Generalized Inverses and Applications, Academic Press, New York,
1976, pp. 245–301.
[8] K.M. Prasad, K.P.S.B. Rao, R.B. Bapat, Generalized inverses over integral domains. II.
Group inverses and Drazin inverses, Linear Algebra Appl. 146 (1991) 31–47.
[9] K.M. Prasad, R.B. Bapat, The generalized Moore–Penrose inverse, Linear Algebra Appl. 165
(1992) 59–69.
[10] D.W. Robinson, The image of the adjoint mapping, Linear Algebra Appl. 277 (1998) 143–148.
[11] N. Shinozaki, M. Sibuya, K. Tanabe, Numerical algorithms for the Moore–Penrose inverse
of a matrix: direct methods, Annals of the Institute of Statistical Mathematics 24 (1) (1972)
193–203.
[12] P.S. Stanimirovi�cc, General determinantal representation of generalized inverses over integral
domains, Publicationes Mathematicae Debrecen 54 (1999) 221–249.
[13] P.S. Stanimirovi�cc, D.S. Djordjevi�cc, Full-rank and determinantal representation of the Drazin
inverse, Linear Algebra Appl. 311 (2000) 31–51.
[14] P.S. Stanimirovi�cc, Limit representations of generalized inverses and related methods, Appl.
Math. Comput. 103 (1999) 51–68.
[15] S. Wolfram, Mathematica: a system for doing mathematics by computer, Addison-Wesley,
Redwood City, CA, 1991.
[16] S. Wolfram, Mathematica Book, Version 3.0, Wolfram Media, Cambridge University Press,
1996.
[17] G. Zielke, in: A survey of generalized matrix inverse, 13, Banach Center Publication, 1984,
pp. 499–526.
[18] G. Zielke, Report on test matrices for generalized inverses, Computing 36 (1986) 105–162.
[19] E.L. �ZZukovski, R.S. Lipcer, On recurrent computation of normal solutions of linear algebraic
equations, �ZZ. Vicisl. Mat. i Mat. Fiz. 12 (1972) 843–857 (in Russian).
[20] E.L. �ZZukovski, R.S. Lipcer, On computation pseudoinverse matrices, �ZZ. Vicisl. Mat. i Mat.
Fiz. 15 (1975) 489–492 (in Russian).
P.S. Stanimirovi�cc, M.B. Tasi�cc / Appl. Math. Comput. 135 (2003) 443–469 469