Raul Miller-4 wrote:
>
> On Nov 20, 2007 7:30 AM, Viktor Cerovski <[EMAIL PROTECTED]>
> wrote:
>> 2) Gramm-Schmidt orthonormalization:
>> (in this example I couldn't find an elegant J code without reduce/fold)
>
> [...]
>
> You did not specify the domain of any of this, but since GS is usually
> for numeric matricies, I believe you use your others with numeric vectors
> (and norm is a monad while mp and orth are dyads).
>
> [...]
>
> GS1=: [: [EMAIL PROTECTED]/\. [EMAIL PROTECTED]:@]`_1:`]}~
>
> [...]
>
Thank you for the code, I will study it a bit more.
The domain is a matrix of n vectors of length m stored in rows.
I think there is a problem with GS1. One test is :
]mat=:?5 5$ 100
98 77 58 26 43
11 17 80 56 43
30 18 77 6 49
49 32 47 75 17
76 50 56 90 6
NB. by definition of the orthonormal basis, the following should be a unit
nxn matrix.
(mp|:)GS mat
1 0 4.16334e_17 _1.38778e_16 _6.10623e_16
0 1 4.02456e_16 2.19269e_15 _2.10942e_15
4.16334e_17 4.02456e_16 1 _7.07767e_16 3.88578e_16
_1.38778e_16 2.19269e_15 _7.07767e_16 1 _8.54872e_15
_6.10623e_16 _2.10942e_15 3.88578e_16 _8.54872e_15 1
(mp|:)GS1 mat
1 0.96888 0.981872 0.985254 _0.880085
0.96888 1 0.987703 0.984322 _0.877379
0.981872 0.987703 1 0.971654 _0.912748
0.985254 0.984322 0.971654 1 _0.834162
_0.880085 _0.877379 _0.912748 _0.834162 1
--
View this message in context:
http://www.nabble.com/reduce-fold-in-J-as-an-adverb-or-conjuction-tf4839217s24193.html#a13858913
Sent from the J General mailing list archive at Nabble.com.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm