Re: sparse matrix question
- To: mathgroup at smc.vnet.net
- Subject: [mg56155] Re: sparse matrix question
- From: Peter Pein <petsie at arcor.de>
- Date: Sun, 17 Apr 2005 03:06:59 -0400 (EDT)
- References: <d3lrsq$sef$1@smc.vnet.net> <200504150847.EAA11518@smc.vnet.net> <d3qh7j$odd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ted Sariyski wrote:
> Hi,
>
> I have a list
> l={{a,b},{c,d},{e,f}}
> and a list of pointers to the non-zero columns of a
> sparse matrix e.g. p={3,4,6}:
>
> | 0 0 a c 0 d 0 ... |
> m= | |
> | 0 0 b d 0 e 0 ... |
>
> What is the best way to do this? How can I address a column in
> mathematica?
>
> Thanks,
> Ted
>
>
>
>
m = {{0, 0, 0, a, c, 0, d, 0, andsoon},
{0, 0, 0, b, d, 0, e, 0, more}};
In[2]:= m[[All,4]]
Out[2]= {a, b}
In[3]:= m[[All,#]]& /@ Range[Min[Length /@ m]]
Out[3]= {{0, 0}, {0, 0}, {0, 0}, {a, b},
{c, d}, {0, 0}, {d, e}, {0, 0},
{andsoon, more}}
--
Peter Pein
Berlin
- References:
- Re: Wierd problems with Mathematica - inversion of a 12x12 matrix
- From: David Bailey <dave@Remove_Thisdbailey.co.uk>
- Re: Wierd problems with Mathematica - inversion of a 12x12 matrix