|
| zgematrix () |
|
| zgematrix (const zgematrix &) |
|
| zgematrix (const _zgematrix &) |
|
| zgematrix (const CPPL_INT &, const CPPL_INT &) |
|
| zgematrix (const char *) |
|
| ~zgematrix () |
|
comple & | operator() (const CPPL_INT &, const CPPL_INT &) |
|
comple | operator() (const CPPL_INT &, const CPPL_INT &) const |
|
zgematrix & | set (const CPPL_INT &, const CPPL_INT &, const comple &) |
|
void | write (const char *) const |
|
void | read (const char *) |
|
void | clear () |
|
zgematrix & | zero () |
|
zgematrix & | identity () |
|
void | chsign () |
|
void | copy (const zgematrix &) |
|
void | shallow_copy (const _zgematrix &) |
|
void | resize (const CPPL_INT &, const CPPL_INT &) |
|
_zrovector | row (const CPPL_INT &) const |
|
_zcovector | col (const CPPL_INT &) const |
|
CPPL_INT | zgesv (zgematrix &) |
|
CPPL_INT | zgesv (zcovector &) |
|
CPPL_INT | zgels (zgematrix &) |
|
CPPL_INT | zgels (zcovector &) |
|
CPPL_INT | zgels (zgematrix &, drovector &) |
|
CPPL_INT | zgels (zcovector &, double &) |
|
CPPL_INT | zgelss (zcovector &, dcovector &, CPPL_INT &, const double) |
|
CPPL_INT | zgelss (zgematrix &, dcovector &, CPPL_INT &, const double) |
|
CPPL_INT | zgeev (std::vector< comple > &) |
|
CPPL_INT | zgeev (std::vector< comple > &, std::vector< zcovector > &) |
|
CPPL_INT | zgeev (std::vector< comple > &, std::vector< zrovector > &) |
|
CPPL_INT | zgesvd (dcovector &, zgematrix &, zgematrix &) |
|
zgematrix & | operator= (const zgematrix &) |
|
zgematrix & | operator= (const _zgematrix &) |
|
zgematrix & | operator+= (const zgematrix &) |
|
zgematrix & | operator+= (const _zgematrix &) |
|
zgematrix & | operator+= (const zhematrix &) |
|
zgematrix & | operator+= (const _zhematrix &) |
|
zgematrix & | operator+= (const zgbmatrix &) |
|
zgematrix & | operator+= (const _zgbmatrix &) |
|
zgematrix & | operator+= (const zgsmatrix &) |
|
zgematrix & | operator+= (const _zgsmatrix &) |
|
zgematrix & | operator+= (const zhsmatrix &) |
|
zgematrix & | operator+= (const _zhsmatrix &) |
|
zgematrix & | operator-= (const zgematrix &) |
|
zgematrix & | operator-= (const _zgematrix &) |
|
zgematrix & | operator-= (const zhematrix &) |
|
zgematrix & | operator-= (const _zhematrix &) |
|
zgematrix & | operator-= (const zgbmatrix &) |
|
zgematrix & | operator-= (const _zgbmatrix &) |
|
zgematrix & | operator-= (const zgsmatrix &) |
|
zgematrix & | operator-= (const _zgsmatrix &) |
|
zgematrix & | operator-= (const zhsmatrix &) |
|
zgematrix & | operator-= (const _zhsmatrix &) |
|
zgematrix & | operator*= (const zgematrix &) |
|
zgematrix & | operator*= (const _zgematrix &) |
|
zgematrix & | operator*= (const zhematrix &) |
|
zgematrix & | operator*= (const _zhematrix &) |
|
zgematrix & | operator*= (const zgbmatrix &) |
|
zgematrix & | operator*= (const _zgbmatrix &) |
|
zgematrix & | operator*= (const zgsmatrix &) |
|
zgematrix & | operator*= (const _zgsmatrix &) |
|
zgematrix & | operator*= (const zhsmatrix &) |
|
zgematrix & | operator*= (const _zhsmatrix &) |
|
zgematrix & | operator*= (const double &) |
|
zgematrix & | operator*= (const comple &) |
|
zgematrix & | operator/= (const double &) |
|
zgematrix & | operator/= (const comple &) |
|
|
std::ostream & | operator<< (std::ostream &, const zgematrix &) |
|
void | swap (zgematrix &, zgematrix &) |
|
_zgematrix | _ (zgematrix &) |
|
_zgematrix | t (const zgematrix &) |
|
_zgematrix | i (const zgematrix &) |
|
_zgematrix | conj (const zgematrix &) |
|
_zgematrix | conjt (const zgematrix &) |
|
void | idamax (CPPL_INT &, CPPL_INT &, const zgematrix &) |
|
comple | damax (const zgematrix &) |
|
const zgematrix & | operator+ (const zgematrix &) |
|
_zgematrix | operator- (const zgematrix &) |
|
_zgematrix | operator+ (const zgematrix &, const zgematrix &) |
|
_zgematrix | operator+ (const zgematrix &, const _zgematrix &) |
|
_zgematrix | operator+ (const zgematrix &, const zhematrix &) |
|
_zgematrix | operator+ (const zgematrix &, const _zhematrix &) |
|
_zgematrix | operator+ (const zgematrix &, const zgbmatrix &) |
|
_zgematrix | operator+ (const zgematrix &, const _zgbmatrix &) |
|
_zgematrix | operator+ (const zgematrix &, const zgsmatrix &) |
|
_zgematrix | operator+ (const zgematrix &, const _zgsmatrix &) |
|
_zgematrix | operator+ (const zgematrix &, const zhsmatrix &) |
|
_zgematrix | operator+ (const zgematrix &, const _zhsmatrix &) |
|
_zgematrix | operator- (const zgematrix &, const zgematrix &) |
|
_zgematrix | operator- (const zgematrix &, const _zgematrix &) |
|
_zgematrix | operator- (const zgematrix &, const zhematrix &) |
|
_zgematrix | operator- (const zgematrix &, const _zhematrix &) |
|
_zgematrix | operator- (const zgematrix &, const zgbmatrix &) |
|
_zgematrix | operator- (const zgematrix &, const _zgbmatrix &) |
|
_zgematrix | operator- (const zgematrix &, const zgsmatrix &) |
|
_zgematrix | operator- (const zgematrix &, const _zgsmatrix &) |
|
_zgematrix | operator- (const zgematrix &, const zhsmatrix &) |
|
_zgematrix | operator- (const zgematrix &, const _zhsmatrix &) |
|
_zcovector | operator* (const zgematrix &, const zcovector &) |
|
_zcovector | operator* (const zgematrix &, const _zcovector &) |
|
_zgematrix | operator* (const zgematrix &, const zgematrix &) |
|
_zgematrix | operator* (const zgematrix &, const _zgematrix &) |
|
_zgematrix | operator* (const zgematrix &, const zhematrix &) |
|
_zgematrix | operator* (const zgematrix &, const _zhematrix &) |
|
_zgematrix | operator* (const zgematrix &, const zgbmatrix &) |
|
_zgematrix | operator* (const zgematrix &, const _zgbmatrix &) |
|
_zgematrix | operator* (const zgematrix &, const zgsmatrix &) |
|
_zgematrix | operator* (const zgematrix &, const _zgsmatrix &) |
|
_zgematrix | operator* (const zgematrix &, const zhsmatrix &) |
|
_zgematrix | operator* (const zgematrix &, const _zhsmatrix &) |
|
_zgematrix | operator* (const zgematrix &, const double &) |
|
_zgematrix | operator* (const zgematrix &, const comple &) |
|
_zgematrix | operator/ (const zgematrix &, const double &) |
|
_zgematrix | operator/ (const zgematrix &, const comple &) |
|
_zgematrix | operator* (const double &, const zgematrix &) |
|
_zgematrix | operator* (const comple &, const zgematrix &) |
|
_zgematrix | hadamard (const zgematrix &, const zgematrix &) |
|
Complex Double-precision General Dence Matrix Class.
Definition at line 3 of file zgematrix.hpp.
comple & zgematrix::operator() |
( |
const CPPL_INT & |
i, |
|
|
const CPPL_INT & |
j |
|
) |
| |
|
inline |
operator() for non-const object
Definition at line 3 of file zgematrix-io.hpp.
References darray, i, m, and n.
Referenced by identity(), operator*=(), operator+=(), operator-=(), read(), and write().
6 if(
i<0 || j<0 ||
m<=
i ||
n<=j ){
8 std::cerr <<
"The required component is out of the matrix size." << std::endl
9 <<
"Your input is (" <<
i <<
"," << j <<
"), whereas the matrix size is " <<
m <<
"x" <<
n <<
"." << std::endl;
comple ** darray
array of pointers of column head addresses
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
CPPL_INT m
matrix row size
solve overdetermined or underdetermined A*X=Y using zgels with the sum of residual squares output
The residual is set as the columnwise sum of residual squares for overdetermined problems while it is always zero for underdetermined problems.
Definition at line 156 of file zgematrix-lapack.hpp.
References array, clear(), i, drovector::l, m, n, drovector::resize(), swap, and drovector::zero().
157 {CPPL_VERBOSE_REPORT;
161 std::cerr <<
"These two matrices cannot be solved." << std::endl
162 <<
"Your input was (" <<
m <<
"x" <<
n <<
") and (" << mat.
m <<
"x" << mat.
n <<
")." << std::endl;
172 for(CPPL_INT
i=0;
i<mat.
m;
i++){
173 for(CPPL_INT j=0; j<mat.
n; j++){
182 CPPL_INT NRHS(mat.
n), LDA(
m), LDB(mat.
m), LWORK(std::min(
m,
n)+std::max(std::min(
m,
n),NRHS)), INFO(1);
183 comple *WORK(
new comple[LWORK]);
184 zgels_(&TRANS, &
m, &
n, &NRHS,
array, &LDA, mat.
array, &LDB, WORK, &LWORK, &INFO);
188 for(CPPL_INT
i=0;
i<residual.
l;
i++){
189 for(CPPL_INT j=0; j<
m-
n; j++){
190 residual(
i) += std::norm(mat(n+j,
i));
195 for(CPPL_INT
i=0;
i<tmp.
m;
i++){
196 for(CPPL_INT j=0; j<tmp.n; j++){
206 std::cerr <<
"Serious trouble happend. INFO = " << INFO <<
"." << std::endl;
CPPL_INT m
matrix row size
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Complex Double-precision General Dence Matrix Class.
comple * array
1D array to store matrix data
drovector & resize(const CPPL_INT &, const CPPL_INT=0)
CPPL_INT m
matrix row size
friend void swap(zgematrix &, zgematrix &)
CPPL_INT zgematrix::zgels |
( |
zcovector & |
vec, |
|
|
double & |
residual |
|
) |
| |
|
inline |
solve overdetermined or underdetermined A*x=y using zgels with the sum of residual squares output
The residual is set as the sum of residual squares for overdetermined problems while it is always zero for underdetermined problems.
Definition at line 217 of file zgematrix-lapack.hpp.
References zcovector::array, array, zcovector::clear(), i, zcovector::l, m, n, and swap.
218 {CPPL_VERBOSE_REPORT;
222 std::cerr <<
"These matrix and vector cannot be solved." << std::endl
223 <<
"Your input was (" <<
m <<
"x" <<
n <<
") and (" << vec.
l <<
")." << std::endl;
232 for(CPPL_INT
i=0;
i<vec.
l;
i++){
240 CPPL_INT NRHS(1), LDA(
m), LDB(vec.
l), LWORK(std::min(
m,
n)+std::max(std::min(
m,
n),NRHS)), INFO(1);
241 comple *WORK(
new comple[LWORK]);
242 zgels_(&TRANS, &
m, &
n, &NRHS,
array, &LDA, vec.
array, &LDB, WORK, &LWORK, &INFO);
246 for(CPPL_INT
i=0;
i<
m-
n;
i++){
247 residual += std::norm(vec(n+
i));
251 for(CPPL_INT
i=0;
i<tmp.l;
i++){
260 std::cerr <<
"Serious trouble happend. INFO = " << INFO <<
"." << std::endl;
comple * array
1D array to store vector data
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
comple * array
1D array to store matrix data
CPPL_INT m
matrix row size
friend void swap(zgematrix &, zgematrix &)
Complex Double-precision Column Vector Class.
CPPL_INT zgematrix::zgelss |
( |
zcovector & |
B, |
|
|
dcovector & |
S, |
|
|
CPPL_INT & |
RANK, |
|
|
const double |
RCOND = -1. |
|
) |
| |
|
inline |
calculate the least-squares-least-norm solution for overdetermined or underdetermined A*x=y using zgelss
Definition at line 272 of file zgematrix-lapack.hpp.
References zcovector::array, array, dcovector::array, zcovector::clear(), i, zcovector::l, m, n, dcovector::resize(), and swap.
274 {CPPL_VERBOSE_REPORT;
278 std::cerr <<
"These matrix and vector cannot be solved." << std::endl
279 <<
"Your input was (" <<
m <<
"x" <<
n <<
") and (" << B.
l <<
")." << std::endl;
286 for(CPPL_INT
i=0;
i<B.
l;
i++){
295 CPPL_INT NRHS(1), LDA(
m), LDB(B.
l), LWORK(2*std::min(
m,
n) +std::max(std::max(
m,
n),NRHS)), INFO(1);
296 double *RWORK(
new double[5*std::min(
m,
n)]);
297 comple *WORK(
new comple[LWORK]);
298 zgelss_(&
m, &
n, &NRHS,
array, &LDA, B.
array, &LDB, S.
array, &RCOND, &RANK, WORK, &LWORK, RWORK, &INFO);
304 std::cerr <<
"Serious trouble happend. INFO = " << INFO <<
"." << std::endl;
comple * array
1D array to store vector data
dcovector & resize(const CPPL_INT &, const CPPL_INT=0)
friend _zgematrix i(const zgematrix &)
double * array
1D array to store vector data
CPPL_INT n
matrix column size
comple * array
1D array to store matrix data
CPPL_INT m
matrix row size
friend void swap(zgematrix &, zgematrix &)
Complex Double-precision Column Vector Class.
CPPL_INT zgematrix::zgeev |
( |
std::vector< comple > & |
w, |
|
|
std::vector< zcovector > & |
vr |
|
) |
| |
|
inline |
calculate eigenvalues and right eigenvectors
All of the arguments need not to be initialized. w, vr are overwitten and become eigenvalues and right eigenvectors, respectively. This matrix is also overwritten.
Definition at line 396 of file zgematrix-lapack.hpp.
References array, i, m, and n.
398 {CPPL_VERBOSE_REPORT;
402 std::cerr <<
"This matrix cannot have eigenvalues." << std::endl
403 <<
"Your input was (" <<
m <<
"x" <<
n <<
")." << std::endl;
410 for(CPPL_INT
i=0;
i<
n;
i++){
415 char JOBVL(
'n'), JOBVR(
'V');
416 CPPL_INT LDA(n), LDVL(1), LDVR(n), LWORK(4*n), INFO(1);
417 double *RWORK(
new double[2*n]);
418 comple *VL(NULL), *WORK(
new comple[LWORK]);
419 zgeev_(&JOBVL, &JOBVR, &n,
array, &LDA, &w[0], VL, &LDVL, VR.array, &LDVR, WORK, &LWORK, RWORK, &INFO);
425 for(CPPL_INT j=0; j<
n; j++){
426 for(CPPL_INT
i=0;
i<
n;
i++){
433 std::cerr <<
"Serious trouble happend. INFO = " << INFO <<
"." << std::endl;
friend _zgematrix i(const zgematrix &)
CPPL_INT n
matrix column size
Complex Double-precision General Dence Matrix Class.
comple * array
1D array to store matrix data
CPPL_INT m
matrix row size
CPPL_INT zgematrix::zgeev |
( |
std::vector< comple > & |
w, |
|
|
std::vector< zrovector > & |
vl |
|
) |
| |
|
inline |
calculate eigenvalues and left eigenvectors
All of the arguments need not to be initialized. w, vr are overwitten and become eigenvalues and left eigenvectors, respectively. This matrix is also overwritten.
Definition at line 444 of file zgematrix-lapack.hpp.
References array, conj(), i, m, and n.
446 {CPPL_VERBOSE_REPORT;
450 std::cerr <<
"This matrix cannot have eigenvalues." << std::endl
451 <<
"Your input was (" <<
m <<
"x" <<
n <<
")." << std::endl;
458 for(CPPL_INT
i=0;
i<
n;
i++){
463 char JOBVL(
'V'), JOBVR(
'n');
464 CPPL_INT LDA(n), LDVL(n), LDVR(1), LWORK(4*n), INFO(1);
465 double *RWORK(
new double[2*n]);
466 comple *VR(NULL), *WORK(
new comple[LWORK]);
467 zgeev_(&JOBVL, &JOBVR, &n,
array, &LDA, &w[0], VL.array, &LDVL, VR, &LDVR, WORK, &LWORK, RWORK, &INFO);
473 for(CPPL_INT j=0; j<
n; j++){
474 for(CPPL_INT
i=0;
i<
n;
i++){
481 std::cerr <<
"Serious trouble happend. INFO = " << INFO <<
"." << std::endl;
friend _zgematrix i(const zgematrix &)
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
Complex Double-precision General Dence Matrix Class.
comple * array
1D array to store matrix data
CPPL_INT m
matrix row size
compute the singular value decomposition (SVD)
The arguments are zcocector S, zgematrix U and VT. All of them need not to be initialized. S, U and VT are overwitten and become singular values, left singular vectors, and right singular vectors respectively. This matrix also overwritten.
Definition at line 507 of file zgematrix-lapack.hpp.
References array, dcovector::array, m, n, resize(), and dcovector::resize().
508 {CPPL_VERBOSE_REPORT;
509 char JOBU(
'A'), JOBVT(
'A');
510 CPPL_INT LDA(
m), LDU(
m), LDVT(
n), LWORK(std::max(3*std::min(
m,
n)+std::max(
m,
n),5*std::min(
m,
n))), INFO(1);
511 double *RWORK(
new double[5*std::min(
m,
n)]);
512 comple *WORK(
new comple[LWORK]);
517 zgesvd_(&JOBU, &JOBVT, &
m, &
n,
array, &LDA, S.
array, U.
array, &LDU, VT.
array, &LDVT, WORK, &LWORK, RWORK, &INFO);
523 std::cerr <<
"Serious trouble happend. INFO = " << INFO <<
"." << std::endl;
void resize(const CPPL_INT &, const CPPL_INT &)
dcovector & resize(const CPPL_INT &, const CPPL_INT=0)
double * array
1D array to store vector data
CPPL_INT n
matrix column size
comple * array
1D array to store matrix data
CPPL_INT m
matrix row size
return its inverse matrix
Definition at line 18 of file zgematrix-calc.hpp.
Referenced by chsign(), col(), copy(), identity(), operator()(), operator*=(), operator+=(), operator-=(), read(), resize(), set(), write(), zero(), zgeev(), zgels(), zgelss(), and zgematrix().
23 std::cerr <<
"This matrix is not square and has no inverse matrix." << std::endl
24 <<
"Your input was (" << mat.
m <<
"x" << mat.
n <<
")." << std::endl;
31 mat_cp.zgesv(mat_inv);
CPPL_INT n
matrix column size
Complex Double-precision General Dence Matrix Class.
friend _zgematrix _(zgematrix &)
CPPL_INT m
matrix row size