dla.h File Reference

(2014-04-30 15:38:09 -0400, (build fd32605))

#include "defines.h"

Go to the source code of this file.

Namespaces

 af
 

Enumerations

enum  af_solve_t {
  af_solve_none = 0, af_solve_posdef = 1, af_solve_nonposdef = 2, af_solve_gaussian = 3,
  af_solve_pseudo = 4, af_solve_ctrans = 256, af_solve_trans = 512, af_solve_uppertri = 1024,
  af_solve_lowertri = 2048, af_solve_tridiag = 4096, af_solve_blkdiag = 8192
}
 

Functions

array lu (const array &in)
 LU factorization (packed). More...
 
void lu (array &lower, array &upper, const array &in)
 LU factorization. More...
 
void lu (array &lower, array &upper, array &pivot, const array &in)
 LU factorization (with pivoting). More...
 
array qr (const array &in)
 QR factorization (packed). More...
 
void qr (array &q, array &r, const array &in)
 QR factorization. More...
 
void qr (array &q, array &r, array &tau, const array &in)
 QR factorization with tau. More...
 
array cholesky (const array &X, bool is_upper=true)
 Cholesky decomposition ("Y^T * Y == X"). More...
 
array cholesky (unsigned &info, const array &X, bool is_upper=true)
 Cholesky decomposition ("Y^T * Y == X"). More...
 
array hessenberg (const array &in)
 Hessenberg matrix form. More...
 
void hessenberg (array &h, array &q, const array &in)
 Hessenberg matrix h with unitary permutation matrix q. More...
 
array eigen (const array &in, bool is_diag=false)
 Compute eigenvalues. More...
 
void eigen (array &values, array &vectors, const array &in)
 Eigenvalues and eigenvectors. More...
 
array svd (const array &in, bool is_diag=false)
 Singular values. More...
 
void svd (array &s, array &u, array &v, const array &in)
 Singular values with unitary bases: in = u * s * v. More...
 
array inverse (const array &in)
 Matrix inversion. More...
 
array matpow (const array &base, double exponent)
 Matrix power. More...
 
unsigned rank (const array &in, double tolerance=1e-5)
 Rank of matrix. More...
 
template<typename T >
T det (const array &in)
 Matrix determinant. More...
 
array solve (const array &A, const array &b, af_solve_t options=af_solve_none)
 Solve linear system. More...
 
Device pointer interface: lu Decomposition

See also Linear Algebra

Parameters
[out]d_pivArray of the pivot indices. Size: min(m, n)
[out]d_UThe upper triangular matrix. Size: size(min(m,n), n)
[in,out]d_LIf d_U isn't NULL, d_L (Size: (m, n)) contains lower triangular matrix. If d_U is NULL, d_L (First m x min(m,n) elements) contain the packed version of lu decomposition.
[in]mnumber of rows in the input
[in]nnumber of columns in the input
[in]batchNumber of tiles of input being handled.
afError af_lu_S (int *d_piv, float *d_U, float *d_L, unsigned m, unsigned n, unsigned batch)
 lu Decomposition on single precision data. No DLA license required. More...
 
afError af_lu_C (int *d_piv, cfloat *d_U, cfloat *d_L, unsigned m, unsigned n, unsigned batch)
 lu Decomposition on single precision, complex data. DLA license required. More...
 
afError af_lu_D (int *d_piv, double *d_U, double *d_L, unsigned m, unsigned n, unsigned batch)
 lu Decomposition on double precision data. DLA license required. More...
 
afError af_lu_Z (int *d_piv, cdouble *d_U, cdouble *d_L, unsigned m, unsigned n, unsigned batch)
 lu Decomposition on double precision, complex data. DLA license required. More...
 
Device pointer interface: qr decomposition

See also Linear Algebra

Parameters
[out]d_tauVector on device containing scalar factors. Size: min(m, n).
[out]d_RThe upper triangular matrix. Size: (k, n)
[in,out]d_QIf d_R isn't NULL, d_Q contains orthogonal matrix. Size: (m, k) if d_R is NULL, d_Q contains the packed version of qr decomposition. Size: (m, n)
[in]mnumber of rows in the input
[in]nnumber of columns in the input
[in]knumber of columns to be calculated in the orthogonal matrix.
[in]batchNumber of tiles of input being handled.
afError af_qr_S (float *d_tau, float *d_R, float *d_Q, unsigned m, unsigned n, unsigned k, unsigned batch)
 qr decomposition on single precision data. More...
 
afError af_qr_C (cfloat *d_tau, cfloat *d_R, cfloat *d_Q, unsigned m, unsigned n, unsigned k, unsigned batch)
 qr decomposition on single precision, complex data. DLA license required. More...
 
afError af_qr_D (double *d_tau, double *d_R, double *d_Q, unsigned m, unsigned n, unsigned k, unsigned batch)
 qr decomposition on double precision data. DLA license required. More...
 
afError af_qr_Z (cdouble *d_tau, cdouble *d_R, cdouble *d_Q, unsigned m, unsigned n, unsigned k, unsigned batch)
 qr decomposition on double precision, complex data. DLA license required. More...
 
Device pointer interface: Cholesky decomposition

See also Linear Algebra

Parameters
[out]d_RMatrix of Size: (n, n).
[in]nWidth of the input matrix d_A.
[in]d_AInput square matrix of width n.
[in]is_upperFlag to specify the format out the required output. d_R is upper triangular if is_upper is true. d_R is lower triangular if is_upper is false.
[in]batchNumber of tiles of input being handled.
afError af_cholesky_S (float *d_R, unsigned *info, unsigned n, const float *d_A, bool is_upper, unsigned batch)
 Cholesky decomposition, single precision data. No DLA license required. More...
 
afError af_cholesky_C (cfloat *d_R, unsigned *info, unsigned n, const cfloat *d_A, bool is_upper, unsigned batch)
 Cholesky decomposition, single precision complex data. DLA license required. More...
 
afError af_cholesky_D (double *d_R, unsigned *info, unsigned n, const double *d_A, bool is_upper, unsigned batch)
 Cholesky decomposition, double precision data. DLA license required. More...
 
afError af_cholesky_Z (cdouble *d_R, unsigned *info, unsigned n, const cdouble *d_A, bool is_upper, unsigned batch)
 Cholesky decomposition, double precision, complex data. DLA license required. More...
 
Device pointer interface: Hessenberg Matrix

See also Linear Algebra

Parameters
[out]d_HHessenberg matrix of input d_A
[out]d_QUnitary matrix such that d_A = d_Q * d_H * d_Q'
[in]nWidth of the input matrix d_A.
[in]d_AInput square matrix of width n.
[in]batchNumber of tiles of input being handled.
afError af_hessenberg_S (float *d_H, float *d_Q, unsigned n, const float *d_A, unsigned batch)
 Find the hessenberg matrix on single precision data. More...
 
afError af_hessenberg_C (cfloat *d_H, cfloat *d_Q, unsigned n, const cfloat *d_A, unsigned batch)
 Find the hessenberg matrix on single precision complex data. More...
 
afError af_hessenberg_D (double *d_H, double *d_Q, unsigned n, const double *d_A, unsigned batch)
 Find the hessenberg matrix on double precision data. More...
 
afError af_hessenberg_Z (cdouble *d_H, cdouble *d_Q, unsigned n, const cdouble *d_A, unsigned batch)
 Find the hessenberg matrix on double precision complex data. More...
 
Device pointer interface: Eigen vectors and Eigen values

See also Linear Algebra

Parameters
[out]d_ValThe output containing the eigen values of d_A. For real inputs, this is allocated internally based on the resulting complexity of output and is_imag indicates complexity, e.g. real-valued hermitial matrices produce real-valued eigen values while non-hermitian produce complex-valued eigen values.
[out]d_VecThe output containing the eigen vectors of d_A, or NULL if this is to be ignored (faster). For real inputs, this is allocated internally based on complexity of output and is_imag indicates complexity. For complex inputs, caller allocates. Pass NULL to avoid computing eigen vectors (faster).
[out]is_imagThe output format specifier for real inputs. If is_imag is true, the outputs are stored as cfloat or (cdouble). If is_imag is false, the outputs are stored as float (or double).
[in]nWidth of the input matrix d_A.
[in]d_AInput square matrix of width n.
[in]is_diagSpecifier of d_Val data structure. If is_diag is true, d_Val is a diagonal matrix. if is_diag is false, d_Val is a vector. is_diag can not be false if d_Vec is not NULL
[in]batchNumber of tiles of input being handled.
afError af_eigen_S (void **d_Val, void **d_Vec, bool *is_imag, unsigned n, const float *d_A, bool is_diag, unsigned batch)
 Eigen value decomposition of single precision input. More...
 
afError af_eigen_D (void **d_Val, void **d_Vec, bool *is_imag, unsigned n, const double *d_A, bool is_diag, unsigned batch)
 Eigen value decomposition of single precision complex input. More...
 
afError af_eigen_C (void **d_Val, cfloat *d_Vec, bool *is_imag, unsigned n, const cfloat *d_A, bool is_diag, unsigned batch)
 Eigen value decomposition of double precision input. More...
 
afError af_eigen_Z (void **d_Val, cdouble *d_Vec, bool *is_imag, unsigned n, const cdouble *d_A, bool is_diag, unsigned batch)
 Eigen value decomposition of double precision complex input. More...
 
Device pointer interface: Singular value decomposition

See also Linear Algebra

Parameters
[out]d_SThe output containing the singular of the input. if is_diag is false, d_S is a vector. if is_diag is true , d_S is a diagonal matrix. d_A = d_U * d_S * d_V'
[out]d_ULeft unitary Matrix
[out]d_VRight unitary Matrix
[in]jobUCan be one of 'A', 'O', 'S', 'N' similar to lapack
[in]jobVCan be one of 'A', 'O', 'S', 'N' similar to lapack
[in]mNumber of rows in the input.
[in]nNumber of columns in the input
[in]d_AThe input matrix.
[in]m_Number of rows required in the output.
[in]n_Number of columns required in the output.
[in]is_diagData structure specifier of input d_S. is_diag can not be false if d_U or d_V are not NULL
[in]batchNumber of tiles of input being handled.
afError af_svd_S (float *d_S, float *d_U, float *d_V, char jobU, char jobV, unsigned m, unsigned n, const float *d_A, unsigned m_, unsigned n_, bool is_diag, unsigned batch)
 Singular value decomposition on single precision input DLA license not required. More...
 
afError af_svd_C (float *d_S, cfloat *d_U, cfloat *d_V, char jobU, char jobV, unsigned m, unsigned n, const cfloat *d_A, unsigned m_, unsigned n_, bool is_diag, unsigned batch)
 Singular value decomposition on single precision complex input DLA license required. More...
 
afError af_svd_D (double *d_S, double *d_U, double *d_V, char jobU, char jobV, unsigned m, unsigned n, const double *d_A, unsigned m_, unsigned n_, bool is_diag, unsigned batch)
 Singular value decomposition on double precision input DLA license not required. More...
 
afError af_svd_Z (double *d_S, cdouble *d_U, cdouble *d_V, char jobU, char jobV, unsigned m, unsigned n, const cdouble *d_A, unsigned m_, unsigned n_, bool is_diag, unsigned batch)
 Singular value decomposition on double precision complex input DLA license not required. More...
 
Device pointer interface: Matrix inversion

See also Linear Algebra

Parameters
[out]d_outThe inverted matrix of d_in.
[in]nWidth of the input matrix.
[in,out]d_AThe input matrix. Inversion done in-place if d_out is NULL
[in]batchNumber of tiles of input being handled.
afError af_inverse_S (float *out, unsigned n, float *d_in, unsigned batch)
 Inversion of single precision matrix. DLA license required. More...
 
afError af_inverse_C (cfloat *out, unsigned n, cfloat *d_in, unsigned batch)
 Inversion of single precision complex matrix. DLA license required. More...
 
afError af_inverse_D (double *out, unsigned n, double *d_in, unsigned batch)
 Inversion of double precision matrix. DLA license required. More...
 
afError af_inverse_Z (cdouble *out, unsigned n, cdouble *d_in, unsigned batch)
 Inversion of double precision complex matrix. DLA license required. More...
 
Device pointer interface: Matrix determinant
Parameters
[out]resThe determinant of the input matrix d_X
[in]nWidth of the input matrix.
[in,out]d_XThe input matrix.
[in]inplaceInput data in d_X is destroyed if true.
[in]batchNumber of tiles of input being handled.
afError af_det_S (float *res, unsigned n, float *d_X, bool inplace, unsigned batch)
 Determinant of single precision matrix. DLA license not required. More...
 
afError af_det_C (cfloat *res, unsigned n, cfloat *d_X, bool inplace, unsigned batch)
 Determinant of single precision complex matrix. DLA license required. More...
 
afError af_det_D (double *res, unsigned n, double *d_X, bool inplace, unsigned batch)
 Determinant of double precision matrix. DLA license required. More...
 
afError af_det_Z (cdouble *res, unsigned n, cdouble *d_X, bool inplace, unsigned batch)
 Determinant of double precision complex matrix. DLA license required. More...
 
Device pointer interface: Matrix power

See also Linear Algebra

Parameters
[out]d_outd_out is the output containing pow(d_in, power)
[in]nWidth of the input matrix.
[in]d_inThe input matrix.
[in]powerThe exponent the input has to be raised to.
[in]batchNumber of tiles of input being handled.
[in]is_cplxTo signal if the output is real or complex
afError af_matrixPower_S (void **d_out, unsigned n, const float *d_in, float power, unsigned batch, bool *is_cplx)
 Matrix power for single precision matrix. More...
 
afError af_matrixPower_C (void **d_out, unsigned n, const cfloat *d_in, float power, unsigned batch, bool *is_cplx)
 Matrix power for single precision, complex matrix. DLA license required. More...
 
afError af_matrixPower_D (void **d_out, unsigned n, const double *d_in, double power, unsigned batch, bool *is_cplx)
 Matrix power for double precision matrix. DLA license required. More...
 
afError af_matrixPower_Z (void **d_out, unsigned n, const cdouble *d_in, double power, unsigned batch, bool *is_cplx)
 Matrix power for double precision, complex matrix. DLA license required. More...
 
Device pointer interface: Solving linear systems.

See also Linear Algebra

Parameters
[out]d_XSolution to the equation d_A * d_X = d_B.
[in]mNumber of rows in d_A.
[in]nNumber of columns in d_A, Number of rows in d_B.
[in]d_AThe co-efficient matrix.
[in]batch_AThe number of tiles of d_A being computed.
[in]kNumber of columns in d_B.
[in]d_BThe residual matrix.
[in]batch_BThe number of tiles of d_B being computed.
[in]optsGive specific information about the system.
optscombination (sum) of:
  • 0 for no information (solves using LU/CHOL for m == n, QR for m != n)
  • 1 if d_A is positive definite
  • 2 if d_A is not positive definite
  • 3 Use Gaussian elimination (fast, cannot be combined with other options)
  • 4 Use pseudo inverse (fast, cannot be combined with other options)
  • 256 to do conjugate transpose on d_A before solving
  • 512 to do transpose on d_A before solving
  • 1024 if d_A is Upper triangular
  • 2048 if d_A is Lower triangular
afError af_linearSolve_SS (float *d_X, unsigned m, unsigned n, const float *d_A, unsigned batch_A, unsigned k, const float *d_B, unsigned batch_B, unsigned opts)
 Solve a single precision system. DLA not required for opts = 0, 3. More...
 
afError af_linearSolve_CC (cfloat *d_X, unsigned m, unsigned n, const cfloat *d_A, unsigned batch_A, unsigned k, const cfloat *d_B, unsigned batch_B, unsigned opts)
 Solve a single precision complex system. DLA not required for opts = 3. More...
 
afError af_linearSolve_DD (double *d_X, unsigned m, unsigned n, const double *d_A, unsigned batch_A, unsigned k, const double *d_B, unsigned batch_B, unsigned opts)
 Solve a double precision system. DLA not required for opts = 3. More...
 
afError af_linearSolve_ZZ (cdouble *d_X, unsigned m, unsigned n, const cdouble *d_A, unsigned batch_A, unsigned k, const cdouble *d_B, unsigned batch_B, unsigned opts)
 Solve a double precision complex system. DLA not required for opts = 3. More...
 
Get original pivot indices

d_piv returned by af_lu_* contain indices from their updated locations.

af_piv_final gives the original locations of each of the pivots. See also Linear Algebra

Parameters
[out]d_outOriginal pivot locations.
[in]mNumber of rows in original input.
[in]kNumber of columns original input.
[in]d_pivContains updated pivot indices.
[in]batchThe number of input tiles.
afError af_piv_final_I (int *d_out, unsigned m, unsigned k, const int *d_piv, unsigned batch)
 
afError af_piv_final_U (unsigned *d_out, unsigned m, unsigned k, const int *d_piv, unsigned batch)
 
afError af_piv_final_S (float *d_out, unsigned m, unsigned k, const int *d_piv, unsigned batch)
 
afError af_piv_final_D (double *d_out, unsigned m, unsigned k, const int *d_piv, unsigned batch)
 

Function Documentation

afError af_piv_final_I ( int *  d_out,
unsigned  m,
unsigned  k,
const int *  d_piv,
unsigned  batch 
)
afError af_piv_final_U ( unsigned *  d_out,
unsigned  m,
unsigned  k,
const int *  d_piv,
unsigned  batch 
)
afError af_piv_final_S ( float *  d_out,
unsigned  m,
unsigned  k,
const int *  d_piv,
unsigned  batch 
)
afError af_piv_final_D ( double *  d_out,
unsigned  m,
unsigned  k,
const int *  d_piv,
unsigned  batch 
)