[Numpy-discussion] Re: Using new numeric instances in NumArray and RecArray.

Ivan Vilata i Balaguer ivilata at carabos.com
Tue Dec 14 09:51:00 EST 2004

On Mon, Dec 13, 2004 at 12:39:29PM +0100, Ivan Vilata i Balaguer wrote:
>   Hi all!  I am trying to define new numeric types to use them in
>   NumArray and RecArray objects.
> [...]

  Hello again.  I have started to code a subclass of RecArray to map
  custom instance types (MyInt32) to standard Numarray instance types
  (Int32).  The task seems plausible once numarray.typeDict,
  numarray.records.numfmt and numarray.records.revfmt are tailored to
  support the new types.  Translating a format specification like
  formats='1MyInt32,(2,3)f8' to formats='1Int32,(2,3)f8' looks hard but
  it is a question of time.

      However, I have come across the fact that the constructors for
  NumArray and RecArray are seldom used directly.  Instead, functions
  like numarray.array() and numarray.records.array() are used.  These
  make heavy transformations on their arguments and then create new
  {Num,Rec}Array objects.  This fact makes using classes different to
  {Num,Rec}Array very difficult, even more when using different
  signatures for their constructors.

      One solution is redefining the aforementioned functions to use
  custom classes.  However, this looks cumbersome and not a simple task,
  but it seems to me the only way to keep the numarray interface.

      So I will try to implement those new types around Numarray instead
  of at the same level.  Well, this was my report on my attempt to
  define new Numarray types!

  Thank you again for your suggestions.  Best wishes,

import disclaimer
Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
       Cárabos Coop. V.  V  V   Enjoy Data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20041214/fe46e05d/attachment-0001.sig>

More information about the NumPy-Discussion mailing list