| 1 |
/* |
| 2 |
* Copyright (C) 1996-2011 Daniel Waggoner |
| 3 |
* |
| 4 |
* This free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation, either version 3 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* It is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* If you did not received a copy of the GNU General Public License |
| 15 |
* with this software, see <http://www.gnu.org/licenses/>. |
| 16 |
*/ |
| 17 |
|
| 18 |
#ifndef __BMATRIX__ |
| 19 |
#define __BMATRIX__ |
| 20 |
|
| 21 |
#include "prcsn.h" |
| 22 |
|
| 23 |
#ifdef __cplusplus |
| 24 |
extern "C" |
| 25 |
{ |
| 26 |
#endif |
| 27 |
|
| 28 |
/* Unary Operators */ |
| 29 |
int bNegative(PRECISION *x, PRECISION *y, int m); |
| 30 |
int bAbs(PRECISION *x, PRECISION *y, int m); |
| 31 |
|
| 32 |
/* Transpose */ |
| 33 |
int bTranspose(PRECISION *x, PRECISION *y, int m, int n, int t); |
| 34 |
int bTransposeInPlace(PRECISION *x, int m); |
| 35 |
|
| 36 |
/* Addition */ |
| 37 |
int bAddV(PRECISION *x, PRECISION *y, PRECISION *z, int m); |
| 38 |
int bSubtractV(PRECISION *x, PRECISION *y, PRECISION *z, int m); |
| 39 |
int bAddM(PRECISION *x, PRECISION *y, PRECISION *z, int m, int n, int xt, int yt, int zt); |
| 40 |
int bSubtractM(PRECISION *x, PRECISION *y, PRECISION *z, int m, int n, int xt, int yt, int zt); |
| 41 |
int bLinearCombinationV(PRECISION *x, PRECISION a, PRECISION *y, PRECISION b,PRECISION *z, int m); |
| 42 |
int bLinearCombinationM(PRECISION *x, PRECISION a, PRECISION *y, PRECISION b,PRECISION *z, int m, int n, int xt, int yt, int zt); |
| 43 |
|
| 44 |
/* Multiplication */ |
| 45 |
int bMultiply(PRECISION *x, PRECISION *y, PRECISION s, int m); |
| 46 |
|
| 47 |
int bProductMM_Update(PRECISION *x, PRECISION *y, PRECISION *z, PRECISION a, PRECISION b, int m, int n, int p, int xt, int yt, int zt); |
| 48 |
int bProductMV_Update(PRECISION *x, PRECISION *y, PRECISION *z, PRECISION a, PRECISION b, int m, int n, int zt); |
| 49 |
|
| 50 |
#define bProductMM(x,y,z,m,n,p,xt,yt,zt) bProductMM_Update(x,y,z,0.0,1.0,m,n,p,xt,yt,zt) |
| 51 |
#define bProductMV(x,y,z,m,n,zt) bProductMV_Update(x,y,z,0.0,1.0,m,n,zt) |
| 52 |
#define bProductVM(x,y,z,m,n,zt) bProductMV_Update(x,y,z,0.0,1.0,n,m,1^zt) |
| 53 |
int bProductMT(PRECISION *x, PRECISION *y, int m, int n, int u, int xt, int yt); |
| 54 |
int bProductTM(PRECISION *x, PRECISION *y, int m, int n, int u, int xt, int yt); |
| 55 |
|
| 56 |
/* LU Decomposition */ |
| 57 |
int bSolveLU(PRECISION *b, PRECISION *a, int m, int n, int bt, int at); |
| 58 |
int bLU(int *p, PRECISION *x, int m, int n, int xt); |
| 59 |
int bSolveTriangular(PRECISION *x, PRECISION *b, int m, int n, int u, int xt, int bt); |
| 60 |
int bSolveUnitTriangular(PRECISION *x, PRECISION *b, int m, int n, int u, int xt, int bt); |
| 61 |
|
| 62 |
/* QR Decompositions */ |
| 63 |
int bQR(PRECISION *Q, PRECISION *R, PRECISION *X, int m, int n, int q, int qt, int rt, int xt); |
| 64 |
|
| 65 |
/* Singular Value Decomposition */ |
| 66 |
int bSVD(PRECISION *U, PRECISION *d, PRECISION *V, PRECISION *A, int m, int n, int ut, int vt, int at, int compact); |
| 67 |
|
| 68 |
/* Generalize Schur Decomposition */ |
| 69 |
int bGeneralizedSchur_real(PRECISION *Q, PRECISION *Z, PRECISION *S, PRECISION *T, PRECISION *A, PRECISION *B, int n, int qt, int zt, |
| 70 |
int st, int tt, int at, int bt, PRECISION *alpha_r, PRECISION *alpha_i, PRECISION *beta); |
| 71 |
int bReorderGeneralizedSchur_real(int *select, PRECISION *QQ, PRECISION *ZZ, PRECISION *SS, PRECISION *TT, PRECISION *Q, PRECISION *Z, |
| 72 |
PRECISION *S, PRECISION *T, int n, int qqt, int zzt, int sst, int ttt, int qt, |
| 73 |
int zt, int st, int tt, PRECISION *alpha_r, PRECISION *alpha_i, PRECISION *beta); |
| 74 |
int bSortGeneralizedSchur_real(PRECISION *QQ, PRECISION *ZZ, PRECISION *SS, PRECISION *TT, PRECISION *Q, PRECISION *Z, |
| 75 |
PRECISION *S, PRECISION *T, int n, int qqt, int zzt, int sst, int ttt, int qt, int zt, |
| 76 |
int st, int tt, PRECISION *alpha_r, PRECISION *alpha_i, PRECISION *beta, int descend); |
| 77 |
|
| 78 |
/* Cholesky Decompositions */ |
| 79 |
int bCholesky(PRECISION *X, int m, int u, int t); |
| 80 |
|
| 81 |
/* Eigenvalues and Eigenvectors */ |
| 82 |
int bEigenvalues(PRECISION *re, PRECISION *im, PRECISION *x, int n, int xt); |
| 83 |
int bEigen(PRECISION *reval, PRECISION *imval, PRECISION *revec, PRECISION *imvec, PRECISION *x, int n, int xt, int revect, int imvect); |
| 84 |
|
| 85 |
/* Permutation Routines */ |
| 86 |
int bPermuteMatrix(PRECISION *x, PRECISION *y, int *p, int m, int n, int yt, int pt); |
| 87 |
int bPermutationMultiply(int *p, PRECISION *y, int m, int n, int q, int pt, int yt); |
| 88 |
int bPermutation(PRECISION *x, int *p, int m, int q, int t); |
| 89 |
|
| 90 |
/* Tensor Calculus */ |
| 91 |
int bMatrixTensor(PRECISION *x, PRECISION *y, PRECISION *z, int m, int n, int r, int s, int xt, int yt, int zt); |
| 92 |
int bVectorTensor(PRECISION *x, PRECISION *y, PRECISION *z, int m, int n); |
| 93 |
|
| 94 |
/* Inner Product */ |
| 95 |
PRECISION bInnerProduct(PRECISION *x, PRECISION *y, PRECISION *S, int n); |
| 96 |
|
| 97 |
#ifdef __cplusplus |
| 98 |
} |
| 99 |
#endif |
| 100 |
|
| 101 |
#endif |
| 102 |
|
| 103 |
|