Create an identity array with diagonal values 1. More...

Functions

AFAPI array identity (const dim4 &dims, const dtype ty=f32)
 
AFAPI array identity (const dim_t d0, const dtype ty=f32)
 
AFAPI array identity (const dim_t d0, const dim_t d1, const dtype ty=f32)
 
AFAPI array identity (const dim_t d0, const dim_t d1, const dim_t d2, const dtype ty=f32)
 
AFAPI array identity (const dim_t d0, const dim_t d1, const dim_t d2, const dim_t d3, const dtype ty=f32)
 
AFAPI af_err af_identity (af_array *out, const unsigned ndims, const dim_t *const dims, const af_dtype type)
 

Detailed Description

Create an identity array with diagonal values 1.

array a = identity(5, 3);
// a [5 3 1 1]
// 1.0000 0.0000 0.0000
// 0.0000 1.0000 0.0000
// 0.0000 0.0000 1.0000
// 0.0000 0.0000 0.0000
// 0.0000 0.0000 0.0000

Function Documentation

AFAPI af_err af_identity ( af_array out,
const unsigned  ndims,
const dim_t *const  dims,
const af_dtype  type 
)
Parameters
[out]outis the generated array
[in]ndimsis size of dimension array dims
[in]dimsis the array containing sizes of the dimension
[in]typeis the type of array to generate
AFAPI array af::identity ( const dim4 dims,
const dtype  ty = f32 
)
Parameters
[in]dimsis dim4 for size of all dimensions
[in]tyis the type of array to generate
Returns
an identity array of specified dimension and type
Examples:
lin_algebra/cholesky.cpp.
AFAPI array af::identity ( const dim_t  d0,
const dtype  ty = f32 
)
Parameters
[in]d0is size of first dimension
[in]tyis the type of array to generate
Returns
an identity array of specified dimension and type
AFAPI array af::identity ( const dim_t  d0,
const dim_t  d1,
const dtype  ty = f32 
)
Parameters
[in]d0is size of first dimension
[in]d1is size of second dimension
[in]tyis the type of array to generate
Returns
an identity array of specified dimension and type
AFAPI array af::identity ( const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const dtype  ty = f32 
)
Parameters
[in]d0is size of first dimension
[in]d1is size of second dimension
[in]d2is size of third dimension
[in]tyis the type of array to generate
Returns
an identity array of specified dimension and type
AFAPI array af::identity ( const dim_t  d0,
const dim_t  d1,
const dim_t  d2,
const dim_t  d3,
const dtype  ty = f32 
)
Parameters
[in]d0is size of first dimension
[in]d1is size of second dimension
[in]d2is size of third dimension
[in]d3is size of fourth dimension
[in]tyis the type of array to generate
Returns
an identity array of specified dimension and type