It took more than 30 minutes of processing time before the first output on printer appeared. The mainframe was operated by the administrative dept., and more than once my job was killed by the operator, because "the job hung...". I ended up testing my program midnights, operating the mainframe myself and alone (those were the days).

The amount of floating point operations (FLOPS) in the main calculation was about 120.000.

That's about 17 msec/FLOP.

Let's compare with an everybody's iPad today.

The little program hereafter generates a 50x50 matrix with random coefficients.

The matrix is inverted, which takes somwhat more than 50^3 = 125.000 FLOPS.

In order to have a glance at the precision of sB, the inverse matrix is multiplied whith the original, which should produce the unity matrix (all diagonal elements equal one, all rest equal zero)

All in all, the number of FLOPS is about 140.000, the total processing time is 0.32 seconds.

That is 2.3 usec/FLOP, or about 7400 times faster than a 360/30.

Code: Select all

```
option base 1
n=50
dim matA(n,n),matAI(n,n),matI(n,n)
time reset
mat_rnd (n,n,matA,-10,10) ' genrate 50x50 random matrix
mat_inv(n,matA,matAI) ' calculate the inverse matrix
mat_mul(n,n,matA,matAI,matI) ' multiply with the original
print time()
debug pause ' inspect precision of the unit matrix matI
end
' {matlib}
' produce a matrix with random elements between mini and maxi
'
def mat_rnd (n,m,mat(,),mini,maxi)
for i=1 to n
for j=1 to m ! mat(i,j)=mini+(maxi-mini)*rnd(1) ! next j
next i
end def
' produce the inverse of square matrix a() giving matrix ainv()
' returns 1 on success, 0 if matrix is singular
'
def mat_inv (nvar,a(,),ainv(,))
dim w(nvar,2*nvar)
for i=1 to nvar
for j=1 to nvar ! w(i,j)=a(i,j) ! w(i,j+nvar)=0 ! next j
w(i,i+nvar)=1
next i
for piv=1 to nvar
fac=w(piv,piv) ! if fac=0 then return 0
for j=piv to piv+nvar ! w(piv,j)=w(piv,j)/fac ! next j
for i=1 to nvar
if i<>piv then
fac=w(i,piv)
for j=piv to piv+nvar ! w(i,j)=w(i,j)-fac*w(piv,j) ! next j
endif
next i
next piv
for i=1 to nvar
for j=1 to nvar ! ainv(i,j)=w(i,j+nvar) ! next j
next i
return 1
end def
' produce product of mata() and matb() giving matc()
'
def mat_mul (n,m,mata(,),matb(,),matc(,))
for i=1 to n
for j=1 to n
tot=0
for k=1 to m ! tot=tot+mata(i,k)*matb(k,j) ! next k
matc(i,j)=tot
next j
next i
end def
```

After such an amount of calculations with cumulative error propagation, that may be called excellent IMNSHO.