[Numpy-discussion] NA_ReturnOutput question

Todd Miller jmiller at stsci.edu
Tue Sep 9 06:04:10 EDT 2003


On Mon, 2003-09-08 at 11:34, Peter Verveer wrote:
> The documentation states that NA_ReturnOutput(numarray, shadow) should be used 
> with the value returned by NA_OptionalOutputArray() for the shadow parameter. 

The purpose of NA_OptionalOutputArray() and NA_ReturnOutput() is to
support an optional output parameter and return value with a couple
specific behaviors:

1. If no output array is specified to the function (it is left defaulted
to None), then the function makes up an output array by cloning it
(shape and type) from some 'master' array.  The output array is returned
as the result of the function.

2. If an output array is specified, then it may still need to be
"shadowed" to correctly match the type, byteswap, and alignment
requirements specified for the function.  When a shadow output is
created,  it is used in all of the real calculations and then copied
back onto the original array and deallocated at function exit.  The
function returns None.

> Is it also possible to use a shadow array allocated otherwise, e.g. by 
> NA_NewArray()?

I don't think so.  It is however possible to return an array allocated
by NA_NewArray() as-is.  

> 
> Cheers, Peter
> 
> -- 
> Dr. Peter J. Verveer
> Cell Biology and Cell Biophysics Programme
> EMBL
> Meyerhofstrasse 1
> D-69117 Heidelberg
> Germany
> Tel. : +49 6221 387245
> Fax  : +49 6221 387242
> Email: Peter.Verveer at embl-heidelberg.de
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
-- 
Todd Miller 			jmiller at stsci.edu
STSCI / ESS / SSB





More information about the NumPy-Discussion mailing list