IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16269


Ignore:
Timestamp:
Feb 1, 2008, 10:20:47 AM (18 years ago)
Author:
eugene
Message:

updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/test/gaussj.sh

    r16117 r16269  
    243243end
    244244
     245# a very large matrix equation
     246# timing on my laptop: 100 : ~1sec; 300 : ~7sec; 1000 : ~88sec
     247# note: at Ndim = 1000, it failed (Ax - B was in the range -2..+2)
     248macro test6
     249 if ($0 != 2)
     250  echo "USAGE: test6 (Ndim)"
     251  break
     252 end
     253
     254 $PASS = 1
     255 break -auto off
     256
     257 $Ndim = $1
     258 mcreate A $Ndim $Ndim
     259 create B 0 $Ndim
     260
     261 # generate the diagonal + off-diagonal elements
     262 for i 0 $Ndim
     263   A[$i][$i] = 2.0
     264   if ($i > 0)
     265     A[$i][$i-1] = -1.0
     266   end
     267   if ($i < $Ndim - 1)
     268     A[$i][$i+1] = -1.0
     269   end
     270 end
     271
     272 set inB = B
     273 set inA = A
     274
     275 gaussj A B
     276 if (not($STATUS))
     277   $PASS = 0
     278 end
     279
     280 set meas = zero(inB)
     281 for i 0 B[]
     282  for j 0 B[]
     283   meas[$i] = meas[$i] + inA[$i][$j] * B[$j]
     284  end
     285 end
     286
     287 for i 0 inB[]
     288  if (abs(inB[$i]-meas[$i]) > 1e-3)
     289    $PASS = 0
     290    echo inB[$i] meas[$i] {inB[$i]-meas[$i]}
     291  end
     292 end
     293end
     294
Note: See TracChangeset for help on using the changeset viewer.