[Date Index]
[Thread Index]
[Author Index]
Re: An easier functional way to divide each Column of matrix by a
*To*: mathgroup at smc.vnet.net
*Subject*: [mg127108] Re: An easier functional way to divide each Column of matrix by a
*From*: "Nasser M. Abbasi" <nma at 12000.org>
*Date*: Sun, 1 Jul 2012 02:05:04 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*References*: <jsmg8v$1k2$1@smc.vnet.net>
*Reply-to*: nma at 12000.org
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
Next by Date:
**Re: Rearranging terms - user-defined**
Next by thread:
**Re: An easier functional way to divide each Column of matrix by a**
| |