# [racket] Matrix Row/Col Ops

 From: Ray Racine (ray.racine at gmail.com) Date: Tue May 7 12:22:05 EDT 2013 Previous message: [racket] [books] HtDP and Realm of Racket Next message: [racket] Matrix Row/Col Ops Messages sorted by: [date] [thread] [subject] [author]

```First of all I've started using some of the new math and prob stuff "for
real" and it's all fantastic work.  Thank you.

Was looking for a routine for sums of a matrix along the either the rows or
cols axis.

See http://docs.scipy.org/doc/numpy/reference/generated/numpy.sum.html

I didn't notice anything but looks straightforward with
matrix-map-rows/cols or similar.  As I started one thing I noticed was the
treatment of Matrix Rows and Cols as themselves a Matrix and not as a flat
Array.

> matrix-row
- : (All (A) ((Array A) Integer -> (Array A)))
#<procedure:matrix-row>
> (matrix-row m 0)
- : (Array Positive-Byte)
(array #[#[1 2]])

In lieu of (array #[#[1 2]]) I would have expected (array #[1 2]).   In
other words, a row or column of a matrix is a row or column vector.

in fact currently

> (matrix-row (matrix-row (matrix-row (matrix-row m 0) 0) 0) 0)
- : (Array Positive-Byte)
(array #[#[1 2]])

What is the advantage of current approach?

Thanks,

Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130507/b753f85a/attachment.html>
```

 Posted on the users mailing list. Previous message: [racket] [books] HtDP and Realm of Racket Next message: [racket] Matrix Row/Col Ops Messages sorted by: [date] [thread] [subject] [author]