From: <mv...@uv...> - 2009-10-25 03:57:37
|
> On Sat, Oct 24, 2009 at 5:02 PM, <mv...@uv...> wrote: >> Hi, >> >> I was wondering if there is an easy way to extend or reshape a matrix. >> >> For example... >> If I had a vector of length 10000 (shape=(1,10000)), then wanted to >> insert >> a new element at position 11000 without creating an entirely new vector >> to >> store it. >> >> I've looked at the Docs, and messed around with the package but was >> unable >> to find a simple way to do this. Â Any tips would be appreaciated. >> >> Thanks, >> Matt > > Hi Matt, > > Currently there is no provision for reshaping, clipping or expanding > matrices in PySparse. I can only imagine doing this efficiently on > matrices in linked-list format. There are essentially two ways to > implement it: by adding methods at C level in ll_mat.c, or by > expanding/subclassing the high-level PysparseMatrix class. If you > decide to have a stab at it, I suggest the second avenue first, > although I am not sure at this point that it is doable without getting > your hands dirty in the C code. > > Are you in a situation where you don't know your problem size beforehand? > > -- > Dominique > > Hey Dominique, Thanks for the quick reply. No, for most of this application I will not know the size of the problem before hand. I think I can still do it, it will just require a change in my thinking and program flow. If I do endup needing this feature(or it just makes it way simpler) I'll gladly hack away at the c code to make it work and share any changes. Thanks, MV |