[SciPy-user] blitz question (slightly off-topic)

Stefan van der Walt stefan at sun.ac.za
Mon Aug 29 08:12:01 CDT 2005

Hi All,

This question is slightly off-topic -- I apologise.  I cannot contact
the Blitz-developers, and hope that someone on this list is
knowledgeable enough to help out.

The type in question is, of course, a Numeric array.  I convert from
Numeric arrays to Blitz matrices without problems, but the other way
around poses problems.

Thanks in advance.

From: Stefan van der Walt <stefan at sun.ac.za>
To: blitz-support at lists.sf.net
Subject: hijacking an array


I am trying to export a Blitz Array to another library's array type.
To do that (without copying data), I need to grab access to the
Array's data, and then destroy the original Array object.  Something

Take a Blitz Array and "stick 'em up":

1. Tell me where you keep your data (in a non-const non-restricted
2. Run, leaving your data here with me.

Or in pseudo-code

otherobj convert_to_otherobj(Array<double, 2> M&)
    otherobj.data_p = M.unrestricted_data();
    // set otherobj size etc.

    return otherobj;

// M goes out of scope and gets destroyed, but data is left behind

Can someone please tell me how to accomplish this?  Or describe a
better way of doing this?


More information about the SciPy-user mailing list