A high-performance general-purpose compute library

Multiply array elements over a given dimension. More...

Functions

array product (const array &in, const int dim=-1)
 C++ Interface to multiply array elements over a given dimension.
 
array product (const array &in, const int dim, const double nanval)
 C++ Interface to multiply array elements over a given dimension, replacing any NaNs with a specified value.
 
template<typename T >
product (const array &in)
 C++ Interface to multiply array elements over the first non-singleton dimension.
 
template<typename T >
product (const array &in, double nanval)
 C++ Interface to multiply array elements over the first non-singleton dimension, replacing any NaNs with a specified value.
 
af_err af_product (af_array *out, const af_array in, const int dim)
 C Interface to multiply array elements over a given dimension.
 
af_err af_product_all_array (af_array *out, const af_array in)
 C Interface to multiply array elements over all dimensions.
 
af_err af_product_nan (af_array *out, const af_array in, const int dim, const double nanval)
 C Interface to multiply array elements over a given dimension, replacing any NaNs with a specified value.
 
af_err af_product_nan_all_array (af_array *out, const af_array in, const double nanval)
 C Interface to multiply array elements over all dimensions, replacing any NaNs with a specified value.
 
af_err af_product_all (double *real, double *imag, const af_array in)
 C Interface to multiply array elements over all dimensions.
 
af_err af_product_nan_all (double *real, double *imag, const af_array in, const double nanval)
 C Interface to multiply array elements over all dimensions, replacing any NaNs with a specified value.
 
AFAPI array mul (const array &in, const int dim=-1)
 C++ Interface to multiply array elements over a given dimension.
 
template<typename T >
mul (const array &in)
 C++ Interface to multiply array elements over the first non-singleton dimension.
 

Detailed Description

Multiply array elements over a given dimension.

This table defines output types for corresponding input types:

Input Type Output Type
f32, f64, c32, c64 same as input
s32, u32, s64, u64 same as input
s16 s32
u16, u8, b8 u32

This function runs across all batches in the input simultaneously.

Function Documentation

◆ af_product()

af_err af_product ( af_array * out,
const af_array in,
const int dim )

C Interface to multiply array elements over a given dimension.

Parameters
[out]outproduct
[in]ininput array
[in]dimdimension along which the product occurs
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_product_all()

af_err af_product_all ( double * real,
double * imag,
const af_array in )

C Interface to multiply array elements over all dimensions.

If in is real, imag will be set to zeros.

Parameters
[out]realproduct of all real components
[out]imagproduct of all imaginary components
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_product_all_array()

af_err af_product_all_array ( af_array * out,
const af_array in )

C Interface to multiply array elements over all dimensions.

Results in a single element af::array.

Parameters
[out]outproduct
[in]ininput array
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_product_nan()

af_err af_product_nan ( af_array * out,
const af_array in,
const int dim,
const double nanval )

C Interface to multiply array elements over a given dimension, replacing any NaNs with a specified value.

Parameters
[out]outproduct
[in]ininput array
[in]dimdimension along with the product occurs
[in]nanvalvalue that replaces NaNs
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_product_nan_all()

af_err af_product_nan_all ( double * real,
double * imag,
const af_array in,
const double nanval )

C Interface to multiply array elements over all dimensions, replacing any NaNs with a specified value.

If in is real, imag will be set to zeros.

Parameters
[out]realproduct of all real components
[out]imagproduct of all imaginary components
[in]ininput array
[in]nanvalvalue that replaces NaNs
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ af_product_nan_all_array()

af_err af_product_nan_all_array ( af_array * out,
const af_array in,
const double nanval )

C Interface to multiply array elements over all dimensions, replacing any NaNs with a specified value.

Parameters
[out]outproduct
[in]ininput array
[in]nanvalvalue that replaces NaNs
Returns
AF_SUCCESS, if function returns successfully, else an af_err code is given

◆ mul() [1/2]

template<typename T >
T mul ( const array & in)

C++ Interface to multiply array elements over the first non-singleton dimension.

Parameters
[in]ininput array
Returns
product
Deprecated
Use product instead

◆ mul() [2/2]

AFAPI array mul ( const array & in,
const int dim = -1 )

C++ Interface to multiply array elements over a given dimension.

Parameters
[in]ininput array
[in]dimdimension along which the product occurs, -1 denotes the first non-singleton dimension
Returns
product
Deprecated
Use product instead

◆ product() [1/4]

template<typename T >
T product ( const array & in)

C++ Interface to multiply array elements over the first non-singleton dimension.

Parameters
[in]ininput array
Returns
product

◆ product() [2/4]

array product ( const array & in,
const int dim,
const double nanval )

C++ Interface to multiply array elements over a given dimension, replacing any NaNs with a specified value.

Parameters
[in]ininput array
[in]dimdimension along which the product occurs
[in]nanvalvalue that replaces NaNs
Returns
product

◆ product() [3/4]

array product ( const array & in,
const int dim = -1 )

C++ Interface to multiply array elements over a given dimension.

Parameters
[in]ininput array
[in]dimdimension along which the product occurs, -1 denotes the first non-singleton dimension
Returns
product

◆ product() [4/4]

template<typename T >
T product ( const array & in,
double nanval )

C++ Interface to multiply array elements over the first non-singleton dimension, replacing any NaNs with a specified value.

Parameters
[in]ininput array
[in]nanvalvalue that replaces NaNs
Returns
product