On Sat, Jun 6, 2009 at 02:01, Fernando Perez <fperez....@gmail.com> wrote: > Howdy, > > I'm finding myself often having to index *into* arrays to set values. > As best I can see, in numpy functions/methods like diag or tri{u,l} > provide for the extraction of values from arrays, but I haven't found > their counterparts for generating the equivalent indices. > > Their implementations are actually quite trivial once you think of it, > but I wonder if there's any benefit in having this type of machinery > in numpy itself. I had to think of how to do it more than once, so I > ended up writing up a few utilities for it. > > Below are my naive versions I have for internal use. If there's any > interest, I'm happy to document them to compliance as a patch.
+1 diag_indices() can be made more efficient, but these are fine. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion