lapack.h
Go to the documentation of this file.
1 /*******************************************************
2  * Copyright (c) 2014, ArrayFire
3  * All rights reserved.
4  *
5  * This file is distributed under 3-clause BSD license.
6  * The complete license agreement can be obtained at:
7  * http://arrayfire.com/licenses/BSD-3-Clause
8  ********************************************************/
9 
10 #pragma once
11 #include <af/array.h>
12 #include <af/defines.h>
13 
14 #ifdef __cplusplus
15 namespace af
16 {
17 #if AF_API_VERSION >= 31
18 
28  AFAPI void svd(array &u, array &s, array &vt, const array &in);
29 #endif
30 
31 #if AF_API_VERSION >= 31
32 
48  AFAPI void svdInPlace(array &u, array &s, array &vt, array &in);
49 #endif
50 
63  AFAPI void lu(array &out, array &pivot, const array &in, const bool is_lapack_piv=true);
64 
77  AFAPI void lu(array &lower, array &upper, array &pivot, const array &in);
78 
90  AFAPI void luInPlace(array &pivot, array &in, const bool is_lapack_piv=true);
91 
103  AFAPI void qr(array &out, array &tau, const array &in);
104 
117  AFAPI void qr(array &q, array &r, array &tau, const array &in);
118 
129  AFAPI void qrInPlace(array &tau, array &in);
130 
145  AFAPI int cholesky(array &out, const array &in, const bool is_upper = true);
146 
160  AFAPI int choleskyInPlace(array &in, const bool is_upper = true);
161 
175  AFAPI array solve(const array &a, const array &b, const matProp options = AF_MAT_NONE);
176 
177 
192  AFAPI array solveLU(const array &a, const array &piv,
193  const array &b, const matProp options = AF_MAT_NONE);
194 
207  AFAPI array inverse(const array &in, const matProp options = AF_MAT_NONE);
208 
209 #if AF_API_VERSION >= 37
210 
227  AFAPI array pinverse(const array &in, const double tol=1E-6,
228  const matProp options = AF_MAT_NONE);
229 #endif
230 
241  AFAPI unsigned rank(const array &in, const double tol=1E-5);
242 
252  template<typename T> T det(const array &in);
253 
266  AFAPI double norm(const array &in, const normType type=AF_NORM_EUCLID,
267  const double p=1, const double q=1);
268 
269 #if AF_API_VERSION >= 33
270 
277  AFAPI bool isLAPACKAvailable();
278 #endif
279 
280 }
281 #endif
282 
283 #ifdef __cplusplus
284 extern "C" {
285 #endif
286 
287 #if AF_API_VERSION >= 31
288 
298  AFAPI af_err af_svd(af_array *u, af_array *s, af_array *vt, const af_array in);
299 #endif
300 
301 #if AF_API_VERSION >= 31
302 
319 #endif
320 
332 
342  AFAPI af_err af_lu_inplace(af_array *pivot, af_array in, const bool is_lapack_piv);
343 
354  AFAPI af_err af_qr(af_array *q, af_array *r, af_array *tau, const af_array in);
355 
365 
378  AFAPI af_err af_cholesky(af_array *out, int *info, const af_array in, const bool is_upper);
379 
391  AFAPI af_err af_cholesky_inplace(int *info, af_array in, const bool is_upper);
392 
405  AFAPI af_err af_solve(af_array *x, const af_array a, const af_array b,
406  const af_mat_prop options);
407 
422  AFAPI af_err af_solve_lu(af_array *x, const af_array a, const af_array piv,
423  const af_array b, const af_mat_prop options);
424 
436  AFAPI af_err af_inverse(af_array *out, const af_array in, const af_mat_prop options);
437 
438 #if AF_API_VERSION >= 37
439 
458  AFAPI af_err af_pinverse(af_array *out, const af_array in, const double tol,
459  const af_mat_prop options);
460 #endif
461 
471  AFAPI af_err af_rank(unsigned *rank, const af_array in, const double tol);
472 
482  AFAPI af_err af_det(double *det_real, double *det_imag, const af_array in);
483 
496  AFAPI af_err af_norm(double *out, const af_array in, const af_norm_type type, const double p, const double q);
497 
498 #if AF_API_VERSION >= 33
499 
509 #endif
510 
511 
512 #ifdef __cplusplus
513 }
514 #endif
af_qr_inplace
AFAPI af_err af_qr_inplace(af_array *tau, af_array in)
C Interface for QR decomposition.
af::cholesky
AFAPI int cholesky(array &out, const array &in, const bool is_upper=true)
C++ Interface for cholesky decomposition.
af_pinverse
AFAPI af_err af_pinverse(af_array *out, const af_array in, const double tol, const af_mat_prop options)
C Interface for pseudo-inverting (Moore-Penrose) a matrix.
af::lower
AFAPI array lower(const array &in, bool is_unit_diag=false)
af::rank
AFAPI unsigned rank(const array &in, const double tol=1E-5)
C++ Interface for finding the rank of a matrix.
af_is_lapack_available
AFAPI af_err af_is_lapack_available(bool *out)
Returns true is ArrayFire is compiled with LAPACK support.
af::info
AFAPI void info()
af::solveLU
AFAPI array solveLU(const array &a, const array &piv, const array &b, const matProp options=AF_MAT_NONE)
C++ Interface for solving a system of equations.
AFAPI
#define AFAPI
Definition: defines.h:38
af::svdInPlace
AFAPI void svdInPlace(array &u, array &s, array &vt, array &in)
C++ Interface for SVD decomposition (in-place)
af
Definition: algorithm.h:14
af_svd_inplace
AFAPI af_err af_svd_inplace(af_array *u, af_array *s, af_array *vt, af_array in)
C Interface for SVD decomposition (in-place)
af_mat_prop
af_mat_prop
Definition: defines.h:348
af_det
AFAPI af_err af_det(double *det_real, double *det_imag, const af_array in)
C Interface for finding the determinant of a matrix.
af_lu
AFAPI af_err af_lu(af_array *lower, af_array *upper, af_array *pivot, const af_array in)
C Interface for LU decomposition.
af_svd
AFAPI af_err af_svd(af_array *u, af_array *s, af_array *vt, const af_array in)
C Interface for SVD decomposition.
AF_NORM_EUCLID
@ AF_NORM_EUCLID
The default. Same as AF_NORM_VECTOR_2.
Definition: defines.h:373
af_array
void * af_array
Definition: defines.h:240
af_norm
AFAPI af_err af_norm(double *out, const af_array in, const af_norm_type type, const double p, const double q)
C Interface for norm of a matrix.
af_qr
AFAPI af_err af_qr(af_array *q, af_array *r, af_array *tau, const af_array in)
C Interface for QR decomposition.
af_solve
AFAPI af_err af_solve(af_array *x, const af_array a, const af_array b, const af_mat_prop options)
C Interface for solving a system of equations.
af::normType
af_norm_type normType
Definition: defines.h:562
af::solve
AFAPI array solve(const array &a, const array &b, const matProp options=AF_MAT_NONE)
C++ Interface for solving a system of equations.
af::pinverse
AFAPI array pinverse(const array &in, const double tol=1E-6, const matProp options=AF_MAT_NONE)
C++ Interface for pseudo-inverting (Moore-Penrose) a matrix.
afcl::array
static af::array array(af::dim4 idims, cl_mem buf, af::dtype type, bool retain=false)
Create an af::array object from an OpenCL cl_mem buffer.
Definition: opencl.h:327
af_solve_lu
AFAPI af_err af_solve_lu(af_array *x, const af_array a, const af_array piv, const af_array b, const af_mat_prop options)
C Interface for solving a system of equations.
af::luInPlace
AFAPI void luInPlace(array &pivot, array &in, const bool is_lapack_piv=true)
C++ Interface for in place LU decomposition.
af::lu
AFAPI void lu(array &out, array &pivot, const array &in, const bool is_lapack_piv=true)
C++ Interface for LU decomposition in packed format.
af::choleskyInPlace
AFAPI int choleskyInPlace(array &in, const bool is_upper=true)
C++ Interface for in place cholesky decomposition.
af_norm_type
af_norm_type
Definition: defines.h:363
af::norm
AFAPI double norm(const array &in, const normType type=AF_NORM_EUCLID, const double p=1, const double q=1)
C++ Interface for norm of a matrix.
af::isLAPACKAvailable
AFAPI bool isLAPACKAvailable()
Returns true is ArrayFire is compiled with LAPACK support.
array.h
af::qr
AFAPI void qr(array &out, array &tau, const array &in)
C++ Interface for QR decomposition in packed format.
af::svd
AFAPI void svd(array &u, array &s, array &vt, const array &in)
C++ Interface for SVD decomposition.
af::upper
AFAPI array upper(const array &in, bool is_unit_diag=false)
af::inverse
AFAPI array inverse(const array &in, const matProp options=AF_MAT_NONE)
C++ Interface for inverting a matrix.
af::det
T det(const array &in)
C++ Interface for finding the determinant of a matrix.
af::qrInPlace
AFAPI void qrInPlace(array &tau, array &in)
C++ Interface for QR decomposition.
AF_MAT_NONE
@ AF_MAT_NONE
Default.
Definition: defines.h:349
af_lu_inplace
AFAPI af_err af_lu_inplace(af_array *pivot, af_array in, const bool is_lapack_piv)
C Interface for in place LU decomposition.
af::matProp
af_mat_prop matProp
Definition: defines.h:560
af_cholesky
AFAPI af_err af_cholesky(af_array *out, int *info, const af_array in, const bool is_upper)
C++ Interface for cholesky decomposition.
af_inverse
AFAPI af_err af_inverse(af_array *out, const af_array in, const af_mat_prop options)
C Interface for inverting a matrix.
af_cholesky_inplace
AFAPI af_err af_cholesky_inplace(int *info, af_array in, const bool is_upper)
C Interface for in place cholesky decomposition.
af_err
af_err
Definition: defines.h:71
defines.h
af_rank
AFAPI af_err af_rank(unsigned *rank, const af_array in, const double tol)
C Interface for finding the rank of a matrix.