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

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 2012-07-01 06:04 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jsopa0$os$1@smc.vnet.net> (permalink)
References <jsmg8v$1k2$1@smc.vnet.net>

Show all headers | 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