Anonymous user
Cholesky decomposition: Difference between revisions
m
→{{header|REXX}}: simplified the code.
(Added C++ solution) |
m (→{{header|REXX}}: simplified the code.) |
||
Line 2,986:
do r=1 for ord
do c=1 for r; $=0; do i=1 for c-1; $= $ + !.r.i * !.c.i; end /*i*/
if r=c then !.r.r= sqrt(!.r.r - $)
else !.r.c= 1 / !.c.c * (@.r.c - $)
end /*c*/
Line 3,019:
numeric form; m.=9; parse value format(x,2,1,,0) 'E0' with g 'E' _ .; g=g*.5'e'_ %2
do j=0 while h>9; m.j=h; h=h%2+1; end /*j*/
do k=j+5 to 0 by -1; numeric digits m.k; g=(g+x/g)*.5; end /*k*/;
{{out|output}}
<pre>
|