Actually, thinking about this - the explicit version should be within a factor of 2 of the performance of the power approach unless intermediate results are so large you run out of memory.
Thanks, -- Raul On Tue, Sep 16, 2014 at 6:33 AM, Raul Miller <[email protected]> wrote: > Here's another power iterator approach: > > {."2 ({. f"1 }.)^:(i.@#) !/~i.10 > > And here's a looping explicit approach: > > orto=:3 :0 > a=. 1 {. y > for. i.(#y)-1 do. > a=.a,{.y=.({:a)f"1}.y > end. > ) > > The explicit approach should be more efficient on very large arguments, > but has no advantage on a 10 by 10. > > Thanks, > > -- > Raul > > On Tue, Sep 16, 2014 at 4:46 AM, Aai <[email protected]> wrote: > >> I'm not sure if this is less embarrassing, but here's an power iterator >> solution: >> >> 0{::([ ((,{.);]) {:@[ f"1 }.@])&>/^:(<:@#`(,:@{.;])) !/~i.10 >> >> >> >> On 16-09-14 08:56, 'Bo Jacoby' via Programming wrote: >> >>> I managed to ortogonalize a 10 10 - matrix like this: >>> >>> f=.[:(%+./)(]*[:+/[*[)-[*[:+/* >>> orto =. 3 : 0 >>> a=.,:{.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> a=.a,{.y=.({:a)f"1}.y >>> ) >>> orto(!/~)i.10 >>> 1 1 1 1 1 1 1 1 1 1 >>> _9 _7 _5 _3 _1 1 3 5 7 9 >>> 6 2 _1 _3 _4 _4 _3 _1 2 6 >>> _42 14 35 31 12 _12 _31 _35 _14 42 >>> 18 _22 _17 3 18 18 3 _17 _22 18 >>> _6 14 _1 _11 _6 6 11 1 _14 6 >>> 3 _11 10 6 _8 _8 6 10 _11 3 >>> _9 47 _86 42 56 _56 _42 86 _47 9 >>> 1 _7 20 _28 14 14 _28 20 _7 1 >>> _1 9 _36 84 _126 126 _84 36 _9 1 >>> >>> >>> How can the program orto be made less embarrassing? >>> >>> Thank you! >>> >>> >>> Bo. >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> >> -- >> Met vriendelijke groet, >> @@i = Arie Groeneveld >> >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
