From: Dominique O. <dom...@gm...> - 2009-10-24 22:13:22
|
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 |