linalg 1.8.2
A linear algebra library that provides a user-friendly interface to several BLAS and LAPACK routines.
Loading...
Searching...
No Matches
linalg.h
Go to the documentation of this file.
1
189#ifndef LINALG_H_DEFINED
190#define LINALG_H_DEFINED
191
192#include <stdbool.h>
193#include <complex.h>
194
195#define LA_NO_OPERATION 0
196#define LA_TRANSPOSE 1
197#define LA_HERMITIAN_TRANSPOSE 2
198#define LA_NO_ERROR 0
199#define LA_INVALID_INPUT_ERROR 101
200#define LA_ARRAY_SIZE_ERROR 102
201#define LA_SINGULAR_MATRIX_ERROR 103
202#define LA_MATRIX_FORMAT_ERROR 104
203#define LA_OUT_OF_MEMORY_ERROR 105
204#define LA_CONVERGENCE_ERROR 106
205#define LA_INVALID_OPERATION_ERROR 107
206
207#ifdef __cplusplus
208extern "C" {
209#endif
210
230int la_rank1_update(int m, int n, double alpha, const double *x,
231 const double *y, double *a, int lda);
232
252int la_rank1_update_cmplx(int m, int n, double complex alpha,
253 const double complex *x, const double complex *y, double complex *a,
254 int lda);
255
270int la_trace(int m, int n, const double *a, int lda, double *rst);
271
286int la_trace_cmplx(int m, int n, const double complex *a, int lda,
287 double complex *rst);
288
315int la_mtx_mult(bool transa, bool transb, int m, int n, int k, double alpha,
316 const double *a, int lda, const double *b, int ldb, double beta,
317 double *c, int ldc);
318
347int la_mtx_mult_cmplx(int opa, int opb, int m, int n, int k,
348 double complex alpha, const double complex *a, int lda,
349 const double complex *b, int ldb, double complex beta, double complex *c,
350 int ldc);
351
385int la_diag_mtx_mult(bool lside, bool transb, int m, int n, int k,
386 double alpha, const double *a, const double *b, int ldb, double beta,
387 double *c, int ldc);
388
423int la_diag_mtx_mult_cmplx(bool lside, int opb, int m, int n, int k,
424 double complex alpha, const double complex *a, const double complex *b,
425 int ldb, double complex beta, double complex *c, int ldc);
426
461int la_diag_mtx_mult_mixed(bool lside, int opb, int m, int n, int k,
462 double complex alpha, const double *a, const double complex *b,
463 int ldb, double complex beta, double complex *c, int ldc);
464
483int la_rank(int m, int n, double *a, int lda, int *rnk);
484
503int la_rank_cmplx(int m, int n, double complex *a, int lda, int *rnk);
504
520int la_det(int n, double *a, int lda, double *d);
521
537int la_det_cmplx(int n, double complex *a, int lda, double complex *d);
538
564int la_tri_mtx_mult(bool upper, double alpha, int n, const double *a, int lda,
565 double beta, double *b, int ldb);
566
592int la_tri_mtx_mult_cmplx(bool upper, double complex alpha, int n,
593 const double complex *a, int lda, double complex beta,
594 double complex *b, int ldb);
595
615int la_lu_factor(int m, int n, double *a, int lda, int *ipvt);
616
636int la_lu_factor_cmplx(int m, int n, double complex *a, int lda, int *ipvt);
637
659int la_form_lu(int n, double *a, int lda, int *ipvt, double *u, int ldu,
660 double *p, int ldp);
661
683int la_form_lu_cmplx(int n, double complex *a, int lda, int *ipvt,
684 double complex *u, int ldu, double *p, int ldp);
685
707int la_qr_factor(int m, int n, double *a, int lda, double *tau);
708
730int la_qr_factor_cmplx(int m, int n, double complex *a, int lda,
731 double complex *tau);
732
757int la_qr_factor_pvt(int m, int n, double *a, int lda, double *tau, int *jpvt);
758
783int la_qr_factor_cmplx_pvt(int m, int n, double complex *a, int lda,
784 double complex *tau, int *jpvt);
785
812int la_form_qr(bool fullq, int m, int n, double *r, int ldr, const double *tau,
813 double *q, int ldq);
814
841int la_form_qr_cmplx(bool fullq, int m, int n, double complex *r, int ldr,
842 const double complex *tau, double complex *q, int ldq);
843
876int la_form_qr_pvt(bool fullq, int m, int n, double *r, int ldr,
877 const double *tau, const int *pvt, double *q, int ldq, double *p, int ldp);
878
911int la_form_qr_cmplx_pvt(bool fullq, int m, int n, double complex *r, int ldr,
912 const double complex *tau, const int *pvt, double complex *q, int ldq,
913 double complex *p, int ldp);
914
944int la_mult_qr(bool lside, bool trans, int m, int n, int k, double *a, int lda,
945 const double *tau, double *c, int ldc);
946
976int la_mult_qr_cmplx(bool lside, bool trans, int m, int n, int k,
977 double complex *a, int lda, const double complex *tau, double complex *c,
978 int ldc);
979
1004int la_qr_rank1_update(int m, int n, double *q, int ldq, double *r, int ldr,
1005 double *u, double *v);
1006
1025int la_cholesky_factor(bool upper, int n, double *a, int lda);
1026
1045int la_cholesky_factor_cmplx(bool upper, int n, double complex *a, int lda);
1046
1064int la_cholesky_rank1_update(int n, double *r, int ldr, double *u);
1065
1085int la_cholesky_rank1_downdate(int n, double *r, int ldr, double *u);
1086
1106int la_cholesky_rank1_downdate_cmplx(int n, double complex *r, int ldr,
1107 double complex *u);
1108
1138int la_svd(int m, int n, double *a, int lda, double *s, double *u, int ldu,
1139 double *vt, int ldv);
1140
1170int la_svd_cmplx(int m, int n, double complex *a, int lda, double *s,
1171 double complex *u, int ldu, double complex *vt, int ldv);
1172
1201int la_solve_tri_mtx(bool lside, bool upper, bool trans, bool nounit, int m,
1202 int n, double alpha, const double *a, int lda, double *b, int ldb);
1203
1232int la_solve_tri_mtx_cmplx(bool lside, bool upper, bool trans, bool nounit,
1233 int m, int n, double complex alpha, const double complex *a, int lda,
1234 double complex *b, int ldb);
1235
1252int la_solve_lu(int m, int n, const double *a, int lda, const int *ipvt,
1253 double *b, int ldb);
1254
1271int la_solve_lu_cmplx(int m, int n, const double complex *a, int lda,
1272 const int *ipvt, double complex *b, int ldb);
1273
1297int la_solve_qr(int m, int n, int k, double *a, int lda, const double *tau,
1298 double *b, int ldb);
1299
1323int la_solve_qr_cmplx(int m, int n, int k, double complex *a, int lda,
1324 const double complex *tau, double complex *b, int ldb);
1325
1349int la_solve_qr_pvt(int m, int n, int k, double *a, int lda, const double *tau,
1350 const int *jpvt, double *b, int ldb);
1351
1375int la_solve_qr_cmplx_pvt(int m, int n, int k, double complex *a, int lda,
1376 const double complex *tau, const int *jpvt, double complex *b, int ldb);
1377
1396int la_solve_cholesky(bool upper, int m, int n, const double *a, int lda,
1397 double *b, int ldb);
1398
1417int la_solve_cholesky_cmplx(bool upper, int m, int n, const double complex *a,
1418 int lda, double complex *b, int ldb);
1419
1445int la_solve_least_squares(int m, int n, int k, double *a, int lda, double *b,
1446 int ldb);
1447
1473int la_solve_least_squares_cmplx(int m, int n, int k, double complex *a,
1474 int lda, double complex *b, int ldb);
1475
1489int la_inverse(int n, double *a, int lda);
1490
1504int la_inverse_cmplx(int n, double complex *a, int lda);
1505
1523int la_pinverse(int m, int n, double *a, int lda, double *ainv, int ldai);
1524
1542int la_pinverse_cmplx(int m, int n, double complex *a, int lda,
1543 double complex *ainv, int ldai);
1544
1568int la_eigen_symm(bool vecs, int n, double *a, int lda, double *vals);
1569
1592int la_eigen_asymm(bool vecs, int n, double *a, int lda,
1593 double complex *vals, double complex *v, int ldv);
1594
1627int la_eigen_gen(bool vecs, int n, double *a, int lda, double *b, int ldb,
1628 double complex *alpha, double *beta, double complex *v, int ldv);
1629
1652int la_eigen_cmplx(bool vecs, int n, double complex *a, int lda,
1653 double complex *vals, double complex *v, int ldv);
1654
1674int la_sort_eigen(bool ascend, int n, double *vals, double *vecs, int ldv);
1675
1695int la_sort_eigen_cmplx(bool ascend, int n, double complex *vals,
1696 double complex *vecs, int ldv);
1697
1719int la_lq_factor(int m, int n, double *a, int lda, double *tau);
1720
1741int la_form_lq(int m, int n, double *l, int ldl, const double *tau, double *q,
1742 int ldq);
1743
1771int la_mult_lq(bool lside, bool trans, int m, int n, int k, const double *a,
1772 int lda, const double *tau, double *c, int ldc);
1773
1797int la_solve_lq(int m, int n, int k, const double *a, int lda,
1798 const double *tau, double *b, int ldb);
1799
1800/* ************************************************************************** */
1801/* STUFF THAT NEEDS MORE WORK BEFORE RELEASING INTO THE WILD */
1802/* ************************************************************************** */
1803
1804
1832int la_qr_rank1_update_cmplx(int m, int n, double complex *q, int ldq,
1833 double complex *r, int ldr, double complex *u, double complex *v);
1834
1855int la_cholesky_rank1_update_cmplx(int n, double complex *r, int ldr,
1856 double complex *u);
1857
1882int la_lq_factor_cmplx(int m, int n, double complex *a, int lda,
1883 double complex *tau);
1884
1908int la_form_lq_cmplx(int m, int n, double complex *l, int ldl,
1909 const double complex *tau, double complex *q, int ldq);
1910
1941int la_mult_lq_cmplx(bool lside, bool trans, int m, int n, int k,
1942 const double complex *a, int lda, const double complex *tau,
1943 double complex *c, int ldc);
1944
1971int la_solve_lq_cmplx(int m, int n, int k, const double complex *a, int lda,
1972 const double complex *tau, double complex *b, int ldb);
1973
1998int la_band_mtx_vec_mult(bool trans, int m, int n, int kl, int ku, double alpha,
1999 const double *a, int lda, const double *x, double beta, double *y);
2000
2027int la_band_mtx_vec_mult_cmplx(int trans, int m, int n, int kl, int ku,
2028 double complex alpha, const double complex *a, int lda,
2029 const double complex *x, double complex beta, double complex *y);
2030
2045int la_band_to_full_mtx(int m, int n, int kl, int ku, const double *b, int ldb,
2046 double *f, int ldf);
2047
2062int la_band_to_full_mtx_cmplx(int m, int n, int kl, int ku,
2063 const double complex *b, int ldb, double complex *f, int ldf);
2064
2096int la_band_diag_mtx_mult(bool left, int m, int n, int kl, int ku, double alpha,
2097 double *a, int lda, const double *b);
2098
2130int la_band_diag_mtx_mult_cmplx(bool left, int m, int n, int kl, int ku,
2131 double complex alpha, double complex *a, int lda, const double complex *b);
2132
2133#ifdef __cplusplus
2134}
2135#endif // __cplusplus
2136#endif // LINALG_H_DEFINED
int la_cholesky_rank1_downdate_cmplx(int n, double complex *r, int ldr, double complex *u)
int la_trace_cmplx(int m, int n, const double complex *a, int lda, double complex *rst)
int la_tri_mtx_mult_cmplx(bool upper, double complex alpha, int n, const double complex *a, int lda, double complex beta, double complex *b, int ldb)
int la_solve_least_squares(int m, int n, int k, double *a, int lda, double *b, int ldb)
int la_form_qr_cmplx(bool fullq, int m, int n, double complex *r, int ldr, const double complex *tau, double complex *q, int ldq)
int la_rank(int m, int n, double *a, int lda, int *rnk)
int la_sort_eigen_cmplx(bool ascend, int n, double complex *vals, double complex *vecs, int ldv)
int la_solve_cholesky(bool upper, int m, int n, const double *a, int lda, double *b, int ldb)
int la_solve_qr_cmplx(int m, int n, int k, double complex *a, int lda, const double complex *tau, double complex *b, int ldb)
int la_form_lu(int n, double *a, int lda, int *ipvt, double *u, int ldu, double *p, int ldp)
int la_cholesky_factor_cmplx(bool upper, int n, double complex *a, int lda)
int la_lu_factor(int m, int n, double *a, int lda, int *ipvt)
int la_cholesky_rank1_downdate(int n, double *r, int ldr, double *u)
int la_solve_lq(int m, int n, int k, const double *a, int lda, const double *tau, double *b, int ldb)
int la_cholesky_factor(bool upper, int n, double *a, int lda)
int la_rank1_update_cmplx(int m, int n, double complex alpha, const double complex *x, const double complex *y, double complex *a, int lda)
int la_qr_factor_cmplx_pvt(int m, int n, double complex *a, int lda, double complex *tau, int *jpvt)
int la_diag_mtx_mult(bool lside, bool transb, int m, int n, int k, double alpha, const double *a, const double *b, int ldb, double beta, double *c, int ldc)
int la_qr_factor_pvt(int m, int n, double *a, int lda, double *tau, int *jpvt)
int la_diag_mtx_mult_mixed(bool lside, int opb, int m, int n, int k, double complex alpha, const double *a, const double complex *b, int ldb, double complex beta, double complex *c, int ldc)
int la_solve_lq_cmplx(int m, int n, int k, const double complex *a, int lda, const double complex *tau, double complex *b, int ldb)
int la_svd(int m, int n, double *a, int lda, double *s, double *u, int ldu, double *vt, int ldv)
int la_lq_factor_cmplx(int m, int n, double complex *a, int lda, double complex *tau)
int la_solve_qr_pvt(int m, int n, int k, double *a, int lda, const double *tau, const int *jpvt, double *b, int ldb)
int la_diag_mtx_mult_cmplx(bool lside, int opb, int m, int n, int k, double complex alpha, const double complex *a, const double complex *b, int ldb, double complex beta, double complex *c, int ldc)
int la_band_diag_mtx_mult(bool left, int m, int n, int kl, int ku, double alpha, double *a, int lda, const double *b)
int la_solve_cholesky_cmplx(bool upper, int m, int n, const double complex *a, int lda, double complex *b, int ldb)
int la_pinverse_cmplx(int m, int n, double complex *a, int lda, double complex *ainv, int ldai)
int la_form_lu_cmplx(int n, double complex *a, int lda, int *ipvt, double complex *u, int ldu, double *p, int ldp)
int la_qr_factor(int m, int n, double *a, int lda, double *tau)
int la_inverse_cmplx(int n, double complex *a, int lda)
int la_lq_factor(int m, int n, double *a, int lda, double *tau)
int la_trace(int m, int n, const double *a, int lda, double *rst)
int la_band_diag_mtx_mult_cmplx(bool left, int m, int n, int kl, int ku, double complex alpha, double complex *a, int lda, const double complex *b)
int la_eigen_asymm(bool vecs, int n, double *a, int lda, double complex *vals, double complex *v, int ldv)
int la_inverse(int n, double *a, int lda)
int la_mult_qr(bool lside, bool trans, int m, int n, int k, double *a, int lda, const double *tau, double *c, int ldc)
int la_mtx_mult(bool transa, bool transb, int m, int n, int k, double alpha, const double *a, int lda, const double *b, int ldb, double beta, double *c, int ldc)
int la_qr_rank1_update(int m, int n, double *q, int ldq, double *r, int ldr, double *u, double *v)
int la_solve_lu_cmplx(int m, int n, const double complex *a, int lda, const int *ipvt, double complex *b, int ldb)
int la_band_to_full_mtx_cmplx(int m, int n, int kl, int ku, const double complex *b, int ldb, double complex *f, int ldf)
int la_form_lq_cmplx(int m, int n, double complex *l, int ldl, const double complex *tau, double complex *q, int ldq)
int la_form_qr_pvt(bool fullq, int m, int n, double *r, int ldr, const double *tau, const int *pvt, double *q, int ldq, double *p, int ldp)
int la_solve_lu(int m, int n, const double *a, int lda, const int *ipvt, double *b, int ldb)
int la_rank1_update(int m, int n, double alpha, const double *x, const double *y, double *a, int lda)
int la_cholesky_rank1_update(int n, double *r, int ldr, double *u)
int la_sort_eigen(bool ascend, int n, double *vals, double *vecs, int ldv)
int la_eigen_symm(bool vecs, int n, double *a, int lda, double *vals)
int la_solve_least_squares_cmplx(int m, int n, int k, double complex *a, int lda, double complex *b, int ldb)
int la_form_lq(int m, int n, double *l, int ldl, const double *tau, double *q, int ldq)
int la_mult_lq(bool lside, bool trans, int m, int n, int k, const double *a, int lda, const double *tau, double *c, int ldc)
int la_det(int n, double *a, int lda, double *d)
int la_band_mtx_vec_mult_cmplx(int trans, int m, int n, int kl, int ku, double complex alpha, const double complex *a, int lda, const double complex *x, double complex beta, double complex *y)
int la_mult_qr_cmplx(bool lside, bool trans, int m, int n, int k, double complex *a, int lda, const double complex *tau, double complex *c, int ldc)
int la_lu_factor_cmplx(int m, int n, double complex *a, int lda, int *ipvt)
int la_det_cmplx(int n, double complex *a, int lda, double complex *d)
int la_qr_rank1_update_cmplx(int m, int n, double complex *q, int ldq, double complex *r, int ldr, double complex *u, double complex *v)
int la_solve_qr_cmplx_pvt(int m, int n, int k, double complex *a, int lda, const double complex *tau, const int *jpvt, double complex *b, int ldb)
int la_form_qr_cmplx_pvt(bool fullq, int m, int n, double complex *r, int ldr, const double complex *tau, const int *pvt, double complex *q, int ldq, double complex *p, int ldp)
int la_mult_lq_cmplx(bool lside, bool trans, int m, int n, int k, const double complex *a, int lda, const double complex *tau, double complex *c, int ldc)
int la_band_to_full_mtx(int m, int n, int kl, int ku, const double *b, int ldb, double *f, int ldf)
int la_band_mtx_vec_mult(bool trans, int m, int n, int kl, int ku, double alpha, const double *a, int lda, const double *x, double beta, double *y)
int la_eigen_cmplx(bool vecs, int n, double complex *a, int lda, double complex *vals, double complex *v, int ldv)
int la_qr_factor_cmplx(int m, int n, double complex *a, int lda, double complex *tau)
int la_tri_mtx_mult(bool upper, double alpha, int n, const double *a, int lda, double beta, double *b, int ldb)
int la_solve_tri_mtx(bool lside, bool upper, bool trans, bool nounit, int m, int n, double alpha, const double *a, int lda, double *b, int ldb)
int la_solve_qr(int m, int n, int k, double *a, int lda, const double *tau, double *b, int ldb)
int la_mtx_mult_cmplx(int opa, int opb, int m, int n, int k, double complex alpha, const double complex *a, int lda, const double complex *b, int ldb, double complex beta, double complex *c, int ldc)
int la_cholesky_rank1_update_cmplx(int n, double complex *r, int ldr, double complex *u)
int la_eigen_gen(bool vecs, int n, double *a, int lda, double *b, int ldb, double complex *alpha, double *beta, double complex *v, int ldv)
int la_pinverse(int m, int n, double *a, int lda, double *ainv, int ldai)
int la_solve_tri_mtx_cmplx(bool lside, bool upper, bool trans, bool nounit, int m, int n, double complex alpha, const double complex *a, int lda, double complex *b, int ldb)
int la_svd_cmplx(int m, int n, double complex *a, int lda, double *s, double complex *u, int ldu, double complex *vt, int ldv)
int la_rank_cmplx(int m, int n, double complex *a, int lda, int *rnk)
int la_form_qr(bool fullq, int m, int n, double *r, int ldr, const double *tau, double *q, int ldq)