[racket] How to iterate through the arrays in a matrix?

From: Alexander D. Knauth (alexander at knauth.org)
Date: Fri Nov 28 17:10:01 EST 2014

Would something like this work?:
(matrix-map-rows
 (lambda (row)
   (matrix- row arr))
 final-data-matrix)

http://docs.racket-lang.org/math/matrix_poly.html?q=matrix%20row%20map#%28def._%28%28lib._math%2Fmatrix..rkt%29._matrix-map-rows%29%29

On Nov 28, 2014, at 4:56 PM, Animesh Pandey <animeshpandey.etno at gmail.com> wrote:

> (map 
>  (λ(i) 
>    (matrix- 
>     (list->matrix 1 4 i) 
>     (list->matrix 1 4 arr))) 
>  final-data)
> 
> I used this method where final-data is a list of lists and I iterate through each list, convert it to a matrix and then subtract a pre-defined constant list to it. What I really need is a way to iterate through a matrix and not a list of lists as I have do to a lot of matrix operations.
> 
> 
> On Fri, Nov 28, 2014 at 4:41 PM, Animesh Pandey <animeshpandey.etno at gmail.com> wrote:
> Hi,
> I have a 80 X 4 matrix. I have iterate through each row and subtract each row with another array at each iteration. At first I thought to convert all array to list and do all the operations and then again convert the final list if lists to a matrix. But I somehow think that is not a suited way. I tried using "for*/matrix" but could not get it right. Could any one give an example on how to iterate a matrix (array for arrays)?
> 
> My matrix looks like this:
> > (list*->matrix final-data)
> (array
>  #[#[5.1 3.5 1.4 0.2]
>    #[4.9 3.0 1.4 0.2]
>    #[4.7 3.2 1.3 0.2]
>    #[4.6 3.1 1.5 0.2]
>    #[5.0 3.6 1.4 0.2]
>    #[5.4 3.9 1.7 0.4]
>    #[4.6 3.4 1.4 0.3]
>    #[5.0 3.4 1.5 0.2]
>    #[4.4 2.9 1.4 0.2]
>    #[4.9 3.1 1.5 0.1]
> ...........
> 
> Thanks!
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141128/2e6a9602/attachment.html>

Posted on the users mailing list.