Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10709

Re: An easier functional way to divide each Column of matrix by a

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!nx02.iad01.newshosting.com!newshosting.com!newspump.sol.net!post2.nntp.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail
From "Nasser M. Abbasi" <nma@12000.org>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: An easier functional way to divide each Column of matrix by a
Date Sun, 1 Jul 2012 06:04:48 +0000 (UTC)
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Sender steve@smc.vnet.net
Approved Steven M. Christensen <steve@smc.vnet.net>, Moderator
Message-ID <jsopa0$os$1@smc.vnet.net> (permalink)
References <jsmg8v$1k2$1@smc.vnet.net>
Reply-To nma@12000.org
Lines 43
NNTP-Posting-Date 01 Jul 2012 06:09:31 GMT
NNTP-Posting-Host 55f9191e.news.twtelecom.net
X-Trace DXC=Elj0BUaVgSbdC]6\m4AY8lC_A=>8kQj6m;[h;PUXBgbd4FCn;b5K>9gEFiONJ7[Gofcj1nBTZeJ1k
X-Complaints-To abuse@twtelecom.net
Xref csiph.com comp.soft-sys.math.mathematica:10709

Show key headers only | View raw


On 6/30/2012 4:18 AM, Ray Koopman wrote:

> What's "unnatural" is that there is no convenient way
>  to operate on the columns of a matrix, as opposed to the rows.

Yes. Also some functions support an argument which
can be used to tell it to do things 'row-wise' vs.
'column-wise'

(sorry, I am using Matrix terms here, but for me, this is
more natural).

For example, if A,B are matrices, and we wanted to join them
side-by-side (i.e. column wise):

Join[A,B,2]

To join them on top of each others (i.e. stack them, row-wise),

Join[A,B,1]

Another example. Given Matrix A and to find the Total
of all the rows (i.e row-wise), then the command is

Total[A,{2}]

and to find the total of all the columns

Total[A,{1}]

So, some commands do not require Transpose as they have
an option to tell it 'which way' to do things.

> Tranposing to make
> the columns rows, operating on the rows, and then re-transposing may
> seem awkward, but it's fast, especially if mat has many rows.

I think Mathematica is definitely biased towards rows. I think
the original designers of Mathematica liked rows much more
than columns :)

--Nasser

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: An easier functional way to divide each Column of matrix by a row vector, element-wise? Ray Koopman <koopman@sfu.ca> - 2012-06-30 09:18 +0000
  Re: An easier functional way to divide each Column of matrix by a "Nasser M. Abbasi" <nma@12000.org> - 2012-07-01 06:04 +0000

csiph-web