IdentifiantMot de passe
Mot de passe oublié ?Je m'inscris ! (gratuit)
21.2 Properties shared by all functions

21.2 Properties shared by all functions

All functions share some common properties. Notably, all functions allow the specification of an output array with the output argument. With this argument you can specify an array that will be changed in-place with the result with the operation. In this case the result is not returned. Usually, using the output argument is more efficient, since an existing array is used to store the result.

The type of arrays returned is dependent on the type of operation, but it is in most cases equal to the type of the input. If, however, the output argument is used, the type of the result is equal to the type of the specified output argument. If no output argument is given, it is still possible to specify what the result of the output should be. This is done by simply assigning the desired numarray type object to the output argument. For example:

>>> print correlate(arange(10), [1, 2.5])
[ 0  2  6  9 13 16 20 23 27 30]
>>> print correlate(arange(10), [1, 2.5], output = Float64)
[  0.    2.5   6.    9.5  13.   16.5  20.   23.5  27.   30.5]
Note: In previous versions of numarray.nd_image, some functions accepted the output_type argument to achieve the same effect. This argument is still supported, but its use will generate an deprecation warning. In a future version all instances of this argument will be removed. The preferred way to specify an output type, is by using the output argument, either by specifying an output array of the desired type, or by specifying the type of the output that is to be returned.
Send comments to the NumArray community.