the C interface for max More...

All Elements

Parameters
[out]countScalar and on host
[in]numelThe number of elements in the vector.
[in]matThe input stream
afError af_max_vector_S (float *h_dst, unsigned numel, const float *d_src)
 Maximum value of a single precision vector. More...
 
afError af_max_vector_B (bool *h_dst, unsigned numel, const bool *d_src)
 Maximum value of a boolean vector. More...
 
afError af_max_vector_I (int *h_dst, unsigned numel, const int *d_src)
 Maximum value of a 32-bit signed integer vector. More...
 
afError af_max_vector_U (unsigned *h_dst, unsigned numel, const unsigned *d_src)
 Maximum value of a 32-bit unsigned integer vector. More...
 
afError af_max_vector_C (cfloat *h_dst, unsigned numel, const cfloat *d_src)
 Maximum value of a single precision, complex vector. More...
 
afError af_max_vector_D (double *h_dst, unsigned numel, const double *d_src)
 Maximum value of a double precision vector. More...
 
afError af_max_vector_Z (cdouble *h_dst, unsigned numel, const cdouble *d_src)
 Maximum value of a double precision, complex vector. More...
 
afError af_imax_vector_S (float *h_dst, int *h_idx, unsigned numel, const float *d_src, bool is_baseone=false)
 Indexed maximum value of a single precision vector. More...
 
afError af_imax_vector_I (int *h_dst, int *h_idx, unsigned numel, const int *d_src, bool is_baseone=false)
 Indexed maximum value of a 32-bit signed integer vector. More...
 
afError af_imax_vector_U (unsigned *h_dst, int *h_idx, unsigned numel, const unsigned *d_src, bool is_baseone=false)
 Indexed maximum value of a 32-bit unsigned integer vector. More...
 
afError af_imax_vector_B (bool *h_dst, int *h_idx, unsigned numel, const bool *d_src, bool is_baseone=false)
 Indexed maximum value of a boolean vector. More...
 
afError af_imax_vector_C (cfloat *h_dst, int *h_idx, unsigned numel, const cfloat *d_src, bool is_baseone=false)
 Indexed maximum value of a single precision, complex vector. More...
 
afError af_imax_vector_D (double *h_dst, int *h_idx, unsigned numel, const double *d_src, bool is_baseone=false)
 Indexed maximum value of a double precision vector. More...
 
afError af_imax_vector_Z (cdouble *h_dst, int *h_idx, unsigned numel, const cdouble *d_src, bool is_baseone=false)
 Indexed maximum value of a double precision, complex vector. More...
 

Along a Dimension

Parameters
[out]countvector and on device
[in]numelThe number of elements in the vector.
[in]matThe input stream
[in]batchThe number of input tiles.
afError af_max_S (float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
 Maximum value along a dimension in single precision matrix. More...
 
afError af_max_B (bool *d_dst, unsigned ndims, const unsigned *dims, const bool *d_src, int dim)
 Maximum value along a dimension in boolean matrix. More...
 
afError af_max_I (int *d_dst, unsigned ndims, const unsigned *dims, const int *d_src, int dim)
 Maximum value along a dimension in 32-bit signed integer matrix. More...
 
afError af_max_U (unsigned *d_dst, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim)
 Maximum value along a dimension in 32-bit unsigned integer matrix. More...
 
afError af_max_C (cfloat *d_dst, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim)
 Maximum value along a dimension in single precision, complex matrix. More...
 
afError af_max_D (double *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
 Maximum value along a dimension in double precision matrix. More...
 
afError af_max_Z (cdouble *d_dst, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim)
 Maximum value along a dimension in double precision, complex matrix. More...
 
afError af_imax_S (float *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const float *d_src, int dim, bool is_baseone=false)
 Indexed maximum value along a dimension in single precision matrix. More...
 
afError af_imax_I (int *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const int *d_src, int dim, bool is_baseone=false)
 Indexed maximum value along a dimension in 32-bit signed integer matrix. More...
 
afError af_imax_U (unsigned *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const unsigned *d_src, int dim, bool is_baseone=false)
 Indexed maximum value along a dimension in 32-bit signed integer matrix. More...
 
afError af_imax_B (bool *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const bool *d_src, int dim, bool is_baseone=false)
 Indexed maximum value along a dimension in boolean matrix. More...
 
afError af_imax_C (cfloat *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const cfloat *d_src, int dim, bool is_baseone=false)
 Indexed maximum value along a dimension in single precision, cplx matrix. More...
 
afError af_imax_D (double *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const double *d_src, int dim, bool is_baseone=false)
 Indexed maximum value along a dimension in double precision matrix. More...
 
afError af_imax_Z (cdouble *d_dst, int *d_idx, unsigned ndims, const unsigned *dims, const cdouble *d_src, int dim, bool is_baseone=false)
 Indexed maximum value along a dimension in double precision, cplx matrix. More...
 

Detailed Description

the C interface for max

Returns the maximum value of an array, or if specified, the
maximum value of each dimension of the array. Max can also
return the indices (0-based) where these elements are located.
int hx[] = { -3, -5, 2, -9 };
// hx = -3 2
// -5 -9
array x(2,2, hx); // 2x2 matrix
float value;
int index;
max(&value, &index, x);
printf("%g,%d\n", value, index)); // 2,2

Return the maximum regardless of dimension:

int hx[] = { -3, -5, 2, -9 };
array x1(2,2, hx); // 2x2 matrix
array x2(4,1, hx); // 4x1 vector
printf("%d,%d\n", max<int>(x1), max<int>(x2)); // 2, 2

Return maximum and indices along a given dimension

float ha[] = {1, 2, 3, 4};
array in = array(2, 2, ha);
// Storage for the results
array m, i;
// max along columns
max(m, i, in, 0);
print(m);
print(i);
// m = 2.0000 4.0000
// i = 1 1
// max along rows
max(m, i, in, 1);
print(m);
print(i);
// m = 3.0000
// 4.0000
// i = 1
// 1

Function Documentation

afError af_max_vector_S ( float *  h_dst,
unsigned  numel,
const float *  d_src 
)

Maximum value of a single precision vector.

afError af_max_vector_B ( bool *  h_dst,
unsigned  numel,
const bool *  d_src 
)

Maximum value of a boolean vector.

afError af_max_vector_I ( int *  h_dst,
unsigned  numel,
const int *  d_src 
)

Maximum value of a 32-bit signed integer vector.

afError af_max_vector_U ( unsigned *  h_dst,
unsigned  numel,
const unsigned *  d_src 
)

Maximum value of a 32-bit unsigned integer vector.

afError af_max_vector_C ( cfloat h_dst,
unsigned  numel,
const cfloat d_src 
)

Maximum value of a single precision, complex vector.

afError af_max_vector_D ( double *  h_dst,
unsigned  numel,
const double *  d_src 
)

Maximum value of a double precision vector.

afError af_max_vector_Z ( cdouble h_dst,
unsigned  numel,
const cdouble d_src 
)

Maximum value of a double precision, complex vector.

afError af_imax_vector_S ( float *  h_dst,
int *  h_idx,
unsigned  numel,
const float *  d_src,
bool  is_baseone = false 
)

Indexed maximum value of a single precision vector.

afError af_imax_vector_I ( int *  h_dst,
int *  h_idx,
unsigned  numel,
const int *  d_src,
bool  is_baseone = false 
)

Indexed maximum value of a 32-bit signed integer vector.

afError af_imax_vector_U ( unsigned *  h_dst,
int *  h_idx,
unsigned  numel,
const unsigned *  d_src,
bool  is_baseone = false 
)

Indexed maximum value of a 32-bit unsigned integer vector.

afError af_imax_vector_B ( bool *  h_dst,
int *  h_idx,
unsigned  numel,
const bool *  d_src,
bool  is_baseone = false 
)

Indexed maximum value of a boolean vector.

afError af_imax_vector_C ( cfloat h_dst,
int *  h_idx,
unsigned  numel,
const cfloat d_src,
bool  is_baseone = false 
)

Indexed maximum value of a single precision, complex vector.

afError af_imax_vector_D ( double *  h_dst,
int *  h_idx,
unsigned  numel,
const double *  d_src,
bool  is_baseone = false 
)

Indexed maximum value of a double precision vector.

afError af_imax_vector_Z ( cdouble h_dst,
int *  h_idx,
unsigned  numel,
const cdouble d_src,
bool  is_baseone = false 
)

Indexed maximum value of a double precision, complex vector.

afError af_max_S ( float *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const float *  d_src,
int  dim 
)

Maximum value along a dimension in single precision matrix.

afError af_max_B ( bool *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const bool *  d_src,
int  dim 
)

Maximum value along a dimension in boolean matrix.

afError af_max_I ( int *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const int *  d_src,
int  dim 
)

Maximum value along a dimension in 32-bit signed integer matrix.

afError af_max_U ( unsigned *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const unsigned *  d_src,
int  dim 
)

Maximum value along a dimension in 32-bit unsigned integer matrix.

afError af_max_C ( cfloat d_dst,
unsigned  ndims,
const unsigned *  dims,
const cfloat d_src,
int  dim 
)

Maximum value along a dimension in single precision, complex matrix.

afError af_max_D ( double *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const double *  d_src,
int  dim 
)

Maximum value along a dimension in double precision matrix.

afError af_max_Z ( cdouble d_dst,
unsigned  ndims,
const unsigned *  dims,
const cdouble d_src,
int  dim 
)

Maximum value along a dimension in double precision, complex matrix.

afError af_imax_S ( float *  d_dst,
int *  d_idx,
unsigned  ndims,
const unsigned *  dims,
const float *  d_src,
int  dim,
bool  is_baseone = false 
)

Indexed maximum value along a dimension in single precision matrix.

afError af_imax_I ( int *  d_dst,
int *  d_idx,
unsigned  ndims,
const unsigned *  dims,
const int *  d_src,
int  dim,
bool  is_baseone = false 
)

Indexed maximum value along a dimension in 32-bit signed integer matrix.

afError af_imax_U ( unsigned *  d_dst,
int *  d_idx,
unsigned  ndims,
const unsigned *  dims,
const unsigned *  d_src,
int  dim,
bool  is_baseone = false 
)

Indexed maximum value along a dimension in 32-bit signed integer matrix.

afError af_imax_B ( bool *  d_dst,
int *  d_idx,
unsigned  ndims,
const unsigned *  dims,
const bool *  d_src,
int  dim,
bool  is_baseone = false 
)

Indexed maximum value along a dimension in boolean matrix.

afError af_imax_C ( cfloat d_dst,
int *  d_idx,
unsigned  ndims,
const unsigned *  dims,
const cfloat d_src,
int  dim,
bool  is_baseone = false 
)

Indexed maximum value along a dimension in single precision, cplx matrix.

afError af_imax_D ( double *  d_dst,
int *  d_idx,
unsigned  ndims,
const unsigned *  dims,
const double *  d_src,
int  dim,
bool  is_baseone = false 
)

Indexed maximum value along a dimension in double precision matrix.

afError af_imax_Z ( cdouble d_dst,
int *  d_idx,
unsigned  ndims,
const unsigned *  dims,
const cdouble d_src,
int  dim,
bool  is_baseone = false 
)

Indexed maximum value along a dimension in double precision, cplx matrix.