Re: Speed test
- Posted by Igor Kachan <kinz at peterlink.ru> Sep 04, 2001
- 457 views
Hello Ricardo, > I'm afraid I don't understand what do you call > "vertical slicing". If one uses parallel sequences, > let's say x, y, z, then there is only one way to > refer to each element of these, namely x[i], etc. > Please give an example of what you mean. This case is described in refman.doc file. See please below: --program vert.ex sequence a,c a={{01, 02, 03, 04}, --> row 1 {05, 06, 07, 08}, --> row 2 {09, 10, 11, 12}, --> row 3 {13, 14, 15, 16}} --> row 4 -- 1 2 3 4 <-- columns 1..4 ? a[3][2..3] -- this is a simple expression for any row function b(sequence s, integer n) sequence v v=repeat(0,length(s)) for i=1 to length(s) do v[i]=s[i][n] end for return v end function c=b(a,3) -- but to take a column you must write ? c [3..4] -- your own function. -- this is a 'vertical slicing problem' -- in Euphoria function d(sequence s, integer n, integer m, integer l) sequence v v=repeat(0,length(s)) for i=1 to length(s) do v[i]=s[i][n] end for return v[m..l] end function ? d(a,3,3,4)-- this complicated expression for columns -- has 10 elements -- but simple one for rows has same 10 elements, -- see above -- end of program Maybe, these functions above are useful too, use if so. Regards, Igor Kachan kinz at peterlink.ru