A while ago I posted to a thread "APL versu MatLab" ,
http://groups.google.com/group/comp.lang.apl/browse_frm/thread/de78dd7b36d069c5/3fc5d831c9052795?hl=en#3fc5d831c9052795
, seeking more concrete examples of elegance of expression of
algorithms in the 2 languages .
My niece just finished "Matrix Methods" in U of CO Applied Math so now
knows what "orthonormalization" means and how to do it in Matlab .
I've told her is is quite elegant in APL ; less so in K . Here's the
K version I did to compute my WTC design :
norm { _sqrt +/ _sqr x }
norm..h : " Euclidian norm , or length of a vector "
normalize : { x % norm x }
normalize..h : "divide vector by its length to make length 1 "
ortho : { r : 1 # x : normalize' x ; i : 0 ; do[ -1 + # x ; r : r , ,
normalize x[ i ] - r _dot x[ i +: 1 ] _lsq r ] ; r }
ortho..h : " orthonormalizes columns of a matrix . i.e / r : ortho x ;
( r _mul + r ) ~ r _lsq r / "
I worry that when the time comes I want to review all my CoSy notes
from ~ 1986 thru 1999 in old flat APL+PC based CoSy 2 , I won't be
able to get it going . In any case , I'm not goiing to mess with it
now to find my ortho from back then .
Can someone post their algorithm ? I doubt if it has been changed much
in newer APLs tho I know the J does some new tricks .