diff --git a/cpplapack-r198/.svn/entries b/cpplapack-r198/.svn/entries deleted file mode 100644 index 48082f72f087ce7e6fa75b9c41d7387daecd447b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/entries +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/cpplapack-r198/.svn/format b/cpplapack-r198/.svn/format deleted file mode 100644 index 48082f72f087ce7e6fa75b9c41d7387daecd447b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/format +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/cpplapack-r198/.svn/pristine/00/0013303c862da2e4a0388c9ce483dc3634364e70.svn-base b/cpplapack-r198/.svn/pristine/00/0013303c862da2e4a0388c9ce483dc3634364e70.svn-base deleted file mode 100644 index ba793295d02392f6aa95e8076fce124512741da6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/00/0013303c862da2e4a0388c9ce483dc3634364e70.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -//============================================================================= -/*! dgbmatrix+_dsymatrix operator */ -inline _dgematrix operator+(const dgbmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB.n,matB.n); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) = matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix-_dsymatrix operator */ -inline _dgematrix operator-(const dgbmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB.n,matB.n); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) = -matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix*_dsymatrix operator */ -inline _dgematrix operator*(const dgbmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/00/00553ab36ac0752ab9fbdf72554629b0ecf2b4dc.svn-base b/cpplapack-r198/.svn/pristine/00/00553ab36ac0752ab9fbdf72554629b0ecf2b4dc.svn-base deleted file mode 100644 index f27af06f876c28b6365ff101b7103f00dd25e54e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/00/00553ab36ac0752ab9fbdf72554629b0ecf2b4dc.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - //// make dcovector x //// - CPPL::dcovector x(L); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - - //// print x in two ways //// - cout << "x =\n" << x << endl; - for(int i=0; i<x.l; i++){ - cout << "x(" << i << ") =" << x(i) << endl; - } - - //// make dcovector y //// - CPPL::dcovector y(x); - - //// print y in two ways //// - cout << "y =\n" << y << endl; - for(int i=0; i<y.l; i++){ - cout << "y(" << i << ") =" << y(i) << endl; - } - - //// print x+y //// - cout << "x+y=\n" << x+y << endl; - - //// write/read //// - x.write( "tmp.txt" ); - CPPL::dcovector z; - z.read( "tmp.txt" ); - cout << "z-x =\n" << z-x << "<-Should be zero." << endl; - - //// const //// - CPPL::dcovector X(CPPL::dcovector(3).set(0,1).set(1,2).set(2,3)); - cout << "X=\n" << X << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/00/006a09b14e20f83bfcc37e9885b6f33eff85d46c.svn-base b/cpplapack-r198/.svn/pristine/00/006a09b14e20f83bfcc37e9885b6f33eff85d46c.svn-base deleted file mode 100644 index c66a35d7704e9e152e6d7ade07e561874a2b9f36..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/00/006a09b14e20f83bfcc37e9885b6f33eff85d46c.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -//============================================================================= -//! Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage] -class dsymatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT const& m; //!< matrix row size - CPPL_INT n; //!< matrix column size - double* array; //!< 1D array to store matrix data - double** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dsymatrix(); - inline dsymatrix(const dsymatrix&); - inline dsymatrix(const _dsymatrix&); - inline dsymatrix(const CPPL_INT&); - inline dsymatrix(const char*); - inline ~dsymatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zhematrix to_zhematrix() const; - inline _dgematrix to_dgematrix() const; - inline _dssmatrix to_dssmatrix(const double eps=-1) const; - - //////// io //////// - inline double& operator()(const CPPL_INT&, const CPPL_INT&); - inline double operator()(const CPPL_INT&, const CPPL_INT&) const; - inline dsymatrix& set(const CPPL_INT&, const CPPL_INT&, const double&); - inline friend std::ostream& operator<<(std::ostream&, const dsymatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void complete() const; - inline void clear(); - inline dsymatrix& zero(); - inline dsymatrix& identity(); - inline void chsign(); - inline void copy(const dsymatrix&); - inline void shallow_copy(const _dsymatrix&); - inline dsymatrix& resize(const CPPL_INT&); - inline _drovector row(const CPPL_INT&) const; - inline _dcovector col(const CPPL_INT&) const; - inline friend void swap(dsymatrix&, dsymatrix&); - inline friend _dsymatrix _(dsymatrix&); - - //////// calc //////// - inline friend _dsymatrix t(const dsymatrix&); - inline friend _dsymatrix i(const dsymatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const dsymatrix&); - inline friend double damax(const dsymatrix&); - - //////// lapack //////// - inline CPPL_INT dsysv(dgematrix&); - inline CPPL_INT dsysv(dcovector&); - inline CPPL_INT dsyev(std::vector<double>&, const bool&); - inline CPPL_INT dsyev(std::vector<double>&, std::vector<dcovector>&); - inline CPPL_INT dsyev(std::vector<double>&, std::vector<drovector>&); - inline CPPL_INT dsygv(dsymatrix&, std::vector<double>&); - inline CPPL_INT dsygv(dsymatrix&, std::vector<double>&, std::vector<dcovector>&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline dsymatrix& operator=(const dsymatrix&); - inline dsymatrix& operator=(const _dsymatrix&); - - //////// += //////// - inline dsymatrix& operator+=(const dsymatrix&); - inline dsymatrix& operator+=(const _dsymatrix&); - - //////// -= //////// - inline dsymatrix& operator-=(const dsymatrix&); - inline dsymatrix& operator-=(const _dsymatrix&); - - //////// *= //////// - inline dsymatrix& operator*=(const dsymatrix&); - inline dsymatrix& operator*=(const _dsymatrix&); - inline dsymatrix& operator*=(const double&); - - //////// /= //////// - inline dsymatrix& operator/=(const double&); - - //////// unary //////// - inline friend const dsymatrix& operator+(const dsymatrix&); - inline friend _dsymatrix operator-(const dsymatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const dsymatrix&, const dgematrix&); - inline friend _dgematrix operator+(const dsymatrix&, const _dgematrix&); - inline friend _dsymatrix operator+(const dsymatrix&, const dsymatrix&); - inline friend _dsymatrix operator+(const dsymatrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const dsymatrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const dsymatrix&, const _dgbmatrix&); - inline friend _dgematrix operator+(const dsymatrix&, const dgsmatrix&); - inline friend _dgematrix operator+(const dsymatrix&, const _dgsmatrix&); - inline friend _dsymatrix operator+(const dsymatrix&, const dssmatrix&); - inline friend _dsymatrix operator+(const dsymatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const dsymatrix&, const dgematrix&); - inline friend _dgematrix operator-(const dsymatrix&, const _dgematrix&); - inline friend _dsymatrix operator-(const dsymatrix&, const dsymatrix&); - inline friend _dsymatrix operator-(const dsymatrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const dsymatrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const dsymatrix&, const _dgbmatrix&); - inline friend _dgematrix operator-(const dsymatrix&, const dgsmatrix&); - inline friend _dgematrix operator-(const dsymatrix&, const _dgsmatrix&); - inline friend _dsymatrix operator-(const dsymatrix&, const dssmatrix&); - inline friend _dsymatrix operator-(const dsymatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const dsymatrix&, const dcovector&); - inline friend _dcovector operator*(const dsymatrix&, const _dcovector&); - inline friend _dgematrix operator*(const dsymatrix&, const dgematrix&); - inline friend _dgematrix operator*(const dsymatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const dsymatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const dsymatrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const dsymatrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const dsymatrix&, const _dgbmatrix&); - inline friend _dgematrix operator*(const dsymatrix&, const dgsmatrix&); - inline friend _dgematrix operator*(const dsymatrix&, const _dgsmatrix&); - inline friend _dsymatrix operator*(const dsymatrix&, const dssmatrix&); - inline friend _dsymatrix operator*(const dsymatrix&, const _dssmatrix&); - inline friend _dsymatrix operator*(const dsymatrix&, const double&); - - //////// / //////// - inline friend _dsymatrix operator/(const dsymatrix&, const double&); - - //////// double //////// - inline friend _dsymatrix operator*(const double&, const dsymatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/00/006dcc7a468909a296e9e70527c68a3c81df37df.svn-base b/cpplapack-r198/.svn/pristine/00/006dcc7a468909a296e9e70527c68a3c81df37df.svn-base deleted file mode 100644 index cc1c5395ded8ab0b04e571a990a5bbb83bb2bfcb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/00/006dcc7a468909a296e9e70527c68a3c81df37df.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+zgsmatrix operator */ -inline _zgsmatrix operator+(const _zgsmatrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix-zgsmatrix operator */ -inline _zgsmatrix operator-(const _zgsmatrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) -=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix*zgsmatrix operator */ -inline _zgsmatrix operator*(const _zgsmatrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA.m, matB.n); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::const_iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::const_iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) +=it->v*matB.data[*p].v; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/00/00966895ce976d768b6c9ae8b64657609958e246.svn-base b/cpplapack-r198/.svn/pristine/00/00966895ce976d768b6c9ae8b64657609958e246.svn-base deleted file mode 100644 index 501cf3eebee3b5508b029f0313d8ed1fbfac0904..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/00/00966895ce976d768b6c9ae8b64657609958e246.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! zgsmatrix+zhematrix operator */ -inline _zgematrix operator+(const zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matB.to_zgematrix() ); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix-zhematrix operator */ -inline _zgematrix operator-(const zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to zgematrix //// - zgematrix newmat( (-matB).to_zgematrix() ); - - //// add //// - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix*zhematrix operator */ -inline _zgematrix operator*(const zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/01/011bc1776e869b8da4ec06e83d5f810789bba656.svn-base b/cpplapack-r198/.svn/pristine/01/011bc1776e869b8da4ec06e83d5f810789bba656.svn-base deleted file mode 100644 index c919a4dee16d39c780d7e6ad62cd1dd7e50a7063..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/01/011bc1776e869b8da4ec06e83d5f810789bba656.svn-base +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vc_sample", "vc_sample.vcxproj", "{61037E7C-EF94-43D7-B5DF-74F1BEB33710}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {61037E7C-EF94-43D7-B5DF-74F1BEB33710}.Debug|Win32.ActiveCfg = Debug|Win32 - {61037E7C-EF94-43D7-B5DF-74F1BEB33710}.Debug|Win32.Build.0 = Debug|Win32 - {61037E7C-EF94-43D7-B5DF-74F1BEB33710}.Release|Win32.ActiveCfg = Release|Win32 - {61037E7C-EF94-43D7-B5DF-74F1BEB33710}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/cpplapack-r198/.svn/pristine/01/018792524be52ab1d4282380feabe9d3207e12b2.svn-base b/cpplapack-r198/.svn/pristine/01/018792524be52ab1d4282380feabe9d3207e12b2.svn-base deleted file mode 100644 index c901331ae2ae23e05e8c9de782f72354949e2a55..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/01/018792524be52ab1d4282380feabe9d3207e12b2.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! +dgbmatrix operator */ -inline const dgbmatrix& operator+(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -dgbmatrix operator */ -inline _dgbmatrix operator-(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgbmatrix newmat(mat.m,mat.n,mat.kl,mat.ku); - for(CPPL_INT i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){ - newmat.array[i]=-mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/01/01b23fa646d120ea2b44aad30a226fe91cd6bb2a.svn-base b/cpplapack-r198/.svn/pristine/01/01b23fa646d120ea2b44aad30a226fe91cd6bb2a.svn-base deleted file mode 100644 index 09d560d118a4bd371fce439d525b2c1aebfa5f8b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/01/01b23fa646d120ea2b44aad30a226fe91cd6bb2a.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(3), N(4), KL(2), KU(1); - - CPPL::zgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - - cout << "A =\n" << A << endl; - - cout << "#### t(A) ####" << endl; - cout << "t(A) =\n" << CPPL::t(A) << endl; - - cout << "#### i(A) ####" << endl; - A.resize(M,M,KL,KU); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if( !((i-j)>A.kl || (j-i)>A.ku) ){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - }} - CPPL::zgematrix A_inv; - A_inv =CPPL::i(A); - //A_inv =i(A); // g++ cannot compile this line - - cout << "A =\n" << A << endl; - cout << "A_inv =\n" << A_inv << endl; - cout << "A*A_inv =\n" << A*A_inv << endl; - cout << "A_inv*A =\n" << A_inv*A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/01/01f3f666b3279f6fd88f910e438926abd5a9895c.svn-base b/cpplapack-r198/.svn/pristine/01/01f3f666b3279f6fd88f910e438926abd5a9895c.svn-base deleted file mode 100644 index ac954dfd63eab4b05635bd6590ab181ccf7f8eef..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/01/01f3f666b3279f6fd88f910e438926abd5a9895c.svn-base +++ /dev/null @@ -1,1062 +0,0 @@ -/*****************************************************************************/ -/* cpplapack.h */ -/*****************************************************************************/ - -#ifndef CPPLAPACK_H -#define CPPLAPACK_H - -//============================================================================= -#include <iostream> -#include <iomanip> -#include <cstdlib> -#include <complex> -#include <cmath> -#include <cfloat> -#include <vector>//only for ?geev, ?gegv, etc. -#include <map> -#include <fstream> -#include <string> -#include <algorithm> -#include <stdint.h> - -//============================================================================= -#ifdef __INTEL_COMPILER -#define CPPL_INT MKL_INT -#define MKL_Complex16 std::complex<double> -#else //__INTEL_COMPILER -typedef int CPPL_INT; -#endif//__INTEL_COMPILER - -//============================================================================= -namespace CPPL{ -#ifdef __INTEL_COMPILER -#include <mkl.h> -#include "prototype/mkl_blas.h" -#include "prototype/mkl_lapack.h" -#else //__INTEL_COMPILER -#include "prototype/dblas.h" -#include "prototype/zblas.h" -#include "prototype/dlapack.h" -#include "prototype/zlapack.h" -#endif//__INTEL_COMPILER -} - -//============================================================================= -#ifdef _OPENMP -#include <omp.h> -#endif//_OPENMP - -//============================================================================= -#ifndef M_PI -#define M_PI 3.14159265358979 -#endif//M_PI - -//============================================================================= -#ifdef _MSC_VER -#define __func__ __FUNCTION__ -#endif//_MSC_VER - -//============================================================================= -/////// ERROR_REPORT /////// -#ifdef __GNUC__ -#define ERROR_REPORT std::cerr << "\n[ERROR]@" << __PRETTY_FUNCTION__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#else //__GNUC__ -#define ERROR_REPORT std::cerr << "\n[ERROR]@" << __func__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#endif//__GNUC__ - -//============================================================================= -/////// WARNING_REPORT /////// -#ifdef __GNUC__ -#define WARNING_REPORT std::cerr << "\n[WARNING]@" << __PRETTY_FUNCTION__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#else //__GNUC__ -#define WARNING_REPORT std::cerr << "\n[WARNING]@" << __func__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#endif//__GNUC__ - -//============================================================================= -/////// DEBUG_REPORT /////// -#ifdef DEBUG -#ifdef __GNUC__ -#define DEBUG_REPORT std::cerr << "\n[DEBUG]@" << __PRETTY_FUNCTION__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#else //__GNUC__ -#define DEBUG_REPORT std::cerr << "\n[DEBUG]@" << __func__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#endif//__GNUC__ -#else //DEBIG -#define DEBUG_REPORT ; -#endif//DEBUG - -//============================================================================= -/////// VERBOSE_REPORT /////// -#ifdef VERBOSE -#ifdef __GNUC__ -#define VERBOSE_REPORT std::cerr << "\n[VERBOSE]@" << __PRETTY_FUNCTION__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#else //__GNUC__ -#define VERBOSE_REPORT std::cerr << "\n[VERBOSE]@" << __func__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#endif//__GNUC__ -#else //VERBOSE -#define VERBOSE_REPORT ; -#endif//VERBOSE - -//============================================================================= -/////// CPPL_VERBOSE_REPORT /////// -#ifdef CPPL_VERBOSE -#ifdef __GNUC__ -#define CPPL_VERBOSE_REPORT std::cerr << "\n[VERBOSE]@" << __PRETTY_FUNCTION__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#else //__GNUC__ -#define CPPL_VERBOSE_REPORT std::cerr << "\n[VERBOSE]@" << __func__ << " in \"" << __FILE__ << "\" at l." << __LINE__ << std::endl; -#endif//__GNUC__ -#else //CPPL_VERBOSE -#define CPPL_VERBOSE_REPORT ; -#endif//CPPL_VERBOSE - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -namespace CPPL{ //!< namespace for CPPLapack - -/////////////////////////////////////////////////////////// -///////////////////// class prototype ///////////////////// -/////////////////////////////////////////////////////////// -class dcomponent; -class zcomponent; -class zhecomplex; -////////////////////////////////// -class dcovector; class _dcovector; -class drovector; class _drovector; -class dgematrix; class _dgematrix; -class dgbmatrix; class _dgbmatrix; -class dsymatrix; class _dsymatrix; -class dgsmatrix; class _dgsmatrix; -class dssmatrix; class _dssmatrix; -class dgrmatrix; -////////////////////////////////// -class zcovector; class _zcovector; -class zrovector; class _zrovector; -class zgematrix; class _zgematrix; -class zgbmatrix; class _zgbmatrix; -class zhematrix; class _zhematrix; -class zgsmatrix; class _zgsmatrix; -class zhsmatrix; class _zhsmatrix; -//class zgrmatrix; -////////////////////////////////// -template<CPPL_INT> class dcovector_small; -template<CPPL_INT> class drovector_small; -template<CPPL_INT,CPPL_INT> class dgematrix_small; -template<CPPL_INT> class dsymatrix_small; -////////////////////////////////// -template<CPPL_INT> class zcovector_small; -template<CPPL_INT> class zrovector_small; -template<CPPL_INT,CPPL_INT> class zgematrix_small; -template<CPPL_INT> class zhematrix_small; - -/////////////////////////////////////////////////////////// -///////////////////////// typedef ///////////////////////// -/////////////////////////////////////////////////////////// -//////// complex //////// -typedef std::complex<double> comple;//double-precision complex -//////// double small //////// -typedef dcovector_small<1> dcovec1;//1D column vector -typedef drovector_small<1> drovec1;//1D row vector -typedef dgematrix_small<1,1> dgemat1;//1x1 dense matrix -typedef dsymatrix_small<1> dsymat1;//1x1 symmetric matrix -typedef dcovector_small<2> dcovec2;//2D column vector -typedef drovector_small<2> drovec2;//2D row vector -typedef dgematrix_small<2,2> dgemat2;//2x2 dense matrix -typedef dsymatrix_small<2> dsymat2;//2x2 symmetric matrix -typedef dcovector_small<3> dcovec3;//3D column vector -typedef drovector_small<3> drovec3;//3D row vector -typedef dgematrix_small<3,3> dgemat3;//3x3 dense matrix -typedef dsymatrix_small<3> dsymat3;//3x3 symmetric matrix -typedef dcovector_small<4> dquater;//quaternion(xi+yj+zk+r) -typedef dcovector_small<4> dcovec4;//4D column vector -typedef drovector_small<4> drovec4;//4D row vector -typedef dgematrix_small<4,4> dgemat4;//4x4 dense matrix -typedef dsymatrix_small<4> dsymat4;//4x4 symmetric matrix -//////// complex small //////// -typedef zcovector_small<1> zcovec1;//1D column vector -typedef zrovector_small<1> zrovec1;//1D row vector -typedef zgematrix_small<1,1> zgemat1;//1x1 dense matrix -typedef zhematrix_small<1> zhemat1;//1x1 hermitian matrix -typedef zcovector_small<2> zcovec2;//2D column vector -typedef zrovector_small<2> zrovec2;//2D row vector -typedef zgematrix_small<2,2> zgemat2;//2x2 dense matrix -typedef zhematrix_small<2> zhemat2;//2x2 hermitian matrix -typedef zcovector_small<3> zcovec3;//3D column vector -typedef zrovector_small<3> zrovec3;//3D row vector -typedef zgematrix_small<3,3> zgemat3;//3x3 dense matrix -typedef zhematrix_small<3> zhemat3;//3x3 hermitian matrix -typedef zcovector_small<4> zcovec4;//4D column vector -typedef zrovector_small<4> zrovec4;//4D row vector -typedef zgematrix_small<4,4> zgemat4;//4x4 dense matrix -typedef zhematrix_small<4> zhemat4;//4x4 hermitian matrix - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////// -//////////////////// class definition ///////////////////// -/////////////////////////////////////////////////////////// -#include "misc/dcomponent.hpp" -#include "misc/zcomponent.hpp" -#include "misc/zhecomplex.hpp" -/////////////////////////////////////// -#include "dcovector-/dcovector.hpp" -#include "drovector-/drovector.hpp" -#include "dgematrix-/dgematrix.hpp" -#include "dgbmatrix-/dgbmatrix.hpp" -#include "dsymatrix-/dsymatrix.hpp" -#include "dgsmatrix-/dgsmatrix.hpp" -#include "dssmatrix-/dssmatrix.hpp" -#include "dgrmatrix-/dgrmatrix.hpp" -/////////////////////////////////////// -#include "_dcovector-/_dcovector.hpp" -#include "_drovector-/_drovector.hpp" -#include "_dgematrix-/_dgematrix.hpp" -#include "_dgbmatrix-/_dgbmatrix.hpp" -#include "_dsymatrix-/_dsymatrix.hpp" -#include "_dgsmatrix-/_dgsmatrix.hpp" -#include "_dssmatrix-/_dssmatrix.hpp" -/////////////////////////////////////// -#include "zcovector-/zcovector.hpp" -#include "zrovector-/zrovector.hpp" -#include "zgematrix-/zgematrix.hpp" -#include "zgbmatrix-/zgbmatrix.hpp" -#include "zhematrix-/zhematrix.hpp" -#include "zgsmatrix-/zgsmatrix.hpp" -#include "zhsmatrix-/zhsmatrix.hpp" -/////////////////////////////////////// -#include "_zcovector-/_zcovector.hpp" -#include "_zrovector-/_zrovector.hpp" -#include "_zgematrix-/_zgematrix.hpp" -#include "_zgbmatrix-/_zgbmatrix.hpp" -#include "_zhematrix-/_zhematrix.hpp" -#include "_zgsmatrix-/_zgsmatrix.hpp" -#include "_zhsmatrix-/_zhsmatrix.hpp" -/////////////////////////////////////// -#include "small/dcovector_small.hpp" -#include "small/drovector_small.hpp" -#include "small/dgematrix_small.hpp" -#include "small/dsymatrix_small.hpp" -/////////////////////////////////////// -#include "small/zcovector_small.hpp" -#include "small/zrovector_small.hpp" -#include "small/zgematrix_small.hpp" -#include "small/zhematrix_small.hpp" - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////// -//////////////////////// dcovector //////////////////////// -/////////////////////////////////////////////////////////// -#include "dcovector-/dcovector-constructor.hpp" -#include "dcovector-/dcovector-cast.hpp" -#include "dcovector-/dcovector-io.hpp" -#include "dcovector-/dcovector-calc.hpp" -#include "dcovector-/dcovector-misc.hpp" -#include "dcovector-/dcovector-unary.hpp" -#include "dcovector-/dcovector-dcovector.hpp" -#include "dcovector-/dcovector-_dcovector.hpp" -#include "dcovector-/dcovector-drovector.hpp" -#include "dcovector-/dcovector-_drovector.hpp" -#include "dcovector-/dcovector-dgematrix.hpp" -#include "dcovector-/dcovector-_dgematrix.hpp" -#include "dcovector-/dcovector-dgbmatrix.hpp" -#include "dcovector-/dcovector-_dgbmatrix.hpp" -#include "dcovector-/dcovector-dsymatrix.hpp" -#include "dcovector-/dcovector-_dsymatrix.hpp" -#include "dcovector-/dcovector-dgsmatrix.hpp" -#include "dcovector-/dcovector-_dgsmatrix.hpp" -//#include "dcovector-/dcovector-dssmatrix.hpp" -//#include "dcovector-/dcovector-_dssmatrix.hpp" -#include "dcovector-/dcovector-double.hpp" -/////////////////////// _dcovector //////////////////////// -#include "_dcovector-/_dcovector-constructor.hpp" -#include "_dcovector-/_dcovector-cast.hpp" -#include "_dcovector-/_dcovector-io.hpp" -#include "_dcovector-/_dcovector-calc.hpp" -#include "_dcovector-/_dcovector-misc.hpp" -#include "_dcovector-/_dcovector-unary.hpp" -#include "_dcovector-/_dcovector-dcovector.hpp" -#include "_dcovector-/_dcovector-_dcovector.hpp" -#include "_dcovector-/_dcovector-drovector.hpp" -#include "_dcovector-/_dcovector-_drovector.hpp" -#include "_dcovector-/_dcovector-dgematrix.hpp" -#include "_dcovector-/_dcovector-_dgematrix.hpp" -#include "_dcovector-/_dcovector-dgbmatrix.hpp" -#include "_dcovector-/_dcovector-_dgbmatrix.hpp" -#include "_dcovector-/_dcovector-dsymatrix.hpp" -#include "_dcovector-/_dcovector-_dsymatrix.hpp" -#include "_dcovector-/_dcovector-dgsmatrix.hpp" -#include "_dcovector-/_dcovector-_dgsmatrix.hpp" -//#include "_dcovector-/_dcovector-dssmatrix.hpp" -//#include "_dcovector-/_dcovector-_dssmatrix.hpp" -#include "_dcovector-/_dcovector-double.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// drovector //////////////////////// -/////////////////////////////////////////////////////////// -#include "drovector-/drovector-constructor.hpp" -#include "drovector-/drovector-cast.hpp" -#include "drovector-/drovector-io.hpp" -#include "drovector-/drovector-calc.hpp" -#include "drovector-/drovector-misc.hpp" -#include "drovector-/drovector-unary.hpp" -#include "drovector-/drovector-dcovector.hpp" -#include "drovector-/drovector-_dcovector.hpp" -#include "drovector-/drovector-drovector.hpp" -#include "drovector-/drovector-_drovector.hpp" -#include "drovector-/drovector-dgematrix.hpp" -#include "drovector-/drovector-_dgematrix.hpp" -#include "drovector-/drovector-dgbmatrix.hpp" -#include "drovector-/drovector-_dgbmatrix.hpp" -#include "drovector-/drovector-dsymatrix.hpp" -#include "drovector-/drovector-_dsymatrix.hpp" -#include "drovector-/drovector-dgsmatrix.hpp" -#include "drovector-/drovector-_dgsmatrix.hpp" -#include "drovector-/drovector-dssmatrix.hpp" -#include "drovector-/drovector-_dssmatrix.hpp" -#include "drovector-/drovector-double.hpp" -/////////////////////// _drovector //////////////////////// -#include "_drovector-/_drovector-constructor.hpp" -#include "_drovector-/_drovector-cast.hpp" -#include "_drovector-/_drovector-io.hpp" -#include "_drovector-/_drovector-calc.hpp" -#include "_drovector-/_drovector-misc.hpp" -#include "_drovector-/_drovector-unary.hpp" -#include "_drovector-/_drovector-dcovector.hpp" -#include "_drovector-/_drovector-_dcovector.hpp" -#include "_drovector-/_drovector-drovector.hpp" -#include "_drovector-/_drovector-_drovector.hpp" -#include "_drovector-/_drovector-dgematrix.hpp" -#include "_drovector-/_drovector-_dgematrix.hpp" -#include "_drovector-/_drovector-dgbmatrix.hpp" -#include "_drovector-/_drovector-_dgbmatrix.hpp" -#include "_drovector-/_drovector-dsymatrix.hpp" -#include "_drovector-/_drovector-_dsymatrix.hpp" -#include "_drovector-/_drovector-dgsmatrix.hpp" -#include "_drovector-/_drovector-_dgsmatrix.hpp" -#include "_drovector-/_drovector-dssmatrix.hpp" -#include "_drovector-/_drovector-_dssmatrix.hpp" -#include "_drovector-/_drovector-double.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// dgematrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "dgematrix-/dgematrix-constructor.hpp" -#include "dgematrix-/dgematrix-cast.hpp" -#include "dgematrix-/dgematrix-io.hpp" -#include "dgematrix-/dgematrix-misc.hpp" -#include "dgematrix-/dgematrix-calc.hpp" -#include "dgematrix-/dgematrix-lapack.hpp" -#include "dgematrix-/dgematrix-unary.hpp" -#include "dgematrix-/dgematrix-dcovector.hpp" -#include "dgematrix-/dgematrix-_dcovector.hpp" -#include "dgematrix-/dgematrix-drovector.hpp" -#include "dgematrix-/dgematrix-_drovector.hpp" -#include "dgematrix-/dgematrix-dgematrix.hpp" -#include "dgematrix-/dgematrix-_dgematrix.hpp" -#include "dgematrix-/dgematrix-dgbmatrix.hpp" -#include "dgematrix-/dgematrix-_dgbmatrix.hpp" -#include "dgematrix-/dgematrix-dsymatrix.hpp" -#include "dgematrix-/dgematrix-_dsymatrix.hpp" -#include "dgematrix-/dgematrix-dgsmatrix.hpp" -#include "dgematrix-/dgematrix-_dgsmatrix.hpp" -//#include "dgematrix-/dgematrix-dssmatrix.hpp" -//#include "dgematrix-/dgematrix-_dssmatrix.hpp" -#include "dgematrix-/dgematrix-double.hpp" -/////////////////////// _dgematrix //////////////////////// -#include "_dgematrix-/_dgematrix-constructor.hpp" -#include "_dgematrix-/_dgematrix-cast.hpp" -#include "_dgematrix-/_dgematrix-io.hpp" -#include "_dgematrix-/_dgematrix-misc.hpp" -#include "_dgematrix-/_dgematrix-calc.hpp" -#include "_dgematrix-/_dgematrix-unary.hpp" -#include "_dgematrix-/_dgematrix-dcovector.hpp" -#include "_dgematrix-/_dgematrix-_dcovector.hpp" -#include "_dgematrix-/_dgematrix-drovector.hpp" -#include "_dgematrix-/_dgematrix-_drovector.hpp" -#include "_dgematrix-/_dgematrix-dgematrix.hpp" -#include "_dgematrix-/_dgematrix-_dgematrix.hpp" -#include "_dgematrix-/_dgematrix-dgbmatrix.hpp" -#include "_dgematrix-/_dgematrix-_dgbmatrix.hpp" -#include "_dgematrix-/_dgematrix-dsymatrix.hpp" -#include "_dgematrix-/_dgematrix-_dsymatrix.hpp" -#include "_dgematrix-/_dgematrix-dgsmatrix.hpp" -#include "_dgematrix-/_dgematrix-_dgsmatrix.hpp" -#include "_dgematrix-/_dgematrix-dssmatrix.hpp" -//#include "_dgematrix-/_dgematrix-_dssmatrix.hpp" -#include "_dgematrix-/_dgematrix-double.hpp" - - -/////////////////////////////////////////////////////////// -//////////////////////// dgbmatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "dgbmatrix-/dgbmatrix-constructor.hpp" -#include "dgbmatrix-/dgbmatrix-cast.hpp" -#include "dgbmatrix-/dgbmatrix-io.hpp" -#include "dgbmatrix-/dgbmatrix-misc.hpp" -#include "dgbmatrix-/dgbmatrix-calc.hpp" -#include "dgbmatrix-/dgbmatrix-lapack.hpp" -#include "dgbmatrix-/dgbmatrix-unary.hpp" -#include "dgbmatrix-/dgbmatrix-dcovector.hpp" -#include "dgbmatrix-/dgbmatrix-_dcovector.hpp" -#include "dgbmatrix-/dgbmatrix-drovector.hpp" -#include "dgbmatrix-/dgbmatrix-_drovector.hpp" -#include "dgbmatrix-/dgbmatrix-dgematrix.hpp" -#include "dgbmatrix-/dgbmatrix-_dgematrix.hpp" -#include "dgbmatrix-/dgbmatrix-dgbmatrix.hpp" -#include "dgbmatrix-/dgbmatrix-_dgbmatrix.hpp" -#include "dgbmatrix-/dgbmatrix-dsymatrix.hpp" -#include "dgbmatrix-/dgbmatrix-_dsymatrix.hpp" -#include "dgbmatrix-/dgbmatrix-dgsmatrix.hpp" -#include "dgbmatrix-/dgbmatrix-_dgsmatrix.hpp" -//#include "dgbmatrix-/dgbmatrix-dssmatrix.hpp" -//#include "dgbmatrix-/dgbmatrix-_dssmatrix.hpp" -#include "dgbmatrix-/dgbmatrix-double.hpp" -/////////////////////// _dgbmatrix //////////////////////// -#include "_dgbmatrix-/_dgbmatrix-constructor.hpp" -#include "_dgbmatrix-/_dgbmatrix-cast.hpp" -#include "_dgbmatrix-/_dgbmatrix-io.hpp" -#include "_dgbmatrix-/_dgbmatrix-misc.hpp" -#include "_dgbmatrix-/_dgbmatrix-calc.hpp" -#include "_dgbmatrix-/_dgbmatrix-unary.hpp" -#include "_dgbmatrix-/_dgbmatrix-dcovector.hpp" -#include "_dgbmatrix-/_dgbmatrix-_dcovector.hpp" -#include "_dgbmatrix-/_dgbmatrix-drovector.hpp" -#include "_dgbmatrix-/_dgbmatrix-_drovector.hpp" -#include "_dgbmatrix-/_dgbmatrix-dgematrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-_dgematrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-dgbmatrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-_dgbmatrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-dsymatrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-_dsymatrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-dgsmatrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-_dgsmatrix.hpp" -//#include "_dgbmatrix-/_dgbmatrix-dssmatrix.hpp" -//#include "_dgbmatrix-/_dgbmatrix-_dssmatrix.hpp" -#include "_dgbmatrix-/_dgbmatrix-double.hpp" - - -/////////////////////////////////////////////////////////// -//////////////////////// dsymatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "dsymatrix-/dsymatrix-constructor.hpp" -#include "dsymatrix-/dsymatrix-cast.hpp" -#include "dsymatrix-/dsymatrix-io.hpp" -#include "dsymatrix-/dsymatrix-misc.hpp" -#include "dsymatrix-/dsymatrix-calc.hpp" -#include "dsymatrix-/dsymatrix-lapack.hpp" -#include "dsymatrix-/dsymatrix-unary.hpp" -#include "dsymatrix-/dsymatrix-dcovector.hpp" -#include "dsymatrix-/dsymatrix-_dcovector.hpp" -#include "dsymatrix-/dsymatrix-drovector.hpp" -#include "dsymatrix-/dsymatrix-_drovector.hpp" -#include "dsymatrix-/dsymatrix-dgematrix.hpp" -#include "dsymatrix-/dsymatrix-_dgematrix.hpp" -#include "dsymatrix-/dsymatrix-dgbmatrix.hpp" -#include "dsymatrix-/dsymatrix-_dgbmatrix.hpp" -#include "dsymatrix-/dsymatrix-dsymatrix.hpp" -#include "dsymatrix-/dsymatrix-_dsymatrix.hpp" -#include "dsymatrix-/dsymatrix-dgsmatrix.hpp" -#include "dsymatrix-/dsymatrix-_dgsmatrix.hpp" -//#include "dsymatrix-/dsymatrix-dssmatrix.hpp" -//#include "dsymatrix-/dsymatrix-_dssmatrix.hpp" -#include "dsymatrix-/dsymatrix-double.hpp" -/////////////////////// _dsymatrix //////////////////////// -#include "_dsymatrix-/_dsymatrix-constructor.hpp" -#include "_dsymatrix-/_dsymatrix-cast.hpp" -#include "_dsymatrix-/_dsymatrix-io.hpp" -#include "_dsymatrix-/_dsymatrix-misc.hpp" -#include "_dsymatrix-/_dsymatrix-calc.hpp" -#include "_dsymatrix-/_dsymatrix-unary.hpp" -#include "_dsymatrix-/_dsymatrix-dcovector.hpp" -#include "_dsymatrix-/_dsymatrix-_dcovector.hpp" -#include "_dsymatrix-/_dsymatrix-drovector.hpp" -#include "_dsymatrix-/_dsymatrix-_drovector.hpp" -#include "_dsymatrix-/_dsymatrix-dgematrix.hpp" -#include "_dsymatrix-/_dsymatrix-_dgematrix.hpp" -#include "_dsymatrix-/_dsymatrix-dgbmatrix.hpp" -#include "_dsymatrix-/_dsymatrix-_dgbmatrix.hpp" -#include "_dsymatrix-/_dsymatrix-dsymatrix.hpp" -#include "_dsymatrix-/_dsymatrix-_dsymatrix.hpp" -#include "_dsymatrix-/_dsymatrix-dgsmatrix.hpp" -#include "_dsymatrix-/_dsymatrix-_dgsmatrix.hpp" -//#include "_dsymatrix-/_dsymatrix-dssmatrix.hpp" -//#include "_dsymatrix-/_dsymatrix-_dssmatrix.hpp" -#include "_dsymatrix-/_dsymatrix-double.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// dgsmatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "dgsmatrix-/dgsmatrix-constructor.hpp" -#include "dgsmatrix-/dgsmatrix-cast.hpp" -#include "dgsmatrix-/dgsmatrix-io.hpp" -#include "dgsmatrix-/dgsmatrix-misc.hpp" -#include "dgsmatrix-/dgsmatrix-calc.hpp" -#include "dgsmatrix-/dgsmatrix-pardiso.hpp" -#include "dgsmatrix-/dgsmatrix-unary.hpp" -#include "dgsmatrix-/dgsmatrix-dcovector.hpp" -#include "dgsmatrix-/dgsmatrix-_dcovector.hpp" -#include "dgsmatrix-/dgsmatrix-drovector.hpp" -#include "dgsmatrix-/dgsmatrix-_drovector.hpp" -#include "dgsmatrix-/dgsmatrix-dgematrix.hpp" -#include "dgsmatrix-/dgsmatrix-_dgematrix.hpp" -#include "dgsmatrix-/dgsmatrix-dgbmatrix.hpp" -#include "dgsmatrix-/dgsmatrix-_dgbmatrix.hpp" -#include "dgsmatrix-/dgsmatrix-dsymatrix.hpp" -#include "dgsmatrix-/dgsmatrix-_dsymatrix.hpp" -#include "dgsmatrix-/dgsmatrix-dgsmatrix.hpp" -#include "dgsmatrix-/dgsmatrix-_dgsmatrix.hpp" -//#include "dgsmatrix-/dgsmatrix-dssmatrix.hpp" -//#include "dgsmatrix-/dgsmatrix-_dssmatrix.hpp" -#include "dgsmatrix-/dgsmatrix-double.hpp" -/////////////////////// _dgsmatrix //////////////////////// -#include "_dgsmatrix-/_dgsmatrix-constructor.hpp" -#include "_dgsmatrix-/_dgsmatrix-cast.hpp" -#include "_dgsmatrix-/_dgsmatrix-io.hpp" -#include "_dgsmatrix-/_dgsmatrix-misc.hpp" -#include "_dgsmatrix-/_dgsmatrix-calc.hpp" -#include "_dgsmatrix-/_dgsmatrix-unary.hpp" -#include "_dgsmatrix-/_dgsmatrix-dcovector.hpp" -#include "_dgsmatrix-/_dgsmatrix-_dcovector.hpp" -#include "_dgsmatrix-/_dgsmatrix-drovector.hpp" -#include "_dgsmatrix-/_dgsmatrix-_drovector.hpp" -#include "_dgsmatrix-/_dgsmatrix-dgematrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-_dgematrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-dgbmatrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-_dgbmatrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-dsymatrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-_dsymatrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-dgsmatrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-_dgsmatrix.hpp" -//#include "_dgsmatrix-/_dgsmatrix-dssmatrix.hpp" -//#include "_dgsmatrix-/_dgsmatrix-_dssmatrix.hpp" -#include "_dgsmatrix-/_dgsmatrix-double.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// dssmatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "dssmatrix-/dssmatrix-constructor.hpp" -#include "dssmatrix-/dssmatrix-cast.hpp" -#include "dssmatrix-/dssmatrix-io.hpp" -#include "dssmatrix-/dssmatrix-misc.hpp" -#include "dssmatrix-/dssmatrix-calc.hpp" -#include "dssmatrix-/dssmatrix-pardiso.hpp" -#include "dssmatrix-/dssmatrix-unary.hpp" -#include "dssmatrix-/dssmatrix-dcovector.hpp" -#include "dssmatrix-/dssmatrix-_dcovector.hpp" -#include "dssmatrix-/dssmatrix-drovector.hpp" -#include "dssmatrix-/dssmatrix-_drovector.hpp" -#include "dssmatrix-/dssmatrix-dgematrix.hpp" -#include "dssmatrix-/dssmatrix-_dgematrix.hpp" -#include "dssmatrix-/dssmatrix-dgbmatrix.hpp" -#include "dssmatrix-/dssmatrix-_dgbmatrix.hpp" -#include "dssmatrix-/dssmatrix-dsymatrix.hpp" -#include "dssmatrix-/dssmatrix-_dsymatrix.hpp" -#include "dssmatrix-/dssmatrix-dssmatrix.hpp" -#include "dssmatrix-/dssmatrix-_dssmatrix.hpp" -#include "dssmatrix-/dssmatrix-double.hpp" -/////////////////////// _dssmatrix //////////////////////// -#include "_dssmatrix-/_dssmatrix-constructor.hpp" -#include "_dssmatrix-/_dssmatrix-cast.hpp" -#include "_dssmatrix-/_dssmatrix-io.hpp" -#include "_dssmatrix-/_dssmatrix-misc.hpp" -#include "_dssmatrix-/_dssmatrix-calc.hpp" -#include "_dssmatrix-/_dssmatrix-unary.hpp" -#include "_dssmatrix-/_dssmatrix-dcovector.hpp" -#include "_dssmatrix-/_dssmatrix-_dcovector.hpp" -#include "_dssmatrix-/_dssmatrix-drovector.hpp" -#include "_dssmatrix-/_dssmatrix-_drovector.hpp" -#include "_dssmatrix-/_dssmatrix-dgematrix.hpp" -#include "_dssmatrix-/_dssmatrix-_dgematrix.hpp" -#include "_dssmatrix-/_dssmatrix-dgbmatrix.hpp" -#include "_dssmatrix-/_dssmatrix-_dgbmatrix.hpp" -#include "_dssmatrix-/_dssmatrix-dsymatrix.hpp" -#include "_dssmatrix-/_dssmatrix-_dsymatrix.hpp" -#include "_dssmatrix-/_dssmatrix-dssmatrix.hpp" -#include "_dssmatrix-/_dssmatrix-_dssmatrix.hpp" -#include "_dssmatrix-/_dssmatrix-double.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// dgrmatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "dgrmatrix-/dgrmatrix-constructor.hpp" -#include "dgrmatrix-/dgrmatrix-cast.hpp" -#include "dgrmatrix-/dgrmatrix-io.hpp" -#include "dgrmatrix-/dgrmatrix-misc.hpp" -#include "dgrmatrix-/dgrmatrix-calc.hpp" -#include "dgrmatrix-/dgrmatrix-pardiso.hpp" -#include "dgrmatrix-/dgrmatrix-rci.hpp" -#include "dgrmatrix-/dgrmatrix-unary.hpp" -#include "dgrmatrix-/dgrmatrix-dcovector.hpp" -#include "dgrmatrix-/dgrmatrix-_dcovector.hpp" -#include "dgrmatrix-/dgrmatrix-double.hpp" - -/////////////////////////////////////////////////////////// -///////////////////////// double ////////////////////////// -/////////////////////////////////////////////////////////// -#include "double-/double-dcovector.hpp" -#include "double-/double-_dcovector.hpp" -#include "double-/double-drovector.hpp" -#include "double-/double-_drovector.hpp" -#include "double-/double-dgematrix.hpp" -#include "double-/double-_dgematrix.hpp" -#include "double-/double-dgbmatrix.hpp" -#include "double-/double-_dgbmatrix.hpp" -#include "double-/double-dsymatrix.hpp" -#include "double-/double-_dsymatrix.hpp" -#include "double-/double-dgsmatrix.hpp" -#include "double-/double-_dgsmatrix.hpp" -#include "double-/double-dssmatrix.hpp" -#include "double-/double-_dssmatrix.hpp" -#include "double-/double-dgrmatrix.hpp" - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////// -//////////////////////// zcovector //////////////////////// -/////////////////////////////////////////////////////////// -#include "zcovector-/zcovector-constructor.hpp" -#include "zcovector-/zcovector-io.hpp" -#include "zcovector-/zcovector-calc.hpp" -#include "zcovector-/zcovector-misc.hpp" -#include "zcovector-/zcovector-unary.hpp" -#include "zcovector-/zcovector-zcovector.hpp" -#include "zcovector-/zcovector-_zcovector.hpp" -#include "zcovector-/zcovector-zrovector.hpp" -#include "zcovector-/zcovector-_zrovector.hpp" -#include "zcovector-/zcovector-zgematrix.hpp" -#include "zcovector-/zcovector-_zgematrix.hpp" -#include "zcovector-/zcovector-zgbmatrix.hpp" -#include "zcovector-/zcovector-_zgbmatrix.hpp" -#include "zcovector-/zcovector-zhematrix.hpp" -#include "zcovector-/zcovector-_zhematrix.hpp" -#include "zcovector-/zcovector-zgsmatrix.hpp" -#include "zcovector-/zcovector-_zgsmatrix.hpp" -#include "zcovector-/zcovector-zhsmatrix.hpp" -#include "zcovector-/zcovector-_zhsmatrix.hpp" -#include "zcovector-/zcovector-double.hpp" -#include "zcovector-/zcovector-complex.hpp" -/////////////////////// _zcovector //////////////////////// -#include "_zcovector-/_zcovector-constructor.hpp" -#include "_zcovector-/_zcovector-io.hpp" -#include "_zcovector-/_zcovector-calc.hpp" -#include "_zcovector-/_zcovector-misc.hpp" -#include "_zcovector-/_zcovector-unary.hpp" -#include "_zcovector-/_zcovector-zcovector.hpp" -#include "_zcovector-/_zcovector-_zcovector.hpp" -#include "_zcovector-/_zcovector-zrovector.hpp" -#include "_zcovector-/_zcovector-_zrovector.hpp" -#include "_zcovector-/_zcovector-zgematrix.hpp" -#include "_zcovector-/_zcovector-_zgematrix.hpp" -#include "_zcovector-/_zcovector-zgbmatrix.hpp" -#include "_zcovector-/_zcovector-_zgbmatrix.hpp" -#include "_zcovector-/_zcovector-zhematrix.hpp" -#include "_zcovector-/_zcovector-_zhematrix.hpp" -#include "_zcovector-/_zcovector-zgsmatrix.hpp" -#include "_zcovector-/_zcovector-_zgsmatrix.hpp" -#include "_zcovector-/_zcovector-zhsmatrix.hpp" -#include "_zcovector-/_zcovector-_zhsmatrix.hpp" -#include "_zcovector-/_zcovector-zhsmatrix.hpp" -#include "_zcovector-/_zcovector-_zhsmatrix.hpp" -#include "_zcovector-/_zcovector-double.hpp" -#include "_zcovector-/_zcovector-complex.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// zrovector //////////////////////// -/////////////////////////////////////////////////////////// -#include "zrovector-/zrovector-constructor.hpp" -#include "zrovector-/zrovector-io.hpp" -#include "zrovector-/zrovector-calc.hpp" -#include "zrovector-/zrovector-misc.hpp" -#include "zrovector-/zrovector-unary.hpp" -#include "zrovector-/zrovector-zcovector.hpp" -#include "zrovector-/zrovector-_zcovector.hpp" -#include "zrovector-/zrovector-zrovector.hpp" -#include "zrovector-/zrovector-_zrovector.hpp" -#include "zrovector-/zrovector-zgematrix.hpp" -#include "zrovector-/zrovector-_zgematrix.hpp" -#include "zrovector-/zrovector-zgbmatrix.hpp" -#include "zrovector-/zrovector-_zgbmatrix.hpp" -#include "zrovector-/zrovector-zhematrix.hpp" -#include "zrovector-/zrovector-_zhematrix.hpp" -#include "zrovector-/zrovector-zgsmatrix.hpp" -#include "zrovector-/zrovector-_zgsmatrix.hpp" -#include "zrovector-/zrovector-zhsmatrix.hpp" -#include "zrovector-/zrovector-_zhsmatrix.hpp" -#include "zrovector-/zrovector-double.hpp" -#include "zrovector-/zrovector-complex.hpp" -/////////////////////// _zrovector //////////////////////// -#include "_zrovector-/_zrovector-constructor.hpp" -#include "_zrovector-/_zrovector-io.hpp" -#include "_zrovector-/_zrovector-calc.hpp" -#include "_zrovector-/_zrovector-misc.hpp" -#include "_zrovector-/_zrovector-unary.hpp" -#include "_zrovector-/_zrovector-zcovector.hpp" -#include "_zrovector-/_zrovector-_zcovector.hpp" -#include "_zrovector-/_zrovector-zrovector.hpp" -#include "_zrovector-/_zrovector-_zrovector.hpp" -#include "_zrovector-/_zrovector-zgematrix.hpp" -#include "_zrovector-/_zrovector-_zgematrix.hpp" -#include "_zrovector-/_zrovector-zgbmatrix.hpp" -#include "_zrovector-/_zrovector-_zgbmatrix.hpp" -#include "_zrovector-/_zrovector-zhematrix.hpp" -#include "_zrovector-/_zrovector-_zhematrix.hpp" -#include "_zrovector-/_zrovector-zgsmatrix.hpp" -#include "_zrovector-/_zrovector-_zgsmatrix.hpp" -#include "_zrovector-/_zrovector-zhsmatrix.hpp" -#include "_zrovector-/_zrovector-_zhsmatrix.hpp" -#include "_zrovector-/_zrovector-double.hpp" -#include "_zrovector-/_zrovector-complex.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// zgematrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "zgematrix-/zgematrix-constructor.hpp" -#include "zgematrix-/zgematrix-cast.hpp" -#include "zgematrix-/zgematrix-io.hpp" -#include "zgematrix-/zgematrix-misc.hpp" -#include "zgematrix-/zgematrix-calc.hpp" -#include "zgematrix-/zgematrix-lapack.hpp" -#include "zgematrix-/zgematrix-unary.hpp" -#include "zgematrix-/zgematrix-zcovector.hpp" -#include "zgematrix-/zgematrix-_zcovector.hpp" -#include "zgematrix-/zgematrix-zrovector.hpp" -#include "zgematrix-/zgematrix-_zrovector.hpp" -#include "zgematrix-/zgematrix-zgematrix.hpp" -#include "zgematrix-/zgematrix-_zgematrix.hpp" -#include "zgematrix-/zgematrix-zgbmatrix.hpp" -#include "zgematrix-/zgematrix-_zgbmatrix.hpp" -#include "zgematrix-/zgematrix-zhematrix.hpp" -#include "zgematrix-/zgematrix-_zhematrix.hpp" -#include "zgematrix-/zgematrix-zgsmatrix.hpp" -#include "zgematrix-/zgematrix-_zgsmatrix.hpp" -//#include "zgematrix-/zgematrix-zhsmatrix.hpp" -//#include "zgematrix-/zgematrix-_zhsmatrix.hpp" -#include "zgematrix-/zgematrix-double.hpp" -#include "zgematrix-/zgematrix-complex.hpp" -/////////////////////// _zgematrix //////////////////////// -#include "_zgematrix-/_zgematrix-constructor.hpp" -#include "_zgematrix-/_zgematrix-cast.hpp" -#include "_zgematrix-/_zgematrix-io.hpp" -#include "_zgematrix-/_zgematrix-misc.hpp" -#include "_zgematrix-/_zgematrix-calc.hpp" -#include "_zgematrix-/_zgematrix-unary.hpp" -#include "_zgematrix-/_zgematrix-zcovector.hpp" -#include "_zgematrix-/_zgematrix-_zcovector.hpp" -#include "_zgematrix-/_zgematrix-zrovector.hpp" -#include "_zgematrix-/_zgematrix-_zrovector.hpp" -#include "_zgematrix-/_zgematrix-zgematrix.hpp" -#include "_zgematrix-/_zgematrix-_zgematrix.hpp" -#include "_zgematrix-/_zgematrix-zgbmatrix.hpp" -#include "_zgematrix-/_zgematrix-_zgbmatrix.hpp" -#include "_zgematrix-/_zgematrix-zhematrix.hpp" -#include "_zgematrix-/_zgematrix-_zhematrix.hpp" -#include "_zgematrix-/_zgematrix-zgsmatrix.hpp" -#include "_zgematrix-/_zgematrix-_zgsmatrix.hpp" -//#include "_zgematrix-/_zgematrix-zhsmatrix.hpp" -//#include "_zgematrix-/_zgematrix-_zhsmatrix.hpp" -#include "_zgematrix-/_zgematrix-double.hpp" -#include "_zgematrix-/_zgematrix-complex.hpp" - - -/////////////////////////////////////////////////////////// -//////////////////////// zgbmatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "zgbmatrix-/zgbmatrix-constructor.hpp" -#include "zgbmatrix-/zgbmatrix-cast.hpp" -#include "zgbmatrix-/zgbmatrix-io.hpp" -#include "zgbmatrix-/zgbmatrix-misc.hpp" -#include "zgbmatrix-/zgbmatrix-calc.hpp" -#include "zgbmatrix-/zgbmatrix-lapack.hpp" -#include "zgbmatrix-/zgbmatrix-unary.hpp" -#include "zgbmatrix-/zgbmatrix-zcovector.hpp" -#include "zgbmatrix-/zgbmatrix-_zcovector.hpp" -#include "zgbmatrix-/zgbmatrix-zrovector.hpp" -#include "zgbmatrix-/zgbmatrix-_zrovector.hpp" -#include "zgbmatrix-/zgbmatrix-zgematrix.hpp" -#include "zgbmatrix-/zgbmatrix-_zgematrix.hpp" -#include "zgbmatrix-/zgbmatrix-zgbmatrix.hpp" -#include "zgbmatrix-/zgbmatrix-_zgbmatrix.hpp" -#include "zgbmatrix-/zgbmatrix-zhematrix.hpp" -#include "zgbmatrix-/zgbmatrix-_zhematrix.hpp" -//#include "zgbmatrix-/zgbmatrix-zgsmatrix.hpp" -//#include "zgbmatrix-/zgbmatrix-_zgsmatrix.hpp" -//#include "zgbmatrix-/zgbmatrix-zhsmatrix.hpp" -//#include "zgbmatrix-/zgbmatrix-_zhsmatrix.hpp" -#include "zgbmatrix-/zgbmatrix-double.hpp" -#include "zgbmatrix-/zgbmatrix-complex.hpp" -/////////////////////// _zgbmatrix //////////////////////// -#include "_zgbmatrix-/_zgbmatrix-constructor.hpp" -#include "_zgbmatrix-/_zgbmatrix-cast.hpp" -#include "_zgbmatrix-/_zgbmatrix-io.hpp" -#include "_zgbmatrix-/_zgbmatrix-misc.hpp" -#include "_zgbmatrix-/_zgbmatrix-calc.hpp" -#include "_zgbmatrix-/_zgbmatrix-unary.hpp" -#include "_zgbmatrix-/_zgbmatrix-zcovector.hpp" -#include "_zgbmatrix-/_zgbmatrix-_zcovector.hpp" -#include "_zgbmatrix-/_zgbmatrix-zrovector.hpp" -#include "_zgbmatrix-/_zgbmatrix-_zrovector.hpp" -#include "_zgbmatrix-/_zgbmatrix-zgematrix.hpp" -#include "_zgbmatrix-/_zgbmatrix-_zgematrix.hpp" -#include "_zgbmatrix-/_zgbmatrix-zgbmatrix.hpp" -#include "_zgbmatrix-/_zgbmatrix-_zgbmatrix.hpp" -#include "_zgbmatrix-/_zgbmatrix-zhematrix.hpp" -#include "_zgbmatrix-/_zgbmatrix-_zhematrix.hpp" -//#include "_zgbmatrix-/_zgbmatrix-zgsmatrix.hpp" -//#include "_zgbmatrix-/_zgbmatrix-_zgsmatrix.hpp" -//#include "_zgbmatrix-/_zgbmatrix-zhsmatrix.hpp" -//#include "_zgbmatrix-/_zgbmatrix-_zhsmatrix.hpp" -#include "_zgbmatrix-/_zgbmatrix-double.hpp" -#include "_zgbmatrix-/_zgbmatrix-complex.hpp" - - -/////////////////////////////////////////////////////////// -//////////////////////// zhematrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "zhematrix-/zhematrix-constructor.hpp" -#include "zhematrix-/zhematrix-cast.hpp" -#include "zhematrix-/zhematrix-io.hpp" -#include "zhematrix-/zhematrix-misc.hpp" -#include "zhematrix-/zhematrix-calc.hpp" -#include "zhematrix-/zhematrix-lapack.hpp" -#include "zhematrix-/zhematrix-unary.hpp" -#include "zhematrix-/zhematrix-zcovector.hpp" -#include "zhematrix-/zhematrix-_zcovector.hpp" -#include "zhematrix-/zhematrix-zrovector.hpp" -#include "zhematrix-/zhematrix-_zrovector.hpp" -#include "zhematrix-/zhematrix-zgematrix.hpp" -#include "zhematrix-/zhematrix-_zgematrix.hpp" -#include "zhematrix-/zhematrix-zgbmatrix.hpp" -#include "zhematrix-/zhematrix-_zgbmatrix.hpp" -#include "zhematrix-/zhematrix-zhematrix.hpp" -#include "zhematrix-/zhematrix-_zhematrix.hpp" -//#include "zhematrix-/zhematrix-zhsmatrix.hpp" -//#include "zhematrix-/zhematrix-_zhsmatrix.hpp" -#include "zhematrix-/zhematrix-double.hpp" -#include "zhematrix-/zhematrix-complex.hpp" -/////////////////////// _zhematrix //////////////////////// -#include "_zhematrix-/_zhematrix-constructor.hpp" -#include "_zhematrix-/_zhematrix-cast.hpp" -#include "_zhematrix-/_zhematrix-io.hpp" -#include "_zhematrix-/_zhematrix-misc.hpp" -#include "_zhematrix-/_zhematrix-calc.hpp" -#include "_zhematrix-/_zhematrix-unary.hpp" -#include "_zhematrix-/_zhematrix-zcovector.hpp" -#include "_zhematrix-/_zhematrix-_zcovector.hpp" -#include "_zhematrix-/_zhematrix-zrovector.hpp" -#include "_zhematrix-/_zhematrix-_zrovector.hpp" -#include "_zhematrix-/_zhematrix-zgematrix.hpp" -#include "_zhematrix-/_zhematrix-_zgematrix.hpp" -#include "_zhematrix-/_zhematrix-zgbmatrix.hpp" -#include "_zhematrix-/_zhematrix-_zgbmatrix.hpp" -#include "_zhematrix-/_zhematrix-zhematrix.hpp" -#include "_zhematrix-/_zhematrix-_zhematrix.hpp" -//#include "_zhematrix-/_zhematrix-zhsmatrix.hpp" -//#include "_zhematrix-/_zhematrix-_zhsmatrix.hpp" -#include "_zhematrix-/_zhematrix-double.hpp" -#include "_zhematrix-/_zhematrix-complex.hpp" - - -/////////////////////////////////////////////////////////// -//////////////////////// zgsmatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "zgsmatrix-/zgsmatrix-constructor.hpp" -#include "zgsmatrix-/zgsmatrix-cast.hpp" -#include "zgsmatrix-/zgsmatrix-io.hpp" -#include "zgsmatrix-/zgsmatrix-misc.hpp" -#include "zgsmatrix-/zgsmatrix-calc.hpp" -#include "zgsmatrix-/zgsmatrix-unary.hpp" -#include "zgsmatrix-/zgsmatrix-zcovector.hpp" -#include "zgsmatrix-/zgsmatrix-_zcovector.hpp" -#include "zgsmatrix-/zgsmatrix-zrovector.hpp" -#include "zgsmatrix-/zgsmatrix-_zrovector.hpp" -#include "zgsmatrix-/zgsmatrix-zgematrix.hpp" -#include "zgsmatrix-/zgsmatrix-_zgematrix.hpp" -#include "zgsmatrix-/zgsmatrix-zgbmatrix.hpp" -#include "zgsmatrix-/zgsmatrix-_zgbmatrix.hpp" -#include "zgsmatrix-/zgsmatrix-zhematrix.hpp" -#include "zgsmatrix-/zgsmatrix-_zhematrix.hpp" -#include "zgsmatrix-/zgsmatrix-zgsmatrix.hpp" -#include "zgsmatrix-/zgsmatrix-_zgsmatrix.hpp" -//#include "zgsmatrix-/zgsmatrix-zhsmatrix.hpp" -//#include "zgsmatrix-/zgsmatrix-_zhsmatrix.hpp" -#include "zgsmatrix-/zgsmatrix-double.hpp" -#include "zgsmatrix-/zgsmatrix-complex.hpp" -/////////////////////// _zgsmatrix //////////////////////// -#include "_zgsmatrix-/_zgsmatrix-constructor.hpp" -#include "_zgsmatrix-/_zgsmatrix-cast.hpp" -#include "_zgsmatrix-/_zgsmatrix-io.hpp" -#include "_zgsmatrix-/_zgsmatrix-misc.hpp" -#include "_zgsmatrix-/_zgsmatrix-calc.hpp" -#include "_zgsmatrix-/_zgsmatrix-unary.hpp" -#include "_zgsmatrix-/_zgsmatrix-zcovector.hpp" -#include "_zgsmatrix-/_zgsmatrix-_zcovector.hpp" -#include "_zgsmatrix-/_zgsmatrix-zrovector.hpp" -#include "_zgsmatrix-/_zgsmatrix-_zrovector.hpp" -#include "_zgsmatrix-/_zgsmatrix-zgematrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-_zgematrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-zgbmatrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-_zgbmatrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-zhematrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-_zhematrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-zgsmatrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-_zgsmatrix.hpp" -//#include "_zgsmatrix-/_zgsmatrix-zhsmatrix.hpp" -//#include "_zgsmatrix-/_zgsmatrix-_zhsmatrix.hpp" -#include "_zgsmatrix-/_zgsmatrix-double.hpp" -#include "_zgsmatrix-/_zgsmatrix-complex.hpp" - -/////////////////////////////////////////////////////////// -//////////////////////// zhsmatrix //////////////////////// -/////////////////////////////////////////////////////////// -#include "zhsmatrix-/zhsmatrix-constructor.hpp" -#include "zhsmatrix-/zhsmatrix-cast.hpp" -#include "zhsmatrix-/zhsmatrix-io.hpp" -#include "zhsmatrix-/zhsmatrix-misc.hpp" -#include "zhsmatrix-/zhsmatrix-calc.hpp" -#include "zhsmatrix-/zhsmatrix-unary.hpp" -#include "zhsmatrix-/zhsmatrix-zcovector.hpp" -#include "zhsmatrix-/zhsmatrix-_zcovector.hpp" -#include "zhsmatrix-/zhsmatrix-zrovector.hpp" -#include "zhsmatrix-/zhsmatrix-_zrovector.hpp" -#include "zhsmatrix-/zhsmatrix-zgematrix.hpp" -#include "zhsmatrix-/zhsmatrix-_zgematrix.hpp" -#include "zhsmatrix-/zhsmatrix-zgbmatrix.hpp" -#include "zhsmatrix-/zhsmatrix-_zgbmatrix.hpp" -#include "zhsmatrix-/zhsmatrix-zhematrix.hpp" -#include "zhsmatrix-/zhsmatrix-_zhematrix.hpp" -#include "zhsmatrix-/zhsmatrix-zhsmatrix.hpp" -#include "zhsmatrix-/zhsmatrix-_zhsmatrix.hpp" -#include "zhsmatrix-/zhsmatrix-double.hpp" -#include "zhsmatrix-/zhsmatrix-complex.hpp" -/////////////////////// _zhsmatrix //////////////////////// -#include "_zhsmatrix-/_zhsmatrix-constructor.hpp" -#include "_zhsmatrix-/_zhsmatrix-cast.hpp" -#include "_zhsmatrix-/_zhsmatrix-io.hpp" -#include "_zhsmatrix-/_zhsmatrix-misc.hpp" -#include "_zhsmatrix-/_zhsmatrix-calc.hpp" -#include "_zhsmatrix-/_zhsmatrix-unary.hpp" -#include "_zhsmatrix-/_zhsmatrix-zcovector.hpp" -#include "_zhsmatrix-/_zhsmatrix-_zcovector.hpp" -#include "_zhsmatrix-/_zhsmatrix-zrovector.hpp" -#include "_zhsmatrix-/_zhsmatrix-_zrovector.hpp" -#include "_zhsmatrix-/_zhsmatrix-zgematrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-_zgematrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-zgbmatrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-_zgbmatrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-zhematrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-_zhematrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-zhsmatrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-_zhsmatrix.hpp" -#include "_zhsmatrix-/_zhsmatrix-double.hpp" -#include "_zhsmatrix-/_zhsmatrix-complex.hpp" - -/////////////////////////////////////////////////////////// -///////////////////////// double ////////////////////////// -/////////////////////////////////////////////////////////// -#include "double-/double-zcovector.hpp" -#include "double-/double-_zcovector.hpp" -#include "double-/double-zrovector.hpp" -#include "double-/double-_zrovector.hpp" -#include "double-/double-zgematrix.hpp" -#include "double-/double-_zgematrix.hpp" -#include "double-/double-zgbmatrix.hpp" -#include "double-/double-_zgbmatrix.hpp" -#include "double-/double-zhematrix.hpp" -#include "double-/double-_zhematrix.hpp" -#include "double-/double-zgsmatrix.hpp" -#include "double-/double-_zgsmatrix.hpp" -#include "double-/double-zhsmatrix.hpp" -#include "double-/double-_zhsmatrix.hpp" - -/////////////////////////////////////////////////////////// -///////////////////////// complex ///////////////////////// -/////////////////////////////////////////////////////////// -#include "complex-/complex-zcovector.hpp" -#include "complex-/complex-_zcovector.hpp" -#include "complex-/complex-zrovector.hpp" -#include "complex-/complex-_zrovector.hpp" -#include "complex-/complex-zgematrix.hpp" -#include "complex-/complex-_zgematrix.hpp" -#include "complex-/complex-zgbmatrix.hpp" -#include "complex-/complex-_zgbmatrix.hpp" -#include "complex-/complex-zhematrix.hpp" -#include "complex-/complex-_zhematrix.hpp" -#include "complex-/complex-zgsmatrix.hpp" -#include "complex-/complex-_zgsmatrix.hpp" -#include "complex-/complex-zhsmatrix.hpp" -#include "complex-/complex-_zhsmatrix.hpp" - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////// -////////////////////////// small ////////////////////////// -/////////////////////////////////////////////////////////// -//// dcovector_small //// -#include "small/dcovector_small-constructors.hpp" -#include "small/dcovector_small-functions.hpp" -#include "small/dcovector_small-specialized.hpp" -//// drovector_small //// -#include "small/drovector_small-constructors.hpp" -#include "small/drovector_small-functions.hpp" -#include "small/drovector_small-specialized.hpp" -//// dgematrix_small //// -#include "small/dgematrix_small-constructors.hpp" -#include "small/dgematrix_small-functions.hpp" -#include "small/dgematrix_small-specialized.hpp" -//// dsymatrix_small //// -#include "small/dsymatrix_small-constructors.hpp" -#include "small/dsymatrix_small-functions.hpp" -#include "small/dsymatrix_small-specialized.hpp" -///////////////////////////////////////////////// -//// zcovector_small //// -#include "small/zcovector_small-constructors.hpp" -#include "small/zcovector_small-functions.hpp" -#include "small/zcovector_small-specialized.hpp" -//// zrovector_small //// -#include "small/zrovector_small-constructors.hpp" -#include "small/zrovector_small-functions.hpp" -#include "small/zrovector_small-specialized.hpp" -//// zgematrix_small //// -#include "small/zgematrix_small-constructors.hpp" -#include "small/zgematrix_small-functions.hpp" -#include "small/zgematrix_small-specialized.hpp" -//// zhematrix_small //// -#include "small/zhematrix_small-constructors.hpp" -#include "small/zhematrix_small-functions.hpp" -#include "small/zhematrix_small-specialized.hpp" -///////////////////////////////////////////////// -//// double //// -#include "small/double-small.hpp" -//// comple //// -#include "small/comple-small.hpp" - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -}//namespace CPPL -#endif//CPPLAPACK_H diff --git a/cpplapack-r198/.svn/pristine/02/0262df855071e6eb1a0e0d90f887dd14a5519909.svn-base b/cpplapack-r198/.svn/pristine/02/0262df855071e6eb1a0e0d90f887dd14a5519909.svn-base deleted file mode 100644 index 869987e2a03e44b27dbb5bdfde59a633027c1452..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/02/0262df855071e6eb1a0e0d90f887dd14a5519909.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::zgematrix A; - cout << "A || m=" << A.m << " n=" << A.n << " array=" << A.array << endl; - - CPPL::zgematrix B(M,N); - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - cout << "B || m=" << B.m << " n=" << B.n << " array=" << B.array << endl; - cout << B << endl; - - CPPL::zgematrix C(B); - cout << "C || m=" << C.m << " n=" << C.n << " array=" << C.array << endl; - cout << C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/02/02cb39550f69a30df8690545764e99bb5a83451b.svn-base b/cpplapack-r198/.svn/pristine/02/02cb39550f69a30df8690545764e99bb5a83451b.svn-base deleted file mode 100644 index 3d89e44f82c73ef6903d036dabf53876cf116451..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/02/02cb39550f69a30df8690545764e99bb5a83451b.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zrovector*_zhematrix operator */ -inline _zrovector operator*(const zrovector& vec, const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/02/02f5fd034db6056df628c71d9530bc0eb9bdf3be.svn-base b/cpplapack-r198/.svn/pristine/02/02f5fd034db6056df628c71d9530bc0eb9bdf3be.svn-base deleted file mode 100644 index bbe84dc47b985bc92217a7fc87fdb0db8a76e7b9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/02/02f5fd034db6056df628c71d9530bc0eb9bdf3be.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -//============================================================================= -/*! double*_dgsmatrix operator */ -inline _dgsmatrix operator*(const double& d, const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *= d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/03/0313faa67890db9285f0b6bea8f2efc6ab367dd7.svn-base b/cpplapack-r198/.svn/pristine/03/0313faa67890db9285f0b6bea8f2efc6ab367dd7.svn-base deleted file mode 100644 index 5f8679eba4db73e544f97dd51917db9e40e4fa6f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/03/0313faa67890db9285f0b6bea8f2efc6ab367dd7.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(1), KU(2); - - CPPL::zgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - }} - - cout << "A =\n" << A << endl; - cout << "A*10. =\n" << A*10. << endl; - cout << "A/10. =\n" << A/10. << endl; - - cout << "#### A*=10.; ####" << endl; - A*=10.; - cout << "A =\n" << A << endl; - cout << "#### A/=10.; ####" << endl; - A/=10.; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/03/038926d860db19f97814c9af7552d7329cce1162.svn-base b/cpplapack-r198/.svn/pristine/03/038926d860db19f97814c9af7552d7329cce1162.svn-base deleted file mode 100644 index fc880ceed4548176684362a96b9068aee960a148..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/03/038926d860db19f97814c9af7552d7329cce1162.svn-base +++ /dev/null @@ -1,283 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline comple zgsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const std::vector<CPPL_INT>::const_iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::const_iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){ return data[*p].v; } - } - - //// (i,j) component was not found //// - return comple(0.0,0.0); -} - -//============================================================================= -/*! operator() for const object */ -inline comple& zgsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// search (i,j) component //////// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){ return data[*p].v; } - } - - //////// (i,j) component not found //////// - rows[i].push_back(CPPL_INT(data.size())); - cols[j].push_back(CPPL_INT(data.size())); - data.push_back( zcomponent(i,j, comple(0.,0.)) ); - return data.back().v; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! put value without isListed check */ -inline zgsmatrix& zgsmatrix::put(const CPPL_INT& i, const CPPL_INT& j, const comple& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } - - if( isListed(i,j) ){ - ERROR_REPORT; - std::cerr << "The required component is already listed." << std::endl - << "Your input was (" << i << "," << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// push //// - rows[i].push_back(CPPL_INT(data.size())); - cols[j].push_back(CPPL_INT(data.size())); - data.push_back(zcomponent(i,j,v)); - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! delete the entry of a component */ -inline zgsmatrix& zgsmatrix::del(const CPPL_INT i, const CPPL_INT j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){//exists - //// save position //// - CPPL_INT c =*p; - CPPL_INT C =CPPL_INT(data.size()-1); - - //// data translation //// - data[c]=data.back(); - data.pop_back(); - - //// remove from List //// - rows[i].erase(p); - const std::vector<CPPL_INT>::iterator cols_j_end =cols[j].end(); - for(std::vector<CPPL_INT>::iterator q=cols[j].begin(); q!=cols_j_end; q++){ - if(*q==c){ cols[j].erase(q); break; } - } - - //// modify the entry of translated component //// - CPPL_INT I(data[c].i), J(data[c].j); - const std::vector<CPPL_INT>::iterator rows_I_end =rows[I].end(); - for(std::vector<CPPL_INT>::iterator q=rows[I].begin(); q!=rows_I_end; q++){ - if(*q==C){ *q=c; break; } - } - const std::vector<CPPL_INT>::iterator cols_J_end =cols[J].end(); - for(std::vector<CPPL_INT>::iterator q=cols[J].begin(); q!=cols_J_end; q++){ - if(*q==C){ *q=c; break; } - } - return *this; - } - } - -#ifdef CPPL_DEBUG - std::cerr << "# [NOTE] zgsmatrix::del(CPPL_INT&, CPPL_INT&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; -#endif//CPPL_DEBUG - - return *this; -} - -//============================================================================= -/*! delete the entry of an element */ -inline zgsmatrix& zgsmatrix::del(const CPPL_INT c) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( c<0 || c>=CPPL_INT(data.size()) ){ - ERROR_REPORT; - std::cerr << "The required element is out of the matrix volume." << std::endl - << "Your input was (" << c << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if( c==CPPL_INT(data.size()-1) ){//if c is the last element - CPPL_INT i(data[c].i), j(data[c].j); - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator q=rows[i].begin(); q!=rows_i_end; q++){ - if(*q==c){ rows[i].erase(q); break; } - } - const std::vector<CPPL_INT>::iterator cols_j_end =cols[j].end(); - for(std::vector<CPPL_INT>::iterator q=cols[j].begin(); q!=cols_j_end; q++){ - if(*q==c){ cols[j].erase(q); break; } - } - data.pop_back(); - } - - else{//if c is NOT the last element - //// data translation //// - CPPL_INT C =CPPL_INT(data.size()-1); - CPPL_INT i(data[c].i), j(data[c].j), I(data.back().i), J(data.back().j); - data[c]=data.back(); - //// remove entry of component //// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator q=rows[i].begin(); q!=rows_i_end; q++){ - if(*q==c){ rows[i].erase(q); break; } - } - const std::vector<CPPL_INT>::iterator cols_j_end =cols[j].end(); - for(std::vector<CPPL_INT>::iterator q=cols[j].begin(); q!=cols_j_end; q++){ - if(*q==c){ cols[j].erase(q); break; } - } - //// modify the entry of translated component //// - const std::vector<CPPL_INT>::iterator rows_I_end =rows[I].end(); - for(std::vector<CPPL_INT>::iterator q=rows[I].begin(); q!=rows_I_end; q++){ - if(*q==C){ *q=c; break; } - } - const std::vector<CPPL_INT>::iterator cols_J_end =cols[J].end(); - for(std::vector<CPPL_INT>::iterator q=cols[J].begin(); q!=cols_J_end; q++){ - if(*q==C){ *q=c; break; } - } - //// pop_back //// - data.pop_back(); - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - const std::vector<CPPL_INT>::const_iterator mat_rows_i_end =mat.rows[i].end(); - for(CPPL_INT j=0; j<mat.n; j++){ - std::vector<CPPL_INT>::const_iterator q; - for(q=mat.rows[i].begin(); q!=mat_rows_i_end; q++){ - if(mat.data[*q].j==j){ break; } - } - if(q!=mat_rows_i_end){ s << " " << mat.data[*q].v; } - else{ s << " x"; } - } - s << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void zgsmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zgsmatrix " << m << " " << n << " " << data.size() << std::endl; - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void zgsmatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zgsmatrix" && id != "#zgsmatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zgsmatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - //////// m, n, size //////// - size_t size; - s >> m >> n >> size; - resize(m, n); - data.reserve(size);//NOT resize. - - //////// i, j, v //////// - CPPL_INT i, j; - comple v; - for(size_t k=0; k<size; k++){ - s >> i >> j >> v; - put(i,j, v); - } - - //// check //// - s >> i; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << " ." << std::endl - << "Most likely, there are too many data components over the context." << std::endl; - exit(1); - } - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/03/03f000cf90a5cc45b53098cc892ce00622f6a7ef.svn-base b/cpplapack-r198/.svn/pristine/03/03f000cf90a5cc45b53098cc892ce00622f6a7ef.svn-base deleted file mode 100644 index a5a03390faa85a3b30692f737f5daa6ecb41a571..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/03/03f000cf90a5cc45b53098cc892ce00622f6a7ef.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! zgbmatrix*_zcovector operator */ -inline _zcovector operator*(const zgbmatrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/04/0460c589f3977ab3841af59b41b1a22490e29f0d.svn-base b/cpplapack-r198/.svn/pristine/04/0460c589f3977ab3841af59b41b1a22490e29f0d.svn-base deleted file mode 100644 index 2015f779bd120d1e4b704f5048706a6717d0a4fe..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/04/0460c589f3977ab3841af59b41b1a22490e29f0d.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -//============================================================================= -/*! _zcovector constructor */ -inline _zcovector::_zcovector() -{CPPL_VERBOSE_REPORT; - l =0; - array =NULL; -} - -//============================================================================= -/*! _zcovector copy constructor */ -inline _zcovector::_zcovector(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - array =vec.array; - - vec.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _zcovector destructor */ -inline _zcovector::~_zcovector() -{CPPL_VERBOSE_REPORT; - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/05/05a336bcc4a3c561f806e36f564977164ca736d8.svn-base b/cpplapack-r198/.svn/pristine/05/05a336bcc4a3c561f806e36f564977164ca736d8.svn-base deleted file mode 100644 index f1adcbc622def10d17e5d71c8c061e2ee0a442bd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/05/05a336bcc4a3c561f806e36f564977164ca736d8.svn-base +++ /dev/null @@ -1,143 +0,0 @@ -//============================================================================= -//! Complex Double-precision General Band Matrix Class -class zgbmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT m; //!< matrix row size - CPPL_INT n; //!< matrix column size - CPPL_INT kl; //!< lower band width - CPPL_INT ku; //!< upper band width - comple* array; //!< 1D array to store matrix data - comple** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zgbmatrix(); - inline zgbmatrix(const zgbmatrix&); - inline zgbmatrix(const _zgbmatrix&); - inline zgbmatrix(const CPPL_INT&, const CPPL_INT&, const CPPL_INT&, const CPPL_INT&); - inline zgbmatrix(const char*); - inline ~zgbmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline comple& operator()(const CPPL_INT&, const CPPL_INT&); - inline comple operator()(const CPPL_INT&, const CPPL_INT&) const; - inline zgbmatrix& set(const CPPL_INT&, const CPPL_INT&, const comple&); - inline friend std::ostream& operator<<(std::ostream&, const zgbmatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline zgbmatrix& zero(); - inline zgbmatrix& identity(); - inline void chsign(); - inline void copy(const zgbmatrix&); - inline void shallow_copy(const _zgbmatrix&); - inline void resize(const CPPL_INT&, const CPPL_INT&, const CPPL_INT&, const CPPL_INT&); - inline _zrovector row(const CPPL_INT&) const; - inline _zcovector col(const CPPL_INT&) const; - inline _dgbmatrix real() const; - inline _dgbmatrix imag() const; - inline _dgbmatrix abs() const; - inline _dgbmatrix arg() const; - inline friend void swap(zgbmatrix&, zgbmatrix&); - inline friend _zgbmatrix _(zgbmatrix&); - - //////// calc //////// - inline friend _zgbmatrix t(const zgbmatrix&); - inline friend _zgematrix i(const zgbmatrix&); - inline friend _zgbmatrix conj(const zgbmatrix&); - inline friend _zgbmatrix conjt(const zgbmatrix&); - - //////// lapack //////// - inline CPPL_INT zgbsv(zgematrix&); - inline CPPL_INT zgbsv(zcovector&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline zgbmatrix& operator=(const zgbmatrix&); - inline zgbmatrix& operator=(const _zgbmatrix&); - - //////// += //////// - inline zgbmatrix& operator+=(const zgbmatrix&); - inline zgbmatrix& operator+=(const _zgbmatrix&); - - //////// -= //////// - inline zgbmatrix& operator-=(const zgbmatrix&); - inline zgbmatrix& operator-=(const _zgbmatrix&); - - //////// *= //////// - inline zgbmatrix& operator*=(const zgbmatrix&); - inline zgbmatrix& operator*=(const _zgbmatrix&); - inline zgbmatrix& operator*=(const double&); - inline zgbmatrix& operator*=(const comple&); - - //////// /= //////// - inline zgbmatrix& operator/=(const double&); - inline zgbmatrix& operator/=(const comple&); - - //////// unary //////// - inline friend const zgbmatrix& operator+(const zgbmatrix&); - inline friend _zgbmatrix operator-(const zgbmatrix&); - - //////// + //////// - inline friend _zgematrix operator+(const zgbmatrix&, const zgematrix&); - inline friend _zgematrix operator+(const zgbmatrix&, const _zgematrix&); - inline friend _zgematrix operator+(const zgbmatrix&, const zhematrix&); - inline friend _zgematrix operator+(const zgbmatrix&, const _zhematrix&); - inline friend _zgbmatrix operator+(const zgbmatrix&, const zgbmatrix&); - inline friend _zgbmatrix operator+(const zgbmatrix&, const _zgbmatrix&); - inline friend _zgematrix operator+(const zgbmatrix&, const zgsmatrix&); - inline friend _zgematrix operator+(const zgbmatrix&, const _zgsmatrix&); - inline friend _zgematrix operator+(const zgbmatrix&, const zhsmatrix&); - inline friend _zgematrix operator+(const zgbmatrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const zgbmatrix&, const zgematrix&); - inline friend _zgematrix operator-(const zgbmatrix&, const _zgematrix&); - inline friend _zgematrix operator-(const zgbmatrix&, const zhematrix&); - inline friend _zgematrix operator-(const zgbmatrix&, const _zhematrix&); - inline friend _zgbmatrix operator-(const zgbmatrix&, const zgbmatrix&); - inline friend _zgbmatrix operator-(const zgbmatrix&, const _zgbmatrix&); - inline friend _zgematrix operator-(const zgbmatrix&, const zgsmatrix&); - inline friend _zgematrix operator-(const zgbmatrix&, const _zgsmatrix&); - inline friend _zgematrix operator-(const zgbmatrix&, const zhsmatrix&); - inline friend _zgematrix operator-(const zgbmatrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const zgbmatrix&, const zcovector&); - inline friend _zcovector operator*(const zgbmatrix&, const _zcovector&); - inline friend _zgematrix operator*(const zgbmatrix&, const zgematrix&); - inline friend _zgematrix operator*(const zgbmatrix&, const _zgematrix&); - inline friend _zgematrix operator*(const zgbmatrix&, const zhematrix&); - inline friend _zgematrix operator*(const zgbmatrix&, const _zhematrix&); - inline friend _zgbmatrix operator*(const zgbmatrix&, const zgbmatrix&); - inline friend _zgbmatrix operator*(const zgbmatrix&, const _zgbmatrix&); - inline friend _zgematrix operator*(const zgbmatrix&, const zgsmatrix&); - inline friend _zgematrix operator*(const zgbmatrix&, const _zgsmatrix&); - inline friend _zgematrix operator*(const zgbmatrix&, const zhsmatrix&); - inline friend _zgematrix operator*(const zgbmatrix&, const _zhsmatrix&); - inline friend _zgbmatrix operator*(const zgbmatrix&, const double&); - inline friend _zgbmatrix operator*(const zgbmatrix&, const comple&); - - //////// / //////// - inline friend _zgbmatrix operator/(const zgbmatrix&, const double&); - inline friend _zgbmatrix operator/(const zgbmatrix&, const comple&); - - //////// double, comple //////// - inline friend _zgbmatrix operator*(const double&, const zgbmatrix&); - inline friend _zgbmatrix operator*(const comple&, const zgbmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/06/067e450c7fec620da893085573d850cbc0cbd8ca.svn-base b/cpplapack-r198/.svn/pristine/06/067e450c7fec620da893085573d850cbc0cbd8ca.svn-base deleted file mode 100644 index 773b1b09c43aefed3d920e6ec90cce15d9c6fe72..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/06/067e450c7fec620da893085573d850cbc0cbd8ca.svn-base +++ /dev/null @@ -1,7 +0,0 @@ -//============================================================================= -/*! complex*zhsmatrix operator */ -inline _zgsmatrix operator*(const comple& d, const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat =mat.to_zgsmatrix(); - return d*newmat; -} diff --git a/cpplapack-r198/.svn/pristine/06/06ecab1cdf7cc0f52bb77f9ab953fab8a9728e26.svn-base b/cpplapack-r198/.svn/pristine/06/06ecab1cdf7cc0f52bb77f9ab953fab8a9728e26.svn-base deleted file mode 100644 index 87567cb7750a03b7aaaae0195df9e581d7be7553..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/06/06ecab1cdf7cc0f52bb77f9ab953fab8a9728e26.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zrovector*_zgematrix operator */ -inline _zrovector operator*(const zrovector& vec, const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/06/06f57ff82602124fd4b0f9fe92731e33402e7f85.svn-base b/cpplapack-r198/.svn/pristine/06/06f57ff82602124fd4b0f9fe92731e33402e7f85.svn-base deleted file mode 100644 index b7fb0b1e27c7952dc5403e73234259bf4ff68166..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/06/06f57ff82602124fd4b0f9fe92731e33402e7f85.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - cout << "A =\n" << A << endl; - cout << "A*10. =\n" << A*10. << endl; - cout << "A/10. =\n" << A/10. << endl; - - cout << "#### A*=10.; ####" << endl; - A*=10.; - cout << "A =\n" << A << endl; - cout << "#### A/=10.; ####" << endl; - A/=10.; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/06/06f7ef4e4332aefe3551c83de06a627b389ba749.svn-base b/cpplapack-r198/.svn/pristine/06/06f7ef4e4332aefe3551c83de06a627b389ba749.svn-base deleted file mode 100644 index e5ce088d9c98b323b0b0bb48b3d5b7cf887d8318..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/06/06f7ef4e4332aefe3551c83de06a627b389ba749.svn-base +++ /dev/null @@ -1,78 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+dsymatrix operator */ -inline _dgematrix operator+(const _dgbmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB.to_dgematrix()); - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix-dsymatrix operator */ -inline _dgematrix operator-(const _dgbmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( (-matB).to_dgematrix() ); - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix*dgematrix operator */ -inline _dgematrix operator*(const _dgbmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/07/0724728c475d4dacbaf3cfbc1c952bee2f00deb4.svn-base b/cpplapack-r198/.svn/pristine/07/0724728c475d4dacbaf3cfbc1c952bee2f00deb4.svn-base deleted file mode 100644 index 4b8f11bdfbba43c811059edf04f9f337076c1ad1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/07/0724728c475d4dacbaf3cfbc1c952bee2f00deb4.svn-base +++ /dev/null @@ -1,134 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+_zgbmatrix operator */ -inline _zgbmatrix operator+(const _zgbmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>matB.kl && matA.ku>matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) += matB(i,j); - } - } - - matB.destroy(); - return matA; - } - - else if(matB.kl>matA.kl && matB.ku>matA.ku){ - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) += matA(i,j); - } - } - - matA.destroy(); - return matB; - } - - else{ - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) += matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! _zgbmatrix-_zgbmatrix operator */ -inline _zgbmatrix operator-(const _zgbmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>matB.kl && matA.ku>matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return matA; - } - - else{ - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! _zgbmatrix*_zgbmatrix operator */ -inline _zgbmatrix operator*(const _zgbmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/07/07ab887997a9292c7d9039c46ab76c3ffed2b96a.svn-base b/cpplapack-r198/.svn/pristine/07/07ab887997a9292c7d9039c46ab76c3ffed2b96a.svn-base deleted file mode 100644 index 4e1137dee5c6336ebbc8a2ea70eb784bfcc3f927..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/07/07ab887997a9292c7d9039c46ab76c3ffed2b96a.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -//============================================================================= -/*! zrovector*=comple operator */ -inline zrovector& zrovector::operator*=(const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zscal_(&l, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zrovector/=comple operator */ -inline zrovector& zrovector::operator/=(const comple& d) -{CPPL_VERBOSE_REPORT; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&l, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector*comple operator */ -inline _zrovector operator*(const zrovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]*d; - } - - return _(newvec); -} - -//============================================================================= -/*! zrovector/comple operator */ -inline _zrovector operator/(const zrovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]/d; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/07/07ca02f9c5cfdf23607cc28306bb0b09706d7658.svn-base b/cpplapack-r198/.svn/pristine/07/07ca02f9c5cfdf23607cc28306bb0b09706d7658.svn-base deleted file mode 100644 index 157f637683e8a5160c65137f9b267ac185e23d03..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/07/07ca02f9c5cfdf23607cc28306bb0b09706d7658.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -dcovector 8 -0.000000e+00 -0.000000e+00 -0.000000e+00 -0.000000e+00 -0.000000e+00 -1.000000e+00 --0.000000e+00 --0.000000e+00 diff --git a/cpplapack-r198/.svn/pristine/08/083b9348c4b30001e43047744bf73150bf52b34f.svn-base b/cpplapack-r198/.svn/pristine/08/083b9348c4b30001e43047744bf73150bf52b34f.svn-base deleted file mode 100644 index 76d4cbef750a6f8c3ff85cebfa04b8aa39803aa7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/08/083b9348c4b30001e43047744bf73150bf52b34f.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################### -## Makefile ## -############################################################################### - -A.OUT = dge2png - -############################################################################### - -#include Makefile.compiler -include Makefile.g++ -#include Makefile.icpc - -############################################################################### - -HEADERS:= $(shell find -iname '*.hpp') -SOURCES:= $(shell find -iname '*.cpp') -OBJECTS:= $(SOURCES:%.cpp=%.o) - -############################################################################### - -all: depend $(OBJECTS) - $(CXX) $(OBJECTS) $(LFLAGS) $(LIB_DIRS) $(LIBS) -o $(A.OUT) - @echo - -.SUFFIXES: .cpp .o -.cpp.o: - $(CXX) -c $< $(CFLAGS) $(INCLUDE_DIRS) $(MACROS) -o $@ - @echo - -depend: -# touch main.cpp - makedepend -f- -Y $(SOURCES) > Makefile.depend 2> /dev/null -# gccmakedep -- -I./ -MM -- $(SOURCES) -# $(CXX) -MM -I./ $(SOURCES) > Makefile.depend - @echo - -clean: - rm -f $(OBJECTS) - -fullclean: - rm -f $(shell find -name '*.o') std err Makefile.depend $(A.OUT) - -remake: clean all - -############################################################################### --include Makefile.depend diff --git a/cpplapack-r198/.svn/pristine/08/089043f47acb773190a6a2d9edb62d580607855b.svn-base b/cpplapack-r198/.svn/pristine/08/089043f47acb773190a6a2d9edb62d580607855b.svn-base deleted file mode 100644 index 8fc448bc53e7120025c338a5a4611beff3d7c735..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/08/089043f47acb773190a6a2d9edb62d580607855b.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! zgbmatrix+_zhematrix operator */ -inline _zgematrix operator+(const zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)+=matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix-_zhematrix operator */ -inline _zgematrix operator-(const zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)-=matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix*_zhematrix operator */ -inline _zgematrix operator*(const zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=max(0,matB.indx[c]-(matA.ku+1)); - i<min(matA.m,matB.indx[c]+matA.kl); i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/08/08e120fe5c96f7d5b31b57bca0bfe260590cd185.svn-base b/cpplapack-r198/.svn/pristine/08/08e120fe5c96f7d5b31b57bca0bfe260590cd185.svn-base deleted file mode 100644 index 9d66ae92c578289411053b4ad4f16d2e4d2bd259..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/08/08e120fe5c96f7d5b31b57bca0bfe260590cd185.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! zgematrix+_zgsmatrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - newmat(z.i,z.j) += z.v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix-_zgsmatrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - newmat(z.i,z.j) -= z.v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix*_zgsmatrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,z.j) += matA(i,z.i)*z.v; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/08/08f8e24f9512eec35e7e039e639ea85977928064.svn-base b/cpplapack-r198/.svn/pristine/08/08f8e24f9512eec35e7e039e639ea85977928064.svn-base deleted file mode 100644 index fca7ad74bd8b0885deb06883298a8a0e091fe4ab..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/08/08f8e24f9512eec35e7e039e639ea85977928064.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class -class _zgsmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable std::vector<zcomponent> data; //!< matrix data - mutable std::vector< std::vector<CPPL_INT> > rows; //!< array of vector to store the entry information of component for each row - mutable std::vector< std::vector<CPPL_INT> > cols; //!< array of vector to store the entry information of component for each column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _zgsmatrix(); - inline _zgsmatrix(const _zgsmatrix&); - inline ~_zgsmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline comple operator()(const CPPL_INT&, const CPPL_INT&) const;//not return comple& - inline friend std::ostream& operator<<(std::ostream&, const _zgsmatrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _zgsmatrix t(const zgsmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const zgsmatrix&); - inline friend comple damax(const zgsmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _zgsmatrix& operator+(const _zgsmatrix&); - inline friend _zgsmatrix operator-(const _zgsmatrix&); - - //////// + //////// - inline friend _zgematrix operator+(const _zgsmatrix&, const zgematrix&); - inline friend _zgematrix operator+(const _zgsmatrix&, const _zgematrix&); - inline friend _zgematrix operator+(const _zgsmatrix&, const zhematrix&); - inline friend _zgematrix operator+(const _zgsmatrix&, const _zhematrix&); - inline friend _zgematrix operator+(const _zgsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const _zgsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator+(const _zgsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator+(const _zgsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator+(const _zgsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator+(const _zgsmatrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const _zgsmatrix&, const zgematrix&); - inline friend _zgematrix operator-(const _zgsmatrix&, const _zgematrix&); - inline friend _zgematrix operator-(const _zgsmatrix&, const zhematrix&); - inline friend _zgematrix operator-(const _zgsmatrix&, const _zhematrix&); - inline friend _zgematrix operator-(const _zgsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const _zgsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator-(const _zgsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator-(const _zgsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator-(const _zgsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator-(const _zgsmatrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const _zgsmatrix&, const zcovector&); - inline friend _zcovector operator*(const _zgsmatrix&, const _zcovector&); - inline friend _zgematrix operator*(const _zgsmatrix&, const zgematrix&); - inline friend _zgematrix operator*(const _zgsmatrix&, const _zgematrix&); - inline friend _zgematrix operator*(const _zgsmatrix&, const zhematrix&); - inline friend _zgematrix operator*(const _zgsmatrix&, const _zhematrix&); - inline friend _zgematrix operator*(const _zgsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const _zgsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator*(const _zgsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator*(const _zgsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator*(const _zgsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator*(const _zgsmatrix&, const _zhsmatrix&); - inline friend _zgsmatrix operator*(const _zgsmatrix&, const double&); - inline friend _zgsmatrix operator*(const _zgsmatrix&, const comple&); - - //////// / //////// - inline friend _zgsmatrix operator/(const _zgsmatrix&, const double&); - inline friend _zgsmatrix operator/(const _zgsmatrix&, const comple&); - - //////// double, complex //////// - inline friend _zgsmatrix operator*(const double&, const _zgsmatrix&); - inline friend _zgsmatrix operator*(const comple&, const _zgsmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/09/0943bb83150b189351d2f7dfa1689ec3be4465bb.svn-base b/cpplapack-r198/.svn/pristine/09/0943bb83150b189351d2f7dfa1689ec3be4465bb.svn-base deleted file mode 100644 index d96dbc56069fccfe8019ca429df897dafd97e921..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/09/0943bb83150b189351d2f7dfa1689ec3be4465bb.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -//============================================================================= -/*! zcovector*=double operator */ -inline zcovector& zcovector::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zdscal_(&l, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zcovector/=double operator */ -inline zcovector& zcovector::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&l, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector*double operator */ -inline _zcovector operator*(const zcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]*d; - } - - return _(newvec); -} - -//============================================================================= -/*! zcovector/double operator */ -inline _zcovector operator/(const zcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]/d; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/09/095bbe45184e66911685554a2cbb77f5440c1545.svn-base b/cpplapack-r198/.svn/pristine/09/095bbe45184e66911685554a2cbb77f5440c1545.svn-base deleted file mode 100644 index 22797a9ab9aff4ec0529363bf9f63ae19fce78a0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/09/095bbe45184e66911685554a2cbb77f5440c1545.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! return its transposed zgbmatrix */ -inline _zgbmatrix t(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl); - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - newmat(i,j) =mat(j,i); - } - } - - mat.destroy(); - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _zgematrix i(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix mat_cp(mat); - zgematrix mat_inv(mat_cp.m,mat_cp.n); - mat_inv.identity(); - mat_cp.zgbsv(mat_inv); - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its conjugate matrix */ -inline _zgbmatrix conj(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - mat(i,j) =std::conj(mat(i,j)); - } - } - - return mat; -} - -//============================================================================= -/*! return its conjugate transposed zgbmatrix */ -inline _zgbmatrix conjt(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - newmat(i,j) =std::conj(mat(j,i)); - } - } - - mat.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/09/09708f5d014e60de0cea70b1b90c3fe2a70c8286.svn-base b/cpplapack-r198/.svn/pristine/09/09708f5d014e60de0cea70b1b90c3fe2a70c8286.svn-base deleted file mode 100644 index 47941d4abe9f59bfe1faef602a7feaf659741a42..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/09/09708f5d014e60de0cea70b1b90c3fe2a70c8286.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _dgematrix+dgbmatrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) += matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _dgematrix-dgbmatrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) -= matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _dgematrix*dgbmatrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/09/09924cc97d61601aa3e13e2a92b8e93bf0ad502c.svn-base b/cpplapack-r198/.svn/pristine/09/09924cc97d61601aa3e13e2a92b8e93bf0ad502c.svn-base deleted file mode 100644 index 674f8d1f837957681044a53241dcb849df09dc62..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/09/09924cc97d61601aa3e13e2a92b8e93bf0ad502c.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -//============================================================================= -/*! double*_dcovector operator */ -inline _dcovector operator*(const double& d, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - dscal_(&vec.l, &d, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/09/09a4271d06bb6e976b5ca47f774b1801d4585987.svn-base b/cpplapack-r198/.svn/pristine/09/09a4271d06bb6e976b5ca47f774b1801d4585987.svn-base deleted file mode 100644 index 204052c6369274358654e8dc533033dde0a5c73a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/09/09a4271d06bb6e976b5ca47f774b1801d4585987.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -//============================================================================= -/*! return transposed dssmatrix */ -inline _dssmatrix t(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - WARNING_REPORT; - std::cerr << "This function call has no effect since the matrix is symmetric." << std::endl; -#endif//CPPL_DEBUG - - dssmatrix newmat(mat); - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < fabs(it->v) ){ - vmax =fabs(it->v); - itx =it; - } - } - - i =itx->i; - j =itx->j; -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < fabs(it->v) ){ - vmax =fabs(it->v); - itx =it; - } - } - - return itx->v; -} diff --git a/cpplapack-r198/.svn/pristine/09/09a83d3dd9bfa0fc825a1c3ac784885472bffce0.svn-base b/cpplapack-r198/.svn/pristine/09/09a83d3dd9bfa0fc825a1c3ac784885472bffce0.svn-base deleted file mode 100644 index 058ba775e61fe2f32c543ae2d1ddf824945e0fec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/09/09a83d3dd9bfa0fc825a1c3ac784885472bffce0.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -//============================================================================= -//! Complex Double-precision Hermitian Sparse Matrix Class -class zhsmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT const& m; //!< matrix row size - CPPL_INT n; //!< matrix column size - std::vector<zcomponent> data; //!< matrix data - std::vector< std::vector<CPPL_INT> > line; //!< vector of vector to store the entry information of component for each row and column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zhsmatrix(); - inline zhsmatrix(const zhsmatrix&); - inline zhsmatrix(const _zhsmatrix&); - inline zhsmatrix(const CPPL_INT&, const CPPL_INT=0); - inline zhsmatrix(const char*); - inline zhsmatrix(const zgematrix&); - inline ~zhsmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - inline _zhematrix to_zhematrix() const; - inline _zgsmatrix to_zgsmatrix() const; - - //////// io //////// - inline comple operator()(const CPPL_INT&, const CPPL_INT&) const; - inline zhecomplex operator()(const CPPL_INT&, const CPPL_INT&); - inline zhsmatrix& put(const CPPL_INT&, const CPPL_INT&, const comple&); - inline zhsmatrix& del(const CPPL_INT, const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline zhsmatrix& del(const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline friend std::ostream& operator<<(std::ostream&, const zhsmatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline zhsmatrix& zero(); - inline zhsmatrix& identity(); - inline void chsign(); - inline void copy(const zhsmatrix&); - inline void shallow_copy(const _zhsmatrix&); - inline zhsmatrix& resize(const CPPL_INT&, const CPPL_INT=0, const CPPL_INT=0); - inline void stretch(const CPPL_INT&); - inline void expand(const CPPL_INT&); - inline bool isListed(const CPPL_INT&, const CPPL_INT&) const; - inline CPPL_INT number(const CPPL_INT&, const CPPL_INT&) const; - //inline void unique(); - inline void checkup(); - inline _zrovector row(const CPPL_INT&) const; - inline _zcovector col(const CPPL_INT&) const; - inline void diet(const double=DBL_MIN); - inline friend void swap(zhsmatrix&, zhsmatrix&); - inline friend _zhsmatrix _(zhsmatrix&); - - //////// calc //////// - inline friend _zhsmatrix t(const zhsmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const zhsmatrix&); - inline friend comple damax(const zhsmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline zhsmatrix& operator=(const zhsmatrix&); - inline zhsmatrix& operator=(const _zhsmatrix&); - - //////// += //////// - inline zhsmatrix& operator+=(const zhsmatrix&); - inline zhsmatrix& operator+=(const _zhsmatrix&); - - //////// -= //////// - inline zhsmatrix& operator-=(const zhsmatrix&); - inline zhsmatrix& operator-=(const _zhsmatrix&); - - //////// *= //////// - inline zhsmatrix& operator*=(const double&); - - //////// /= //////// - inline zhsmatrix& operator/=(const double&); - - //////// unary //////// - inline friend const zhsmatrix& operator+(const zhsmatrix&); - inline friend _zhsmatrix operator-(const zhsmatrix&); - - //////// + //////// - inline friend _zgematrix operator+(const zhsmatrix&, const zgematrix&); - inline friend _zgematrix operator+(const zhsmatrix&, const _zgematrix&); - inline friend _zgematrix operator+(const zhsmatrix&, const zhematrix&); - inline friend _zgematrix operator+(const zhsmatrix&, const _zhematrix&); - inline friend _zgematrix operator+(const zhsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const zhsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator+(const zhsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator+(const zhsmatrix&, const _zgsmatrix&); - inline friend _zhsmatrix operator+(const zhsmatrix&, const zhsmatrix&); - inline friend _zhsmatrix operator+(const zhsmatrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const zhsmatrix&, const zgematrix&); - inline friend _zgematrix operator-(const zhsmatrix&, const _zgematrix&); - inline friend _zgematrix operator-(const zhsmatrix&, const zhematrix&); - inline friend _zgematrix operator-(const zhsmatrix&, const _zhematrix&); - inline friend _zgematrix operator-(const zhsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const zhsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator-(const zhsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator-(const zhsmatrix&, const _zgsmatrix&); - inline friend _zhsmatrix operator-(const zhsmatrix&, const zhsmatrix&); - inline friend _zhsmatrix operator-(const zhsmatrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const zhsmatrix&, const zcovector&); - inline friend _zcovector operator*(const zhsmatrix&, const _zcovector&); - inline friend _zgematrix operator*(const zhsmatrix&, const zgematrix&); - inline friend _zgematrix operator*(const zhsmatrix&, const _zgematrix&); - inline friend _zgematrix operator*(const zhsmatrix&, const zhematrix&); - inline friend _zgematrix operator*(const zhsmatrix&, const _zhematrix&); - inline friend _zgematrix operator*(const zhsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const zhsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator*(const zhsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator*(const zhsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator*(const zhsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator*(const zhsmatrix&, const _zhsmatrix&); - inline friend _zhsmatrix operator*(const zhsmatrix&, const double&); - inline friend _zgsmatrix operator*(const zhsmatrix&, const comple&); - - //////// / //////// - inline friend _zhsmatrix operator/(const zhsmatrix&, const double&); - inline friend _zgsmatrix operator/(const zhsmatrix&, const comple&); - - //////// double, comple //////// - inline friend _zhsmatrix operator*(const double&, const zhsmatrix&); - inline friend _zgsmatrix operator*(const comple&, const zhsmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/0a/0a37eb7fb2b37981867231f056bccf404c93d321.svn-base b/cpplapack-r198/.svn/pristine/0a/0a37eb7fb2b37981867231f056bccf404c93d321.svn-base deleted file mode 100644 index 169a73e93bf76c2f2dc5b3f6dbf2040e72cf87d4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0a/0a37eb7fb2b37981867231f056bccf404c93d321.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! dgematrix+dgsmatrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix-dgsmatrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix*dgsmatrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/0a/0a6c95129aedc96ff1d336422757ce0591261352.svn-base b/cpplapack-r198/.svn/pristine/0a/0a6c95129aedc96ff1d336422757ce0591261352.svn-base deleted file mode 100644 index 47008bf79a244e051f53e4e119e55fbe429f98d1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0a/0a6c95129aedc96ff1d336422757ce0591261352.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! zrovector*zgsmatrix operator */ -inline _zrovector operator*(const zrovector& vec, const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/0a/0affc6f02f8f9ee7a57313b778c9d9c76f8a0eaf.svn-base b/cpplapack-r198/.svn/pristine/0a/0affc6f02f8f9ee7a57313b778c9d9c76f8a0eaf.svn-base deleted file mode 100644 index 117c6bc9c5c13bbdf5cbbf01c507647a0bb57e85..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0a/0affc6f02f8f9ee7a57313b778c9d9c76f8a0eaf.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! +_dgematrix operator */ -inline const _dgematrix& operator+(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_dgematrix operator */ -inline _dgematrix operator-(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m*mat.n; i++){ mat.array[i]=-mat.array[i]; } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/0b/0b23f11eabb9ee309f766c756effc019cea48a6b.svn-base b/cpplapack-r198/.svn/pristine/0b/0b23f11eabb9ee309f766c756effc019cea48a6b.svn-base deleted file mode 100644 index c98329cb11f41c54e2c97ccf703c85a51634ff1f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0b/0b23f11eabb9ee309f766c756effc019cea48a6b.svn-base +++ /dev/null @@ -1,174 +0,0 @@ -//============================================================================= -/*! calculate inverse */ -inline dgemat1 inv(const dgemat1& A) -{CPPL_VERBOSE_REPORT; - dgemat1 Ainv; - Ainv(0,0) =1./A(0,0); - return Ainv; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate determinant */ -inline double det(const dgemat2& A) -{CPPL_VERBOSE_REPORT; - return A(0,0)*A(1,1)-A(0,1)*A(1,0); -} - -//============================================================================= -/*! calculate inverse */ -inline dgemat2 inv(const dgemat2& A) -{CPPL_VERBOSE_REPORT; - const double Adet( det(A) ); - dgemat2 Ainv; - Ainv(0,0)= A(1,1)/Adet; Ainv(0,1)=-A(0,1)/Adet; - Ainv(1,0)=-A(1,0)/Adet; Ainv(1,1)= A(0,0)/Adet; - return Ainv; -} - -//============================================================================= -/*! return rotated tensor */ -inline dgemat2 rotate(const dgemat2& m, const double& theta) -{CPPL_VERBOSE_REPORT; - //dgemat2 R(t2m(theta)); return R*m*t(R);//too slow - double c(std::cos(theta)), s(std::sin(theta)); - double cc(c*c), cs(c*s), ss(s*s); - dgemat2 mat; - mat(0,0) =m(0,0)*cc -(m(0,1)+m(1,0))*cs +m(1,1)*ss; - mat(0,1) =m(0,1)*cc +(m(0,0)-m(1,1))*cs -m(1,0)*ss; - mat(1,0) =m(1,0)*cc +(m(0,0)-m(1,1))*cs -m(0,1)*ss; - mat(1,1) =m(1,1)*cc +(m(0,1)+m(1,0))*cs +m(0,0)*ss; - return mat; -} - -//============================================================================= -/*! convert theta to 2x2 rotational matrix */ -inline dgemat2 t2m(const double& theta) -{CPPL_VERBOSE_REPORT; - dgemat2 R; - R(0,0)=std::cos(theta); R(0,1)=-std::sin(theta); - R(1,0)=std::sin(theta); R(1,1)= std::cos(theta); - return R; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate determinant */ -inline double det(const dgemat3& A) -{CPPL_VERBOSE_REPORT; - return - +A(0,0)*A(1,1)*A(2,2) -A(0,0)*A(1,2)*A(2,1) - +A(0,1)*A(1,2)*A(2,0) -A(0,1)*A(1,0)*A(2,2) - +A(0,2)*A(1,0)*A(2,1) -A(0,2)*A(1,1)*A(2,0); -} - -//============================================================================= -/*! calculate the 2nd invariant */ -inline double II(const dgemat3& A) -{CPPL_VERBOSE_REPORT; - return - +A(0,0)*A(1,1) +A(1,1)*A(2,2) +A(2,2)*A(0,0) - -A(0,1)*A(1,0) -A(1,2)*A(2,1) -A(2,0)*A(0,2); -} - -//============================================================================= -/*! calculate inverse */ -inline dgemat3 inv(const dgemat3& A) -{CPPL_VERBOSE_REPORT; - const double Adet( det(A) ); - dgemat3 Ainv; - Ainv(0,0) =(A(1,1)*A(2,2)-A(1,2)*A(2,1))/Adet; - Ainv(0,1) =(A(0,2)*A(2,1)-A(0,1)*A(2,2))/Adet; - Ainv(0,2) =(A(0,1)*A(1,2)-A(0,2)*A(1,1))/Adet; - Ainv(1,0) =(A(1,2)*A(2,0)-A(1,0)*A(2,2))/Adet; - Ainv(1,1) =(A(0,0)*A(2,2)-A(0,2)*A(2,0))/Adet; - Ainv(1,2) =(A(0,2)*A(1,0)-A(0,0)*A(1,2))/Adet; - Ainv(2,0) =(A(1,0)*A(2,1)-A(1,1)*A(2,0))/Adet; - Ainv(2,1) =(A(0,1)*A(2,0)-A(0,0)*A(2,1))/Adet; - Ainv(2,2) =(A(0,0)*A(1,1)-A(0,1)*A(1,0))/Adet; - return Ainv; -} - -//============================================================================= -/*! rotate 3D matrix by quaternion */ -inline dgemat3 rotate(const dgemat3& m, const dquater& q) -{CPPL_VERBOSE_REPORT; - dgemat3 R(q2m(q)); - return R*m*t(R); -} - -//============================================================================= -/*! convert 3D rotational matrix to quaternion */ -inline dquater m2q(const dgemat3& m) -{CPPL_VERBOSE_REPORT; - dcovec3 v( m(2,1)-m(1,2), m(0,2)-m(2,0), m(1,0)-m(0,1) ); - double t( std::acos(0.5*(m(0,0)+m(1,1)+m(2,2)-1.)) ); - return vt2q(v,t); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate determinant */ -inline double det(const dgemat4& A) -{CPPL_VERBOSE_REPORT; - return - ((A(0,0)*A(1,1)-A(0,1)*A(1,0))*A(2,2)+(A(0,2)*A(1,0)-A(0,0)*A(1,2))*A(2,1)+(A(0,1)*A(1,2)-A(0,2)*A(1,1))*A(2,0))*A(3,3) - +((A(0,1)*A(1,0)-A(0,0)*A(1,1))*A(2,3)+(A(0,0)*A(1,3)-A(0,3)*A(1,0))*A(2,1)+(A(0,3)*A(1,1)-A(0,1)*A(1,3))*A(2,0))*A(3,2) - +((A(0,0)*A(1,2)-A(0,2)*A(1,0))*A(2,3)+(A(0,3)*A(1,0)-A(0,0)*A(1,3))*A(2,2)+(A(0,2)*A(1,3)-A(0,3)*A(1,2))*A(2,0))*A(3,1) - +((A(0,2)*A(1,1)-A(0,1)*A(1,2))*A(2,3)+(A(0,1)*A(1,3)-A(0,3)*A(1,1))*A(2,2)+(A(0,3)*A(1,2)-A(0,2)*A(1,3))*A(2,1))*A(3,0); -} - -//============================================================================= -/*! calculate inverse */ -inline dgemat4 inv(const dgemat4& A) -{CPPL_VERBOSE_REPORT; - const double Adet =det(A); - - dgemat4 Ainv; - Ainv(0,0) =(A(1,1)*A(2,2)-A(1,2)*A(2,1))*A(3,3)+(A(1,3)*A(2,1)-A(1,1)*A(2,3))*A(3,2)+(A(1,2)*A(2,3)-A(1,3)*A(2,2))*A(3,1); - Ainv(0,1) =(A(0,2)*A(2,1)-A(0,1)*A(2,2))*A(3,3)+(A(0,1)*A(2,3)-A(0,3)*A(2,1))*A(3,2)+(A(0,3)*A(2,2)-A(0,2)*A(2,3))*A(3,1); - Ainv(0,2) =(A(0,1)*A(1,2)-A(0,2)*A(1,1))*A(3,3)+(A(0,3)*A(1,1)-A(0,1)*A(1,3))*A(3,2)+(A(0,2)*A(1,3)-A(0,3)*A(1,2))*A(3,1); - Ainv(0,3) =(A(0,2)*A(1,1)-A(0,1)*A(1,2))*A(2,3)+(A(0,1)*A(1,3)-A(0,3)*A(1,1))*A(2,2)+(A(0,3)*A(1,2)-A(0,2)*A(1,3))*A(2,1); - Ainv(1,0) =(A(1,2)*A(2,0)-A(1,0)*A(2,2))*A(3,3)+(A(1,0)*A(2,3)-A(1,3)*A(2,0))*A(3,2)+(A(1,3)*A(2,2)-A(1,2)*A(2,3))*A(3,0); - Ainv(1,1) =(A(0,0)*A(2,2)-A(0,2)*A(2,0))*A(3,3)+(A(0,3)*A(2,0)-A(0,0)*A(2,3))*A(3,2)+(A(0,2)*A(2,3)-A(0,3)*A(2,2))*A(3,0); - Ainv(1,2) =(A(0,2)*A(1,0)-A(0,0)*A(1,2))*A(3,3)+(A(0,0)*A(1,3)-A(0,3)*A(1,0))*A(3,2)+(A(0,3)*A(1,2)-A(0,2)*A(1,3))*A(3,0); - Ainv(1,3) =(A(0,0)*A(1,2)-A(0,2)*A(1,0))*A(2,3)+(A(0,3)*A(1,0)-A(0,0)*A(1,3))*A(2,2)+(A(0,2)*A(1,3)-A(0,3)*A(1,2))*A(2,0); - Ainv(2,0) =(A(1,0)*A(2,1)-A(1,1)*A(2,0))*A(3,3)+(A(1,3)*A(2,0)-A(1,0)*A(2,3))*A(3,1)+(A(1,1)*A(2,3)-A(1,3)*A(2,1))*A(3,0); - Ainv(2,1) =(A(0,1)*A(2,0)-A(0,0)*A(2,1))*A(3,3)+(A(0,0)*A(2,3)-A(0,3)*A(2,0))*A(3,1)+(A(0,3)*A(2,1)-A(0,1)*A(2,3))*A(3,0); - Ainv(2,2) =(A(0,0)*A(1,1)-A(0,1)*A(1,0))*A(3,3)+(A(0,3)*A(1,0)-A(0,0)*A(1,3))*A(3,1)+(A(0,1)*A(1,3)-A(0,3)*A(1,1))*A(3,0); - Ainv(2,3) =(A(0,1)*A(1,0)-A(0,0)*A(1,1))*A(2,3)+(A(0,0)*A(1,3)-A(0,3)*A(1,0))*A(2,1)+(A(0,3)*A(1,1)-A(0,1)*A(1,3))*A(2,0); - Ainv(3,0) =(A(1,1)*A(2,0)-A(1,0)*A(2,1))*A(3,2)+(A(1,0)*A(2,2)-A(1,2)*A(2,0))*A(3,1)+(A(1,2)*A(2,1)-A(1,1)*A(2,2))*A(3,0); - Ainv(3,1) =(A(0,0)*A(2,1)-A(0,1)*A(2,0))*A(3,2)+(A(0,2)*A(2,0)-A(0,0)*A(2,2))*A(3,1)+(A(0,1)*A(2,2)-A(0,2)*A(2,1))*A(3,0); - Ainv(3,2) =(A(0,1)*A(1,0)-A(0,0)*A(1,1))*A(3,2)+(A(0,0)*A(1,2)-A(0,2)*A(1,0))*A(3,1)+(A(0,2)*A(1,1)-A(0,1)*A(1,2))*A(3,0); - Ainv(3,3) =(A(0,0)*A(1,1)-A(0,1)*A(1,0))*A(2,2)+(A(0,2)*A(1,0)-A(0,0)*A(1,2))*A(2,1)+(A(0,1)*A(1,2)-A(0,2)*A(1,1))*A(2,0); - - Ainv /=Adet; - return Ainv; -} diff --git a/cpplapack-r198/.svn/pristine/0b/0b6649fbc38d98ab44bff8bcf74ef8c5e6762107.svn-base b/cpplapack-r198/.svn/pristine/0b/0b6649fbc38d98ab44bff8bcf74ef8c5e6762107.svn-base deleted file mode 100644 index 1f4d4f04cdc145659b422491a0c80b1ea2aaba57..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0b/0b6649fbc38d98ab44bff8bcf74ef8c5e6762107.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -//============================================================================= -/*! zhsmatrix+zgematrix operator */ -/* -inline _zgematrix operator+(const zhsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! zhsmatrix-zgematrix operator */ -/* -inline _zgematrix operator-(const zhsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! zhsmatrix*zgematrix operator */ -/* -inline _zgematrix operator*(const zhsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/0b/0b6ca2226739cc982ac3b3a87381f54d071e1259.svn-base b/cpplapack-r198/.svn/pristine/0b/0b6ca2226739cc982ac3b3a87381f54d071e1259.svn-base deleted file mode 100644 index c2a4b247256f7e5560aa1a552f216a0af737e665..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0b/0b6ca2226739cc982ac3b3a87381f54d071e1259.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision General Band Matrix Class -class _dgbmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable CPPL_INT kl; //!< lower band width - mutable CPPL_INT ku; //!< upper band width - mutable double* array; //!< 1D array to store matrix data - mutable double** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _dgbmatrix(); - inline _dgbmatrix(const _dgbmatrix&); - inline ~_dgbmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgbmatrix to_zgbmatrix() const; - inline _dgematrix to_dgematrix() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&, const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const _dgbmatrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _dgbmatrix t(const _dgbmatrix&); - inline friend _dgematrix i(const _dgbmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _dgbmatrix& operator+(const _dgbmatrix&); - inline friend _dgbmatrix operator-(const _dgbmatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const _dgbmatrix&, const dgematrix&); - inline friend _dgematrix operator+(const _dgbmatrix&, const _dgematrix&); - inline friend _dgematrix operator+(const _dgbmatrix&, const dsymatrix&); - inline friend _dgematrix operator+(const _dgbmatrix&, const _dsymatrix&); - inline friend _dgbmatrix operator+(const _dgbmatrix&, const dgbmatrix&); - inline friend _dgbmatrix operator+(const _dgbmatrix&, const _dgbmatrix&); - inline friend _dgematrix operator+(const _dgbmatrix&, const dgsmatrix&); - inline friend _dgematrix operator+(const _dgbmatrix&, const _dgsmatrix&); - inline friend _dgematrix operator+(const _dgbmatrix&, const dssmatrix&); - inline friend _dgematrix operator+(const _dgbmatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const _dgbmatrix&, const dgematrix&); - inline friend _dgematrix operator-(const _dgbmatrix&, const _dgematrix&); - inline friend _dgematrix operator-(const _dgbmatrix&, const dsymatrix&); - inline friend _dgematrix operator-(const _dgbmatrix&, const _dsymatrix&); - inline friend _dgbmatrix operator-(const _dgbmatrix&, const dgbmatrix&); - inline friend _dgbmatrix operator-(const _dgbmatrix&, const _dgbmatrix&); - inline friend _dgematrix operator-(const _dgbmatrix&, const dgsmatrix&); - inline friend _dgematrix operator-(const _dgbmatrix&, const _dgsmatrix&); - inline friend _dgematrix operator-(const _dgbmatrix&, const dssmatrix&); - inline friend _dgematrix operator-(const _dgbmatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const _dgbmatrix&, const dcovector&); - inline friend _dcovector operator*(const _dgbmatrix&, const _dcovector&); - inline friend _dgematrix operator*(const _dgbmatrix&, const dgematrix&); - inline friend _dgematrix operator*(const _dgbmatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const _dgbmatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const _dgbmatrix&, const _dsymatrix&); - inline friend _dgbmatrix operator*(const _dgbmatrix&, const dgbmatrix&); - inline friend _dgbmatrix operator*(const _dgbmatrix&, const _dgbmatrix&); - inline friend _dgematrix operator*(const _dgbmatrix&, const dgsmatrix&); - inline friend _dgematrix operator*(const _dgbmatrix&, const _dgsmatrix&); - inline friend _dgematrix operator*(const _dgbmatrix&, const dssmatrix&); - inline friend _dgematrix operator*(const _dgbmatrix&, const _dssmatrix&); - inline friend _dgbmatrix operator*(const _dgbmatrix&, const double&); - - //////// / //////// - inline friend _dgbmatrix operator/(const _dgbmatrix&, const double&); - - //////// double //////// - inline friend _dgbmatrix operator*(const double&, const _dgbmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/0b/0b81a25a8e4fd065f95cb0362d2d92811b4e36e0.svn-base b/cpplapack-r198/.svn/pristine/0b/0b81a25a8e4fd065f95cb0362d2d92811b4e36e0.svn-base deleted file mode 100644 index 58ad3372a6e1a734f9ccdb6f558c6bde3e7a03f2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0b/0b81a25a8e4fd065f95cb0362d2d92811b4e36e0.svn-base +++ /dev/null @@ -1,131 +0,0 @@ -//============================================================================= -/*! dsymatrix=dsymatrix operator */ -inline dsymatrix& dsymatrix::operator=(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - if(array!=mat.array){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix+=dsymatrix operator */ -inline dsymatrix& dsymatrix::operator+=(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] +=mat.darray[j][i]; - } - } - - return *this; -} - -//============================================================================= -/*! dsymatrix operator-= */ -inline dsymatrix& dsymatrix::operator-=(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] -=mat.darray[j][i]; - } - } - - return *this; -} - -//============================================================================= -/*! dsymatrix+dsymatrix operator */ -inline _dsymatrix operator+(const dsymatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dsymatrix newmat(matA.n); - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - newmat.darray[j][i] =matA.darray[j][i] +matB.darray[j][i]; - } - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix-dsymatrix operator */ -inline _dsymatrix operator-(const dsymatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dsymatrix newmat(matA.n); - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - newmat.darray[j][i] =matA.darray[j][i] -matB.darray[j][i]; - } - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix*dsymatrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - dgematrix newmat(matA.n, matA.n); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/0b/0b95be583d3c5325385dddb0d644b3517ba21cbb.svn-base b/cpplapack-r198/.svn/pristine/0b/0b95be583d3c5325385dddb0d644b3517ba21cbb.svn-base deleted file mode 100644 index 5b042451ecd45b6f59805515115e102e7859d2e4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0b/0b95be583d3c5325385dddb0d644b3517ba21cbb.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! +_zcovector operator */ -inline const _zcovector& operator+(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -_zcovector operator */ -inline _zcovector operator-(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ vec.array[i]=-vec.array[i]; } - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/0c/0c5d76d1344b58eb98494f1c191af1e31b0e39b8.svn-base b/cpplapack-r198/.svn/pristine/0c/0c5d76d1344b58eb98494f1c191af1e31b0e39b8.svn-base deleted file mode 100644 index ce65b573a4930ea413d8b8e9c70a45c3787b3218..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0c/0c5d76d1344b58eb98494f1c191af1e31b0e39b8.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::zhematrix A; - cout << "A || n=" << A.n << " array=" << A.array << " " << endl; - - - CPPL::zhematrix B(N); - for(int i=0; i<B.n; i++){ - for(int j=0; j<i; j++){ - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - B(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - cout << "B || n=" << B.n << " array=" << B.array << " " << endl; - cout << B << endl; - - CPPL::zhematrix C(B); - cout << "C || n=" << C.n << " array=" << C.array << " " << endl; - cout << C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/0c/0c8cd851b25902662180170357af97343a7fd8a4.svn-base b/cpplapack-r198/.svn/pristine/0c/0c8cd851b25902662180170357af97343a7fd8a4.svn-base deleted file mode 100644 index 5e036577c00b13683046594c9f73f825616667c8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0c/0c8cd851b25902662180170357af97343a7fd8a4.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -extern "C" { - // Level 1 BLAS - /* Vector rotation: x := c*x[i] + s*y[i], y[i] := - s*x[i] + c*y[i] */ - void drot_( const CPPL_INT *N, double *x, const CPPL_INT *incx, double *y, - const CPPL_INT *incy, const double *c, const double *s ); - /* x <--> y */ - void dswap_( const CPPL_INT *N, double *x, const CPPL_INT *incx, double *y, - const CPPL_INT *incy ); - /* x := alpha * x */ - void dscal_( const CPPL_INT *N, const double *alpha, double *x, - const CPPL_INT *incx ); - /* y := x */ - void dcopy_( const CPPL_INT *N, const double *x, const CPPL_INT *incx, - double *y, const CPPL_INT *incy ); - /* y := alpha * x + y */ - void daxpy_( const CPPL_INT *N, const double *alpha, const double *x, - const CPPL_INT *incx, double *y, const CPPL_INT *incy ); - /* return x^T y */ - double ddot_( const CPPL_INT *N, const double *x, const CPPL_INT *incx, - const double *y, const CPPL_INT *incy ); - /* return N2 norm */ - double dnrm2_( const CPPL_INT *N, const double *x, const CPPL_INT *incx ); - /* return sum of abs(x[i]) */ - double dasum_( const CPPL_INT *N, const double *x, const CPPL_INT *incx ); - /* return the index of element having the largest absolute value */ - CPPL_INT idamax_( const CPPL_INT *N, const double *x, const CPPL_INT *incx ); - - // Level 2 BLAS - /* y := alpha * A * x + beta * y for General M by N Matrix */ - void dgemv_( const char *trans, const CPPL_INT *M, const CPPL_INT *N, - const double *alpha, const double *a, const CPPL_INT *lda, - const double *x, const CPPL_INT *incx, const double *beta, - double *y, const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for General M by N Band Matrix */ - void dgbmv_( const char *trans, const CPPL_INT *M, const CPPL_INT *N, - const CPPL_INT *KL, const CPPL_INT *KU, const double *alpha, - const double *a, const CPPL_INT *lda, const double *x, - const CPPL_INT *incx, const double *beta, double *y, - const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for Symmetric Matrix */ - void dsymv_( const char *uplo, const CPPL_INT *N, const double *alpha, - const double *a, const CPPL_INT *lda, const double *x, - const CPPL_INT *incx, const double *beta, double *y, - const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for Symmetric Band Matrix */ - void dsbmv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *k, - const double *alpha, const double *a, const CPPL_INT *lda, - const double *x, const CPPL_INT *incx, const double *beta, - double *y, const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for Symmetric Packed Matrix */ - void dspmv_( const char *uplo, const CPPL_INT *N, const double *alpha, - const double *ap, const double *x, const CPPL_INT *incx, - const double *beta, double *y, const CPPL_INT *incy ); - - /* x := A * x for Triangular Matrix */ - void dtrmv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const double *a, const CPPL_INT *lda, - double *x, const CPPL_INT *incx ); - /* x := A * x for Triangular (Banded Storage) Matrix */ - void dtbmv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const CPPL_INT *k, const double *a, - const CPPL_INT *lda, double *x, const CPPL_INT *incx ); - /* x := A * x for Triangular (Packed Storage) Matrix */ - void dtpmv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const double *ap, double *x, - const CPPL_INT *incx ); - - /* Solve A * x = b for Triangular Matrix */ - void dtrsv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const double *a, const CPPL_INT *lda, double *x, - const CPPL_INT *incx ); - /* Solve A * x = b for Triangular (Banded Storage) Matrix */ - void dtbsv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const CPPL_INT *k, const double *a, - const CPPL_INT *lda, double *x, const CPPL_INT *incx ); - /* Solve A * x = b for Triangular (Packed Storage) Matrix */ - void dtpsv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const double *ap, double *x, - const CPPL_INT *incx ); - - /* A := alpha * x * y' + A (A: M by N Matrix) */ - void dger_( const CPPL_INT *M, const CPPL_INT *N, const double *alpha, - const double *x, const CPPL_INT *incx, const double *y, - const CPPL_INT *incy, double *a, const CPPL_INT *lda ); - /* A := alpha * x * x' + A (A: Symmetric N by N Matrix) */ - void dsyr_( const char *uplo, const CPPL_INT *N, const double *alpha, - const double *x, const CPPL_INT *incx, double *a, - const CPPL_INT *lda ); - /* A := alpha * x * x' + A - (A: Symmetric N by N Packed Storage Matrix) */ - void dspr_( const char *uplo, const CPPL_INT *N, const double *alpha, - const double *x, const CPPL_INT *incx, double *ap ); - /* A := alpha * x * y' + alpha * y * x' + A - (A: Symmetric N by N Matrix) */ - void dsyr2_( const char *uplo, const CPPL_INT *N, const double *alpha, - const double *x, const CPPL_INT *incx, const double *y, - const CPPL_INT *incy, double *a, const CPPL_INT *lda ); - /* A := alpha * x * y' + alpha * y * x' + A - (A: Symmetric N by N Packed Storage Matrix) */ - void dspr2_( const char *uplo, const CPPL_INT *N, const double *alpha, - const double *x, const CPPL_INT *incx, const double *y, - const CPPL_INT *incy, double *ap ); - - // Level 3 BLAS - /* C := alpha * A * B + beta * C (C: M by N Matrix) */ - void dgemm_( const char *transa, const char *transb, const CPPL_INT *M, - const CPPL_INT *N, const CPPL_INT *k, const double *alpha, - const double *a, const CPPL_INT *lda, const double *b, - const CPPL_INT *ldb, const double *beta, double *c, - const CPPL_INT *ldc ); - /* C := alpha * A * B + beta * C - (A: Symmetric Matrix, B, C: M by N Matrices) */ - void dsymm_( const char *side, const char *uplo, const CPPL_INT *M, - const CPPL_INT *N, const double *alpha, const double *a, - const CPPL_INT *lda, const double *b, const CPPL_INT *ldb, - const double *beta, double *c, const CPPL_INT *ldc ); - /* C:= alpha * A * A' + beta * C - (A: N by k Matrix, C: Symmetric Matrix) */ - void dsyrk_( const char *uplo, const char *trans, const CPPL_INT *N, - const CPPL_INT *k, const double *alpha, const double *a, - const CPPL_INT *lda, const double *beta, double *c, - const CPPL_INT *ldc ); - /* C := alpha * A * B' + alpha * B * A' + beta * C - (A, B: N by k Marices, C: Symmetric Matrix ) */ - void dsyr2k_( const char *uplo, const char *trans, const CPPL_INT *N, - const CPPL_INT *k, const double *alpha, const double *a, - const CPPL_INT *lda, const double *b, const CPPL_INT *ldb, - const double *beta, double *c, const CPPL_INT *ldc ); - /* B := alpha * A * B (A: Triangular Matrix, B: M by N Matrix) */ - void dtrmm_( const char *side, const char *uplo, const char *transa, - const char *diag, const CPPL_INT *M, const CPPL_INT *N, - const double *alpha, const double *a, const CPPL_INT *lda, - double *b, const CPPL_INT *ldb ); - /* Solve A * X = alpha * B - (A: Triangular Matrix, X, B: M by N Matrices) */ - void dtrsm_( const char *side, const char *uplo, const char *transa, - const char *diag, const CPPL_INT *M, const CPPL_INT *N, - const double *alpha, const double *a, const CPPL_INT *lda, - double *b, const CPPL_INT *ldb ); -} diff --git a/cpplapack-r198/.svn/pristine/0c/0cd5026388dd38783e0a43d09e711a37fa836adc.svn-base b/cpplapack-r198/.svn/pristine/0c/0cd5026388dd38783e0a43d09e711a37fa836adc.svn-base deleted file mode 100644 index 440f013b1729e69b0a0c741046cf1636e2279fa8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0c/0cd5026388dd38783e0a43d09e711a37fa836adc.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! dgesvd_check */ -void dgesvd_check() -{ - std::cout << "############ check dgesvd ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(4), N(3); - - //// make dgematrix A //// - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make A_original //// - CPPL::dgematrix A_original(A); - - //// make S, U and VT //// - CPPL::dcovector S; - CPPL::dgematrix U, VT; - - //// SVD A //// - A.dgesvd(S,U,VT); - - //// print A, S, U, and VT //// - std::cout << "A=\n" << A << std::endl; - std::cout << "S=\n" << S << std::endl; - std::cout << "U=\n" << U << std::endl; - std::cout << "VT=\n" << VT << std::endl; - - CPPL::dgematrix S_matrix(M,N); - S_matrix.zero(); - for(int i=0; i<std::min(M,N); i++){ S_matrix(i,i) =S(i); } - std::cout << "S_matrix=\n" << S_matrix << std::endl; - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "U*S_matrix*VT=\n" << U*S_matrix*VT << std::endl; -} diff --git a/cpplapack-r198/.svn/pristine/0c/0ce6471ac1f19f2e936cf9780172e653f5e2e4af.svn-base b/cpplapack-r198/.svn/pristine/0c/0ce6471ac1f19f2e936cf9780172e653f5e2e4af.svn-base deleted file mode 100644 index e55611142d58c5a69c22a46284ccd2ceca9275dc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0c/0ce6471ac1f19f2e936cf9780172e653f5e2e4af.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zgematrix*_zcovector operator */ -inline _zcovector operator*(const zgematrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/0c/0cef1705bc005748538ab1c5c3fe27233275f767.svn-base b/cpplapack-r198/.svn/pristine/0c/0cef1705bc005748538ab1c5c3fe27233275f767.svn-base deleted file mode 100644 index dc1b59b471e66d877fe1f0f874f3ff6e9280d0f1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0c/0cef1705bc005748538ab1c5c3fe27233275f767.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! dssmatrix+_dgematrix operator */ -/* -inline _dgematrix operator+(const dssmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - matB(matA.jndx[c],matA.indx[c]) += matA.array[c]; - } - - return matB; -} -*/ - -//============================================================================= -/*! dssmatrix-_dgematrix operator */ -/* -inline _dgematrix operator-(const dssmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matB.m*matB.n; i++){ - matB.array[i]=-matB.array[i]; - } - - //// add //// - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return matB; -} -*/ -//============================================================================= -/*! dssmatrix*_dgematrix operator */ -/* -inline _dgematrix operator*(const dssmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/0e/0e0bc390046ac16199d7cc6601fba85f26aad89d.svn-base b/cpplapack-r198/.svn/pristine/0e/0e0bc390046ac16199d7cc6601fba85f26aad89d.svn-base deleted file mode 100644 index b8413f4d69c5d771ae14b9f09c9112c1ce70ef74..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0e/0e0bc390046ac16199d7cc6601fba85f26aad89d.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -//============================================================================= -/*! _zhematrix constructor without arguments */ -inline _zhematrix::_zhematrix() - :m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! _zhematrix copy constructor */ -inline _zhematrix::_zhematrix(const _zhematrix& mat) - :m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix destructor */ -inline _zhematrix::~_zhematrix() -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/0e/0e41e94ad786e9e9243347625f489a29283b9b24.svn-base b/cpplapack-r198/.svn/pristine/0e/0e41e94ad786e9e9243347625f489a29283b9b24.svn-base deleted file mode 100644 index 13ed0e3a1f1876eb53e260970af3d9b2d621c689..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0e/0e41e94ad786e9e9243347625f489a29283b9b24.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! +_zrovector operator */ -inline const _zrovector& operator+(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -_zrovector operator */ -inline _zrovector operator-(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ vec.array[i]=-vec.array[i]; } - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/0e/0ea7d04e0bcedbb35f4b86825568601dd2aa1b76.svn-base b/cpplapack-r198/.svn/pristine/0e/0ea7d04e0bcedbb35f4b86825568601dd2aa1b76.svn-base deleted file mode 100644 index 4398e4e8cbeb5ec927d9e417972fd16a1bd419f4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0e/0ea7d04e0bcedbb35f4b86825568601dd2aa1b76.svn-base +++ /dev/null @@ -1,157 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline double& dsymatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if( i >= j ) { - //return array[i+n*j]; - return darray[j][i]; - } else { - //return array[j+n*i]; - return darray[i][j]; - } -} - -//============================================================================= -/*! operator() for const object */ -inline double dsymatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if( i >= j ) { - //return array[i+n*j]; - return darray[j][i]; - } else { - //return array[j+n*i]; - return darray[i][j]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline dsymatrix& dsymatrix::set(const CPPL_INT& i, const CPPL_INT& j, const double& v) //const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if( i >= j ) { - //array[i+n*j] = v; - darray[j][i] =v; - } else { - //array[j+n*i] = v; - darray[i][j] =v; - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - s << " " << mat(i,j) << " "; - } - for(CPPL_INT j=i+1; j<mat.n; j++){ - s << "{" << mat(i,j) << "}"; - } - s << std::endl; - } - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void dsymatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dsymatrix " << n << std::endl; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void dsymatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s(filename); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dsymatrix" && id != "#dsymatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dsymatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> n; - resize(n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++ ){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << " ." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/0f/0f239d17f8d1a270b255891045597ab4c91a0630.svn-base b/cpplapack-r198/.svn/pristine/0f/0f239d17f8d1a270b255891045597ab4c91a0630.svn-base deleted file mode 100644 index 44a3490236cddc6a481bdc2b0a493601fc22df57..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0f/0f239d17f8d1a270b255891045597ab4c91a0630.svn-base +++ /dev/null @@ -1,32 +0,0 @@ -//============================================================================= -/*! cast to _zgbmatrix */ -inline _zgbmatrix dgbmatrix::to_zgbmatrix() const -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(m,n,kl,ku); - - for(CPPL_INT i=0; i<(kl+ku+1)*n; i++){ - newmat.array[i] =comple(array[i],0.0); - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix dgbmatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat( dgematrix(m,n).zero() ); - - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/0f/0fa0e571d27e44ae5c85435eca884f5d2644b51c.svn-base b/cpplapack-r198/.svn/pristine/0f/0fa0e571d27e44ae5c85435eca884f5d2644b51c.svn-base deleted file mode 100644 index 6fd90d2217eec3fc87092df094723ddde5487bdc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0f/0fa0e571d27e44ae5c85435eca884f5d2644b51c.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zgsmatrix*_zcovector operator */ -inline _zcovector operator*(const zgsmatrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v*vec(it->j); - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/0f/0fef21b82fc0896d3c963b7492a7c565d6df9b7a.svn-base b/cpplapack-r198/.svn/pristine/0f/0fef21b82fc0896d3c963b7492a7c565d6df9b7a.svn-base deleted file mode 100644 index 77e42330b2f8eeb78e27f926262afca4d9d9e441..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/0f/0fef21b82fc0896d3c963b7492a7c565d6df9b7a.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+dgematrix operator */ -inline _dgematrix operator+(const _dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix-dgematrix operator */ -inline _dgematrix operator-(const _dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix*dgematrix operator */ -inline _dgematrix operator*(const _dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/10/107bb5141ebb5ea9e5ef321f06dbbf0f519ce68b.svn-base b/cpplapack-r198/.svn/pristine/10/107bb5141ebb5ea9e5ef321f06dbbf0f519ce68b.svn-base deleted file mode 100644 index 4cdac820ce2690e4f44f84343fd69c4f5e54179a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/10/107bb5141ebb5ea9e5ef321f06dbbf0f519ce68b.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -//============================================================================= -/*! zgsmatrix constructor without arguments */ -inline zgsmatrix::zgsmatrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - data.clear(); - rows.clear(); - cols.clear(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix copy constructor */ -inline zgsmatrix::zgsmatrix(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - data.clear(); - rows.clear(); - cols.clear(); - copy(mat); -} - -//============================================================================= -/*! zgsmatrix constructor to cast _zgsmatrix */ -inline zgsmatrix::zgsmatrix(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - data.clear(); - rows.clear(); - cols.clear(); - - data.swap(mat.data); - rows.swap(mat.rows); - cols.swap(mat.cols); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix constructor with size specification */ -inline zgsmatrix::zgsmatrix(const CPPL_INT& _m, const CPPL_INT& _n, const CPPL_INT _c) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _c<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl - << "Your input was (" << _m << "," << _n << "," << _c << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - m =_m; - n =_n; - data.resize(0); - data.reserve(_c); - rows.resize(m); - cols.resize(n); -} - -//============================================================================= -/*! zgsmatrix constructor with filename */ -inline zgsmatrix::zgsmatrix(const char* filename) -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix destructor */ -inline zgsmatrix::~zgsmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/10/109c48a83176c692037609f839e94f8e0287d36d.svn-base b/cpplapack-r198/.svn/pristine/10/109c48a83176c692037609f839e94f8e0287d36d.svn-base deleted file mode 100644 index a247502302321dbf9aa6c2fc008065ee1e896d39..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/10/109c48a83176c692037609f839e94f8e0287d36d.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! zhesv_check */ -void zhesv_check_vector() -{ - cout << "############ check zhesv vector ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make zhematrix A //// - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - //// make zcovector y //// - CPPL::zcovector y(N); - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - //// make A_original and y_original //// - CPPL::zhematrix A_original(A); - CPPL::zcovector y_original(y); - cout << "A_original=\n" << A_original << endl; - cout << "y_original=\n" << y_original << endl; - - //// solve Ax=y //// - A.zhesv(y); - - //// print A, y and A_original*y //// - cout << "A=\n" << A << endl; - cout << "y=\n" << y << endl; - cout << "A_original*y=\n" << A_original*y << endl; -} - -//============================================================================= -void zhesv_check_matrix() -{ - cout << "############ check zhesv matrix ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - - //// make zhematrix A //// - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - //// make zhematrix Y //// - CPPL::zgematrix Y(N,N); - for(int i=0; i<Y.m; i++){ for(int j=0; j<Y.n; j++){ - Y(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make A_original and Y_original //// - CPPL::zhematrix A_original(A); - CPPL::zgematrix Y_original(Y); - cout << "A_original=\n" << A_original << endl; - cout << "Y_original=\n" << Y_original << endl; - - //// solve AY=B //// - A.zhesv(Y); - - //// print A, Y and A_original*Y //// - cout << "A=\n" << A << endl; - cout << "Y=\n" << Y << endl; - cout << "A_original*Y=\n" << A_original*Y << endl; -} diff --git a/cpplapack-r198/.svn/pristine/10/10f9508cb6651c39cb4884912394ad7df95cd5e0.svn-base b/cpplapack-r198/.svn/pristine/10/10f9508cb6651c39cb4884912394ad7df95cd5e0.svn-base deleted file mode 100644 index 7ddf2a7e18ccf0257f643463af7192fc151fc0c5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/10/10f9508cb6651c39cb4884912394ad7df95cd5e0.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -//============================================================================= -/*! dgglse_check */ -void dgglse_check() -{ - std::cout << "############ check dgglse ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3), N(4), P(2); - - //////// make A //////// - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ - for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - CPPL::dgematrix A0(A); - - //////// make B //////// - CPPL::dgematrix B(P,N); - for(int i=0; i<B.m; i++){ - for(int j=0; j<B.n; j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - CPPL::dgematrix B0(B); - - //////// make c //////// - CPPL::dcovector c(M); - for(int i=0; i<c.l; i++){ - c(i) =double( rand() /(RAND_MAX/10) ); - } - CPPL::dcovector c0(c); - - //////// make d //////// - CPPL::dcovector d(P); - for(int i=0; i<d.l; i++){ - d(i) =double( rand() /(RAND_MAX/10) ); - } - CPPL::dcovector d0(d); - - //////// solve LSE //////// - CPPL::dcovector x; - A.dgglse(B,c,d,x); - - //// print //// - std::cout << "t(c0-A0*x)=" << t(c0-A0*x) << std::endl; - std::cout << "t(d0-B0*x)=" << t(d0-B0*x) << std::endl; -} diff --git a/cpplapack-r198/.svn/pristine/11/1131fe8227b780577961060a0e3198313e87172e.svn-base b/cpplapack-r198/.svn/pristine/11/1131fe8227b780577961060a0e3198313e87172e.svn-base deleted file mode 100644 index b5b55a717b5fda9c3c02c2ac4a052d2f122094b9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/11/1131fe8227b780577961060a0e3198313e87172e.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -rootdir=`pwd` -MAKEFILE=$HOME/local/cpplapack/makefiles/Makefile - -for i in `find * -type d | grep -v .svn`; do - if [ -d $i ]; then - echo "################ Enter into $i/ ################" - cd $i - if [ -f SUCCEEDED ]; then - echo "======== Skipping cause already succeeded ========" - elif [ -f main.cpp ]; then - echo "======== Making ========" &&\ - make -f $MAKEFILE &&\ - echo "======== Executing ./A.OUT ========" &&\ - ./A.OUT &&\ - make -f $MAKEFILE fullclean - if [ $? != 0 ]; then exit 1; fi - echo "======== Succeeded ========" - touch SUCCEEDED - else - echo "======== No main.cpp ========" - fi - cd $rootdir - echo "################ Exit from $i/ ################" - fi -done diff --git a/cpplapack-r198/.svn/pristine/11/1174f3be59bc640bfd8b1bbc6c0393121d3c610d.svn-base b/cpplapack-r198/.svn/pristine/11/1174f3be59bc640bfd8b1bbc6c0393121d3c610d.svn-base deleted file mode 100644 index f35443271d3cf8840cd8e9181b3c2b181a8e7759..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/11/1174f3be59bc640bfd8b1bbc6c0393121d3c610d.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::zcovector x; - cout << "x || l=" << x.l << ", array=" << x.array << endl; - - - CPPL::zcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - cout << "y || l=" << y.l << ", array=" << y.array << endl; - cout << y << endl; - - CPPL::zcovector z(y); - cout << "z || l=" << z.l << ", array=" << z.array << endl; - cout << z << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/11/11fa21c4b9563393ac931aaa32b1d464a503ff52.svn-base b/cpplapack-r198/.svn/pristine/11/11fa21c4b9563393ac931aaa32b1d464a503ff52.svn-base deleted file mode 100644 index 83ed4180042c7d5bdce6bd1ee1b481f8e239acb8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/11/11fa21c4b9563393ac931aaa32b1d464a503ff52.svn-base +++ /dev/null @@ -1,180 +0,0 @@ -//============================================================================= -/*! zgematrix=zgematrix operator */ -inline zgematrix& zgematrix::operator=(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - if(array!=mat.array){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+=zgematrix operator */ -inline zgematrix& zgematrix::operator+=(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - array[i]+=mat.array[i]; - } - return *this; -} - -//============================================================================= -/*! zgematrix operator-= */ -inline zgematrix& zgematrix::operator-=(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - array[i]-=mat.array[i]; - } - return *this; -} - -//============================================================================= -/*! zgematrix operator*= */ -inline zgematrix& zgematrix::operator*=(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( m, mat.n ); - char transa ='n'; - char transb ='n'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zgemm_( &transa, &transb, &m, &mat.n, &n, &alpha, array, &m, mat.array, &mat.m, &beta, newmat.array, &m ); - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+zgematrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m,matA.n); - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =matA.array[i]+matB.array[i]; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix-zgematrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m,matA.n); - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =matA.array[i]-matB.array[i]; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix*zgematrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return Hadamerd product */ -inline _zgematrix hadamerd(const zgematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( matA.m!=matB.m || matA.n!=matB.n ){ - ERROR_REPORT; - std::cerr << "These two matrices can not make Hadamerd product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") and (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m,matA.n); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =matA(i,j)*matB(i,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/12/123e64439e51515abe6350d9a5e5c4f479f61d30.svn-base b/cpplapack-r198/.svn/pristine/12/123e64439e51515abe6350d9a5e5c4f479f61d30.svn-base deleted file mode 100644 index 72eb98f799586ddd5f6dcafcc2c6a4eeb193d58f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/12/123e64439e51515abe6350d9a5e5c4f479f61d30.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -#include <Magick++.h> -#include <cpplapack.h> - -//============================================================================= -int main(int argc, char** argv) -{ - //////// argc check //////// - if(argc!=2){ - std::cerr << "[ERROR] invalid usage" << std::endl; - std::cerr << "USAGE: " << argv[0] << " xxxx.dgematrix" << std::endl; - exit(1); - } - - //////// open //////// - CPPL::dgematrix mat(argv[1]); - std::cerr << "mat size = " << mat.m << "x" << mat.n << std::endl; - Magick::Image img(Magick::Geometry(mat.n,mat.m),Magick::ColorGray(0)); - std::cerr << "img size = " << img.columns() << "x" << img.rows() << std::endl; - - //////// assign pixelcolor //////// - int n(16); - double maximum(fabs(damax(mat))); - std::cerr << "maximum = " << maximum << std::endl; - for(int i=0; i<mat.m; i++){ - for(int j=0; j<mat.n; j++){ - double x; - x = ( log10(maximum)-log10(fabs(mat(i,j))) )/double(n); - x = std::min(x,1.); - img.pixelColor(j,i, Magick::ColorGray(x)); - } - } - - //////// write //////// - img.write(std::string(argv[1])+".png"); - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/12/1290c40e434aff8537a412adb3da2ae671a7201e.svn-base b/cpplapack-r198/.svn/pristine/12/1290c40e434aff8537a412adb3da2ae671a7201e.svn-base deleted file mode 100644 index cc969e5404684563f934661492e71257cd29d515..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/12/1290c40e434aff8537a412adb3da2ae671a7201e.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(5), CAP(4); - int KL(1), KU(2); - - CPPL::dgsmatrix A(M,N,CAP); - A.put(0,0, 1.); - A.put(3,2, 2.); - A.put(1,2, 3.); - A.put(4,1, 4.); - std::cout << "A =\n" << A << std::endl; - - CPPL::dgbmatrix B(M,N,KL,KU); - for(int i=0; i<B.m; i++){ - for(int j=std::max(0,i-B.kl); j<std::min(B.n,i+B.ku+1); j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - std::cout << "B =\n" << B << std::endl; - - std::cout << "A+B =\n" << A+B << std::endl; - std::cout << "A-B =\n" << A-B << std::endl; - std::cout << "A*B =\n" << A*B << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/12/12b4f8b9ad1d7fd5972ba84088e8fa009d4ef319.svn-base b/cpplapack-r198/.svn/pristine/12/12b4f8b9ad1d7fd5972ba84088e8fa009d4ef319.svn-base deleted file mode 100644 index fd07df642dccf652723011825d95e760aaa295d8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/12/12b4f8b9ad1d7fd5972ba84088e8fa009d4ef319.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -//============================================================================= -/*! _dssmatrix constructor without arguments */ -inline _dssmatrix::_dssmatrix() - :m(n) -{CPPL_VERBOSE_REPORT; - n =0; - data.clear(); - line.clear(); -} - -//============================================================================= -/*! _dssmatrix copy constructor */ -inline _dssmatrix::_dssmatrix(const _dssmatrix& mat) - :m(n) -{CPPL_VERBOSE_REPORT; - n =mat.n; - data.swap(mat.data); - line.swap(mat.line); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _dssmatrix destructor */ -inline _dssmatrix::~_dssmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/13/132e66fd53071d5382c162729ac32d03c6521806.svn-base b/cpplapack-r198/.svn/pristine/13/132e66fd53071d5382c162729ac32d03c6521806.svn-base deleted file mode 100644 index 469cdad0a40727db3edb8439142c3f4215714a51..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/13/132e66fd53071d5382c162729ac32d03c6521806.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -############################################################################### -## Makefile.g++ ## -############################################################################### - -####################################### -############### common ################ -####################################### - -CXX = g++ -pipe - -######## FLAGS ######## -#FLAGS += -std=c++0x # -std=c++98 -#FLAGS += -fopenmp - -######## CFLAGS ######## -CFLAGS += -Wall -Wno-unknown-pragmas -Wextra -Wshadow -Wformat=2 -CFLAGS += -ftree-vectorizer-verbose=0 - -######## LFLAGS ######## -#LFLAGS += -static - -######## others ######## -INCLUDE_DIRS += -I./ -I$(HOME)/local/cpplapack/include -LIB_DIRS += -LIBS += -lm -LIBS += -llapack -lblas -lgfortran -##LIBS += $(HOME)/local/lapack-3.2.2/liblapack.a $(HOME)/local/lapack-3.2.2/libblas.a -lgfortran -##LIBS += $(HOME)/local/CLAPACK-3.2.1/liblapack.a $(HOME)/local/CLAPACK-3.2.1/libblas.a $(HOME)/local/CLAPACK-3.2.1/libf2c.a -##LIBS += /usr/lib/sse2/liblapack.a /usr/lib/sse2/libblas.a -lgfortran -##LIBS += -llapack $(HOME)/local/ATLAS/libatlas.a -lgfortran -#LIBS += -lgsl -lgslcblas -#LIBS += -lboost_filesystem -lboost_system -##MACROS += -DUSE_LIBF2C - -####################################### -############ release mode ############# -####################################### -ifdef RELEASE -#### FLAGS #### -FLAGS += -O2 #### -O3 is dangerous -FLAGS += -mtune=native -march=native -#FLAGS += -funroll-loops -ffast-math -fno-math-errno #-mfpmath=sse -FLAGS += -fprefetch-loop-arrays -fstrength-reduce -malign-double -FLAGS += -fomit-frame-pointer -##FLAGS += -fforce-addr -falign-functions=4 -ftree-vectorize -ftree-vectorizer-verbose=5 -funsafe-loop-optimizations -Wunsafe-loop-optimizations -#### CFLAGS #### -##CFLAGS += -fimplement-inlines -finline-limit=0 --param large-function-growth=0 --param max-inline-insns-single=0 --param inline-unit-growth=0 -##CFLAGS += --param large-function-growth=99999 --param max-inline-insns-single=99999 --param inline-unit-growth=99999 -Winline -#### LFLAGS #### -#LFLAGS += -#### others #### -MACROS += -DBOOST_DISABLE_ASSERTS -endif - -####################################### -############ profile mode ############# -####################################### -ifdef PROFILE -#### FLAGS #### -#### CFLAGS #### -CFLAGS += -pg #-g -#### LFLAGS #### -LFLAGS += -pg #-g -#### others #### -MACROS += -DBOOST_DISABLE_ASSERTS -endif - -####################################### -############## debug mode ############# -####################################### -ifdef DEBUG -#### FLAGS #### -FLAGS += -g -O0 -#FLAGS += -fmudflap -fmudflapir ## not reliable -#### CFLAGS #### -CFLAGS += -fstack-protector-all -fbounds-check -ftrapv -ftrapping-math #-ffpe-trap=invalid,zero,overflow,underflow -CFLAGS += #-mfp-trap-mode=sui -#### LFLAGS #### -#LFLAGS += -lefence -#### others #### -#LIBS += -lmudflap ## not reliable -MACROS += -DDEBUG -MACROS += -DCPPL_DEBUG -endif - -####################################### -############ verbose mode ############# -####################################### -ifdef VERBOSE -#### FLAGS #### -#### CFLAGS #### -#### LFLAGS #### -#### others #### -MACROS += -DVERBOSE -MACROS += -DCPPL_VERBOSE -endif diff --git a/cpplapack-r198/.svn/pristine/14/14357e05d517bf7c03f5fef359a554428696ebcb.svn-base b/cpplapack-r198/.svn/pristine/14/14357e05d517bf7c03f5fef359a554428696ebcb.svn-base deleted file mode 100644 index 75a5e1ed41fc7221fa555343a26a3be1e6283bb9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/14/14357e05d517bf7c03f5fef359a554428696ebcb.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! cast to _zgsmatrix */ -inline _zgsmatrix dgsmatrix::to_zgsmatrix() const -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(m,n,CPPL_INT(data.size())); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, comple(it->v,0.)); - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix dgsmatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat(m,n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i,it->j) = it->v; - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to dgrmatrix */ -inline dgrmatrix dgsmatrix::to_dgrmatrix() const -{CPPL_VERBOSE_REPORT; - //////// resize //////// - dgrmatrix newmat; - newmat.m =m; - newmat.n =n; - newmat.a.resize(data.size()); - newmat.ia.resize(m+1); - newmat.ja.resize(data.size()); - - //////// copy //////// - newmat.ia[0] =1;//one-based - CPPL_INT k=0; - for(CPPL_INT i=0; i<m; i++){ - //// make map //// - const std::vector<CPPL_INT>::const_iterator rows_i_end =rows[i].end(); - std::map<CPPL_INT,CPPL_INT> jc; - for(std::vector<CPPL_INT>::const_iterator rit=rows[i].begin(); rit!=rows_i_end; rit++){ - jc.insert( std::make_pair(data[*rit].j, *rit) ); - } - //// assign //// - const std::map<CPPL_INT,CPPL_INT>::const_iterator jc_end =jc.end(); - for(std::map<CPPL_INT,CPPL_INT>::const_iterator jcit=jc.begin(); jcit!=jc_end; jcit++){ - newmat.a[k] =data[(*jcit).second].v; - newmat.ja[k] =CPPL_INT((*jcit).first)+1;//one-based - k++; - } - newmat.ia[i+1] =k+1;//one-based - } - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/14/1464e442fc08f299f525b3ea231afd1145022ea0.svn-base b/cpplapack-r198/.svn/pristine/14/1464e442fc08f299f525b3ea231afd1145022ea0.svn-base deleted file mode 100644 index 21df6578755dde8b1a4abd3c5f006e74722e7cc9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/14/1464e442fc08f299f525b3ea231afd1145022ea0.svn-base +++ /dev/null @@ -1,61 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline comple& _zgbmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << " with kl=" << kl << ", ku=" << ku << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[ku+i+(kl+ku)*j]; - return darray[j][ku-j+i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i-j>mat.kl || j-i>mat.ku ){ s << " x"; } - else{ s << " " << mat(i,j); } - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _zgbmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zgbmatrix" << " " << m << " " << n << " " << kl << " " << ku << std::endl; - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/14/1472c5718f0bfc2e60881082b719b2af94f2a350.svn-base b/cpplapack-r198/.svn/pristine/14/1472c5718f0bfc2e60881082b719b2af94f2a350.svn-base deleted file mode 100644 index e5a274f8788ab400261ca8f0ec7327c13c6b2551..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/14/1472c5718f0bfc2e60881082b719b2af94f2a350.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! zgesv_check */ -void zgesv_check_vector() -{ - cout << "############ check zgesv vector ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make zgematrix A //// - CPPL::zgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make zcovector y //// - CPPL::zcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - //// make A_original and y_original //// - CPPL::zgematrix A_original(A); - CPPL::zcovector y_original(y); - cout << "A_original=\n" << A_original << endl; - cout << "y_original=\n" << y_original << endl; - - //// solve Ax=y //// - A.zgesv(y); - - //// print A, y and A_original*y //// - cout << "A=\n" << A << endl; - cout << "y=\n" << y << endl; - cout << "A_original*y=\n" << A_original*y << endl; -} - -//============================================================================= -void zgesv_check_matrix() -{ - cout << "############ check zgesv matrix ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - - //// make zgematrix A //// - CPPL::zgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make zgematrix Y //// - CPPL::zgematrix Y(M,M); - for(int i=0; i<Y.m; i++){ for(int j=0; j<Y.n; j++){ - Y(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make A_original and Y_original //// - CPPL::zgematrix A_original(A); - CPPL::zgematrix Y_original(Y); - cout << "A_original=\n" << A_original << endl; - cout << "Y_original=\n" << Y_original << endl; - - //// solve AY=B //// - A.zgesv(Y); - - //// print A, Y and A_original*Y //// - cout << "A=\n" << A << endl; - cout << "Y=\n" << Y << endl; - cout << "A_original*Y=\n" << A_original*Y << endl; -} diff --git a/cpplapack-r198/.svn/pristine/14/14fb986ce3a4b373a8f6a533d8d7e1b4788a4a2c.svn-base b/cpplapack-r198/.svn/pristine/14/14fb986ce3a4b373a8f6a533d8d7e1b4788a4a2c.svn-base deleted file mode 100644 index cdba58eff63dc2e63fb4b8d326b483e7342bd626..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/14/14fb986ce3a4b373a8f6a533d8d7e1b4788a4a2c.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(3), N(4); - - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - cout << "A =\n" << A << endl; - - cout << "#### t(A) ####" << endl; - cout << "t(A) =\n" << CPPL::t(A) << endl; - - cout << "#### i(A) ####" << endl; - A.resize(M); - for(int i=0; i<A.n; i++){ - for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - cout << "A =\n" << A << endl; - - CPPL::dsymatrix A_inv = CPPL::i(A); - cout << "A_inv =\n" << A_inv << endl; - cout << "A*A_inv =\n" << A*A_inv << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/15/150c44188f6362b0a3db56060cefcdbf968aa622.svn-base b/cpplapack-r198/.svn/pristine/15/150c44188f6362b0a3db56060cefcdbf968aa622.svn-base deleted file mode 100644 index dbdd9af16969468d204fae85b9624647b4fb70b0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/15/150c44188f6362b0a3db56060cefcdbf968aa622.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -//============================================================================= -/*! _dgsmatrix constructor without arguments */ -inline _dgsmatrix::_dgsmatrix() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - data.clear(); - rows.clear(); - cols.clear(); -} - -//============================================================================= -/*! _dgsmatrix copy constructor */ -inline _dgsmatrix::_dgsmatrix(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - data.swap(mat.data); - rows.swap(mat.rows); - cols.swap(mat.cols); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _dgsmatrix destructor */ -inline _dgsmatrix::~_dgsmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/15/15a1b92cd184177c303b518454a2919c1e50e71d.svn-base b/cpplapack-r198/.svn/pristine/15/15a1b92cd184177c303b518454a2919c1e50e71d.svn-base deleted file mode 100644 index c91f47bb9de2a6fd04d59f3ff1846fd96c2373a4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/15/15a1b92cd184177c303b518454a2919c1e50e71d.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! _zhematrix+zssmatrix operator */ -inline _zgematrix operator+(const _zhematrix& matA, const zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix-zssmatrix operator */ -inline _zgematrix operator-(const _zhematrix& matA, const zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c]; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix*zssmatrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/16/16594a8732c88b000af05f311d9c6e354d33ac19.svn-base b/cpplapack-r198/.svn/pristine/16/16594a8732c88b000af05f311d9c6e354d33ac19.svn-base deleted file mode 100644 index 2e9778a5d3b061c1405c9a203c4bb40d4e15685d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/16/16594a8732c88b000af05f311d9c6e354d33ac19.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! +_dsymatrix operator */ -inline const _dsymatrix& operator+(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_dsymatrix operator */ -inline _dsymatrix operator-(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - const CPPL_INT size =mat.n*mat.n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =-mat.array[i]; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/16/166598d0040ded6644e08cac7782fc6ab487d040.svn-base b/cpplapack-r198/.svn/pristine/16/166598d0040ded6644e08cac7782fc6ab487d040.svn-base deleted file mode 100644 index c5ea355d178d4cef795425d8221fcb3598bd61cf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/16/166598d0040ded6644e08cac7782fc6ab487d040.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(2), KU(1); - - CPPL::zrovector x(M), y; - CPPL::zgbmatrix A(M,N,KL,KU); - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - - cout << "x =\n" << x << endl; - cout << "A =\n" << A << endl; - - cout << "#### y=x*A; ####" << endl; - y=x*A; - cout << "y =\n" << y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/16/16b63d5e7632ef38187e7345f994a6ad3ad6d16d.svn-base b/cpplapack-r198/.svn/pristine/16/16b63d5e7632ef38187e7345f994a6ad3ad6d16d.svn-base deleted file mode 100644 index 92a7e687fe4134fca5e49c1c012b083901a693ca..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/16/16b63d5e7632ef38187e7345f994a6ad3ad6d16d.svn-base +++ /dev/null @@ -1,144 +0,0 @@ -//============================================================================= -/*! zrovector=zrovector operator */ -inline zrovector& zrovector::operator=(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - if(array!=vec.array){ // if it is NOT self substitution - copy(vec); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector+=zrovector operator */ -inline zrovector& zrovector::operator+=(const zrovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] += vec.array[i]; - } - - return *this; -} - -//============================================================================= -/*! zrovector operator-= */ -inline zrovector& zrovector::operator-=(const zrovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] -= vec.array[i]; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector+zrovector operator */ -inline _zrovector operator+(const zrovector& vecA, const zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - zrovector newvec(vecA.l); - - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]+vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! zrovector-zrovector operator */ -inline _zrovector operator-(const zrovector& vecA, const zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(vecA.l); - - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]-vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! zrovector^T*zrovector operator (inner product) */ -inline comple operator%(const zrovector& vecA, const zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - return val; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return Hadamerd product */ -inline _zrovector hadamerd(const zrovector& vecA, const zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( vecA.l!=vecB.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make Hadamerd product." << std::endl - << "Your input was (" << vecA.l << ") and (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(vecA.l); - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec(i) =vecA(i)*vecB(i); - } - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/16/16f43a7a35265ea155bf87e8768e033f5127d1f2.svn-base b/cpplapack-r198/.svn/pristine/16/16f43a7a35265ea155bf87e8768e033f5127d1f2.svn-base deleted file mode 100644 index 8a8761303ef494291db4b3518880935d186141ca..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/16/16f43a7a35265ea155bf87e8768e033f5127d1f2.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -//============================================================================= -/*! _zhsmatrix*_zcovector operator */ -inline _zcovector operator*(const _zhsmatrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=std::conj(it->v)*vec(it->i); - } - } - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/17/17558489bab02f118af2ba28b27b36b78e6e9eef.svn-base b/cpplapack-r198/.svn/pristine/17/17558489bab02f118af2ba28b27b36b78e6e9eef.svn-base deleted file mode 100644 index dbdaedfb43215f147c6e792579237564853746ab..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/17/17558489bab02f118af2ba28b27b36b78e6e9eef.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double _dssmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is (" << n << "," << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ return data[*p].v; } - } - - //// (i,j) component was not found //// - return 0.0; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i >= j ){ - std::vector<CPPL_INT>::iterator q; - const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.line[i].end(); - for(q=mat.line[i].begin(); q!=mat_line_i_end; q++){ - if(mat.data[*q].j==j){ break; } - } - if(q!=mat_line_i_end){ s << " " << mat.data[*q].v << " "; } - else{ s << " x "; } - } - else{//i<j - std::vector<CPPL_INT>::iterator q; - const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.line[i].end(); - for(q=mat.line[i].begin(); q!=mat_line_i_end; q++){ - if(mat.data[*q].j==j){ break; } - } - if(q!=mat_line_i_end){ s << "{" << mat.data[*q].v << "}"; } - else{ s << "{x}"; } - } - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _dssmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dssmatrix " << n << " " << data.size() << std::endl; - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/17/17dd75e1fd65e0fa01543953cb99ba10805210ad.svn-base b/cpplapack-r198/.svn/pristine/17/17dd75e1fd65e0fa01543953cb99ba10805210ad.svn-base deleted file mode 100644 index bb3e97c71aa2d85b1e94077759c9701f7544b072..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/17/17dd75e1fd65e0fa01543953cb99ba10805210ad.svn-base +++ /dev/null @@ -1,139 +0,0 @@ -//============================================================================= -/*! drovector=drovector operator */ -inline drovector& drovector::operator=(const drovector& vec) -{CPPL_VERBOSE_REPORT; - if(array!=vec.array){ // if it is NOT self substitution - copy(vec); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector+=drovector operator */ -inline drovector& drovector::operator+=(const drovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]+=vec.array[i]; } - - return *this; -} - -//============================================================================= -/*! drovector operator-= */ -inline drovector& drovector::operator-=(const drovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]-=vec.array[i]; } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector+drovector operator */ -inline _drovector operator+(const drovector& vecA, const drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - drovector newvec(vecA.l); - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]+vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! drovector-drovector operator */ -inline _drovector operator-(const drovector& vecA, const drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(vecA.l); - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]-vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! drovector^T*drovector operator (inner product) */ -inline double operator%(const drovector& vecA, const drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - return val; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return Hadamerd product */ -inline _drovector hadamerd(const drovector& vecA, const drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( vecA.l!=vecB.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make Hadamerd product." << std::endl - << "Your input was (" << vecA.l << ") and (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(vecA.l); - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec(i) =vecA(i)*vecB(i); - } - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/18/1838382096dae7bee12cf1af02a511663af11c78.svn-base b/cpplapack-r198/.svn/pristine/18/1838382096dae7bee12cf1af02a511663af11c78.svn-base deleted file mode 100644 index 3d3cf6ddf6390593a7bd6dea55c930384d051591..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/18/1838382096dae7bee12cf1af02a511663af11c78.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -#include "dgesv_check.hpp" -#include "dgels_check.hpp" -#include "dgelss_check.hpp" -#include "dgeev_check.hpp" -#include "dggev_check.hpp" -#include "dgesvd_check.hpp" -#include "dgglse_check.hpp" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - //////// dgesv //////// - dgesv_check_vector(); - dgesv_check_matrix(); - - //////// dgels //////// - dgels_check_vector(); - dgels_check_matrix(); - - //////// dgelss //////// - dgelss_check_vector(); - dgelss_check_matrix(); - - //////// dgeev //////// - dgeev_check_value(); - dgeev_check_right(); - dgeev_check_left(); - - //////// dggev //////// - dggev_check_value(); - dggev_check_right(); - dggev_check_left(); - - //////// dgesvd //////// - dgesvd_check(); - - //////// dgglse //////// - dgglse_check(); - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/18/1898fe569202f5149711d827e613ca2002cfab44.svn-base b/cpplapack-r198/.svn/pristine/18/1898fe569202f5149711d827e613ca2002cfab44.svn-base deleted file mode 100644 index a3d4e8ffc0044c5a128891ac26335e80b6caa6d5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/18/1898fe569202f5149711d827e613ca2002cfab44.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================= -/*! return transposed dgematrix */ -inline _dgematrix t(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(mat.n,mat.m); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =mat(j,i); - } - } - - mat.destroy(); - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _dgematrix i(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix mat_cp(mat); - dgematrix mat_inv(mat_cp.m,mat_cp.n); - mat_inv.identity(); - mat_cp.dgesv(mat_inv); - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =mat.m*mat.n; - CPPL_INT inc =1; - CPPL_INT index =idamax_(&mn, mat.array, &inc) -1; - i =index%mat.m; - j =index/mat.m; - - mat.destroy(); -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =mat.m*mat.n; - CPPL_INT inc =1; - double val =mat.array[idamax_(&mn, mat.array, &inc) -1]; - - mat.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/19/19487274053553221385ab55bc57d5f1bf99ae64.svn-base b/cpplapack-r198/.svn/pristine/19/19487274053553221385ab55bc57d5f1bf99ae64.svn-base deleted file mode 100644 index ef95ddf79cd41d204600e1de8e9f3f9bbeb56852..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/19/19487274053553221385ab55bc57d5f1bf99ae64.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3), CAP(4); - - CPPL::zhsmatrix A(N,CAP); - A.put(0,0, complex<double>(1.,0) ); - A.put(1,0, complex<double>(3.,4.) ); - A.put(1,1, complex<double>(2.,0.) ); - A.put(2,1, complex<double>(7.,8.) ); - cout << "A =\n" << A << endl; - - CPPL::zcovector x(N); - x(0)=complex<double>(1,1); - x(1)=complex<double>(2,2); - x(2)=complex<double>(3,3); - cout << "x =\n" << x << endl; - - cout << "A*x =\n" << A*x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/19/19a0dfc49779a7a52fcd70f7b0d2838be76e4d9b.svn-base b/cpplapack-r198/.svn/pristine/19/19a0dfc49779a7a52fcd70f7b0d2838be76e4d9b.svn-base deleted file mode 100644 index e7c732be7e140873910a8d9c88c40321e3568133..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/19/19a0dfc49779a7a52fcd70f7b0d2838be76e4d9b.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _zgematrix+_zhematrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT c=0; c<matB.vol; c++){ - matA(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix-_zhematrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matA.m*matA.n; i++){ - matA.array[i]=-matA.array[i]; - } - - //// add //// - for(CPPL_INT c=0; c<matB.vol; c++){ - matA(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix*_zhematrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/19/19ccce35b2aee2986f6937f71ccc4293d871c562.svn-base b/cpplapack-r198/.svn/pristine/19/19ccce35b2aee2986f6937f71ccc4293d871c562.svn-base deleted file mode 100644 index 1e108973e695ec1224a9482f491ad2bfe5c546d6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/19/19ccce35b2aee2986f6937f71ccc4293d871c562.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - - ///////////////////////////////////// - //////////////// 2D ///////////////// - ///////////////////////////////////// - CPPL::dcovec2 cv2; - CPPL::drovec2 rv2; - CPPL::dgemat2 gm2; - CPPL::dsymat2 sm2; - - //////// dcovec2 //////// - cv2(0) =1.; cv2(1) =2.; - std::cout << "hadamard(cv2,cv2) =\n" << hadamard(cv2,cv2) << std::endl; - - //////// drovec2 //////// - rv2(0) =3.; rv2(1) =4.; - std::cout << "hadamard(rv2,rv2) =\n" << hadamard(rv2,rv2) << std::endl; - - //////// dgemat2 //////// - gm2.identity(); - std::cout << "gm2=\n" << gm2 << std::endl; - std::cout << "t2m(0.1)*gm2=\n" << CPPL::t2m(0.1)*gm2 << std::endl; - gm2(0,0) =1.; gm2(0,1) =2.; - gm2(1,0) =3.; gm2(1,1) =4.; - std::cout << "gm2=\n" << gm2 << std::endl; - std::cout << "inv(gm2)=\n" << inv(gm2) << std::endl; - std::cout << "gm2*inv(gm2)=\n" << gm2*inv(gm2) << std::endl; - std::cout << "rotate(gm2,0.1)=\n" << rotate(gm2,0.1) << std::endl; - - //////// dsymat2 //////// - sm2(0,0) =1.; - sm2(1,0) =2.; sm2(1,1) =3.; - std::cout << "sm2=\n" << sm2 << std::endl; - std::cout << "inv(sm2)=\n" << inv(sm2) << std::endl; - std::cout << "sm2*inv(sm2)=\n" << sm2*inv(sm2) << std::endl; - std::cout << "rotate(sm2,0.1)=\n" << rotate(sm2,0.1) << std::endl; - std::cout << "rotate(sm2,0.1)=\n" << rotate(sm2,0.1) << std::endl; - std::cout << "gm2*sm2=\n" << gm2*sm2 << std::endl; - - //////// //////// - cv2 += t(rv2); - - - ///////////////////////////////////// - //////////////// 3D ///////////////// - ///////////////////////////////////// - CPPL::dcovec3 cv3; - CPPL::drovec3 rv3; - CPPL::dgemat3 gm3; - CPPL::dsymat3 sm3; - CPPL::dquater q; - - gm3.identity(); - //std::cout << "gm3=\n" << gm3 << std::endl; - //std::cout << "vt2q(0.1)*gm2=\n" << CPPL::t2m(0.1)*gm2 << std::endl; - - sm3(0,0)=1.; - sm3(1,0)=2.; sm3(1,1)=3.; - sm3(2,0)=4.; sm3(2,1)=5.; sm3(2,2)=6.; - std::cout << "sm3=\n" << sm3 << std::endl; - std::cout << "inv(sm3)=\n" << inv(sm3) << std::endl; - std::cout << "sm3*inv(sm3)=\n" << sm3*inv(sm3) << std::endl; - - ///////////////////////////////////// - ///////////////////////////////////// - ///////////////////////////////////// - //CPPL::dcovector_small<5> cv5 ={{1,2,3,4,5}}; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/19/19fb70159cd20aace7e7f9912ed6e965cfa4bc60.svn-base b/cpplapack-r198/.svn/pristine/19/19fb70159cd20aace7e7f9912ed6e965cfa4bc60.svn-base deleted file mode 100644 index d02608a5972642c7b7a13b987f21e2502a5af3ea..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/19/19fb70159cd20aace7e7f9912ed6e965cfa4bc60.svn-base +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include <limits.h> - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include <wchar.h> -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h> -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/cpplapack-r198/.svn/pristine/1a/1a0489bca6083f8bd398e662995358e3c4899e69.svn-base b/cpplapack-r198/.svn/pristine/1a/1a0489bca6083f8bd398e662995358e3c4899e69.svn-base deleted file mode 100644 index a236365faaff16c75824929cc6bd9405317a3e06..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1a/1a0489bca6083f8bd398e662995358e3c4899e69.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! zhsmatrix+zgbmatrix operator */ -/* -inline _zgematrix operator+(const zhsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! zhsmatrix-zgbmatrix operator */ -/* -inline _zgematrix operator-(const zhsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! zhsmatrix*zgbmatrix operator */ -/* -inline _zgematrix operator*(const zhsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=max(0,matA.jndx[c]-matB.kl); - j<min(matB.n,matA.jndx[c]+matB.ku+1); j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/1a/1aadb91aa4c860871a243fca2002a3bd8b52ba34.svn-base b/cpplapack-r198/.svn/pristine/1a/1aadb91aa4c860871a243fca2002a3bd8b52ba34.svn-base deleted file mode 100644 index 635ff3b62196adef04c3716b23d0a6dbfcbd5b0a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1a/1aadb91aa4c860871a243fca2002a3bd8b52ba34.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -//============================================================================= -/*! return transposed dgbmatrix */ -inline _dgbmatrix t(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - newmat(i,j) =mat(j,i); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _dgematrix i(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix mat_cp(mat); - dgematrix mat_inv(mat.m,mat.n); - mat_inv.identity(); - mat_cp.dgbsv(mat_inv); - - return _(mat_inv); -} diff --git a/cpplapack-r198/.svn/pristine/1a/1ab3993a5fc79cc1ce78da670b173deee64bd391.svn-base b/cpplapack-r198/.svn/pristine/1a/1ab3993a5fc79cc1ce78da670b173deee64bd391.svn-base deleted file mode 100644 index 16a22e837f5392a2e19f31431d6e152bf21d727c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1a/1ab3993a5fc79cc1ce78da670b173deee64bd391.svn-base +++ /dev/null @@ -1,576 +0,0 @@ -//============================================================================= -/*! convert zhematrix_small to zgematrix_small */ -template<CPPL_INT n> -inline zgematrix_small<n,n> zhematrix_small<n>::to_zgematrix_small() const -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> newmat; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ newmat(i,j) =(*this)(i,j); } - for(CPPL_INT j=i+1; j<n; j++){ newmat(i,j) =(*this)(j,i); } - } - return newmat; -} - -//============================================================================= -/*! convert zhematrix_small to zhematrix */ -template<CPPL_INT n> -inline zhematrix zhematrix_small<n>::to_zhematrix() const -{CPPL_VERBOSE_REPORT; - zhematrix newmat(n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - newmat(i,j) =(*this)(i,j); - } - } - return newmat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT n> -inline comple& zhematrix_small<n>::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(i<j){ - ERROR_REPORT; - std::cerr << "i must be greater than or equal to j since dsymatrix_small is L strage. " << std::endl; - std::cerr << "Your input was (" << i << ", " << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //const CPPL_INT I(max(i,j)), J(min(i,j)); return array[(I*(I+1))/2 +J]; - return array[(i*(i+1))/2 +j]; //l storage -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT n> -inline comple zhematrix_small<n>::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(i<j){ - ERROR_REPORT; - std::cerr << "i must be greater than or equal to j since dsymatrix_small is L strage. " << std::endl; - std::cerr << "Your input was (" << i << ", " << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //const CPPL_INT I(max(i,j)), J(min(i,j)); return array[(I*(I+1))/2 +J]; - return array[(i*(i+1))/2 +j]; -} - -//============================================================================= -/*! set */ -template<CPPL_INT n> -inline zhematrix_small<n>& zhematrix_small<n>::set(const CPPL_INT& i, const CPPL_INT& j, const comple& v) -{CPPL_VERBOSE_REPORT; - (*this)(i,j)=v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT n> -inline std::ostream& operator<<(std::ostream& s, const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ s << " " << A(i,j) << " "<< std::flush; } - for(CPPL_INT j=i+1; j<n; j++){ s << "{" << A(j,i) << "}" << std::flush; } - s << std::endl; - } - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT n> -inline void zhematrix_small<n>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - ofs << "#zhematrix" << " " << n << std::endl; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - ofs << (*this)(i,j) << " "; - } - ofs << std::endl; - } - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT n> -inline void zhematrix_small<n>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s(filename); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zhematrix" && id != "#zhematrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zhematrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _n; - s >> _n; - if(n!=_n){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++ ){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zero */ -template<CPPL_INT n> -inline zhematrix_small<n>& zhematrix_small<n>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - (*this)(i,j) =0.; - } - } - return *this; -} - -//============================================================================= -/*! identity */ -template<CPPL_INT n> -inline zhematrix_small<n>& zhematrix_small<n>::identity() -{CPPL_VERBOSE_REPORT; - zero(); - for(CPPL_INT k=0; k<n; k++){ - (*this)(k,k) =1.; - } - return *this; -} - -//============================================================================= -/*! return its trace */ -template<CPPL_INT n> -inline comple trace(const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - comple trace =comple(0.,0.); - for(CPPL_INT i=0; i<n; i++){ - trace +=A(i,i); - } - return trace; -} - -//============================================================================= -/*! find index of the maximum component */ -template<CPPL_INT n> -inline void idamax(CPPL_INT& I, CPPL_INT& J, const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - double max(-1.); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - if( max<fabs(A(i,j)) ){ - I=i; - J=j; - max =fabs(A(i,j)); - } - } - } - return; -} - -//============================================================================= -/*! return the maximum component */ -template<CPPL_INT n> -inline comple damax(const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - CPPL_INT i(0),j(0); - idamax(i,j,A); - return A(i,j); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix_small+=zhematrix_small operator */ -template<CPPL_INT n> -inline zhematrix_small<n>& operator+=(zhematrix_small<n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ - A.array[k] +=B.array[k]; - } - return A; -} - -//============================================================================= -/*! zhematrix_small-=zhematrix_small operator */ -template<CPPL_INT n> -inline zhematrix_small<n>& operator-=(zhematrix_small<n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ - A.array[k] -=B.array[k]; - } - return A; -} - -//============================================================================= -/*! zhematrix_small*=double operator */ -template<CPPL_INT n> -inline zhematrix_small<n>& operator*=(zhematrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - A(i,j) *=v; - } - } - return A; -} - -//============================================================================= -/*! zhematrix_small*=comple operator */ -template<CPPL_INT n> -inline zhematrix_small<n>& operator*=(zhematrix_small<n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - A(i,j) *=v; - } - } - return A; -} - -//============================================================================= -/*! zhematrix_small/=double operator */ -template<CPPL_INT n> -inline zhematrix_small<n>& operator/=(zhematrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - A(i,j) /=v; - } - } - return A; -} - -//============================================================================= -/*! zhematrix_small/=comple operator */ -template<CPPL_INT n> -inline zhematrix_small<n>& operator/=(zhematrix_small<n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - A(i,j) /=v; - } - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary */ -template<CPPL_INT n> -inline const zhematrix_small<n>& operator+(const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary */ -template<CPPL_INT n> -inline zhematrix_small<n> operator-(const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - X(i,j) =-A(i,j); - } - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix_small+zgematrix_small operator */ -template<CPPL_INT n> -inline zgematrix_small<n,n> operator+(const zhematrix_small<n>& A, const zgematrix_small<n,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - X(i,j) =A(i,j)+B(i,j); - } - for(CPPL_INT j=i; j<n; j++){ - X(i,j) =A(j,i)+B(i,j); - } - } - return X; -} - -//============================================================================= -/*! zhematrix_small+zhematrix_small operator */ -template<CPPL_INT n> -inline zhematrix_small<n> operator+(const zhematrix_small<n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - X(i,j) =A(i,j)+B(i,j); - } - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix_small-zgematrix_small operator */ -template<CPPL_INT n> -inline zgematrix_small<n,n> operator-(const zhematrix_small<n>& A, const zgematrix_small<n,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - X(i,j) =A(i,j)-B(i,j); - } - for(CPPL_INT j=i; j<n; j++){ - X(i,j) =A(j,i)-B(i,j); - } - } - return X; -} - -//============================================================================= -/*! zhematrix_small-zhematrix_small operator */ -template<CPPL_INT n> -inline zhematrix_small<n> operator-(const zhematrix_small<n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - X(i,j) =A(i,j)-B(i,j); - } - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix_small*zcovector_small operator */ -template<CPPL_INT n> -inline zcovector_small<n> operator*(const zhematrix_small<n>& A, const zcovector_small<n>& B) -{CPPL_VERBOSE_REPORT; - zcovector_small<n> C; - C.zero(); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - C(i) +=A(i,j)*B(j); - } - for(CPPL_INT j=i; j<n; j++){ - C(i) +=A(j,i)*B(j); - } - } - return C; -} - -//============================================================================= -/*! zhematrix_small*zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const zhematrix_small<m>& A, const zgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> X; - X.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT k=0; k<i; k++){ - X(i,j) +=A(i,k)*B(k,j); - } - for(CPPL_INT k=i; k<m; k++){ - X(i,j) +=A(k,i)*B(k,j); - } - } - } - return X; -} - -//============================================================================= -/*! zhematrix_small*zhematrix_small operator */ -template<CPPL_INT n> -inline zgematrix_small<n,n> operator*(const zhematrix_small<n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> X; - X.zero(); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - for(CPPL_INT k=0; k<j; k++){ - X(i,j) +=A(i,k)*B(j,k); - } - for(CPPL_INT k=j; k<i; k++){ - X(i,j) +=A(i,k)*B(k,j); - } - for(CPPL_INT k=i; k<n; k++){ - X(i,j) +=A(k,i)*B(k,j); - } - } - for(CPPL_INT j=i; j<n; j++){ - for(CPPL_INT k=0; k<i; k++){ - X(i,j) +=A(i,k)*B(j,k); - } - for(CPPL_INT k=i; k<j; k++){ - X(i,j) +=A(k,i)*B(j,k); - } - for(CPPL_INT k=j; k<n; k++){ - X(i,j) +=A(k,i)*B(k,j); - } - } - } - return X; -} - -//============================================================================= -/*! zhematrix_small*double operator */ -template<CPPL_INT n> -inline zhematrix_small<n> operator*(const zhematrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*v; - } - } - return C; -} - -//============================================================================= -/*! zhematrix_small*comple operator */ -template<CPPL_INT n> -inline zhematrix_small<n> operator*(const zhematrix_small<n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*v; - } - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix_small/double operator */ -template<CPPL_INT n> -inline zhematrix_small<n> operator/(const zhematrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)/v; - } - } - return C; -} - -//============================================================================= -/*! zhematrix_small/comple operator */ -template<CPPL_INT n> -inline zhematrix_small<n> operator/(const zhematrix_small<n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)/v; - } - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT n> -inline zgematrix_small<n,n> hadamard(const zhematrix_small<n>& A, const zgematrix_small<n,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*B(i,j); - } - for(CPPL_INT j=i+1; j<n; j++){ - C(i,j) =conj(A(j,i))*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT n> -inline zhematrix_small<n> hadamard(const zhematrix_small<n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*B(i,j); - } - } - return C; -} diff --git a/cpplapack-r198/.svn/pristine/1b/1b23632de69757c61b0e58cb47fe7e83e1736a43.svn-base b/cpplapack-r198/.svn/pristine/1b/1b23632de69757c61b0e58cb47fe7e83e1736a43.svn-base deleted file mode 100644 index 48daaf986049230a082e98912d767b7ec756b8df..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1b/1b23632de69757c61b0e58cb47fe7e83e1736a43.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -//============================================================================= -/*! dssmatrix constructor without arguments */ -inline dssmatrix::dssmatrix() - : m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =0; - data.clear(); - line.clear(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix copy constructor */ -inline dssmatrix::dssmatrix(const dssmatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); - copy(mat); -} - -//============================================================================= -/*! dssmatrix constructor to cast _dssmatrix */ -inline dssmatrix::dssmatrix(const _dssmatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - n =mat.n; - data.clear(); - line.clear(); - - data.swap(mat.data); - line.swap(mat.line); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix constructor with size specification */ -inline dssmatrix::dssmatrix(const CPPL_INT& _n, const CPPL_INT _c) - : m(n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _c<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl - << "Your input was (" << _n << "," << _c << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - n =_n; - data.resize(0); - data.reserve(_c); - line.resize(n); -} - -//============================================================================= -/*! dssmatrix constructor with filename */ -inline dssmatrix::dssmatrix(const char* filename) - : m(n) -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix destructor */ -inline dssmatrix::~dssmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/1b/1b8401b65eb4530afbe3bfbc3a489e00412580b0.svn-base b/cpplapack-r198/.svn/pristine/1b/1b8401b65eb4530afbe3bfbc3a489e00412580b0.svn-base deleted file mode 100644 index a8d1eb932413c22d8ec9aab8a271313bf05a3be6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1b/1b8401b65eb4530afbe3bfbc3a489e00412580b0.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -//============================================================================= -/*! return transposed _dgsmatrix */ -inline _dgsmatrix t(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - std::swap(it->i,it->j); - } - - std::swap(mat.rows,mat.cols); - - return mat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax(0); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if(vmax < it->v){ - vmax=fabs(it->v); - itx=it; - } - } - - i=itx->i; - j=itx->j; - - mat.destroy(); -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax(0); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if(vmax < it->v){ - vmax=fabs(it->v); - itx=it; - } - } - - mat.destroy(); - return itx->v; -} diff --git a/cpplapack-r198/.svn/pristine/1b/1badd32a8a959eda14e358ab178c6843723ff3ba.svn-base b/cpplapack-r198/.svn/pristine/1b/1badd32a8a959eda14e358ab178c6843723ff3ba.svn-base deleted file mode 100644 index c306dc3228193da2dda892758481a2efce2a6ea2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1b/1badd32a8a959eda14e358ab178c6843723ff3ba.svn-base +++ /dev/null @@ -1,5 +0,0 @@ -#zhematrix 4 -(0,0) -(1,-0) (1,0) -(2,-0) (2,-1) (2,0) -(3,-0) (3,-1) (3,-2) (3,0) diff --git a/cpplapack-r198/.svn/pristine/1c/1c0e7506fb7be9abedba5eb8df9e3e40a21580e3.svn-base b/cpplapack-r198/.svn/pristine/1c/1c0e7506fb7be9abedba5eb8df9e3e40a21580e3.svn-base deleted file mode 100644 index 27ce25355b788e01ca4bd05e947117ce87c696a6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1c/1c0e7506fb7be9abedba5eb8df9e3e40a21580e3.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - //// make zrovector x //// - CPPL::zrovector x(L); - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - //// print x in two ways //// - cout << "x =\n" << x << endl; - for(int i=0; i<x.l; i++){ - cout << "x(" << i << ") =" << x(i) << endl; - } - - //// make zrovector y //// - CPPL::zrovector y(x); - - //// print y in two ways //// - cout << "y =\n" << y << endl; - for(int i=0; i<y.l; i++){ - cout << "y(" << i << ") =" << y(i) << endl; - } - - //// print x+y //// - cout << "x+y=\n" << x+y << endl; - - //// write/read //// - x.write( "tmp.txt" ); - CPPL::zrovector z; - z.read( "tmp.txt" ); - cout << "z-x =\n" << z-x << "<-Should be zero." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/1c/1c32112b1be56ba0e4c98cec5e02877eef53095a.svn-base b/cpplapack-r198/.svn/pristine/1c/1c32112b1be56ba0e4c98cec5e02877eef53095a.svn-base deleted file mode 100644 index 66bf3c9855a667d7ee8948b93d953947c5692f98..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1c/1c32112b1be56ba0e4c98cec5e02877eef53095a.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -bool bicgstab -( - const CPPL::dgematrix& A, - CPPL::dcovector& x, - const double& eps -) -{ - double alpha(0.0), zeta(1.0); - CPPL::dcovector t, R(x), r(R), p(x.l), Ap(x.l), At; - x.zero(); p.zero(); Ap.zero(); - - int itc(0); - const int itmax(2*x.l); - while(fabs(damax(r))>eps && itc<itmax){ - std::cerr << "itc=" << itc << ", fabs(damax(r))=" << fabs(damax(r)) << std::endl; - - p =r +(alpha/zeta)*p -alpha*Ap; - - Ap =A*p; - alpha =(R%r)/(R%Ap); - t =r -alpha*Ap; - At =A*t; - zeta =(At%t)/(At%At); - - x +=alpha*p +zeta*t; - r =t -zeta*At; - alpha =(R%r)/(R%Ap); - - itc++; - } - std::cerr << "fabs(damax(r))=" << fabs(damax(r)) << std::endl; - - if(itc<itmax){ return 0; } - else{ return 1; } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - srand(time(NULL)); - - const int size(100); - CPPL::dgematrix A(size,size); - - for(int i=0; i<size; i++){ - for(int j=0; j<size; j++){ - A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; - } - A(i,i)+=10.; - } - A.write("A.dgematrix"); - - CPPL::dcovector x(size); - for(int i=0; i<size; i++){ - x(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - x.write("answer.dcovector");//solution - std::cerr << "answer=\n" << t(x) << std::endl; - - CPPL::dcovector y(size); - y=A*x; - y.write("y.dcovector"); - - double eps(fabs(damax(y))*1e-6); - //std::cerr << "eps=" << eps << std::endl; - if( bicgstab(A, y, eps) ){ - std::cerr << "failed." << std::endl; - exit(1); - } - y.write("solution.dcovector"); - std::cout << "solution=\n" << t(y) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/1c/1c4555e42cca438a89b5b7f655e2697034779996.svn-base b/cpplapack-r198/.svn/pristine/1c/1c4555e42cca438a89b5b7f655e2697034779996.svn-base deleted file mode 100644 index 0c523299907ac22eb0473a5219ab41321b5dae35..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1c/1c4555e42cca438a89b5b7f655e2697034779996.svn-base +++ /dev/null @@ -1,508 +0,0 @@ -//============================================================================= -/*! convert dsymatrix_small to dgematrix_small */ -template<CPPL_INT n> -inline dgematrix_small<n,n> dsymatrix_small<n>::to_dgematrix_small() const -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,n> newmat; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ newmat(i,j) =(*this)(i,j); } - for(CPPL_INT j=i+1; j<n; j++){ newmat(i,j) =(*this)(j,i); } - } - return newmat; -} - -//============================================================================= -/*! convert dsymatrix_small to dsymatrix */ -template<CPPL_INT n> -inline dsymatrix dsymatrix_small<n>::to_dsymatrix() const -{CPPL_VERBOSE_REPORT; - dsymatrix newmat(n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - newmat(i,j) =(*this)(i,j); - } - } - return newmat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT n> -inline double& dsymatrix_small<n>::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(i<j){ - ERROR_REPORT; - std::cerr << "i must be greater than or equal to j since dsymatrix_small is L strage. " << std::endl; - std::cerr << "Your input was (" << i << ", " << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //const CPPL_INT I(max(i,j)), J(min(i,j)); return array[(I*(I+1))/2 +J]; - return array[(i*(i+1))/2 +j]; //L storage -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT n> -inline double dsymatrix_small<n>::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(i<j){ - ERROR_REPORT; - std::cerr << "i must be greater than or equal to j since dsymatrix_small is L strage. " << std::endl; - std::cerr << "Your input was (" << i << ", " << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //const CPPL_INT I(max(i,j)), J(min(i,j)); return array[(I*(I+1))/2 +J]; - return array[(i*(i+1))/2 +j]; -} - -//============================================================================= -/*! set function */ -template<CPPL_INT n> -inline dsymatrix_small<n>& dsymatrix_small<n>::set(const CPPL_INT& i, const CPPL_INT& j, const double& v) -{CPPL_VERBOSE_REPORT; - (*this)(i,j)=v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT n> -inline std::ostream& operator<<(std::ostream& s, const dsymatrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ s << " " << A(i,j) << " "<< std::flush; } - for(CPPL_INT j=i+1; j<n; j++){ s << "{" << A(j,i) << "}" << std::flush; } - s << std::endl; - } - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT n> -inline void dsymatrix_small<n>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - ofs << "#dsymatrix" << " " << n << std::endl; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - ofs << (*this)(i,j) << " "; - } - ofs << std::endl; - } - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT n> -inline void dsymatrix_small<n>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s(filename); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dsymatrix" && id != "#dsymatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dsymatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _n; - s >> _n; - if(n!=_n){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++ ){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zero */ -template<CPPL_INT n> -inline dsymatrix_small<n>& dsymatrix_small<n>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - (*this)(i,j) =0.; - } - } - return *this; -} - -//============================================================================= -/*! identity */ -template<CPPL_INT n> -inline dsymatrix_small<n>& dsymatrix_small<n>::identity() -{CPPL_VERBOSE_REPORT; - zero(); - for(CPPL_INT k=0; k<n; k++){ - (*this)(k,k) =1.; - } - return *this; -} - -//============================================================================= -/*! return its trace */ -template<CPPL_INT n> -inline double trace(const dsymatrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - double trace =0.; - for(CPPL_INT i=0; i<n; i++){ - trace +=A(i,i); - } - return trace; -} - -//============================================================================= -/*! return index of maximum component */ -template<CPPL_INT n> -inline void idamax(CPPL_INT& I, CPPL_INT& J, const dsymatrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - double max(-1.); - for(int i=0; i<n; i++){ - for(int j=0; j<=i; j++){ - if( max<fabs(A(i,j)) ){ - I=i; - J=j; - max =fabs(A(i,j)); - } - } - } - return; -} - -//============================================================================= -/*! return maximum component */ -template<CPPL_INT n> -inline double damax(const dsymatrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - CPPL_INT i(0),j(0); - idamax(i,j,A); - return A(i,j); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - - -//============================================================================= -/*! dsymatrix_small+=dsymatrix_small operator */ -template<CPPL_INT n> -inline dsymatrix_small<n>& operator+=(dsymatrix_small<n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ A.array[k]+=B.array[k]; } - return A; -} - -//============================================================================= -/*! dsymatrix_small-=dsymatrix_small operator */ -template<CPPL_INT n> -inline dsymatrix_small<n>& operator-=(dsymatrix_small<n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ A.array[k]-=B.array[k]; } - return A; -} - -//============================================================================= -/*! dsymatrix_small*=double operator */ -template<CPPL_INT n> -inline dsymatrix_small<n>& operator*=(dsymatrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - A(i,j)*=v; - } - } - return A; -} - -//============================================================================= -/*! dsymatrix_small/=double operator */ -template<CPPL_INT n> -inline dsymatrix_small<n>& operator/=(dsymatrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - A(i,j)/=v; - } - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary + operator */ -template<CPPL_INT n> -inline const dsymatrix_small<n>& operator+(const dsymatrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary - operator */ -template<CPPL_INT n> -inline dsymatrix_small<n> operator-(const dsymatrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - X(i,j)=-A(i,j); - } - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix_small+dgematrix_small operator */ -template<CPPL_INT n> -inline dgematrix_small<n,n> operator+(const dsymatrix_small<n>& A, const dgematrix_small<n,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - X(i,j) =A(i,j)+B(i,j); - } - for(CPPL_INT j=i; j<n; j++){ - X(i,j) =A(j,i)+B(i,j); - } - } - return X; -} - -//============================================================================= -/*! dsymatrix_small+dsymatrix_small operator */ -template<CPPL_INT n> -inline dsymatrix_small<n> operator+(const dsymatrix_small<n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - X(i,j) =A(i,j)+B(i,j); - } - } - return X; -} - - -//============================================================================= -/*! dsymatrix_small-dgematrix_small operator */ -template<CPPL_INT n> -inline dgematrix_small<n,n> operator-(const dsymatrix_small<n>& A, const dgematrix_small<n,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - X(i,j) =A(i,j)-B(i,j); - } - for(CPPL_INT j=i; j<n; j++){ - X(i,j) =A(j,i)-B(i,j); - } - } - return X; -} - -//============================================================================= -/*! dsymatrix_small-dsymatrix_small operator */ -template<CPPL_INT n> -inline dsymatrix_small<n> operator-(const dsymatrix_small<n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - X(i,j) =A(i,j)-B(i,j); - } - } - return X; -} - -//============================================================================= -/*! dsymatrix_small*dcovector_small operator */ -template<CPPL_INT n> -inline dcovector_small<n> operator*(const dsymatrix_small<n>& A, const dcovector_small<n>& B) -{CPPL_VERBOSE_REPORT; - dcovector_small<n> C; - C.zero(); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - C(i) +=A(i,j)*B(j); - } - for(CPPL_INT j=i; j<n; j++){ - C(i) +=A(j,i)*B(j); - } - } - return C; -} - -//============================================================================= -/*! dsymatrix_small*dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator*(const dsymatrix_small<m>& A, const dgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> X; - X.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT k=0; k<i; k++){ - X(i,j) +=A(i,k)*B(k,j); - } - for(CPPL_INT k=i; k<m; k++){ - X(i,j) +=A(k,i)*B(k,j); - } - } - } - return X; -} - -//============================================================================= -/*! dsymatrix_small*dsymatrix_small operator */ -template<CPPL_INT n> -inline dgematrix_small<n,n> operator*(const dsymatrix_small<n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,n> X; - X.zero(); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - for(CPPL_INT k=0; k<j; k++){ - X(i,j) +=A(i,k)*B(j,k); - } - for(CPPL_INT k=j; k<i; k++){ - X(i,j) +=A(i,k)*B(k,j); - } - for(CPPL_INT k=i; k<n; k++){ - X(i,j) +=A(k,i)*B(k,j); - } - } - for(CPPL_INT j=i; j<n; j++){ - for(CPPL_INT k=0; k<i; k++){ - X(i,j) +=A(i,k)*B(j,k); - } - for(CPPL_INT k=i; k<j; k++){ - X(i,j) +=A(k,i)*B(j,k); - } - for(CPPL_INT k=j; k<n; k++){ - X(i,j) +=A(k,i)*B(k,j); - } - } - } - return X; -} - -//============================================================================= -/*! dsymatrix_small*double operator */ -template<CPPL_INT n> -inline dsymatrix_small<n> operator*(const dsymatrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*v; - } - } - return C; -} - -//============================================================================= -/*! dsymatrix_small/double operator */ -template<CPPL_INT n> -inline dsymatrix_small<n> operator/(const dsymatrix_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)/v; - } - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamerd operator */ -template<CPPL_INT n> -inline dgematrix_small<n,n> hadamerd(const dsymatrix_small<n>& A, const dgematrix_small<n,n>& B) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*B(i,j); - } - for(CPPL_INT j=i+1; j<n; j++){ - C(i,j) =A(j,i)*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! Hadamerd operator */ -template<CPPL_INT n> -inline dsymatrix_small<n> hadamerd(const dsymatrix_small<n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*B(i,j); - } - } - return C; -} diff --git a/cpplapack-r198/.svn/pristine/1c/1c6bd24af1793c0968a5edc251414f62c8c3608f.svn-base b/cpplapack-r198/.svn/pristine/1c/1c6bd24af1793c0968a5edc251414f62c8c3608f.svn-base deleted file mode 100644 index 6597651a9b1619092acc50a28f6b36bec294e1f3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1c/1c6bd24af1793c0968a5edc251414f62c8c3608f.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _dgbmatrix*dcovector operator */ -inline _dcovector operator*(const _dgbmatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/1c/1c93f492792865b928cf8139e51866ff7f9cb21f.svn-base b/cpplapack-r198/.svn/pristine/1c/1c93f492792865b928cf8139e51866ff7f9cb21f.svn-base deleted file mode 100644 index 6ae32a90550d50fd232eafd758eb57ed8e36939d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1c/1c93f492792865b928cf8139e51866ff7f9cb21f.svn-base +++ /dev/null @@ -1,103 +0,0 @@ -//============================================================================= -/*! double*dcovector_small operator */ -template<CPPL_INT l> -inline dcovector_small<l> operator*(const double& v, const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - dcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =v*A(i); - } - return X; -} - -//============================================================================= -/*! double*drovector_small operator */ -template<CPPL_INT l> -inline drovector_small<l> operator*(const double& v, const drovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - drovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =v*A(i); - } - return X; -} - -//============================================================================= -/*! double*dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator*(const double& v, const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =v*A(i,j); - } - } - return C; -} - -//============================================================================= -/*! double*dsymatrix_small operator */ -template<CPPL_INT n> -inline dsymatrix_small<n> operator*(const double& v, const dsymatrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - dsymatrix_small<n> X; - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ - X.array[k] =v*A.array[k]; - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! double*zcovector_small operator */ -template<CPPL_INT l> -inline zcovector_small<l> operator*(const double& v, const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - zcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =v*A(i); - } - return X; -} - -//============================================================================= -/*! double*zrovector_small operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator*(const double& v, const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =v*A(i); - } - return X; -} - -//============================================================================= -/*! double*zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const double& v, const zgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =v*A(i,j); - } - } - return C; -} - -//============================================================================= -/*! double*zhematrix_small operator */ -template<CPPL_INT n> -inline zhematrix_small<n> operator*(const double& v, const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> X; - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ - X.array[k] =v*A.array[k]; - } - return X; -} diff --git a/cpplapack-r198/.svn/pristine/1c/1cda490b76a233506737652758a11108c876180b.svn-base b/cpplapack-r198/.svn/pristine/1c/1cda490b76a233506737652758a11108c876180b.svn-base deleted file mode 100644 index 89c09e13a24382fc2e0d5bb30b4c7a4fd28ffc3d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1c/1cda490b76a233506737652758a11108c876180b.svn-base +++ /dev/null @@ -1,100 +0,0 @@ -//============================================================================= -void zgeev_check_value() -{ - cout << "############ check zgeev value ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make zgematrix A //// - CPPL::zgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make w //// - vector< complex<double> > w; - - //// make A_original //// - CPPL::zgematrix A_original(A); - - //// zgeev //// - A.zgeev(w); - - //// print //// - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - } -} - -//============================================================================= -void zgeev_check_right() -{ - cout << "############ check zgeev right ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make zgematrix A //// - CPPL::zgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make w v //// - vector< complex<double> > w; - vector<CPPL::zcovector> vr; - - //// make A_original //// - CPPL::zgematrix A_original(A); - - //// zgeev //// - A.zgeev(w, vr); - - //// print //// - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - cout << "vr=\n" << vr[i] <<endl; - cout << "[A]*{x} -lambda*{x} = (Should be zeros)\n" - << A_original*vr[i] -w[i]*vr[i] << endl; - } -} - -//============================================================================= -void zgeev_check_left() -{ - cout << "############ check zgeev left ############" << endl; - - //srand(unsigned(time(NULL))); - int M(3); - - //// make zgematrix A //// - CPPL::zgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make w v //// - vector< complex<double> > w; - vector<CPPL::zrovector> vl; - - //// make A_original //// - CPPL::zgematrix A_original(A); - - //// zgeev //// - A.zgeev(w, vl); - - //// print //// - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w= " << w[i] << endl; - cout << "vl = " << vl[i] << endl; - cout << "{x}*[A] -{x}*lambda = (Should be zeros)\n" - << vl[i]*A_original -vl[i]*w[i] << endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/1d/1df48c9c52cac621830258d7dfcad35c1532ec1a.svn-base b/cpplapack-r198/.svn/pristine/1d/1df48c9c52cac621830258d7dfcad35c1532ec1a.svn-base deleted file mode 100644 index cc123f3bfa1363d2521687a292a0365f4dea38f5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1d/1df48c9c52cac621830258d7dfcad35c1532ec1a.svn-base +++ /dev/null @@ -1,102 +0,0 @@ -//============================================================================= -/*! return transposed zgematrix */ -inline _zgematrix t(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.n,mat.m); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =mat(j,i); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _zgematrix i(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix mat_cp(mat), mat_inv(mat.m,mat.n); - mat_inv.identity(); - mat_cp.zgesv(mat_inv); - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its conjugate matrix */ -inline _zgematrix conj(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m,mat.n); - - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - newmat(i,j) =std::conj(mat(i,j)); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its conjugate transposed matrix */ -inline _zgematrix conjt(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.n,mat.m); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =std::conj(mat(j,i)); - } - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its Euclidean norm */ -inline comple nrm2(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT N =mat.m*mat.n; - CPPL_INT INCX =1; - return dznrm2_(&N, mat.array, &INCX); -} - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - CPPL_INT index =izamax_(&size, mat.array, &inc) -1; - i =index%mat.m; - j =index/mat.m; -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - return mat.array[izamax_(&size, mat.array, &inc) -1]; -} diff --git a/cpplapack-r198/.svn/pristine/1f/1f1f82515c4e131718a5bc76318b5a28c1d6c8d4.svn-base b/cpplapack-r198/.svn/pristine/1f/1f1f82515c4e131718a5bc76318b5a28c1d6c8d4.svn-base deleted file mode 100644 index 00211bcec86debfaabc1cf857532d1b9a616cf19..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1f/1f1f82515c4e131718a5bc76318b5a28c1d6c8d4.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -version=2015.05.11-1 - -name=cpplapack-$version -dir=/tmp/$name - -mkdir $dir || exit 1 -cp -r ../../* $dir || exit 1 -rm -rf `find $dir -type d -name .svn` || exit 1 - -cd /tmp || exit 1 -rm -f $name.tar.gz || exit 1 -tar czf $name.tar.gz $name || exit 1 -rm -rf $dir || exit 1 -mv $name.tar.gz ~/ || exit 1 -echo "~/$name.tar.gz was successfully created." diff --git a/cpplapack-r198/.svn/pristine/1f/1f8a07a9b208da33a8040edc7d909ad840452333.svn-base b/cpplapack-r198/.svn/pristine/1f/1f8a07a9b208da33a8040edc7d909ad840452333.svn-base deleted file mode 100644 index 63503b3d2487c0dbd6c8f1febeeaf25cc7d95dea..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1f/1f8a07a9b208da33a8040edc7d909ad840452333.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! zgsmatrix+zgematrix operator */ -inline _zgematrix operator+(const zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix-zgematrix operator */ -inline _zgematrix operator-(const zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix*zgematrix operator */ -inline _zgematrix operator*(const zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/1f/1fbdda1060de3bdaf855e75cab07129c839b81ab.svn-base b/cpplapack-r198/.svn/pristine/1f/1fbdda1060de3bdaf855e75cab07129c839b81ab.svn-base deleted file mode 100644 index 74dc003bca5b4d99a304ed0ed86b10333ef0fb3a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/1f/1fbdda1060de3bdaf855e75cab07129c839b81ab.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -//============================================================================= -/*! _zhsmatrix constructor without arguments */ -inline _zhsmatrix::_zhsmatrix() - :m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =0; - data.clear(); - line.clear(); -} - -//============================================================================= -/*! _zhsmatrix copy constructor */ -inline _zhsmatrix::_zhsmatrix(const _zhsmatrix& mat) - :m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =mat.n; - data.swap(mat.data); - line.swap(mat.line); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _zhsmatrix destructor */ -inline _zhsmatrix::~_zhsmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/21/2124c4e4449d5b87d0c828bca8fe5c2cb94162aa.svn-base b/cpplapack-r198/.svn/pristine/21/2124c4e4449d5b87d0c828bca8fe5c2cb94162aa.svn-base deleted file mode 100644 index 64f3af263b01c6cd15b5f22d2863f03c57e1915a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/21/2124c4e4449d5b87d0c828bca8fe5c2cb94162aa.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -//============================================================================= -/*! return a transposed column vector */ -inline _dcovector t(const drovector& rovec) -{CPPL_VERBOSE_REPORT; - dcovector covec(rovec.l); - - CPPL_INT inc =1; - dcopy_(&rovec.l, rovec.array, &inc, covec.array, &inc); - - return _(covec); -} - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const drovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return dnrm2_(&vec.l, vec.array, &inc); -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const drovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return idamax_(&vec.l, vec.array, &inc) -1; -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const drovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return vec.array[idamax_(&vec.l, vec.array, &inc) -1]; -} diff --git a/cpplapack-r198/.svn/pristine/21/212fb4027a1a77e84e423629ee4fb5f2cc4e2f76.svn-base b/cpplapack-r198/.svn/pristine/21/212fb4027a1a77e84e423629ee4fb5f2cc4e2f76.svn-base deleted file mode 100644 index 6cbb6d4e41c4aa047b9636291c654edd58cc6c6a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/21/212fb4027a1a77e84e423629ee4fb5f2cc4e2f76.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! _dcovector*double operator */ -inline _dcovector operator*(const _dcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - dscal_(&vec.l, &d, vec.array, &inc); - return vec; -} - -//============================================================================= -/*! _dcovector/double operator */ -inline _dcovector operator/(const _dcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double dinv =1./d; - dscal_(&vec.l, &dinv, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/21/21ef75da36a28dcdb2a57b9d37a230ec7bb30b84.svn-base b/cpplapack-r198/.svn/pristine/21/21ef75da36a28dcdb2a57b9d37a230ec7bb30b84.svn-base deleted file mode 100644 index 0dcc752e6522a7ef3fd900490c2ba3c843d8cc53..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/21/21ef75da36a28dcdb2a57b9d37a230ec7bb30b84.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -//============================================================================= -/*! calculate determinant */ -inline comple det(const zgemat2& A) -{CPPL_VERBOSE_REPORT; - return A(0,0)*A(1,1)-A(0,1)*A(1,0); -} - -//============================================================================= -/*! calculate inverse */ -inline zgemat2 inv(const zgemat2& A) -{CPPL_VERBOSE_REPORT; - const comple Adet( det(A) ); - zgemat2 Ainv; - Ainv(0,0)= A(1,1)/Adet; Ainv(0,1)=-A(0,1)/Adet; - Ainv(1,0)=-A(1,0)/Adet; Ainv(1,1)= A(0,0)/Adet; - return Ainv; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate determinant */ -inline comple det(const zgemat3& A) -{CPPL_VERBOSE_REPORT; - return - +A(0,0)*A(1,1)*A(2,2) -A(0,0)*A(1,2)*A(2,1) - +A(0,1)*A(1,2)*A(2,0) -A(0,1)*A(1,0)*A(2,2) - +A(0,2)*A(1,0)*A(2,1) -A(0,2)*A(1,1)*A(2,0); -} - -//============================================================================= -/*! calculate inverse */ -inline zgemat3 inv(const zgemat3& A) -{CPPL_VERBOSE_REPORT; - const comple Adet( det(A) ); - zgemat3 Ainv; - Ainv(0,0) =(A(1,1)*A(2,2)-A(1,2)*A(2,1))/Adet; - Ainv(0,1) =(A(0,2)*A(2,1)-A(0,1)*A(2,2))/Adet; - Ainv(0,2) =(A(0,1)*A(1,2)-A(0,2)*A(1,1))/Adet; - Ainv(1,0) =(A(1,2)*A(2,0)-A(1,0)*A(2,2))/Adet; - Ainv(1,1) =(A(0,0)*A(2,2)-A(0,2)*A(2,0))/Adet; - Ainv(1,2) =(A(0,2)*A(1,0)-A(0,0)*A(1,2))/Adet; - Ainv(2,0) =(A(1,0)*A(2,1)-A(1,1)*A(2,0))/Adet; - Ainv(2,1) =(A(0,1)*A(2,0)-A(0,0)*A(2,1))/Adet; - Ainv(2,2) =(A(0,0)*A(1,1)-A(0,1)*A(1,0))/Adet; - return Ainv; -} diff --git a/cpplapack-r198/.svn/pristine/22/222116defa4f5cedc9c06a7ebfff319ed1e49f4f.svn-base b/cpplapack-r198/.svn/pristine/22/222116defa4f5cedc9c06a7ebfff319ed1e49f4f.svn-base deleted file mode 100644 index 0e2808f9122e9a469272f183267666b1308a8557..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/22/222116defa4f5cedc9c06a7ebfff319ed1e49f4f.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -//============================================================================= -/*! zgelss_check */ -void zgelss_check() -{ - cout << "############ check zgelss ############" << endl; - - srand(unsigned(time(NULL))); - int M(3), N(4); - int RANK(0); - double RCOND(-1.0); - - //// make zgematrix A //// - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make dcovector b //// - CPPL::zcovector b(M); - for(int i=0; i<b.l; i++){ - b(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - //// make dcovector s //// - CPPL::dcovector s; - - //// make A_original //// - CPPL::zgematrix A_original(A); - - //// make b_original //// - CPPL::zcovector b_original(b); - - //// zgels //// - A.zgelss(b,s,RANK,RCOND); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "b_original=\n" << b_original << endl; - cout << "A=\n" << A << endl; - cout << "b=\n" << b << endl; - cout << "s=\n" << s << endl; - cout << "A_original*b=\n" << A_original*b << endl; - cout << "RANK =" << RANK << endl; -} - diff --git a/cpplapack-r198/.svn/pristine/22/2231fb021d91610cf4cd30a422ee3c4a2f6d302c.svn-base b/cpplapack-r198/.svn/pristine/22/2231fb021d91610cf4cd30a422ee3c4a2f6d302c.svn-base deleted file mode 100644 index 03b18fbfd6cf959d94cbc2e6652f8dd56eabd080..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/22/2231fb021d91610cf4cd30a422ee3c4a2f6d302c.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! +zgbmatrix operator */ -inline const zgbmatrix& operator+(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -zgbmatrix operator */ -inline _zgbmatrix operator-(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m,mat.n,mat.kl,mat.ku); - for(CPPL_INT i=0; i<(newmat.kl+newmat.ku+1)*newmat.n; i++){ - newmat.array[i]=-mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/22/22ac116c244f48c916503b82a8405342372bac09.svn-base b/cpplapack-r198/.svn/pristine/22/22ac116c244f48c916503b82a8405342372bac09.svn-base deleted file mode 100644 index 95f7645346f5e23f8994614598ddc68bd815aea3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/22/22ac116c244f48c916503b82a8405342372bac09.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - CPPL::zcovector x(L); - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "x =\n" << x << endl; - cout << "x*10. =\n" << x*10. << endl; - cout << "x/10. =\n" << x/10. << endl; - - cout << "#### x*=10.; ####" << endl; - x*=10.; - cout << "x =\n" << x << endl; - cout << "#### x/=10.; ####" << endl; - x/=10.; - cout << "x =\n" << x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/22/22cd2404ff33e5542f5ffbe61707fbfebe407841.svn-base b/cpplapack-r198/.svn/pristine/22/22cd2404ff33e5542f5ffbe61707fbfebe407841.svn-base deleted file mode 100644 index 314b7817a9e294b91682d97127cd22f8bd159e4f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/22/22cd2404ff33e5542f5ffbe61707fbfebe407841.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! drovector*_dgematrix operator */ -inline _drovector operator*(const drovector& vec, const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/23/230a0fd1171b6cc90b8b33d2c21163893b3c6094.svn-base b/cpplapack-r198/.svn/pristine/23/230a0fd1171b6cc90b8b33d2c21163893b3c6094.svn-base deleted file mode 100644 index 10846838292a5b05002267c7934318c4db41966a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/23/230a0fd1171b6cc90b8b33d2c21163893b3c6094.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _zhematrix+_zhematrix operator */ -inline _zhematrix operator+(const _zhematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] += matB.darray[j][i]; - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zhematrix-_zhematrix operator */ -inline _zhematrix operator-(const _zhematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] -= matB.darray[j][i]; - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zhematrix*_zhematrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.n, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/23/2345b84a785dd9f012c42051238b4234f0a08085.svn-base b/cpplapack-r198/.svn/pristine/23/2345b84a785dd9f012c42051238b4234f0a08085.svn-base deleted file mode 100644 index 57a32adbdf21380648f8a40bdfb18c21bf8e38a3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/23/2345b84a785dd9f012c42051238b4234f0a08085.svn-base +++ /dev/null @@ -1,183 +0,0 @@ -//============================================================================= -//! Real Double-precision General Dence Matrix Class -class dgematrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT m; //!< matrix row size - CPPL_INT n; //!< matrix column size - double* array; //!< 1D array to store matrix data - double** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dgematrix(); - inline dgematrix(const dgematrix&); - inline dgematrix(const _dgematrix&); - inline dgematrix(const CPPL_INT&, const CPPL_INT&); - inline dgematrix(const char*); - inline ~dgematrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&, const CPPL_INT&); - inline double operator()(const CPPL_INT&, const CPPL_INT&) const; - inline dgematrix& set(const CPPL_INT&, const CPPL_INT&, const double&); //const; - inline friend std::ostream& operator<<(std::ostream&, const dgematrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline dgematrix& zero(); - inline dgematrix& identity(); - inline void chsign(); - inline void copy(const dgematrix&); - inline void shallow_copy(const _dgematrix&); - inline dgematrix& resize(const CPPL_INT&, const CPPL_INT&); - inline _drovector row(const CPPL_INT&) const; - inline _dcovector col(const CPPL_INT&) const; - inline friend void swap(dgematrix&, dgematrix&); - inline friend _dgematrix _(dgematrix&); - - //////// calc //////// - inline friend _dgematrix t(const dgematrix&); - inline friend _dgematrix i(const dgematrix&); - inline friend double nrm2(const dgematrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const dgematrix&); - inline friend double damax(const dgematrix&); - - //////// lapack //////// - inline CPPL_INT dgesv(dgematrix&); - inline CPPL_INT dgesv(dcovector&); - inline CPPL_INT dgels(dgematrix&); - inline CPPL_INT dgels(dcovector&); - inline CPPL_INT dgels(dgematrix&, drovector&); - inline CPPL_INT dgels(dcovector&, double&); - //inline CPPL_INT dgelss(dcovector&); - inline CPPL_INT dgelss(dcovector&, dcovector&, CPPL_INT&, const double); - inline CPPL_INT dgelss(dgematrix&, dcovector&, CPPL_INT&, const double); - inline CPPL_INT dgelsd(dcovector&, dcovector&, CPPL_INT&, const double); - //inline CPPL_INT dgelsd(dgematrix&, dcovector&, CPPL_INT&, const double); - inline CPPL_INT dgeev(std::vector<double>&, std::vector<double>&); - inline CPPL_INT dgeev(zcovector&); - inline CPPL_INT dgeev(std::vector<comple>&, std::vector<zcovector>&); - inline CPPL_INT dgeev(std::vector<double>&, std::vector<double>&, std::vector<dcovector>&, std::vector<dcovector>&); - inline CPPL_INT dgeev(std::vector<double>&, std::vector<double>&, std::vector<drovector>&, std::vector<drovector>&); - inline CPPL_INT dggev(dgematrix&, std::vector<double>&, std::vector<double>&); - inline CPPL_INT dggev(dgematrix&, std::vector<double>&, std::vector<double>&, std::vector<dcovector>&, std::vector<dcovector>&); - inline CPPL_INT dggev(dgematrix&, std::vector<double>&, std::vector<double>&, std::vector<drovector>&, std::vector<drovector>&); - inline CPPL_INT dgesvd(dgbmatrix&); - inline CPPL_INT dgesvd(dcovector&, dgematrix&, dgematrix&); - inline CPPL_INT dgglse(dgematrix&, dcovector&, dcovector&, dcovector&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline dgematrix& operator=(const dgematrix&); - inline dgematrix& operator=(const _dgematrix&); - - //////// += //////// - inline dgematrix& operator+=(const dgematrix&); - inline dgematrix& operator+=(const _dgematrix&); - inline dgematrix& operator+=(const dsymatrix&); - inline dgematrix& operator+=(const _dsymatrix&); - inline dgematrix& operator+=(const dgbmatrix&); - inline dgematrix& operator+=(const _dgbmatrix&); - inline dgematrix& operator+=(const dgsmatrix&); - inline dgematrix& operator+=(const _dgsmatrix&); - inline dgematrix& operator+=(const dssmatrix&); - inline dgematrix& operator+=(const _dssmatrix&); - - //////// -= //////// - inline dgematrix& operator-=(const dgematrix&); - inline dgematrix& operator-=(const _dgematrix&); - inline dgematrix& operator-=(const dsymatrix&); - inline dgematrix& operator-=(const _dsymatrix&); - inline dgematrix& operator-=(const dgbmatrix&); - inline dgematrix& operator-=(const _dgbmatrix&); - inline dgematrix& operator-=(const dgsmatrix&); - inline dgematrix& operator-=(const _dgsmatrix&); - inline dgematrix& operator-=(const dssmatrix&); - inline dgematrix& operator-=(const _dssmatrix&); - - //////// *= //////// - inline dgematrix& operator*=(const dgematrix&); - inline dgematrix& operator*=(const _dgematrix&); - inline dgematrix& operator*=(const dsymatrix&); - inline dgematrix& operator*=(const _dsymatrix&); - inline dgematrix& operator*=(const dgbmatrix&); - inline dgematrix& operator*=(const _dgbmatrix&); - inline dgematrix& operator*=(const dgsmatrix&); - inline dgematrix& operator*=(const _dgsmatrix&); - inline dgematrix& operator*=(const dssmatrix&); - inline dgematrix& operator*=(const _dssmatrix&); - inline dgematrix& operator*=(const double&); - - //////// /= //////// - inline dgematrix& operator/=(const double&); - - //////// unary //////// - inline friend const dgematrix& operator+(const dgematrix&); - inline friend _dgematrix operator-(const dgematrix&); - - //////// + //////// - inline friend _dgematrix operator+(const dgematrix&, const dgematrix&); - inline friend _dgematrix operator+(const dgematrix&, const _dgematrix&); - inline friend _dgematrix operator+(const dgematrix&, const dsymatrix&); - inline friend _dgematrix operator+(const dgematrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const dgematrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const dgematrix&, const _dgbmatrix&); - inline friend _dgematrix operator+(const dgematrix&, const dgsmatrix&); - inline friend _dgematrix operator+(const dgematrix&, const _dgsmatrix&); - inline friend _dgematrix operator+(const dgematrix&, const dssmatrix&); - inline friend _dgematrix operator+(const dgematrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const dgematrix&, const dgematrix&); - inline friend _dgematrix operator-(const dgematrix&, const _dgematrix&); - inline friend _dgematrix operator-(const dgematrix&, const dsymatrix&); - inline friend _dgematrix operator-(const dgematrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const dgematrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const dgematrix&, const _dgbmatrix&); - inline friend _dgematrix operator-(const dgematrix&, const dgsmatrix&); - inline friend _dgematrix operator-(const dgematrix&, const _dgsmatrix&); - inline friend _dgematrix operator-(const dgematrix&, const dssmatrix&); - inline friend _dgematrix operator-(const dgematrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const dgematrix&, const dcovector&); - inline friend _dcovector operator*(const dgematrix&, const _dcovector&); - inline friend _dgematrix operator*(const dgematrix&, const dgematrix&); - inline friend _dgematrix operator*(const dgematrix&, const _dgematrix&); - inline friend _dgematrix operator*(const dgematrix&, const dsymatrix&); - inline friend _dgematrix operator*(const dgematrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const dgematrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const dgematrix&, const _dgbmatrix&); - inline friend _dgematrix operator*(const dgematrix&, const dgsmatrix&); - inline friend _dgematrix operator*(const dgematrix&, const _dgsmatrix&); - inline friend _dgematrix operator*(const dgematrix&, const dssmatrix&); - inline friend _dgematrix operator*(const dgematrix&, const _dssmatrix&); - inline friend _dgematrix operator*(const dgematrix&, const double&); - - //////// / //////// - inline friend _dgematrix operator/(const dgematrix&, const double&); - - //////// % //////// - inline friend _drovector operator%(const dgematrix&, const dgematrix&); - - //////// double //////// - inline friend _dgematrix operator*(const double&, const dgematrix&); - - //////// hadamard //////// - inline friend _dgematrix hadamard(const dgematrix&, const dgematrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/23/23bd85cb2e0a167c0fa26fecca0c80cb94b1e0e6.svn-base b/cpplapack-r198/.svn/pristine/23/23bd85cb2e0a167c0fa26fecca0c80cb94b1e0e6.svn-base deleted file mode 100644 index 51dbee4c3ca9464e2eb08fbfbaf66aa9af41e579..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/23/23bd85cb2e0a167c0fa26fecca0c80cb94b1e0e6.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -//============================================================================= -/*! double*_dssmatrix operator */ -inline _dssmatrix operator*(const double& d, const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *=d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/24/2435bd68f1ae2ee487cdd7f0e81915e0576275a7.svn-base b/cpplapack-r198/.svn/pristine/24/2435bd68f1ae2ee487cdd7f0e81915e0576275a7.svn-base deleted file mode 100644 index e1a0441c7c1f139468f5052c2ef2aaec22babd1e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/24/2435bd68f1ae2ee487cdd7f0e81915e0576275a7.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! _dgbmatrix*_dcovector operator */ -inline _dcovector operator*(const _dgbmatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/24/246b7d42dd7343347a8b0b1b18849acb9dfe5728.svn-base b/cpplapack-r198/.svn/pristine/24/246b7d42dd7343347a8b0b1b18849acb9dfe5728.svn-base deleted file mode 100644 index 4fc4103342a673edc45098be3c71cd09db651284..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/24/246b7d42dd7343347a8b0b1b18849acb9dfe5728.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+zgbmatrix operator */ -inline _zgematrix operator+(const _zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) +=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix-zgbmatrix operator */ -inline _zgematrix operator-(const _zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix*zgbmatrix operator */ -inline _zgematrix operator*(const _zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/25/25437f317b9405d52d9350951a31e18087af808d.svn-base b/cpplapack-r198/.svn/pristine/25/25437f317b9405d52d9350951a31e18087af808d.svn-base deleted file mode 100644 index 0845f771b51c53578c3769064caf353d17083e4e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/25/25437f317b9405d52d9350951a31e18087af808d.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zrovector*zgbmatrix operator */ -inline _zrovector operator*(const zrovector& vec, const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/26/26672c7e08e6ac4a7344aade5774ccb80924ec87.svn-base b/cpplapack-r198/.svn/pristine/26/26672c7e08e6ac4a7344aade5774ccb80924ec87.svn-base deleted file mode 100644 index 9b65d85e530489ee042fd6d72b3708c8e170a09f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/26/26672c7e08e6ac4a7344aade5774ccb80924ec87.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _drovector*dsymatrix operator */ -inline _drovector operator*(const _drovector& vec, const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/26/267b49f5553d38769c66194d2f4014aacf8859f1.svn-base b/cpplapack-r198/.svn/pristine/26/267b49f5553d38769c66194d2f4014aacf8859f1.svn-base deleted file mode 100644 index 5274d8e9fade59ab207be42f62c08e7f35e443de..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/26/267b49f5553d38769c66194d2f4014aacf8859f1.svn-base +++ /dev/null @@ -1,323 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -/* the simplest block subspace itration */ -template <typename MATRIX> -bool block_subspace_simplest -( - const MATRIX& A, - CPPL::drovector& lambda, - CPPL::dgematrix& V, //V.m >= V.n - const double& eps, - const int& itmax - ) -{ - //////// initialization //////// - srand(time(NULL)); - for(int i=0; i<V.m; i++){ for(int j=0;j<V.n; j++){ V(i,j)=rand(); } } - CPPL::dgematrix V_new; - double *tau(new double[V.n]), *work(new double[V.n]); - int info, itc(0); - - //////// loop //////// - while(++itc<itmax){ - //// ortonormalize //// - CPPL::dgeqrf_(&V.m, &V.n, V.array, &V.m, tau, work, &V.n, &info); - if(info!=0){ std::cerr << "info = " << info << std::endl; } - CPPL::dorgqr_(&V.m, &V.n, &V.n, V.array, &V.m, tau, work, &V.n, &info); - if(info!=0){ std::cerr << "info = " << info << std::endl; } - - //// power method //// - V_new =A*V; - lambda =V_new%V; - - //// convergence check //// - double rmax(0.); - for(int k=0; k<V.n; k++){ - CPPL::dcovector rv( V_new.col(k)/lambda(k) -V.col(k) ); - rmax =std::max( rmax, fabs(damax(rv)) ); - if(rmax>eps){ break; }//failed - } - if(rmax<eps){ break; }//converged - - //// update //// - swap(V,V_new); - } - std::cerr << "itc=" << itc << std::endl; - - if(itc<itmax){ - std::cerr << "[NOTE]@block_subspace_simplest: converged!!!!!!\n" << std::endl; - return 0; - } - else{ - std::cerr << "[WARNING]@block_subspace_simplest: not converged......\n" << std::endl; - return 1; - } -} - -//============================================================================= -/* block subspace itration with projection */ -template <typename MATRIX> -bool block_subspace_projection -( - const MATRIX& A,//a symmetrix matrix - CPPL::drovector& lambda, - CPPL::dgematrix& V, //V.m >= V.n - const double& eps, - const int& itmax - ) -{ - //////// initialization //////// - char jobz ='V'; - char uplo ='L'; - double *tau =new double[V.n]; - double *work =new double[V.n]; - double *work2 =new double[3*V.n-1]; - int lwork =3*V.n-1; - int info; - //// make initial V //// - srand(time(NULL)); - for(int i=0; i<V.m; i++){ - for(int j=0;j<V.n; j++){ - V(i,j) =double(rand())/double(RAND_MAX); - } - } - - //////// loop //////// - size_t itc =0; - while(++itc<itmax){ - //// ortonormalize //// - CPPL::dgeqrf_(&V.m, &V.n, V.array, &V.m, tau, work, &V.n, &info); - if(info!=0){ std::cerr << "[ERROR]dgeqrf_ info = " << info << std::endl; exit(1); } - CPPL::dorgqr_(&V.m, &V.n, &V.n, V.array, &V.m, tau, work, &V.n, &info); - if(info!=0){ std::cerr << "[ERROR]dorgqr_ info = " << info << std::endl; exit(1); } - std::cerr << "V=\n" << V; - - //// make Schur vectors S //// - CPPL::dgematrix S =(t(V)*A)*V; - CPPL::dsyev_(&jobz, &uplo, &S.n, S.array, &S.n, lambda.array, work2, &lwork, &info); - if(info!=0){ std::cerr << "[ERROR]dsyev_ info = " << info << std::endl; exit(1); } - //std::cerr << "lambda = " << lambda << std::endl; - - //// convergence check //// - CPPL::dgematrix lhs =A*V; - CPPL::dgematrix tmp =lhs; - for(int j=0; j<tmp.n; j++){ - for(int i=0; i<tmp.m; i++){ - tmp(i,j) /=lambda(j); - } - } - std::cerr << "tmp=\n" << tmp; - double rmax =fabs(damax((tmp-V))); - std::cerr << "rmax=" << rmax << std::endl; - if(rmax<eps){ break; }//converged - - //// update //// - V =lhs*S; - } - std::cerr << "itc=" << itc << std::endl; - - if(itc<itmax){ - std::cerr << "[NOTE]@block_subspace_projection: converged!!!!!!\n" << std::endl; - return 0; - } - else{ - std::cerr << "[WARNING]@block_subspace_projection: not converged......\n" << std::endl; - return 1; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/* block subspace itration with projection and deflation */ -template <typename MATRIX> -bool block_subspace_projection_deflation -( - const MATRIX& A,//a symmetrix matrix - CPPL::drovector& lambda, - CPPL::dgematrix& V, //V.m >= V.n - const double& eps, - const int& itmax - ) -{ - //////// initialization //////// - srand(time(NULL)); - lambda.resize(V.n); - CPPL::dgematrix V_yet, AV_yet, Y(V.m,V.n), V_new(V.m,V.n); - CPPL::drovector lambda_yet(V.n); - double *tau(new double[V.n]), *work(new double[V.n]), *work2(new double[3*V.n-1]); - int info, itc(0); - int nconv(0); - - //// make initial V //// - for(int i=0; i<V.m; i++){ for(int j=0;j<V.n; j++){ V(i,j)=rand(); } } - CPPL::dgeqrf_(&V.m, &V.n, V.array, &V.m, tau, work, &V.n, &info); - if(info!=0){ std::cerr << "[ERROR]dgeqrf_ info = " << info << std::endl; exit(1); } - CPPL::dorgqr_(&V.m, &V.n, &V.n, V.array, &V.m, tau, work, &V.n, &info); - if(info!=0){ std::cerr << "[ERROR]dorgqr_ info = " << info << std::endl; exit(1); } - - //////// main loop //////// - char jobz ='V'; - char uplo ='L'; - int lwork =3*V.n-1; - while(++itc<itmax){ - //// make V_yet //// - V_yet.resize(V.m, V.n-nconv); - for(int j=0; j<V.n-nconv; j++){ - for(int i=0; i<V.m; i++){ - V_yet(i,j) =V(i,j); - } - } -h - //// power method //// - AV_yet =A*V_yet; - - //// make Y //// - for(int j=0; j<V.n-nconv; j++){ - for(int i=0; i<V.m; i++){ - Y(i,j) =AV_yet(i,j); - } - } - for(int j=V.n-nconv; j<V.n; j++){ - for(int i=0; i<V.m; i++){ - Y(i,j) =V(i,j); - } - } - - //// ortonormalize //// - CPPL::dgeqrf_(&Y.m, &Y.n, Y.array, &Y.m, tau, work, &Y.n, &info); - if(info!=0){ std::cerr << "[ERROR]dgeqrf_ info = " << info << std::endl; exit(1); } - CPPL::dorgqr_(&Y.m, &Y.n, &Y.n, Y.array, &Y.m, tau, work, &Y.n, &info); - if(info!=0){ std::cerr << "[ERROR]dorgqr_ info = " << info << std::endl; exit(1); } - - //// remake V_yet //// - for(int j=0; j<V.n-nconv; j++){ - for(int i=0; i<V.m; i++){ - V_yet(i,j) =Y(i,j); - } - } - - //// make Schur vectors S //// - CPPL::dgematrix S( t(V_yet)*(A*V_yet) ); - CPPL::dsyev_(&jobz, &uplo, &S.n, S.array, &S.n, lambda_yet.array, work2, &lwork, &info); - - if(info!=0){ std::cerr << "[ERROR]dsyev_ info = " << info << std::endl; exit(1); } - //std::cerr << "lambda_yet B= " << lambda_yet << std::endl; - - //// update lambda //// - for(int j=0; j<V.n-nconv; j++){ - lambda(j) =lambda_yet(j); - } - - //// make V_new //// - V_yet =V_yet*S; - for(int j=0; j<V.n-nconv; j++){ - for(int i=0; i<V.m; i++){ - V_new(i,j) =V_yet(i,j); - } - } - for(int j=V.n-nconv; j<V.n; j++){ - for(int i=0; i<V.m; i++){ - V_new(i,j) =V(i,j); - } - } - - //// convergence check //// - int nconv_new(nconv); - for(int j=V.n-nconv-1; j>=0; j--){ - //if( nconv_new>0 ){ - //std::cerr << "lambda(j) = " << lambda(j) << std::endl; - //std::cerr << "lambda(V.n-nconv_new) = " << lambda(V.n-nconv_new) << std::endl; - //} - if( nconv_new>0 && lambda(j)>lambda(V.n-nconv_new) ){ break; }//failed - CPPL::dcovector rv( V_new.col(j) -V.col(j) ); - if(fabs(damax(rv))>eps){ break; }//failed - nconv_new++; - } - if(nconv_new==V.n){ break; }//all converged - //std::cerr << "nconv_new = " << nconv_new << std::endl; - - //// update //// - V =V_new; - nconv =nconv_new; - } - std::cerr << "itc=" << itc << std::endl; - - if(itc<itmax){ - std::cerr << "[NOTE]@block_subspace_projection_deflation: converged!!!!!!\n" << std::endl; - return 0; - } - else{ - std::cerr << "[WARNING]@block_subspace_projection_deflation: not converged......\n" << std::endl; - return 1; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int /*argc*/, char** /*argv*/) -{ - std::cout.precision(6); - std::cout.setf(std::ios::scientific, std::ios::floatfield); - std::cout.setf(std::ios::showpos); - std::cerr.precision(6); - std::cerr.setf(std::ios::scientific, std::ios::floatfield); - std::cerr.setf(std::ios::showpos); - - //////// objects //////// - CPPL::dssmatrix A("K6.dssmatrix"); - //CPPL::dssmatrix A("K810.dssmatrix"); - std::cout << "A=\n" << A << std::endl; - - const int num_of_eigen(3); - CPPL::drovector lambda(num_of_eigen); - CPPL::dgematrix V(A.m,num_of_eigen); - - //////// subspace //////// - //block_subspace_simplest(A,lambda,V,1e-3,A.m*A.n);//unstable - //block_subspace_projection(A,lambda,V,1e-3,A.m*A.n);//better - block_subspace_projection_deflation(A,lambda,V,1e-3,A.m*A.n);//YET UNSTABLE!!!!!!! - - //////// print //////// - for(int k=V.n-1; k>=0; k--){ - std::cout << "lambda(" << k << ") = " << lambda(k) << std::endl; - std::cout << "v(" << k << ") = " << t(V.col(k)) << std::flush; - //std::cout << "residual=" << t( A*V.col(k)/lambda(k)-V.col(k) ) << std::endl; - //std::cout << "nrm2(residual)=" << nrm2( A*V.col(k)/lambda(k)-V.col(k) ) << std::endl; - std::cout << std::endl; - } - - std::cout << std::endl << std::endl; - - //////// verify //////// - CPPL::dsymatrix B(A.to_dsymatrix()); - std::vector<double> w; - std::vector<CPPL::dcovector> v; - B.dsyev(w,v); - for(int k=B.n-1; k>=B.n-V.n; k--){ - std::cout << "answer lambda[" << k << "] = " << w[k] << std::endl; - std::cout << "answer v[" << k << "] = " << t(v[k]) << std::endl; - } - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/27/27788abf4cdbd20a8c722cbc1a98c48239ce5658.svn-base b/cpplapack-r198/.svn/pristine/27/27788abf4cdbd20a8c722cbc1a98c48239ce5658.svn-base deleted file mode 100644 index 2f645c328d4a69569b87dd668bf49288a7c0ec3d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/27/27788abf4cdbd20a8c722cbc1a98c48239ce5658.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! zgematrix*=double operator */ -inline zgematrix& zgematrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =m*n; - CPPL_INT inc =1; - zdscal_(&size, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zgematrix/=double operator */ -inline zgematrix& zgematrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =m*n; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&size, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix*double operator */ -inline _zgematrix operator*(const zgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m, mat.n); - - const CPPL_INT size =mat.m*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix/double operator */ -inline _zgematrix operator/(const zgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m, mat.n); - - const CPPL_INT size =mat.m*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/27/27aeef49872ab85f8e8c3e25067f7f0c6c858e08.svn-base b/cpplapack-r198/.svn/pristine/27/27aeef49872ab85f8e8c3e25067f7f0c6c858e08.svn-base deleted file mode 100644 index 9664fcc15d162995238bc8ce4223728eb41c905c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/27/27aeef49872ab85f8e8c3e25067f7f0c6c858e08.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _drovector*dgematrix operator */ -inline _drovector operator*(const _drovector& vec, const dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/27/27da72d991bd888f410e98c35c42b62204f099f8.svn-base b/cpplapack-r198/.svn/pristine/27/27da72d991bd888f410e98c35c42b62204f099f8.svn-base deleted file mode 100644 index b0dcef2e7d4580c8e9edb63d37a702115e2f3d38..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/27/27da72d991bd888f410e98c35c42b62204f099f8.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! _dgematrix+_dsymatrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++) { - for(CPPL_INT j=0; j<matB.n; j++) { - matA(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix-_dsymatrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++) { - for(CPPL_INT j=0; j<matB.n; j++) { - matA(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix*_dsymatrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char side ='R'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/28/283578f3082fd7df4407df26277a4ce22d2b0605.svn-base b/cpplapack-r198/.svn/pristine/28/283578f3082fd7df4407df26277a4ce22d2b0605.svn-base deleted file mode 100644 index aa96eea468edc57beeb895ed8dbbc781d1ca57f3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/28/283578f3082fd7df4407df26277a4ce22d2b0605.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! +_zhematrix operator */ -inline const _zhematrix& operator+(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_zhematrix operator */ -inline _zhematrix operator-(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - mat.darray[j][i] =-mat.darray[j][i]; - } - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/28/28e2dad99be8cf8d066d0bd3abddb88820b1a582.svn-base b/cpplapack-r198/.svn/pristine/28/28e2dad99be8cf8d066d0bd3abddb88820b1a582.svn-base deleted file mode 100644 index d5203f0c334993bd1e374f3a559e1000cba360d2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/28/28e2dad99be8cf8d066d0bd3abddb88820b1a582.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! dgematrix*=double operator */ -inline dgematrix& dgematrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =m*n; - CPPL_INT inc =1; - dscal_(&mn, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! dgematrix/=double operator */ -inline dgematrix& dgematrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =m*n; - double dinv =1./d; - CPPL_INT inc =1; - dscal_(&mn, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix*double operator */ -inline _dgematrix operator*(const dgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(mat.m, mat.n); - - const CPPL_INT mn =mat.m*mat.n; - for(CPPL_INT i=0; i<mn; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix/double operator */ -inline _dgematrix operator/(const dgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(mat.m, mat.n); - - const CPPL_INT mn =mat.m*mat.n; - for(CPPL_INT i=0; i<mn; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/29/292eb3b3aa6af60c8b041dbea78d1f8fe64c9f86.svn-base b/cpplapack-r198/.svn/pristine/29/292eb3b3aa6af60c8b041dbea78d1f8fe64c9f86.svn-base deleted file mode 100644 index 303148796e184850f3574ffaab64a609e99a6b34..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/29/292eb3b3aa6af60c8b041dbea78d1f8fe64c9f86.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! _zhsmatrix*zcovector operator */ -inline _zcovector operator*(const _zhsmatrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=std::conj(it->v)*vec(it->i); - } - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/29/2952b9bc84c67c2edd0c0a558a2f1c7e25e9eab0.svn-base b/cpplapack-r198/.svn/pristine/29/2952b9bc84c67c2edd0c0a558a2f1c7e25e9eab0.svn-base deleted file mode 100644 index 5a00927f1b97ec08ddf3af1ff638c74c4da45f8e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/29/2952b9bc84c67c2edd0c0a558a2f1c7e25e9eab0.svn-base +++ /dev/null @@ -1,543 +0,0 @@ -%!PS-Adobe-3.0 EPSF-3.0 -%%BoundingBox: 70 496 343 561 -%%Title: dssmatrix-array -%%CreationDate: Thu Nov 4 02:07:04 2004 -%%Creator: Tgif-4.1.43-QPL written by William Chia-Wei Cheng (bill.cheng@acm.org) -%%ProducedBy: (unknown) -%%Pages: 1 -%%DocumentFonts: (atend) -%%EndComments -%%BeginProlog - -/tgifdict 86 dict def -tgifdict begin - -/tgifellipsedict 6 dict def -tgifellipsedict /mtrx matrix put - -/TGEL % tgifellipse - { tgifellipsedict begin - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y translate - xrad yrad scale - 0 0 1 0 360 arc - savematrix setmatrix - end - } def - -/tgifpatdict 10 dict def - -/tgifpatbyte - { currentdict /retstr get exch - pat i cellsz mod get put - } def - -/tgifpatproc - { 0 1 widthlim {tgifpatbyte} for retstr - /i i 1 add def - } def - -/TGPF % tgifpatfill - { tgifpatdict begin - /h exch def - /w exch def - /lty exch def - /ltx exch def - /cellsz exch def - /pat exch def - - /widthlim w cellsz div cvi 1 sub def - /retstr widthlim 1 add string def - /i 0 def - - tgiforigctm setmatrix - ltx lty translate - w h true [1 0 0 1 0 0] {tgifpatproc} imagemask - ltx neg lty neg translate - end - } def - -/pat3 <8000000008000000> def -/pat4 <8800000022000000> def -/pat5 <8800220088002200> def -/pat6 <8822882288228822> def -/pat7 <aa55aa55aa55aa55> def -/pat8 <77dd77dd77dd77dd> def -/pat9 <77ffddff77ffddff> def -/pat10 <77ffffff77ffffff> def -/pat11 <7fffffff7fffffff> def -/pat12 <8040200002040800> def -/pat13 <40a00000040a0000> def -/pat14 <ff888888ff888888> def -/pat15 <ff808080ff080808> def -/pat16 <f87422478f172271> def -/pat17 <038448300c020101> def -/pat18 <081c22c180010204> def -/pat19 <8080413e080814e3> def -/pat20 <8040201008040201> def -/pat21 <8844221188442211> def -/pat22 <77bbddee77bbddee> def -/pat23 <c1e070381c0e0783> def -/pat24 <7fbfdfeff7fbfdfe> def -/pat25 <3e1f8fc7e3f1f87c> def -/pat26 <0102040810204080> def -/pat27 <1122448811224488> def -/pat28 <eeddbb77eeddbb77> def -/pat29 <83070e1c3870e0c1> def -/pat30 <fefdfbf7efdfbf7f> def -/pat31 <7cf8f1e3c78f1f3e> def - -/TGMAX - { exch dup 3 1 roll exch dup 3 1 roll gt { pop } { exch pop } ifelse - } def -/TGMIN - { exch dup 3 1 roll exch dup 3 1 roll lt { pop } { exch pop } ifelse - } def -/TGSW { stringwidth pop } def - -/bd { bind def } bind def - -/GS { gsave } bd -/GR { grestore } bd -/NP { newpath } bd -/CP { closepath } bd -/CHP { charpath } bd -/CT { curveto } bd -/L { lineto } bd -/RL { rlineto } bd -/M { moveto } bd -/RM { rmoveto } bd -/S { stroke } bd -/F { fill } bd -/TR { translate } bd -/RO { rotate } bd -/SC { scale } bd -/MU { mul } bd -/DI { div } bd -/DU { dup } bd -/NE { neg } bd -/AD { add } bd -/SU { sub } bd -/PO { pop } bd -/EX { exch } bd -/CO { concat } bd -/CL { clip } bd -/EC { eoclip } bd -/EF { eofill } bd -/IM { image } bd -/IMM { imagemask } bd -/ARY { array } bd -/SG { setgray } bd -/RG { setrgbcolor } bd -/SD { setdash } bd -/W { setlinewidth } bd -/SM { setmiterlimit } bd -/SLC { setlinecap } bd -/SLJ { setlinejoin } bd -/SH { show } bd -/FF { findfont } bd -/MS { makefont setfont } bd -/AR { arcto 4 {pop} repeat } bd -/CURP { currentpoint } bd -/FLAT { flattenpath strokepath clip newpath } bd -/TGSM { tgiforigctm setmatrix } def -/TGRM { savematrix setmatrix } def - -end - -%%EndProlog -%%Page: 1 1 - -%%PageBoundingBox: 70 496 343 561 -tgifdict begin -/tgifsavedpage save def - -1 SM -1 W - -0 SG - -72 0 MU 72 8.203 MU TR -72 128 DI 100.000 MU 100 DI DU NE SC - -GS - -/tgiforigctm matrix currentmatrix def - -% BOX -0 SG -GS - 10 SM - GS - NP 552 128 M 608 128 L 608 164 L 552 164 L CP - S - GR -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 452 128 M 508 128 L 508 164 L 452 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 396 128 M 452 128 L 452 164 L 396 164 L CP EC NP - pat5 8 392 120 64 48 TGPF -GR -GS - 10 SM - GS - NP 396 128 M 452 128 L 452 164 L 396 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 340 128 M 396 128 L 396 164 L 340 164 L CP EC NP - pat5 8 336 120 64 48 TGPF -GR -GS - 10 SM - GS - NP 340 128 M 396 128 L 396 164 L 340 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 240 128 M 296 128 L 296 164 L 240 164 L CP EC NP - pat5 8 232 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 240 128 M 296 128 L 296 164 L 240 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 184 128 M 240 128 L 240 164 L 184 164 L CP EC NP - pat5 8 176 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 184 128 M 240 128 L 240 164 L 184 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 128 128 M 184 128 L 184 164 L 128 164 L CP EC NP - pat5 8 120 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 128 128 M 184 128 L 184 164 L 128 164 L CP - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 156 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (0) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (0) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 212 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 268 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 368 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 580 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) SH - GR - GR - -% OVAL -0 SG -NP 306 146 2 2 TGEL F -GS - GS - NP 306 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 318 146 2 2 TGEL F -GS - GS - NP 318 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 330 146 2 2 TGEL F -GS - GS - NP 330 146 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 424 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 480 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) SH - GR - GR - -% OVAL -0 SG -NP 518 146 2 2 TGEL F -GS - GS - NP 518 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 530 146 2 2 TGEL F -GS - GS - NP 530 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 542 146 2 2 TGEL F -GS - GS - NP 542 146 2 2 TGEL - 3 W - S - GR -GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 128 124 M - 128 116 L - 452 116 L - 452 124 L - TGSM - 2 W - S - 1 W -GR - -% TEXT -NP -0 SG - GS - 1 W - 288 112 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (Effective Data) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (Effective Data) SH - GR - GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 128 96 M - 128 76 L - 608 76 L - 608 96 L - TGSM - 2 W - S - 1 W -GR - -% TEXT -NP -0 SG - GS - 1 W - 368 72 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (Data Capacity) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (Data Capacity) SH - GR - GR - -GR -tgifsavedpage restore -end -showpage - -%%Trailer -%MatchingCreationDate: Thu Nov 4 02:07:04 2004 -%%DocumentFonts: Helvetica -%%EOF diff --git a/cpplapack-r198/.svn/pristine/29/29ec0c4812990d83aedf5a708fbad86907fd1541.svn-base b/cpplapack-r198/.svn/pristine/29/29ec0c4812990d83aedf5a708fbad86907fd1541.svn-base deleted file mode 100644 index 3cba9c117c8ed74c6a75a3dacd55649fb01eb157..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/29/29ec0c4812990d83aedf5a708fbad86907fd1541.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! double*_dsymatrix operator */ -inline _dsymatrix operator*(const double& d, const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - mat.darray[j][i] *=d; - } - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/2a/2a621cd6c1b6995fc5723a65d270dd1a631beb78.svn-base b/cpplapack-r198/.svn/pristine/2a/2a621cd6c1b6995fc5723a65d270dd1a631beb78.svn-base deleted file mode 100644 index f1aa5a98071d35014c21174cf1417b4009bd86b1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2a/2a621cd6c1b6995fc5723a65d270dd1a631beb78.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! double*zcovector operator */ -inline _zcovector operator*(const double& d, const zcovector& vec) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =d*vec.array[i]; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/2b/2b6f12daf4dfe0901aa8aee173f2b7875362156b.svn-base b/cpplapack-r198/.svn/pristine/2b/2b6f12daf4dfe0901aa8aee173f2b7875362156b.svn-base deleted file mode 100644 index a90254a81b077b9b04b1b74f4e7930bd68decb72..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2b/2b6f12daf4dfe0901aa8aee173f2b7875362156b.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -<p> -Let A, B, C, and X be the dgematrix objects, -and A, B, and C be the same size and initialized properly. -</p> - -<!----------------------------------------------------------------------------> -<center><table border="3"> -<caption align="top"> -Calculation Procedures to Process "X=A*B+C;"</caption> -<tr> - <td></td> - <td>CPPLapack</td> - <td>ordinary matrix libraries</td> -</tr> - -<tr> - <td>operator*</td> - <td>calculate A*B, and put it to a local _dgematrix object P to return</td> - <td>calculate A*B, and put it to a local dgematrix object P to return</td> -</tr> - -<tr> - <td>passing of returned object</td> - <td>make a temporary _dgematrix object Q as the shallow copy of P</td> - <td>make a temporary dgematrix object Q as the deep copy of P</td> -</tr> - -<tr> - <td>destructor for local object</td> - <td>destruct local object P without deleting the array data</td> - <td>destruct local object P with deleting the array data</td> -</tr> - -<tr> - <td>operator+</td> - <td>add C into Q, and return Q.</td> - <td>calculate C+Q and, put it to a local dgematrix object R to return.</td> -</tr> - -<tr> - <td>passing of returned object</td> - <td>make a temporary _dgematrix object R as the shallow copy of Q</td> - <td>make a temporary dgematrix object S as the deep copy of R</td> -</tr> - -<tr> - <td>destructor for local object</td> - <td>destruct local object Q without deleting the array data</td> - <td>destruct local object R with deleting the array data</td> -</tr> - -<tr> - <td>operator=</td> - <td>set the array address of X to that of R</td> - <td>copy whole the data of S to X</td> -</tr> - -<tr> - <td>implicit destructer (;)</td> - <td>destruct the temporary object R without deleting the array data</td> - <td>destruct the temporary objects Q and S with deleting the array data</td> -</tr> - -</table></center> -<!----------------------------------------------------------------------------> - -<p> -CPPLapack does not consume any extra memory space -using its original "Smart-Temporary" system. -On the other hand, ordinary matrix libraries always generate useless -temporary objects implicitly and consume a lot of extra memory space. -CPPLapack is efficient not only in computing speed -but also in saving memory space. -</p> - - -<p> -[NOTE] -Recent advanced compilers automatically optimize -the way of passing returned objects. -The steps shown above is the case of the most primitive compiler. -The performance of ordinary matrix libraries using advanced compilers -becomes close to the performance of CPPLapack. -However, CPPLapack still has some advantages in terms of -the stepwise elimination, minimization of the number of temporary objects, -and so on. -</p> - diff --git a/cpplapack-r198/.svn/pristine/2b/2be10ba837cf4ad0ffabe9ea9c987061e74f5495.svn-base b/cpplapack-r198/.svn/pristine/2b/2be10ba837cf4ad0ffabe9ea9c987061e74f5495.svn-base deleted file mode 100644 index c39e5551d8dbe325cd42d6f6416427281980722a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2b/2be10ba837cf4ad0ffabe9ea9c987061e74f5495.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -//============================================================================= -/*! _dgbmatrix constructor */ -inline _dgbmatrix::_dgbmatrix() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - kl =0; - ku =0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! _dgbmatrix copy constructor */ -inline _dgbmatrix::_dgbmatrix(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _dgbmatrix destructor */ -inline _dgbmatrix::~_dgbmatrix() -{CPPL_VERBOSE_REPORT; - delete[] array; - delete[] darray; -} diff --git a/cpplapack-r198/.svn/pristine/2b/2bf67a858516cf7d96ce5e858ce5139e562a4f1c.svn-base b/cpplapack-r198/.svn/pristine/2b/2bf67a858516cf7d96ce5e858ce5139e562a4f1c.svn-base deleted file mode 100644 index 0e8b59807cdb107a6a93a124e7d7c2f861f26149..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2b/2bf67a858516cf7d96ce5e858ce5139e562a4f1c.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+zgematrix operator */ -/* -inline _zgematrix operator+(const _zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix-zgematrix operator */ -/* -inline _zgematrix operator-(const _zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix*zgematrix operator */ -/* -inline _zgematrix operator*(const _zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/2c/2c46db2c0d06cbc4b1393dec7f38c42fc8076f2e.svn-base b/cpplapack-r198/.svn/pristine/2c/2c46db2c0d06cbc4b1393dec7f38c42fc8076f2e.svn-base deleted file mode 100644 index 3ddffb8f1b31311deeb1e438deb586970e2b7a15..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2c/2c46db2c0d06cbc4b1393dec7f38c42fc8076f2e.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _zgematrix::nullify() const -{CPPL_VERBOSE_REPORT; - m=0; - n=0; - array=NULL; - darray=NULL; -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _zgematrix::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; - array=NULL; - darray=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/2c/2c7c22484ba72868dd47e115b37f350fc3c72ac8.svn-base b/cpplapack-r198/.svn/pristine/2c/2c7c22484ba72868dd47e115b37f350fc3c72ac8.svn-base deleted file mode 100644 index 531e5a51a21668bffb252acdf504c44285cbb679..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2c/2c7c22484ba72868dd47e115b37f350fc3c72ac8.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -//============================================================================= -/*! _dgematrix+_dgematrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =matA.m*matA.n; - for(CPPL_INT i=0; i<mn; i++){ - matA.array[i]+=matB.array[i]; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix-_dgematrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =matA.m*matA.n; - for(CPPL_INT i=0; i<mn; i++){ - matA.array[i]-=matB.array[i]; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix*_dgematrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - double alpha =1.; - double beta =0.; - - dgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/2c/2c85e0e11bf1860dcbe434890264e9e0910262c8.svn-base b/cpplapack-r198/.svn/pristine/2c/2c85e0e11bf1860dcbe434890264e9e0910262c8.svn-base deleted file mode 100644 index a1f3c49d7bb5b95782f7f7e3e43c4ec872740c27..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2c/2c85e0e11bf1860dcbe434890264e9e0910262c8.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(5); - - //////// A //////// - CPPL::dssmatrix A(N); - A.put(0,0, 1.); - A.put(3,2, 2.); - A.put(1,3, 3.); - A.put(3,4, 4.); - A.put(1,2, 5.); - A.put(2,2, 6.); - A.put(4,1, 7.); - A.put(1,1, 8.); - std::cout << "A =\n" << A << std::endl; - - //////// B //////// - CPPL::dssmatrix B(A); - for(int i=0; i<B.n; i++){ - B.del(i,i); - } - std::cout << "B =\n" << B << std::endl; - - //////// reorder A //////// - //A.checkup(); - std::cout << "==============================================" << std::endl; - A.reorder(0); - A.checkup(); - - std::cout << "##############################################" << std::endl; - - //////// reorder B //////// - //B.checkup(); - std::cout << "==============================================" << std::endl; - B.reorder(1); - B.checkup(); - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/2c/2ce0ac4e236c8ba3ee5c4f25c4574dc36d1da324.svn-base b/cpplapack-r198/.svn/pristine/2c/2ce0ac4e236c8ba3ee5c4f25c4574dc36d1da324.svn-base deleted file mode 100644 index d1ccf1e95e1ad17a239214ae843e9d2858fc4fef..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2c/2ce0ac4e236c8ba3ee5c4f25c4574dc36d1da324.svn-base +++ /dev/null @@ -1,328 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void zgsmatrix::clear() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - data.clear(); - rows.clear(); - cols.clear(); -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline zgsmatrix& zgsmatrix::zero() -{CPPL_VERBOSE_REPORT; - data.resize(0); - for(CPPL_INT i=0; i<m; i++){ rows[i].resize(0); } - for(CPPL_INT j=0; j<n; j++){ cols[j].resize(0); } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline zgsmatrix& zgsmatrix::identity() -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "Only square matrix can be a identity matrix." << std::endl - << "The matrix size was " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zero(); - for(CPPL_INT i=0; i<m; i++){ - put(i,i, comple(1.,0.)); - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void zgsmatrix::chsign() -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v =-it->v; - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void zgsmatrix::copy(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - data =mat.data; - rows =mat.rows; - cols =mat.cols; -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void zgsmatrix::shallow_copy(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); - - m =mat.m; - n =mat.n; - data.swap(mat.data); - rows.swap(mat.rows); - cols.swap(mat.cols); - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline zgsmatrix& zgsmatrix::resize(const CPPL_INT& _m, const CPPL_INT& _n, const CPPL_INT _c, const CPPL_INT _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _c<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl - << "Your input was (" << _m << "," << _n << "," << _c << "," << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - m =_m; - n =_n; - data.resize(0); - data.reserve(_c); - rows.resize(m); - for(CPPL_INT i=0; i<m; i++){ - rows[i].resize(0); - rows[i].reserve(_l); - } - cols.resize(n); - for(CPPL_INT i=0; i<n; i++){ - cols[i].resize(0); - cols[i].reserve(_l); - } - - return *this; -} - -//============================================================================= -/*! stretch the matrix size */ -inline void zgsmatrix::stretch(const CPPL_INT& dm, const CPPL_INT& dn) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( m+dm<0 || n+dn<0 ){ - ERROR_REPORT; - std::cerr << "The new matrix size must be larger than zero. " << std::endl - << "Your input was (" << dm << ", " << dn << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// zero //////// - if(dm==0 && dn==0){ return; } - - //////// non-zero //////// - m +=dm; - n +=dn; - - //// for rows //// - if(dm<0){ - //// delete components over the new size //// - const std::vector<zcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<zcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( it->i>=m ){ del( CPPL_INT(data_rend-it-1) ); } - } - //// shrink rows //// - for(CPPL_INT i=0; i<-dm; i++){ - rows.pop_back(); - } - } - else{//dm>0 - //// expand rows //// - for(CPPL_INT i=0; i<dm; i++){ - rows.push_back( std::vector<CPPL_INT>(0) ); - } - } - - //// for cols //// - if(dn<0){ - //// delete components over the new size //// - const std::vector<zcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<zcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( it->j>=n ){ del( CPPL_INT(data_rend-it-1) ); } - } - for(CPPL_INT j=0; j<-dn; j++){ - cols.pop_back(); - } - } - else{//dn>0 - //// expand cols //// - for(CPPL_INT j=0; j<dn; j++){ - cols.push_back( std::vector<CPPL_INT>(0) ); - } - } -} - -//============================================================================= -/*! check if the component is listed */ -inline bool zgsmatrix::isListed(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<CPPL_INT>::const_iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::const_iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if( data[*p].j==j ){ return 1; } - } - - return 0; -} - -//============================================================================= -/*! return the element number of the component */ -inline CPPL_INT zgsmatrix::number(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if( data[*p].j==j ){ return *p; } - } - - return -1; -} - -//============================================================================= -/*! erase components less than DBL_MIN */ -inline void zgsmatrix::diet(const double eps) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<zcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( fabs(it->v.real())<eps && fabs(it->v.imag())<eps ){ del( CPPL_INT(data_rend-it-1) ); } - } -} - -//============================================================================= -/*! health checkup */ -inline void zgsmatrix::checkup() -{CPPL_VERBOSE_REPORT; - //////////////// data //////////////// - //////// check i,j //////// - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - if( it->i>=m || it->j>=n ){ - ERROR_REPORT; - std::cerr << "A component, (" << it->i << ", " << it->j << "), is out of matrix size." << std::endl; - exit(1); - } - } - //////// check double listing //////// - - //////////////// rows //////////////// - //////////////// cols //////////////// - - //////////////// NOTE //////////////// - std::cerr << "# [NOTE] zgsmatrix::checkup(): This sparse matrix is fine." << std::endl; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _zrovector zgsmatrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector vec( zrovector(n).zero() ); - - const std::vector<CPPL_INT>::const_iterator rows__m_end =rows[_m].end(); - for(std::vector<CPPL_INT>::const_iterator p=rows[_m].begin(); p!=rows__m_end; p++){ - vec(data[*p].j) =data[*p].v; - } - - return _(vec); -} - -//============================================================================= -/*! get column of the matrix */ -inline _zcovector zgsmatrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector vec( zcovector(m).zero() ); - - const std::vector<CPPL_INT>::const_iterator cols__n_end =cols[_n].end(); - for(std::vector<CPPL_INT>::const_iterator p=cols[_n].begin(); p!=cols__n_end; p++){ - vec(data[*p].i) =data[*p].v; - } - - return _(vec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(zgsmatrix& A, zgsmatrix& B) -{CPPL_VERBOSE_REPORT; - std::swap(A.n,B.n); - std::swap(A.m,B.m); - std::swap(A.data,B.data); - std::swap(A.rows,B.rows); - std::swap(A.cols,B.cols); -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _zgsmatrix _(zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - _zgsmatrix newmat; - - //////// shallow copy //////// - newmat.n =mat.n; - newmat.m =mat.m; - std::swap(newmat.data,mat.data); - std::swap(newmat.rows,mat.rows); - std::swap(newmat.cols,mat.cols); - - //////// nullify //////// - mat.m =0; - mat.n =0; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/2c/2ceccfcd981b0195a84f1f0f188258e8de1eb2db.svn-base b/cpplapack-r198/.svn/pristine/2c/2ceccfcd981b0195a84f1f0f188258e8de1eb2db.svn-base deleted file mode 100644 index efa2f654c9de392ccc43e4f69b7e1d344c67ca5e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2c/2ceccfcd981b0195a84f1f0f188258e8de1eb2db.svn-base +++ /dev/null @@ -1,100 +0,0 @@ -//============================================================================= -//! Samll Real Double-precision General Dence Matrix Class -template<CPPL_INT m, CPPL_INT n> class dgematrix_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - double array[m*n]; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dgematrix_small(); - inline explicit dgematrix_small(const dgematrix&); - inline ~dgematrix_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _dgematrix to_dgematrix() const; - - //////// io //////// - inline double& operator()(const CPPL_INT& i, const CPPL_INT& j); - inline double operator()(const CPPL_INT& i, const CPPL_INT& j) const; - inline dgematrix_small<m,n>& set(const CPPL_INT& i, const CPPL_INT& j, const double& v); - template<CPPL_INT _m, CPPL_INT _n> inline friend std::ostream& operator<<(std::ostream&, const dgematrix_small<_m,_n>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// calc //////// -#ifndef _MSC_VER - template<CPPL_INT _m, CPPL_INT _n> inline friend dgematrix_small<n,m> t(const dgematrix_small<m,n>&); - template<CPPL_INT _m, CPPL_INT _n> inline friend void idamax(CPPL_INT&, CPPL_INT&, const dgematrix_small&); - template<CPPL_INT _m, CPPL_INT _n> inline friend double damax(const dgematrix_small&); -#endif//_MSC_VER - - //////// misc //////// - inline dgematrix_small<m,n>& zero(); - inline dgematrix_small<m,n>& identity(); - inline dcovector_small<m> col(const CPPL_INT& j) const; - inline drovector_small<n> row(const CPPL_INT& i) const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT M, CPPL_INT N> inline dgematrix_small<M,N>& operator=(const dgematrix_small<M,N>&); - //////// += //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N>& operator+=(dgematrix_small<M,N>&, const dgematrix_small<M,N>&); - //////// -= //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N>& operator-=(dgematrix_small<M,N>&, const dgematrix_small<M,N>&); - //////// *= //////// - template<CPPL_INT M, CPPL_INT L, CPPL_INT N> inline friend dgematrix_small<M,N>& operator*=(dgematrix_small<M,L>&, const dgematrix_small<L,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N>& operator*=(dgematrix_small<M,N>&, const dsymatrix_small< N >&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N>& operator*=(dgematrix_small<M,N>&, const double&); - //////// /= //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N>& operator/=(dgematrix_small<M,N>&, const double&); - //////// unary //////// - template<CPPL_INT M, CPPL_INT N> inline friend const dgematrix_small<M,N>& operator+(const dgematrix_small<M,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator-(const dgematrix_small<M,N>&); - //////// + //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator+(const dgematrix_small<M,N>&, const dgematrix_small<M,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator+(const dgematrix_small<M,N>&, const dsymatrix_small< N >&); - //////// - //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator-(const dgematrix_small<M,N>&, const dgematrix_small<M,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator-(const dgematrix_small<M,N>&, const dsymatrix_small< N >&); - //////// * //////// - template<CPPL_INT M, CPPL_INT N> inline friend dcovector_small< M > operator*(const dgematrix_small<M,N>&, const dcovector_small< N >&); - template<CPPL_INT M, CPPL_INT L, CPPL_INT N> inline friend dgematrix_small<M,N> operator*(const dgematrix_small<M,L>&, const dgematrix_small<L,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator*(const dgematrix_small<M,N>&, const dsymatrix_small< N >&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator*(const dgematrix_small<M,N>&, const double&); - //////// / //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator/(const dgematrix_small<M,N>&, const double&); - //////// double //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator*(const double&, const dgematrix_small<M,N>&); - //////// hadamerd //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> hadamerd(const dgematrix_small<M,N>&, const dgematrix_small<M,N>&); - template<CPPL_INT N> inline friend dgematrix_small<N,N> hadamerd(const dgematrix_small<N,N>&, const dsymatrix_small< N >&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline double det(const dgemat2&); -inline dgemat2 inv(const dgemat2&); -inline dgemat2 rotate(const dgemat2&, const double&); -inline dgemat2 t2m(const double&); - -inline double det(const dgemat3&); -inline dgemat3 inv(const dgemat3&); -inline dgemat3 rotate(const dgemat3&, const dquater&); -inline dquater m2q(const dgemat3&); - -inline double det(const dgemat4&); -inline dgemat4 inv(const dgemat4&); diff --git a/cpplapack-r198/.svn/pristine/2d/2dc0b457f7ba35b0066d191578a8333a42f1c3f0.svn-base b/cpplapack-r198/.svn/pristine/2d/2dc0b457f7ba35b0066d191578a8333a42f1c3f0.svn-base deleted file mode 100644 index ead916d5faf47008207a17bdf7a7e36f3500f546..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2d/2dc0b457f7ba35b0066d191578a8333a42f1c3f0.svn-base +++ /dev/null @@ -1,81 +0,0 @@ -//============================================================================= -/*! zhsmatrix+_zgbmatrix operator */ -/* -inline _zgematrix operator+(const zhsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! zhsmatrix-_zgbmatrix operator */ -/* -inline _zgematrix operator-(const zhsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ - -//============================================================================= -/*! zhsmatrix*_zgbmatrix operator */ -/* -inline _zgematrix operator*(const zhsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=max(0,matA.jndx[c]-matB.kl); - j<min(matB.n,matA.jndx[c]+matB.ku+1); j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/2d/2dc9c4b87691aa85fe174ec3d63ad9fb5c0852f6.svn-base b/cpplapack-r198/.svn/pristine/2d/2dc9c4b87691aa85fe174ec3d63ad9fb5c0852f6.svn-base deleted file mode 100644 index 553a46ab691055abf590a9de1c66e11d68c0c25a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2d/2dc9c4b87691aa85fe174ec3d63ad9fb5c0852f6.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::dsymatrix A; - cout << "A || n=" << A.n << " array=" << A.array << " " << endl; - - - CPPL::dsymatrix B(N); - for(int i=0; i<B.n; i++){ for(int j=0; j<=i; j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - cout << "B || n=" << B.n << " array=" << B.array << " " << endl; - cout << B << endl; - - CPPL::dsymatrix C(B); - cout << "C || n=" << C.n << " array=" << C.array << " " << endl; - cout << C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/2e/2e303f99e74aa03243d0cb86068fab3813ed8ae5.svn-base b/cpplapack-r198/.svn/pristine/2e/2e303f99e74aa03243d0cb86068fab3813ed8ae5.svn-base deleted file mode 100644 index 8f45b4eb32963fd1da2e5b02888c8d6192f55001..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2e/2e303f99e74aa03243d0cb86068fab3813ed8ae5.svn-base +++ /dev/null @@ -1,97 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision Symmetric Matrix Class -class _dsymatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - //mutable CPPL_INT const& m; //!< matrix row size - CPPL_INT const& m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable double* array; //!< 1D array to store matrix data - mutable double** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _dsymatrix(); - inline _dsymatrix(const _dsymatrix&); - inline ~_dsymatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zhematrix to_zhematrix() const; - inline _dgematrix to_dgematrix() const; - inline _dssmatrix to_dssmatrix(const double=DBL_MIN) const; - - //////// io //////// - inline double& operator()(const CPPL_INT&, const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const dsymatrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - inline void complete() const; - - //////// calc //////// - inline friend _dsymatrix t(const _dsymatrix&); - inline friend _dsymatrix i(const _dsymatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const _dsymatrix&); - inline friend double damax(const _dsymatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _dsymatrix& operator+(const _dsymatrix&); - inline friend _dsymatrix operator-(const _dsymatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const _dsymatrix&, const dgematrix&); - inline friend _dgematrix operator+(const _dsymatrix&, const _dgematrix&); - inline friend _dsymatrix operator+(const _dsymatrix&, const dsymatrix&); - inline friend _dsymatrix operator+(const _dsymatrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const _dsymatrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const _dsymatrix&, const _dgbmatrix&); - inline friend _dgematrix operator+(const _dsymatrix&, const dgsmatrix&); - inline friend _dgematrix operator+(const _dsymatrix&, const _dgsmatrix&); - inline friend _dsymatrix operator+(const _dsymatrix&, const dssmatrix&); - inline friend _dsymatrix operator+(const _dsymatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const _dsymatrix&, const dgematrix&); - inline friend _dgematrix operator-(const _dsymatrix&, const _dgematrix&); - inline friend _dsymatrix operator-(const _dsymatrix&, const dsymatrix&); - inline friend _dsymatrix operator-(const _dsymatrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const _dsymatrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const _dsymatrix&, const _dgbmatrix&); - inline friend _dgematrix operator-(const _dsymatrix&, const dgsmatrix&); - inline friend _dgematrix operator-(const _dsymatrix&, const _dgsmatrix&); - inline friend _dsymatrix operator-(const _dsymatrix&, const dssmatrix&); - inline friend _dsymatrix operator-(const _dsymatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const _dsymatrix&, const dcovector&); - inline friend _dcovector operator*(const _dsymatrix&, const _dcovector&); - inline friend _dgematrix operator*(const _dsymatrix&, const dgematrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const _dgbmatrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const dgsmatrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const _dgsmatrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const dssmatrix&); - inline friend _dgematrix operator*(const _dsymatrix&, const _dssmatrix&); - inline friend _dsymatrix operator*(const _dsymatrix&, const double&); - - //////// / //////// - inline friend _dsymatrix operator/(const _dsymatrix&, const double&); - - //////// double //////// - inline friend _dsymatrix operator*(const double&, const _dsymatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/2e/2e356455d5486c38799bd9d9bb622ed119f335f5.svn-base b/cpplapack-r198/.svn/pristine/2e/2e356455d5486c38799bd9d9bb622ed119f335f5.svn-base deleted file mode 100644 index 42b8cb0daca3add90e01f29dc728546f86dc7496..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2e/2e356455d5486c38799bd9d9bb622ed119f335f5.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! zhematrix*zcovector operator */ -inline _zcovector operator*(const zhematrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/2e/2e52bd51319869d1a511a4b712d08ba58c1521a9.svn-base b/cpplapack-r198/.svn/pristine/2e/2e52bd51319869d1a511a4b712d08ba58c1521a9.svn-base deleted file mode 100644 index 93d65223d8b6a48b58e7a16be90f6eefd1ac067a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2e/2e52bd51319869d1a511a4b712d08ba58c1521a9.svn-base +++ /dev/null @@ -1,123 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -CPPL::dcovector solve -( - const CPPL::dsymatrix& A, - const CPPL::dcovector& inv_D, - const CPPL::dcovector& y - ) -{ - CPPL::dcovector z(y.l); - for(long i=0; i<y.l; i++){ - double sum_lz(0.0); - for(long j=0; j<i; j++){ sum_lz +=A(i,j)*z(j); } - z(i) =inv_D(i)*(y(i)-sum_lz); - } - - CPPL::dcovector x(y.l); - for(long i=y.l-1; i>=0; i--){ - double sum_ux(0.0); - for(long j=y.l-1; j>i; j--){ sum_ux +=A(i,j)*x(j); } - x(i) =z(i) -inv_D(i)*sum_ux; - } - - return x; -} - -//============================================================================= -bool dilucg -( - const CPPL::dsymatrix& A, - CPPL::dcovector& x, - const double& eps -) -{ - CPPL::dcovector inv_D(x.l); - for(long i=0; i<x.l; i++){ inv_D(i)=A(i,i); } - for(long i=0; i<x.l; i++){ - inv_D(i) =1./inv_D(i); - for(long j=i+1; j<x.l; j++){ - inv_D(j) -=pow(A(i,j),2)*inv_D(i); - } - } - //inv_D.write("inv_D"); - - double alpha, beta, rho(1.0), rho2; - const CPPL::dcovector y(x); - CPPL::dcovector z, r(x), p(x.l), q; - x.zero(); p.zero(); - - int itc(0); - const int itmax(2*x.l); - while(fabs(damax(r))>eps && ++itc<itmax){ - std::cout << itc << " " << fabs(damax(r)) << " " << fabs(damax(y-A*x)) << " " << rho << std::endl; - z =solve(A,inv_D,r); - - rho2=r%z; - beta=rho2/rho; - rho=rho2; - - p =z +beta*p; - q =A*p; - alpha=rho/(p%q); - - x+=alpha*p; - r-=alpha*q; - } - std::cerr << "itc=" << itc << " fabs(damax(r))=" << fabs(damax(r)) << std::endl; - - if(itc<itmax){ return 0; } - else{ return 1; } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - srand(time(NULL)); - - const int size(100); - CPPL::dsymatrix A(size); - - for(int i=0; i<size; i++){ - for(int j=0; j<=i; j++){ - A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; - } - A(i,i)+=10.; - } - A.write("A.dsymatrix"); - - CPPL::dcovector x(size); - for(int i=0; i<size; i++){ - x(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - x.write("answer.dcovector");//solution - std::cerr << "answer=\n" << t(x) << std::endl; - - CPPL::dcovector y(size); - y=A*x; - y.write("y.dcovector"); - - double eps(fabs(damax(y))*1e-6); - //std::cerr << "eps=" << eps << std::endl; - if( dilucg(A, y, eps) ){ - std::cerr << "failed." << std::endl; - exit(1); - } - y.write("solution.dcovector"); - std::cout << "solution=\n" << t(y) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/2e/2e5ccc487bebf29b1f0299106f3948823181ab92.svn-base b/cpplapack-r198/.svn/pristine/2e/2e5ccc487bebf29b1f0299106f3948823181ab92.svn-base deleted file mode 100644 index 9841ec82310bfe5f2b39a970bba9e9b898c755ee..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2e/2e5ccc487bebf29b1f0299106f3948823181ab92.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -//============================================================================= -/*! _zgematrix constructor without arguments */ -inline _zgematrix::_zgematrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! _zgematrix copy constructor */ -inline _zgematrix::_zgematrix(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =mat.m; - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix destructor */ -inline _zgematrix::~_zgematrix() -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/2e/2ea2a05f69597f31d35b452aed2f9731d2a1f8c1.svn-base b/cpplapack-r198/.svn/pristine/2e/2ea2a05f69597f31d35b452aed2f9731d2a1f8c1.svn-base deleted file mode 100644 index 7731cfc4c1926e05ebe2cd90b24ad040e9f1156f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2e/2ea2a05f69597f31d35b452aed2f9731d2a1f8c1.svn-base +++ /dev/null @@ -1,425 +0,0 @@ -//============================================================================= -/*! convert drovector_small to drovector */ -template<CPPL_INT l> -inline _drovector drovector_small<l>::to_drovector() const -{CPPL_VERBOSE_REPORT; - drovector vec(l); - for(CPPL_INT k=0; k<l; k++){ - vec(k)=(*this)(k); - } - return _(vec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT l> -inline double& drovector_small<l>::operator()(const CPPL_INT& k) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT l> -inline double drovector_small<l>::operator()(const CPPL_INT& k) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! set function */ -template<CPPL_INT l> -inline drovector_small<l>& drovector_small<l>::set(const CPPL_INT& k, const double& v) -{CPPL_VERBOSE_REPORT; - (*this)(k) =v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT l> -inline std::ostream& operator<<(std::ostream& s, const drovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<l; i++){ - s << " " << A(i) << std::flush; - } - s << std::endl; - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT l> -inline void drovector_small<l>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#drovector" << " " << l << std::endl; - for(CPPL_INT k=0; k<l; k++){ - ofs << (*this)(k) << " "; - } - ofs << std::endl; - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT l> -inline void drovector_small<l>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "drovector" && id != "#drovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not drovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _l; - s >> _l; - if(l!=_l){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - for(CPPL_INT k=0; k<l; k++){ - s >> (*this)(k); - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id;//tmp - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return transposed column vector */ -template<CPPL_INT n> -inline dcovector_small<n> t(const drovector_small<n>& A) -{CPPL_VERBOSE_REPORT; - dcovector_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - X(i)=A(i); - } - return X; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline double nrm2(const drovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - double v(0.); - for(CPPL_INT i=0; i<l; i++){ - v+=A(i)*A(i); - } - return std::sqrt(v); -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline void idamax(CPPL_INT& K, const drovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - double max(-1.); - for(int k=0; k<l; k++){ - if( max<fabs(A(k)) ){ - K=k; - max =fabs(A(k)); - } - } - return; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline double damax(const drovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - CPPL_INT k(0); - idamax(k,A); - return A(k); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l>& drovector_small<l>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<l; k++){ - array[k] =0.; - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l>& operator+=(drovector_small<l>& A, const drovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) +=B(i); - } - return A; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l>& operator-=(drovector_small<l>& A, const drovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) -=B(i); - } - return A; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l>& operator*=(drovector_small<l>& A, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) *=d; - } - return A; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l>& operator/=(drovector_small<l>& A, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) /=d; - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary */ -template<CPPL_INT l> -inline const drovector_small<l>& operator+(const drovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary */ -template<CPPL_INT l> -inline drovector_small<l> operator-(const drovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - drovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =-A(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l> operator+(const drovector_small<l>& A, const drovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - drovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)+B(i); - } - return X; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l> operator-(const drovector_small<l>& A, const drovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - drovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)-B(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline double operator*(const drovector_small<l>& A, const dcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - double x =0.; - for(CPPL_INT i=0; i<l; i++){ - x +=A(i)*B(i); - } - return x; -} - -//============================================================================= -/*! */ -template<CPPL_INT m, CPPL_INT n> -inline drovector_small<n> operator*(const drovector_small<m>& A, const dgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - drovector_small<n> C; - C.zero(); - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=0; i<m; i++){ - C(j) +=A(i)*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l> operator*(const drovector_small<l>& A, const dsymatrix_small<l>& B) -{CPPL_VERBOSE_REPORT; - drovector_small<l> C; - C.zero(); - for(CPPL_INT j=0; j<l; j++){ - for(CPPL_INT i=0; i<j; i++){ - C(j) +=A(i)*B(j,i); - } - for(CPPL_INT i=j; i<l; i++){ - C(j) +=A(i)*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l> operator*(const drovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - drovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)*v; - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! */ -template<CPPL_INT l> -inline drovector_small<l> operator/(const drovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - drovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)/v; - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector_small%drovector_small (inner product) operator */ -template<CPPL_INT l> -inline double operator%(const drovector_small<l>& A, const drovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - double v(0.); - for(CPPL_INT i=0; i<l; i++){ - v +=A(i)*B(i); - } - return v; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT l> -inline drovector_small<l> hadamard(const drovector_small<l>& A, const drovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - drovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)*B(i); - } - return C; -} diff --git a/cpplapack-r198/.svn/pristine/2e/2edf659211225752b491efd0e47a4442fb5a970e.svn-base b/cpplapack-r198/.svn/pristine/2e/2edf659211225752b491efd0e47a4442fb5a970e.svn-base deleted file mode 100644 index ad9f8aa0318fe2808ae77d0ee39f1b62dc73a15e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2e/2edf659211225752b491efd0e47a4442fb5a970e.svn-base +++ /dev/null @@ -1,240 +0,0 @@ -//============================================================================= -/*! zgbmatrix=_zgbmatrix operator */ -inline zgbmatrix& zgbmatrix::operator=(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix+=_zgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline zgbmatrix& zgbmatrix::operator+=(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) += mat(i,j); - } - } - - mat.destroy(); - return *this; - } - else{ - zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j) += operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j) += mat(i,j); - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; - } -} - -//============================================================================= -/*! zgbmatrix-=_zgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline zgbmatrix& zgbmatrix::operator-=(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - mat.destroy(); - return *this; - } - else{ - zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j) += operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j) -= mat(i,j); - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; - } -} - -//============================================================================= -/*! zgbmatrix*=_zgbmatrix operator */ -inline zgbmatrix& zgbmatrix::operator*=(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-kl), std::max(CPPL_INT(0),j-mat.ku) ); k<kmax; k++){ - newmat(i,j) += operator()(i,k)*mat(k,j); - } - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix+_zgbmatrix operator */ -inline _zgbmatrix operator+(const zgbmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matB.kl>matA.kl && matB.ku>matA.ku){ - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) += matA(i,j); - } - } - return matB; - } - - else{ - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) += matB(i,j); - } - } - - matB.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! zgbmatrix-_zgbmatrix operator */ -inline _zgbmatrix operator-(const zgbmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix*_zgbmatrix operator */ -inline _zgbmatrix operator*(const zgbmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/2f/2f06eb2a0d1bdd7636b58ef2e6eeb114102de1dd.svn-base b/cpplapack-r198/.svn/pristine/2f/2f06eb2a0d1bdd7636b58ef2e6eeb114102de1dd.svn-base deleted file mode 100644 index b75fc3de8d454e5ac984519a42f17bcde5d3e5f7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2f/2f06eb2a0d1bdd7636b58ef2e6eeb114102de1dd.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix _zhematrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat(n,n); - - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<n; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/2f/2f524bd95d1ead8ca1adb3e5cc04acb062c9402f.svn-base b/cpplapack-r198/.svn/pristine/2f/2f524bd95d1ead8ca1adb3e5cc04acb062c9402f.svn-base deleted file mode 100644 index 68254b0682d26eea83ca32762d0ba5a28539ea2e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2f/2f524bd95d1ead8ca1adb3e5cc04acb062c9402f.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -#undef CPPL_VERBOSE -#undef CPPL_DEBUG - -//============================================================================= -#include "cpplapack.h" -#include <cstring> -#include <ctime> - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - int size(3000); - CPPL::dgematrix A(size,size); - - srand(unsigned(time(NULL))); - for(int i=0; i<size; i++){ for(int j=0; j<size; j++){ - A(i,j) =double(rand())/double(RAND_MAX); - }} - - clock_t t0, t1, t2, t3; - /* - t0=clock(); - - A.zero(); - - t1=clock(); - - for(int i=0; i<size*size; i++){ - A.array[i] =0.; - } - */ - t2=clock(); - - memset(A.array, 0, size*size*sizeof(double)); - - t3=clock(); - A.write("aho"); - - std::cout << "\"A.zero()\" took "<< (1000./CLOCKS_PER_SEC)*(t1-t0) << "[ms]." << std::endl; - std::cout << "\"loop\" took "<< (1000./CLOCKS_PER_SEC)*(t2-t1) << "[ms]." << std::endl; - std::cout << "\"memset\" took "<< (1000./CLOCKS_PER_SEC)*(t3-t2) << "[ms]." << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/2f/2f95513f787d6ad3e9b92f00d44b7be77133d0c7.svn-base b/cpplapack-r198/.svn/pristine/2f/2f95513f787d6ad3e9b92f00d44b7be77133d0c7.svn-base deleted file mode 100644 index 79d4ec8f27ef3b215042a8abef101390fe510560..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2f/2f95513f787d6ad3e9b92f00d44b7be77133d0c7.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! zgsmatrix+zgbmatrix operator */ -inline _zgematrix operator+(const zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) +=matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix-zgbmatrix operator */ -inline _zgematrix operator-(const zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -=matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix*zgbmatrix operator */ -inline _zgematrix operator*(const zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/2f/2fadc4694aac62d5712f342b16432be5b87cb9fc.svn-base b/cpplapack-r198/.svn/pristine/2f/2fadc4694aac62d5712f342b16432be5b87cb9fc.svn-base deleted file mode 100644 index fb2660ac6155e77ccd4225a2e7da607427737ebf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2f/2fadc4694aac62d5712f342b16432be5b87cb9fc.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -//============================================================================= -/*! dcovector=dcovector operator */ -inline dcovector& dcovector::operator=(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - if(array!=vec.array){ // if it is NOT self substitution - copy(vec); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector+=dcovector operator */ -inline dcovector& dcovector::operator+=(const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]+=vec.array[i]; } - - return *this; -} - -//============================================================================= -/*! dcovector operator-= */ -inline dcovector& dcovector::operator-=(const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]-=vec.array[i]; } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector+dcovector operator */ -inline _dcovector operator+(const dcovector& vecA, const dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - dcovector newvec(vecA.l); - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]+vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! dcovector-dcovector operator */ -inline _dcovector operator-(const dcovector& vecA, const dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(vecA.l); - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]-vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! dcovector^T*dcovector operator (inner product) */ -inline double operator%(const dcovector& vecA, const dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - - double val( ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ) ); - - return val; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return Hadamerd product */ -inline _dcovector hadamerd(const dcovector& vecA, const dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( vecA.l!=vecB.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make Hadamerd product." << std::endl - << "Your input was (" << vecA.l << ") and (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(vecA.l); - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec(i) =vecA(i)*vecB(i); - } - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/2f/2fe1cacde9aaef4456f54ff6398127bd4c518d62.svn-base b/cpplapack-r198/.svn/pristine/2f/2fe1cacde9aaef4456f54ff6398127bd4c518d62.svn-base deleted file mode 100644 index 80203417c5200799f2cf82f47d038d146913f80a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/2f/2fe1cacde9aaef4456f54ff6398127bd4c518d62.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -MAKEFILE=$HOME/local/cpplapack/makefiles/Makefile -rootdir=`pwd` -logfile="$rootdir/do.log" -rm -f $logfile -echo "writing in $logfile" - -for i in `find * -type d | grep -v .svn`; do - if [ -d $i ]; then - echo "################ Enter into $i/ ################" >> $logfile 2>&1 || exit 1 - cd $i || exit 1 - if [ -f SUCCEEDED ]; then - echo "======== Skipping cause already succeeded ========" >> $logfile 2>&1 || exit 1 - elif [ -f main.cpp ]; then - echo "======== Making ========" >> $logfile 2>&1 || exit 1 - make -f $MAKEFILE fullclean >> $logfile 2>&1 || exit 1 - make -f $MAKEFILE debug >> $logfile 2>&1 || exit 1 - echo "======== Executing ./A.OUT ========" >> $logfile 2>&1 || exit 1 - valgrind ./A.OUT >> $logfile 2>&1 || exit 1 - make -f $MAKEFILE fullclean >> $logfile 2>&1 || exit 1 - echo "======== Succeeded ========" >> $logfile 2>&1 || exit 1 - touch SUCCEEDED - else - echo "======== No main.cpp ========" >> $logfile 2>&1 || exit 1 - fi - cd $rootdir - echo "################ Exit from $i/ ################" >> $logfile 2>&1 || exit 1 - fi -done diff --git a/cpplapack-r198/.svn/pristine/30/30c88ec14047d3953b0ba8c2749200be2dc43521.svn-base b/cpplapack-r198/.svn/pristine/30/30c88ec14047d3953b0ba8c2749200be2dc43521.svn-base deleted file mode 100644 index f803259c370e5902a59798a5fa269af7f416c6b3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/30/30c88ec14047d3953b0ba8c2749200be2dc43521.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -//============================================================================= -/*! dgrmatrix*_dcovector operator */ -inline _dcovector operator*(const dgrmatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector VEC =vec; - dcovector newvec =mat*VEC; - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/31/312c9f7246bcd8a1d836adf1c05efc5ccbc3713a.svn-base b/cpplapack-r198/.svn/pristine/31/312c9f7246bcd8a1d836adf1c05efc5ccbc3713a.svn-base deleted file mode 100644 index 688ddf6fcb9c430016a5f229a55ccd938be18d43..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/31/312c9f7246bcd8a1d836adf1c05efc5ccbc3713a.svn-base +++ /dev/null @@ -1,116 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+dgbmatrix operator */ -inline _dgbmatrix operator+(const _dgbmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>=matB.kl && matA.ku>=matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) += matB(i,j); - } - } - - return matA; - } - - else{ - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) += matB(i,j); - } - } - - matA.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! _dgbmatrix-dgbmatrix operator */ -inline _dgbmatrix operator-(const _dgbmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>=matB.kl && matA.ku>=matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) -= matB(i,j); - } - } - - return matA; - } - - else{ - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); - } -} - -//============================================================================= -/*! _dgbmatrix*dgbmatrix operator */ -inline _dgbmatrix operator*(const _dgbmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/31/31408c1a29f79450f06410f319488ced2868442e.svn-base b/cpplapack-r198/.svn/pristine/31/31408c1a29f79450f06410f319488ced2868442e.svn-base deleted file mode 100644 index 4ee4ffd567c11ab7738d7231284e451b98769cf5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/31/31408c1a29f79450f06410f319488ced2868442e.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(4), KL(3), KU(2); - - CPPL::zgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - }} - - cout << "A =\n" << A << endl; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ - cout << "A(" << i << "," << j << ") =" << A(i,j) << endl; - } - }} - - - - const CPPL::zgbmatrix B(A); - cout << "B =\n" << B << endl; - - //B*=10.; //compile error - //B(0,0)=0.; //compile error - - //cout << "A+B=\n" << A+B << endl; - - //// write/read //// - B.write( "tmp.txt" ); - CPPL::zgbmatrix C; - C.read( "tmp.txt" ); - cout << "C-B =\n" << C-B << "<-Should be zero." << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/31/31dc12899c3bf351979822817b26c562e1940073.svn-base b/cpplapack-r198/.svn/pristine/31/31dc12899c3bf351979822817b26c562e1940073.svn-base deleted file mode 100644 index dd227673a6176ff789700ead5fe83cc8ce1bd6a2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/31/31dc12899c3bf351979822817b26c562e1940073.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! zgematrix*=comple operator */ -inline zgematrix& zgematrix::operator*=(const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =m*n; - CPPL_INT inc =1; - zscal_(&size, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zgematrix/=comple operator */ -inline zgematrix& zgematrix::operator/=(const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =m*n; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&size, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix*comple operator */ -inline _zgematrix operator*(const zgematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m, mat.n); - - const CPPL_INT size =mat.m*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix/comple operator */ -inline _zgematrix operator/(const zgematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m, mat.n); - - const CPPL_INT size =mat.m*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/32/322355965d2607b757119b9faebd2aae77c69239.svn-base b/cpplapack-r198/.svn/pristine/32/322355965d2607b757119b9faebd2aae77c69239.svn-base deleted file mode 100644 index b25cf084d8b5a6bad56d40ac41788999583ed2f5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/32/322355965d2607b757119b9faebd2aae77c69239.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! +dssmatrix operator */ -inline const dssmatrix& operator+(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -dssmatrix operator */ -inline _dssmatrix operator-(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - dssmatrix newmat(mat); - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v =-it->v; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/32/32bd1f8143bcf2b4d0e5cf98b9d8789c05fbd75d.svn-base b/cpplapack-r198/.svn/pristine/32/32bd1f8143bcf2b4d0e5cf98b9d8789c05fbd75d.svn-base deleted file mode 100644 index 3476e51d9f6d37e890f7accb12e64a84b26d8639..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/32/32bd1f8143bcf2b4d0e5cf98b9d8789c05fbd75d.svn-base +++ /dev/null @@ -1,155 +0,0 @@ -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h3>Ideas of Implementation</h3> -<p> -The sparse-matrix classes of CPPLapack is designed in the following policies. -<ul> -<li>The matrix data must be stored continuously in the memory space. -The link-list is not adopted because it is too slow.</li> -<li>The put and del operation of a component should not come with the relocation of the matrix data as the push_back and pop_back functions of std::vector always do.</li> -</ul> -</p> - -<p> -Each sparse-matrix object has the following important member variables. -<center><table border="3"> -<tr> - <td><code>int cap</code></td> - <td>size of matrix data array (capacity of the number of components)</td> -</tr> -<tr> - <td><code>int vol</code></td> - <td>current volume of array size (current number of non-zero component)</td> -</tr> -<tr> - <td><code>int* indx</code></td> - <td>row index of matrix data</td> -</tr> -<tr> - <td><code>int* jndx</code></td> - <td>column index of matrix data</td> -</tr> -</table></center> - -<p> -The size of <code>array</code> is determined by <code>cap</code>. -The volume of the matrix <code>vol</code> is changed each time when a non-zero component is put or deleted. -</p> - -<p> -For example, <code>CPPL::dssmatrix A(m,n,cap);</code> makes a <code>m</code>x<code>n</code> matrix <code>A</code> which has <code>cap</code> free data space. -Its <code>vol</code> is automatically set to zero in this case. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h3>"put" and "fput"</h3> -<p> -To assign a value to a component of dssmatrix or zssmatrix, use "put" or "fput" function. -</p> - -<p> -The <code>"put(i,j,v)"</code> function checks if the (i,j) component already exists. -When the (i,j) component exists, <code>put</code> function overwrite the existing value. -When the (i,j) component doesn't exist, <code>put</code> function creates a new element and increase the volume(VOL++;). -In case VOL=CAP, <code>put</code> function calls <code>expand</code> function before creating a new element. -</p> - -<p> -On the other hand, the <code>"fput(i,j,v)"</code> function doesn't check if the (i,j) component already exists and if VOL=CAP. -The <code>fput</code> function always suppose that the (i,j) component doesn't exist and VOL<CAP, -and simply creates a new element and increase the volume(VOL++;). -</p> - -<p> -The <code>"fput(i,j,v)"</code> function is faster but more dangerous than the <code>"put(i,j,v)"</code> function. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h3>"add", "sub", "mult", and "div"</h3> -<p> -To add, subtract, multiply, and divide a component of dssmatrix or zssmatrix, use the <code>add</code>, <code>sub</code>, <code>mult</code>, and <code>div</code> functions, respectively. -</p> - -<p> -These functions check if the (i,j) component already exists. -When the (i,j) component exists, these functions operate the existing value. -When the (i,j) component doesn't exist, the <code>add</code> and <code>sub</code> functions create a new element, set to v and -v respectively, and VOL++, and the <code>mult</code> and <code>div</code> functions do nothing. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h3>"del" and "fdel"</h3> -<p> -To delete a component of dssmatrix or zssmatrix, use <code>del</code> or <code>fdel</code> function. -</p> - -<p> -The <code>del(i,j)</code> function deletes the (i,j) component when it exists. -The <code>fdel(c)</code> function deletes the cth element of the array when it exists. -</p> - -<p>When you use <code>del</code> or <code>fdel</code> in a loop, you must pay a lot of attention to what they do. - -For example, the following for-loop doesn't work as it seems to be. -<br><code> -for(int c=0; c<A.vol; c++){<br> - if(A.indx[i]==A.jndx[c]){ A.fdel(c); }<br> -} -</code><br> - -To make the code work as we expect, -<br><code> -for(int c=0; c<A.vol; c++){<br> - if(A.indx[i]==A.jndx[c]){ A.fdel(c); c--; }<br> -} -</code><br> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h3>"expand" and "CPPL_SS_SECTOR"</h3> -<p> -The <code>expand</code> function creates an array which is "a little bit" larger than the current array, copies the data of current array to the new array, and deletes the current array. -The size of "a little bit" is defined in cpplapack.h as a macro "CPPL_SS_SECTOR". -You can edit cpplapack.h and change the value of "CPPL_SS_SECTOR". -</p> - - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h3>"isListed" and "number"</h3> -<p> -The <code>isListed(i,j)</code> function checks if the (i,j) component is listed. -When the (i,j) component is listed, this function returns 1, otherwise 0. -</p> - -<p> -The <code>number(i,j)</code> function returns the element number of the (i,j) component if it is listed. -When the (i,j) component is no listed, this function returns -1. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h3>"checkup"</h3> -<p> -After using fput, read, etc., you may break the consistency of the object. -The <code>checkup</code> function is helpful for the debugging. -It checks the bounds of <code>cap</code>, <code>vol</code>, <code>indx</code>, and <code>jndx</code>, and the double-entry of the elements. -</p> - - diff --git a/cpplapack-r198/.svn/pristine/33/3364beaa2268d64ad3e7a891aa2acb765ad6c37e.svn-base b/cpplapack-r198/.svn/pristine/33/3364beaa2268d64ad3e7a891aa2acb765ad6c37e.svn-base deleted file mode 100644 index 47f561f273809a0635992bf7e2e596819ba8dd47..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/33/3364beaa2268d64ad3e7a891aa2acb765ad6c37e.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! zgbmatrix+zgematrix operator */ -inline _zgematrix operator+(const zgbmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix-zgematrix operator */ -inline _zgematrix operator-(const zgbmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix*zgematrix operator */ -inline _zgematrix operator*(const zgbmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/33/33750fb8917a62cdd6ff967a1027db002308db1f.svn-base b/cpplapack-r198/.svn/pristine/33/33750fb8917a62cdd6ff967a1027db002308db1f.svn-base deleted file mode 100644 index 421bbb68a67f51e18e94d5b3f6953b49db24e0a1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/33/33750fb8917a62cdd6ff967a1027db002308db1f.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(2), KU(1); - - CPPL::dgbmatrix A(M,N,KL,KU); - CPPL::dgematrix B(M,N), C(N,M); - - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - for(int i=0; i<C.m; i++){ for(int j=0; j<C.n; j++){ - C(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - cout << "C =\n" << C << endl; - - cout << "A+B =\n" << A+B << endl; - cout << "A-B =\n" << A-B << endl; - cout << "A*C =\n" << A*C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/33/33af6500790fe96a3025b76d795b68bbe3e3bb14.svn-base b/cpplapack-r198/.svn/pristine/33/33af6500790fe96a3025b76d795b68bbe3e3bb14.svn-base deleted file mode 100644 index 6e23e533acfca03c1786932ec37a06ec4563ea83..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/33/33af6500790fe96a3025b76d795b68bbe3e3bb14.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+_zgbmatrix operator */ -/* -inline _zgematrix operator+(const _zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix-_zgbmatrix operator */ -/* -inline _zgematrix operator-(const _zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix*_zgbmatrix operator */ -/* -inline _zgematrix operator*(const _zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT k=max(0,matA.jndx[c]-matB.ku); - k<min(matB.m,matA.jndx[c]+matB.kl+1); k++){ - newmat(matA.indx[c],k) += matA.array[c]*matB(matA.jndx[c],k); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/33/33ce4169a33dd02e684ce284e6d306dfc7f0258b.svn-base b/cpplapack-r198/.svn/pristine/33/33ce4169a33dd02e684ce284e6d306dfc7f0258b.svn-base deleted file mode 100644 index 1d5d57ea05af712c09f25a433c4849c77e7edcbf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/33/33ce4169a33dd02e684ce284e6d306dfc7f0258b.svn-base +++ /dev/null @@ -1,567 +0,0 @@ -//============================================================================= -/*! convert zgematrix_small to zgematrix */ -template<CPPL_INT m, CPPL_INT n> -inline _zgematrix zgematrix_small<m,n>::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix mat(m,n); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - mat(i,j) =(*this)(i,j); - } - } - return _(mat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT m, CPPL_INT n> -inline comple& zgematrix_small<m,n>::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i+m*j]; -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT m, CPPL_INT n> -inline comple zgematrix_small<m,n>::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i+m*j]; -} - -//============================================================================= -/*! set */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& zgematrix_small<m,n>::set(const CPPL_INT& i, const CPPL_INT& j, const comple& v) -{CPPL_VERBOSE_REPORT; - (*this)(i,j) =v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT m, CPPL_INT n> -inline std::ostream& operator<<(std::ostream& s, const zgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - s << " " << A(i,j); - } - s << std::endl; - } - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT m, CPPL_INT n> -inline void zgematrix_small<m,n>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - ofs << "#zgematrix" << " " << m << " " << n << std::endl; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - ofs << (*this)(i,j) << " "; - } - ofs << std::endl; - } - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT m, CPPL_INT n> -inline void zgematrix_small<m,n>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zgematrix" && id != "#zgematrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zgematrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _m, _n; - s >> _m >> _n; - if(m!=_m || n!=_n){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++ ){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return transposed zgematrix_small */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<n,m> t(const zgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,m> X; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - X(j,i) =A(i,j); - } - } - return X; -} - -//============================================================================= -/*! return its trace */ -template<CPPL_INT m, CPPL_INT n> -inline comple trace(const zgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - comple trace =comple(0.,0); - - const CPPL_INT imax =std::min(m,n); - for(CPPL_INT i=0; i<imax; i++){ - trace +=A(i,i); - } - - return trace; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zero */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& zgematrix_small<m,n>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - array[k] =comple(0.,0.); - } - - return *this; -} - -//============================================================================= -/*! identity */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& zgematrix_small<m,n>::identity() -{CPPL_VERBOSE_REPORT; - zero(); - - const CPPL_INT kmax =std::min(m,n); - for(CPPL_INT k=0; k<kmax; k++){ - (*this)(k,k) =1.; - } - - return *this; -} - -//============================================================================= -/*! return the j-th column vector */ -template<CPPL_INT m, CPPL_INT n> -inline zcovector_small<m> zgematrix_small<m,n>::col(const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; - zcovector_small<m> vec; - for(CPPL_INT i=0; i<m; i++){ - vec(i) =(*this)(i,j); - } - return vec; -} - -//============================================================================= -/*! return the i-th row vector */ -template<CPPL_INT m, CPPL_INT n> -inline zrovector_small<n> zgematrix_small<m,n>::row(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; - zrovector_small<n> vec; - for(CPPL_INT j=0; j<n; j++){ - vec(j)=(*this)(i,j); - } - return vec; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix_small+=zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& operator+=(zgematrix_small<m,n>& A, const zgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] +=B.array[k]; - } - return A; -} - -//============================================================================= -/*! zgematrix_small-=zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& operator-=(zgematrix_small<m,n>& A, const zgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] -=B.array[k]; - } - return A; -} - -//============================================================================= -/*! zgematrix_small*=zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT l, CPPL_INT n> -inline zgematrix_small<m,n>& operator*=(zgematrix_small<m,l>& A, const zgematrix_small<l,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> X; - X.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT k=0; k<l; k++){ - X(i,j) += A(i,k)*B(k,j); - } - } - } - A =X; - return A; -} - -//============================================================================= -/*! zgematrix_small*=double operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& operator*=(zgematrix_small<m,n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] *=v; - } - return A; -} - -//============================================================================= -/*! zgematrix_small*=comple operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& operator*=(zgematrix_small<m,n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] *=v; - } - return A; -} - -//============================================================================= -/*! zgematrix_small/=double operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& operator/=(zgematrix_small<m,n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] /=v; - } - return A; -} -//============================================================================= -/*! zgematrix_small/=comple operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>& operator/=(zgematrix_small<m,n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] /=v; - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary + operator */ -template<CPPL_INT m, CPPL_INT n> -inline const zgematrix_small<m,n>& operator+(const zgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary - operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator-(const zgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> X; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - X(i,j) =-A(i,j); - } - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix_small+zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator+(const zgematrix_small<m,n>& A, const zgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(int i=0; i<m; i++){ - for(int j=0; j<n; j++){ - C(i,j) =A(i,j)+B(i,j); - } - } - return C; -} - -//============================================================================= -/*! zgematrix_small+zhematrix_small operator */ -template<CPPL_INT n> -inline zgematrix_small<n,n> operator+(const zgematrix_small<n,n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - X(i,j) =A(i,j)+B(i,j); - } - for(CPPL_INT j=i; j<n; j++){ - X(i,j) =A(i,j)+B(j,i); - } - } - return X; -} - -//============================================================================= -/*! zgematrix_small-zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator-(const zgematrix_small<m,n>& A, const zgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(int i=0; i<m; i++){ - for(int j=0; j<n; j++){ - C(i,j)=A(i,j)-B(i,j); - } - } - return C; -} - -//============================================================================= -/*! zgematrix_small-zhematrix_small operator */ -template<CPPL_INT n> -inline zgematrix_small<n,n> operator-(const zgematrix_small<n,n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - X(i,j)=A(i,j)-B(i,j); - } - for(CPPL_INT j=i+1; j<n; j++){ - X(i,j)=A(i,j)-B(j,i); - } - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix_small*zcovector_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zcovector_small<m> operator*(const zgematrix_small<m,n>& A, const zcovector_small<n>& B) -{CPPL_VERBOSE_REPORT; - zcovector_small<m> C; - C.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i) +=A(i,j)*B(j); - } - } - return C; -} - -//============================================================================= -/*! zgematrix_small*zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT l, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const zgematrix_small<m,l>& A, const zgematrix_small<l,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - C.zero(); - for(int i=0; i<m; i++){ - for(int j=0; j<n; j++){ - for(int k=0; k<l; k++){ - C(i,j) +=A(i,k)*B(k,j); - } - } - } - return C; -} - -//============================================================================= -/*! zgematrix_small+zhematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const zgematrix_small<m,n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> X; - X.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT k=0; k<j; k++){ - X(i,j) +=A(i,k)*B(j,k); - } - for(CPPL_INT k=j; k<n; k++){ - X(i,j) +=A(i,k)*B(k,j); - } - } - } - return X; -} - -//============================================================================= -/*! zgematrix_small*double operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const zgematrix_small<m,n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)*v; - } - } - return C; -} - -//============================================================================= -/*! zgematrix_small*comple operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const zgematrix_small<m,n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)*v; - } - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix_small/double operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator/(const zgematrix_small<m,n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)/v; - } - } - return C; -} - -//============================================================================= -/*! zgematrix_small/comple operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator/(const zgematrix_small<m,n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)/v; - } - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamerd product */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> hadamerd(const zgematrix_small<m,n>& A, const zgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! Hadamerd product */ -template<CPPL_INT n> -inline zgematrix_small<n,n> hadamerd(const zgematrix_small<n,n>& A, const zhematrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<n,n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*B(i,j); - } - for(CPPL_INT j=i+1; j<n; j++){ - C(i,j) =A(i,j)*conj(B(j,i)); - } - } - return C; -} diff --git a/cpplapack-r198/.svn/pristine/34/343ebf6e1f97b039039f7392fdd30da46e65b4f0.svn-base b/cpplapack-r198/.svn/pristine/34/343ebf6e1f97b039039f7392fdd30da46e65b4f0.svn-base deleted file mode 100644 index 1629e0faca9ef98ddf65a7feb25cf0f2ed047512..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/34/343ebf6e1f97b039039f7392fdd30da46e65b4f0.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! dssmatrix+dgematrix operator */ -/* -inline _dgematrix operator+(const dssmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! dssmatrix-dgematrix operator */ -/* -inline _dgematrix operator-(const dssmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! dssmatrix*dgematrix operator */ -inline _dgematrix operator*(const dssmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i, j) += it->v * matB(it->j, j); - if(it->i != it->j){ - newmat(it->j, j) += it->v * matB(it->i, j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/34/345a5d70c2556ac529ffcaeff514075ab22bf678.svn-base b/cpplapack-r198/.svn/pristine/34/345a5d70c2556ac529ffcaeff514075ab22bf678.svn-base deleted file mode 100644 index a0f6d51e4f458e9242734a601ab15d819e6096b6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/34/345a5d70c2556ac529ffcaeff514075ab22bf678.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(1), KU(2); - - CPPL::dgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ A(i,j) =double( rand() /(RAND_MAX/10) ); } - }} - - cout << "A =\n" << A << endl; - cout << "A*10. =\n" << A*10. << endl; - cout << "A/10. =\n" << A/10. << endl; - - cout << "#### A*=10.; ####" << endl; - A*=10.; - cout << "A =\n" << A << endl; - cout << "#### A/=10.; ####" << endl; - A/=10.; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/34/34cf3d3d1f0e802eadcfa16126f0a1cf483f3428.svn-base b/cpplapack-r198/.svn/pristine/34/34cf3d3d1f0e802eadcfa16126f0a1cf483f3428.svn-base deleted file mode 100644 index a861f10b88dc27a545c144f524719f1183a10c0b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/34/34cf3d3d1f0e802eadcfa16126f0a1cf483f3428.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::dsymatrix A(N), X(N), Y(N), Z(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - X(i,j) = -A(i,j); - Y(i,j) = A(i,j); - Z(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - - cout << "A =\n" << A << endl; - cout << "X =\n" << X << endl; - cout << "Y =\n" << Y << endl; - cout << "Z =\n" << Z << endl; - - //dsy+dsy - cout << "A+X =\n" << A+X << "<-Should be zero." << endl; - //dsy-dsy - cout << "A-Y =\n" << A-Y << "<-Should be zero." << endl; - //dsy*dsy - cout << "t(A*Z)-Z*A =\n" << t(A*Z)-Z*A << "<-Should be zero." << endl; - - //dsy=dsy, dsy-dsy - CPPL::dsymatrix B; - cout << "(B=A)-A =\n" << (B=A)-A << "<-Should be zero." << endl; - //dsy+=dsy - cout << "(B+=Z) =\n" << (B+=Z) << endl; - //dsy-=dsy - cout << "(B-=A) =\n" << (B-=A) << endl; - - //dsy+_dsy, -dsy - cout << "A+(-Y) =\n" << A+(-Y) << "<-Should be zero." << endl; - //dsy-_dsy, -dsy - cout << "A-(-X) =\n" << A-(-X) << "<-Should be zero." << endl; - //dsy*_dsy, dsy+dsy, dsy*dsy, _dge+_dge, _dge-_dge - cout << "A*(X+Z) - (A*X+A*Z) =\n" << A*(X+Z) - (A*X+A*Z) << "<-Should be zero." << endl; - - //dsy=_dsy - cout << "(B=-A)+A =\n" << (B=-A)+A << "<-Should be zero." << endl; - //dsy+=_dsy - cout << "(B+=-Z) =\n" << (B+=-Z) << endl; - //dsy-=_dsy - cout << "(B-=-A) =\n" << (B-=-A) << endl; - - //_dsy+dsy, -dsy - cout << "(-A)+Y =\n" << (-A)+Y << "<-Should be zero." << endl; - //_dsy-dsy, -dsy - cout << "(-A)-X =\n" << (-A)-X << "<-Should be zero." << endl; - //_dsy*dsy, -dsy, dsy*dsy, _dge+_dge - cout << "(-A)*Z+(A*Z) =\n" << ((-A)*Z+(A*Z)) << "<-Should be zero." << endl; - - //_dsy+_dsy, -dsy, -dsy - cout << "(-A)+(-X) =\n" << (-A)+(-X) << "<-Should be zero." << endl; - //_dsy-_dsy, -dsy, -dsy - cout << "(-A)-(-Y) =\n" << (-A)-(-Y) << "<-Should be zero." << endl; - //_dsy*_dsy, -dsy, -dsy, dsy*dsy, _dge-_dge - cout << "(-A)*(-Z)-(A*Z) =\n" << (-A)*(-Z)-(A*Z) << "<-Should be zero." << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/35/351c2de08b96cd47ffeed6818bd5775f8edfc4de.svn-base b/cpplapack-r198/.svn/pristine/35/351c2de08b96cd47ffeed6818bd5775f8edfc4de.svn-base deleted file mode 100644 index 86b0d3ce81e003b04b64e7e98675b51362c5af12..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/35/351c2de08b96cd47ffeed6818bd5775f8edfc4de.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::zgematrix A(M,N), B; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - cout << "#### B.copy(A) ####" << endl; - B.copy(A); - cout << "B =\n" << B << endl; - - cout << "#### B.clear() ####" << endl; - B.clear(); - cout << "B =\n" << B << endl; - - cout << "#### B.resize(2,2) & B.zero() ####" << endl; - B.resize(2,2); - B.zero(); - cout << "B =\n" << B << endl; - - cout << "#### B.identity() ####" << endl; - B.identity(); - cout << "B =\n" << B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/36/3604e6c9943062d1462c9d538547de95e338040f.svn-base b/cpplapack-r198/.svn/pristine/36/3604e6c9943062d1462c9d538547de95e338040f.svn-base deleted file mode 100644 index 25d7ed8fce532a6df37f66f3fc29ea2d40cd97d0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/36/3604e6c9943062d1462c9d538547de95e338040f.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================= -/*! return a transposed column vector */ -inline _zcovector t(const zrovector& rovec) -{CPPL_VERBOSE_REPORT; - zcovector covec(rovec.l); - CPPL_INT inc =1; - - zcopy_(&rovec.l, rovec.array, &inc, covec.array, &inc); - - return _(covec); -} - -//============================================================================= -/*! return its conjugated vector */ -inline _zrovector conj(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec(i) =std::conj(vec(i)); - } - - return _(newvec); -} - -//============================================================================= -/*! return a conjugate transposed column vector */ -inline _zcovector conjt(const zrovector& rovec) -{CPPL_VERBOSE_REPORT; - zcovector covec(rovec.l); - - for(CPPL_INT i=0; i<rovec.l; i++){ - covec(i) =std::conj(rovec(i)); - } - - return _(covec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return dznrm2_(&vec.l, vec.array, &inc); -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return izamax_(&vec.l, vec.array, &inc) -1; -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return vec.array[izamax_(&vec.l, vec.array, &inc) -1]; -} diff --git a/cpplapack-r198/.svn/pristine/36/3636490f3b51aa029592b5730436682afb19c129.svn-base b/cpplapack-r198/.svn/pristine/36/3636490f3b51aa029592b5730436682afb19c129.svn-base deleted file mode 100644 index aa451359b09313da4f25736585e617b54e02c8ef..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/36/3636490f3b51aa029592b5730436682afb19c129.svn-base +++ /dev/null @@ -1,181 +0,0 @@ -//============================================================================= -//! Complex Double-precision General Dence Matrix Class -class zgematrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT m; //!< matrix row size - CPPL_INT n; //!< matrix column size - comple* array; //!< 1D array to store matrix data - comple** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zgematrix(); - inline zgematrix(const zgematrix&); - inline zgematrix(const _zgematrix&); - inline zgematrix(const CPPL_INT&, const CPPL_INT&); - inline zgematrix(const char*); - inline ~zgematrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - - //////// io //////// - inline comple& operator()(const CPPL_INT&, const CPPL_INT&); - inline comple operator()(const CPPL_INT&, const CPPL_INT&) const; - inline zgematrix& set(const CPPL_INT&, const CPPL_INT&, const comple&); - inline friend std::ostream& operator<<(std::ostream&, const zgematrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline zgematrix& zero(); - inline zgematrix& identity(); - inline void chsign(); - inline void copy(const zgematrix&); - inline void shallow_copy(const _zgematrix&); - inline void resize(const CPPL_INT&, const CPPL_INT&); - inline _zrovector row(const CPPL_INT&) const; - inline _zcovector col(const CPPL_INT&) const; - inline _dgematrix real() const; - inline _dgematrix imag() const; - inline _dgematrix abs() const; - inline _dgematrix arg() const; - inline friend void swap(zgematrix&, zgematrix&); - inline friend _zgematrix _(zgematrix&); - - //////// calc //////// - inline friend _zgematrix t(const zgematrix&); - inline friend _zgematrix i(const zgematrix&); - inline friend _zgematrix conj(const zgematrix&); - inline friend _zgematrix conjt(const zgematrix&); - inline friend comple nrm2(const zgematrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const zgematrix&); - inline friend comple damax(const zgematrix&); - - //////// lapack //////// - inline CPPL_INT zgesv(zgematrix&); - inline CPPL_INT zgesv(zcovector&); - inline CPPL_INT zgels(zgematrix&); - inline CPPL_INT zgels(zcovector&); - inline CPPL_INT zgels(zgematrix&, drovector&); - inline CPPL_INT zgels(zcovector&, double&); - inline CPPL_INT zgelss(zcovector&, dcovector&, CPPL_INT&, const double); - inline CPPL_INT zgelss(zgematrix&, dcovector&, CPPL_INT&, const double); - inline CPPL_INT zgeev(std::vector< comple >&); - inline CPPL_INT zgeev(std::vector< comple >&, std::vector<zcovector>&); - inline CPPL_INT zgeev(std::vector< comple >&, std::vector<zrovector>&); - //inline CPPL_INT zgegv() - inline CPPL_INT zgesvd(dcovector&, zgematrix&, zgematrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline zgematrix& operator=(const zgematrix&); - inline zgematrix& operator=(const _zgematrix&); - - //////// += //////// - inline zgematrix& operator+=(const zgematrix&); - inline zgematrix& operator+=(const _zgematrix&); - inline zgematrix& operator+=(const zhematrix&); - inline zgematrix& operator+=(const _zhematrix&); - inline zgematrix& operator+=(const zgbmatrix&); - inline zgematrix& operator+=(const _zgbmatrix&); - inline zgematrix& operator+=(const zgsmatrix&); - inline zgematrix& operator+=(const _zgsmatrix&); - inline zgematrix& operator+=(const zhsmatrix&); - inline zgematrix& operator+=(const _zhsmatrix&); - - //////// -= //////// - inline zgematrix& operator-=(const zgematrix&); - inline zgematrix& operator-=(const _zgematrix&); - inline zgematrix& operator-=(const zhematrix&); - inline zgematrix& operator-=(const _zhematrix&); - inline zgematrix& operator-=(const zgbmatrix&); - inline zgematrix& operator-=(const _zgbmatrix&); - inline zgematrix& operator-=(const zgsmatrix&); - inline zgematrix& operator-=(const _zgsmatrix&); - inline zgematrix& operator-=(const zhsmatrix&); - inline zgematrix& operator-=(const _zhsmatrix&); - - //////// *= //////// - inline zgematrix& operator*=(const zgematrix&); - inline zgematrix& operator*=(const _zgematrix&); - inline zgematrix& operator*=(const zhematrix&); - inline zgematrix& operator*=(const _zhematrix&); - inline zgematrix& operator*=(const zgbmatrix&); - inline zgematrix& operator*=(const _zgbmatrix&); - inline zgematrix& operator*=(const zgsmatrix&); - inline zgematrix& operator*=(const _zgsmatrix&); - inline zgematrix& operator*=(const zhsmatrix&); - inline zgematrix& operator*=(const _zhsmatrix&); - inline zgematrix& operator*=(const double&); - inline zgematrix& operator*=(const comple&); - - //////// /= //////// - inline zgematrix& operator/=(const double&); - inline zgematrix& operator/=(const comple&); - - //////// unary //////// - inline friend const zgematrix& operator+(const zgematrix&); - inline friend _zgematrix operator-(const zgematrix&); - - //////// + //////// - inline friend _zgematrix operator+(const zgematrix&, const zgematrix&); - inline friend _zgematrix operator+(const zgematrix&, const _zgematrix&); - inline friend _zgematrix operator+(const zgematrix&, const zhematrix&); - inline friend _zgematrix operator+(const zgematrix&, const _zhematrix&); - inline friend _zgematrix operator+(const zgematrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const zgematrix&, const _zgbmatrix&); - inline friend _zgematrix operator+(const zgematrix&, const zgsmatrix&); - inline friend _zgematrix operator+(const zgematrix&, const _zgsmatrix&); - inline friend _zgematrix operator+(const zgematrix&, const zhsmatrix&); - inline friend _zgematrix operator+(const zgematrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const zgematrix&, const zgematrix&); - inline friend _zgematrix operator-(const zgematrix&, const _zgematrix&); - inline friend _zgematrix operator-(const zgematrix&, const zhematrix&); - inline friend _zgematrix operator-(const zgematrix&, const _zhematrix&); - inline friend _zgematrix operator-(const zgematrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const zgematrix&, const _zgbmatrix&); - inline friend _zgematrix operator-(const zgematrix&, const zgsmatrix&); - inline friend _zgematrix operator-(const zgematrix&, const _zgsmatrix&); - inline friend _zgematrix operator-(const zgematrix&, const zhsmatrix&); - inline friend _zgematrix operator-(const zgematrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const zgematrix&, const zcovector&); - inline friend _zcovector operator*(const zgematrix&, const _zcovector&); - inline friend _zgematrix operator*(const zgematrix&, const zgematrix&); - inline friend _zgematrix operator*(const zgematrix&, const _zgematrix&); - inline friend _zgematrix operator*(const zgematrix&, const zhematrix&); - inline friend _zgematrix operator*(const zgematrix&, const _zhematrix&); - inline friend _zgematrix operator*(const zgematrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const zgematrix&, const _zgbmatrix&); - inline friend _zgematrix operator*(const zgematrix&, const zgsmatrix&); - inline friend _zgematrix operator*(const zgematrix&, const _zgsmatrix&); - inline friend _zgematrix operator*(const zgematrix&, const zhsmatrix&); - inline friend _zgematrix operator*(const zgematrix&, const _zhsmatrix&); - inline friend _zgematrix operator*(const zgematrix&, const double&); - inline friend _zgematrix operator*(const zgematrix&, const comple&); - - //////// / //////// - inline friend _zgematrix operator/(const zgematrix&, const double&); - inline friend _zgematrix operator/(const zgematrix&, const comple&); - - //////// double, comple //////// - inline friend _zgematrix operator*(const double&, const zgematrix&); - inline friend _zgematrix operator*(const comple&, const zgematrix&); - - //////// hadamard //////// - inline friend _zgematrix hadamard(const zgematrix&, const zgematrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/36/363cb4c4de6e402adb36d2d4722386d6c01612f1.svn-base b/cpplapack-r198/.svn/pristine/36/363cb4c4de6e402adb36d2d4722386d6c01612f1.svn-base deleted file mode 100644 index c8a95d6b537fdfd6fd3d967363a1e08f8c1fb6bb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/36/363cb4c4de6e402adb36d2d4722386d6c01612f1.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -//============================================================================= -/*! zcovector*=comple operator */ -inline zcovector& zcovector::operator*=(const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zscal_(&l, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zcovector/=comple operator */ -inline zcovector& zcovector::operator/=(const comple& d) -{CPPL_VERBOSE_REPORT; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&l, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector*comple operator */ -inline _zcovector operator*(const zcovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]*d; - } - - return _(newvec); -} - -//============================================================================= -/*! zcovector/comple operator */ -inline _zcovector operator/(const zcovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]/d; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/37/378c50d078c50965dcae49d4bdc152974d14fb26.svn-base b/cpplapack-r198/.svn/pristine/37/378c50d078c50965dcae49d4bdc152974d14fb26.svn-base deleted file mode 100644 index 2c68c53b58d8a88b60455e91cba85d1cc8cf55a6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/37/378c50d078c50965dcae49d4bdc152974d14fb26.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -rootdir=`pwd` -MAKEFILE=$HOME/local/cpplapack/makefiles/Makefile - -for i in `find * -type d | grep -v .svn`; do - if [ -d $i ]; then - echo "################ Enter into $i/ ################" - cd $i - if [ -f main.cpp ]; then - make -f $MAKEFILE fullclean && rm -f SUCCEEDED tmp.txt - fi - if [ $? != 0 ]; then exit 1; fi - cd $rootdir - echo "################ Exit from $i/ ################" - fi -done diff --git a/cpplapack-r198/.svn/pristine/37/37b6f58aebaaae1b665e318acc8eaa27501683f3.svn-base b/cpplapack-r198/.svn/pristine/37/37b6f58aebaaae1b665e318acc8eaa27501683f3.svn-base deleted file mode 100644 index 8713c1418382874ff79588c1f7733fec62d7e187..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/37/37b6f58aebaaae1b665e318acc8eaa27501683f3.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -//============================================================================= -/*! _zrovector+_zrovector operator */ -inline _zrovector operator+(const _zrovector& vecA, const _zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] += vecB.array[i]; - } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _zrovector-_zrovector operator */ -inline _zrovector operator-(const _zrovector& vecA, const _zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] -= vecB.array[i]; - } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _zrovector^T*_zrovector operator (inner product) */ -inline comple operator%(const _zrovector& vecA, const _zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/38/3811a6b22adfe03baf1e7d86d7e8e8d38dd2e657.svn-base b/cpplapack-r198/.svn/pristine/38/3811a6b22adfe03baf1e7d86d7e8e8d38dd2e657.svn-base deleted file mode 100644 index 85e4ac0c58b8db4455e5771a052719cb0c9671e7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/3811a6b22adfe03baf1e7d86d7e8e8d38dd2e657.svn-base +++ /dev/null @@ -1,93 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision General Dence Matrix Class -class _dgematrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable double* array; //!< 1D array to store matrix data - mutable double** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _dgematrix(); - inline _dgematrix(const _dgematrix&); - inline ~_dgematrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&, const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const dgematrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _dgematrix t(const _dgematrix&); - inline friend _dgematrix i(const _dgematrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const _dgematrix&); - inline friend double damax(const _dgematrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _dgematrix& operator+(const _dgematrix&); - inline friend _dgematrix operator-(const _dgematrix&); - - //////// + //////// - inline friend _dgematrix operator+(const _dgematrix&, const dgematrix&); - inline friend _dgematrix operator+(const _dgematrix&, const _dgematrix&); - inline friend _dgematrix operator+(const _dgematrix&, const dsymatrix&); - inline friend _dgematrix operator+(const _dgematrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const _dgematrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const _dgematrix&, const _dgbmatrix&); - inline friend _dgematrix operator+(const _dgematrix&, const dgsmatrix&); - inline friend _dgematrix operator+(const _dgematrix&, const _dgsmatrix&); - inline friend _dgematrix operator+(const _dgematrix&, const dssmatrix&); - inline friend _dgematrix operator+(const _dgematrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const _dgematrix&, const dgematrix&); - inline friend _dgematrix operator-(const _dgematrix&, const _dgematrix&); - inline friend _dgematrix operator-(const _dgematrix&, const dsymatrix&); - inline friend _dgematrix operator-(const _dgematrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const _dgematrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const _dgematrix&, const _dgbmatrix&); - inline friend _dgematrix operator-(const _dgematrix&, const dgsmatrix&); - inline friend _dgematrix operator-(const _dgematrix&, const _dgsmatrix&); - inline friend _dgematrix operator-(const _dgematrix&, const dssmatrix&); - inline friend _dgematrix operator-(const _dgematrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const _dgematrix&, const dcovector&); - inline friend _dcovector operator*(const _dgematrix&, const _dcovector&); - inline friend _dgematrix operator*(const _dgematrix&, const dgematrix&); - inline friend _dgematrix operator*(const _dgematrix&, const _dgematrix&); - inline friend _dgematrix operator*(const _dgematrix&, const dsymatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const _dgbmatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const dgsmatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const _dgsmatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const dssmatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const _dssmatrix&); - inline friend _dgematrix operator*(const _dgematrix&, const double&); - - //////// / //////// - inline friend _dgematrix operator/(const _dgematrix&, const double&); - - //////// double //////// - inline friend _dgematrix operator*(const double&, const _dgematrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/38/382b0d17e0fbbc9d729eb03d3a98e2c1af8cf267.svn-base b/cpplapack-r198/.svn/pristine/38/382b0d17e0fbbc9d729eb03d3a98e2c1af8cf267.svn-base deleted file mode 100644 index ad75fcf61f63863ce17852dacbea993fa3a832cd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/382b0d17e0fbbc9d729eb03d3a98e2c1af8cf267.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! dgbmatrix*dcovector operator */ -inline _dcovector operator*(const dgbmatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/38/38452f9148a92928f972ba39024f6e7b11e07a12.svn-base b/cpplapack-r198/.svn/pristine/38/38452f9148a92928f972ba39024f6e7b11e07a12.svn-base deleted file mode 100644 index 3b551c79d3bb5b841953846ed63d63d4d96b5ac5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/38452f9148a92928f972ba39024f6e7b11e07a12.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+_zhematrix operator */ -inline _zgematrix operator+(const _zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)+=matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix-_zhematrix operator */ -inline _zgematrix operator-(const _zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)-=matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix*_zhematrix operator */ -inline _zgematrix operator*(const _zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=max(0,matB.indx[c]-(matA.ku+1)); - i<min(matA.m,matB.indx[c]+matA.kl); i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/38/388944c89e8a6c406636b4a6c7fff0311fc4a356.svn-base b/cpplapack-r198/.svn/pristine/38/388944c89e8a6c406636b4a6c7fff0311fc4a356.svn-base deleted file mode 100644 index df4cb5d912670bd37f673bd40e3b06b560e11da6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/388944c89e8a6c406636b4a6c7fff0311fc4a356.svn-base +++ /dev/null @@ -1,106 +0,0 @@ -//============================================================================= -//! Real Double-precision Column Vector Class -class dcovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT l; //!< vector size - CPPL_INT cap; //!< vector capacity - double* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dcovector(); - inline dcovector(const dcovector&); - inline dcovector(const _dcovector&); - inline dcovector(const CPPL_INT&, const CPPL_INT=0); - inline dcovector(const char *); - inline ~dcovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zcovector to_zcovector() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&); - inline double operator()(const CPPL_INT&) const; - inline dcovector& set(const CPPL_INT&, const double&); //const; - inline friend std::ostream& operator<<(std::ostream&, const dcovector&); - inline void write(const char*) const; - inline void read(const char*); - - //////// calc //////// - inline friend _drovector t(const dcovector&); - inline friend double nrm2(const dcovector&); - inline friend CPPL_INT idamax(const dcovector&); - inline friend double damax(const dcovector&); - - //////// misc //////// - inline void clear(); - inline dcovector& zero(); - inline void chsign(); - inline void copy(const dcovector&); - inline void shallow_copy(const _dcovector&); - inline void alias(const dcovector&); - inline void unalias(); - inline dcovector& resize(const CPPL_INT&, const CPPL_INT=0); - inline void stretch(const CPPL_INT&); - inline friend void swap(dcovector&, dcovector&); - inline friend _dcovector _(dcovector&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline dcovector& operator=(const dcovector&); - inline dcovector& operator=(const _dcovector&); - - //////// += //////// - inline dcovector& operator+=(const dcovector&); - inline dcovector& operator+=(const _dcovector&); - - //////// -= //////// - inline dcovector& operator-=(const dcovector&); - inline dcovector& operator-=(const _dcovector&); - - //////// *= //////// - inline dcovector& operator*=(const double&); - - //////// /= //////// - inline dcovector& operator/=(const double&); - - //////// unary //////// - inline friend const dcovector& operator+(const dcovector&); - inline friend _dcovector operator-(const dcovector&); - - //////// + //////// - inline friend _dcovector operator+(const dcovector&, const dcovector&); - inline friend _dcovector operator+(const dcovector&, const _dcovector&); - - //////// - //////// - inline friend _dcovector operator-(const dcovector&, const dcovector&); - inline friend _dcovector operator-(const dcovector&, const _dcovector&); - - //////// * //////// - inline friend _dgematrix operator*(const dcovector&, const drovector&); - inline friend _dgematrix operator*(const dcovector&, const _drovector&); - inline friend _dcovector operator*(const dcovector&, const double&); - - //////// / //////// - inline friend _dcovector operator/(const dcovector&, const double&); - - //////// % //////// - inline friend double operator%(const dcovector&, const dcovector&); - inline friend double operator%(const dcovector&, const _dcovector&); - - //////// double //////// - inline friend _dcovector operator*(const double&, const dcovector&); - - //////// hadamard //////// - inline friend _dcovector hadamard(const dcovector&, const dcovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/38/389e1b20481e909f8978f88336d38ba5fbf88e22.svn-base b/cpplapack-r198/.svn/pristine/38/389e1b20481e909f8978f88336d38ba5fbf88e22.svn-base deleted file mode 100644 index fd53acf4b1c0306ce54030e6160d2df868ddb568..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/389e1b20481e909f8978f88336d38ba5fbf88e22.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! +zrovector operator */ -inline const zrovector& operator+(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -zrovector operator */ -inline _zrovector operator-(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - for(CPPL_INT i=0; i<newvec.l; i++){ newvec.array[i]=-vec.array[i]; } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/38/38a40611536785485dde4b83bd42c3e24c121772.svn-base b/cpplapack-r198/.svn/pristine/38/38a40611536785485dde4b83bd42c3e24c121772.svn-base deleted file mode 100644 index a3ede88ff7552ee6ab9c74a932c8425d8843bc37..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/38a40611536785485dde4b83bd42c3e24c121772.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zhematrix*_zcovector operator */ -inline _zcovector operator*(const zhematrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/38/38cdbb8dc03a1290d20a164207777fd1511f0fc9.svn-base b/cpplapack-r198/.svn/pristine/38/38cdbb8dc03a1290d20a164207777fd1511f0fc9.svn-base deleted file mode 100644 index 64adb69ba5b7577e70c9d9eac86720df14e13dd7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/38cdbb8dc03a1290d20a164207777fd1511f0fc9.svn-base +++ /dev/null @@ -1,132 +0,0 @@ -//============================================================================= -/*! zhematrix=_zhematrix operator */ -inline zhematrix& zhematrix::operator=(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix+=_zhematrix operator */ -inline zhematrix& zhematrix::operator+=(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] += mat.darray[j][i]; - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zhematrix-=_zhematrix operator */ -inline zhematrix& zhematrix::operator-=(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] -= mat.darray[j][i]; - } - } - - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix+_zhematrix operator */ -inline _zhematrix operator+(const zhematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matB.darray[j][i] += matA.darray[j][i]; - } - } - - return matB; -} - -//============================================================================= -/*! zhematrix-_zhematrix operator */ -inline _zhematrix operator-(const zhematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matB.darray[j][i] =matA.darray[j][i]-matB.darray[j][i]; - } - } - - return matB; -} - -//============================================================================= -/*! zhematrix*_zhematrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.n, &beta, newmat.array, &newmat.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/38/38cef6ad80b4a684538b9832fe9443effad3a3ff.svn-base b/cpplapack-r198/.svn/pristine/38/38cef6ad80b4a684538b9832fe9443effad3a3ff.svn-base deleted file mode 100644 index 97ee0083828836b5844e9cbdf9c2c397c9042e89..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/38/38cef6ad80b4a684538b9832fe9443effad3a3ff.svn-base +++ /dev/null @@ -1,1035 +0,0 @@ -//============================================================================= -/*! solve A*X=Y using dgesv\n - The argument is dgematrix Y. Y is overwritten and become the solution X. - A is also overwritten and become P*l*U. -*/ -inline CPPL_INT dgematrix::dgesv(dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1); - dgesv_(&n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, &INFO); - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve A*x=y using dgesv\n - The argument is dcovector y. y is overwritten and become the solution x. - A is also overwritten and become P*l*U. -*/ -inline CPPL_INT dgematrix::dgesv(dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || m!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT NRHS(1), LDA(n), *IPIV(new CPPL_INT[n]), LDB(vec.l), INFO(1); - dgesv_(&n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, &INFO); - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! solve overdetermined or underdetermined A*X=Y using dgels\n - */ -inline CPPL_INT dgematrix::dgels(dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - dgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - double *WORK(new double[LWORK]); - dgels_(&TRANS, &m, &n, &NRHS, array, &LDA, mat.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - dgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<tmp.m; i++){ - for(CPPL_INT j=0; j<tmp.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve overdetermined or underdetermined A*x=y using dgels\n - */ -inline CPPL_INT dgematrix::dgels(dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - dcovector tmp(n); - for(CPPL_INT i=0; i<vec.l; i++){ - tmp(i)=vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - double *WORK(new double[LWORK]); - dgels_(&TRANS, &m, &n, &NRHS, array, &LDA, vec.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - dcovector tmp(n); - for(CPPL_INT i=0; i<tmp.l; i++){ - tmp(i)=vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve overdetermined or underdetermined A*X=Y using dgels - with the sum of residual squares output\n - The residual is set as the columnwise sum of residual squares - for overdetermined problems - while it is always zero for underdetermined problems. -*/ -inline CPPL_INT dgematrix::dgels(dgematrix& mat, drovector& residual) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - residual.resize(mat.n); - residual.zero(); - - if(m<n){ //underdetermined - dgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - double *WORK(new double[LWORK]); - dgels_(&TRANS, &m, &n, &NRHS, array, &LDA, mat.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - for(CPPL_INT i=0; i<residual.l; i++){ - for(CPPL_INT j=0; j<m-n; j++){ - residual(i) += std::pow(mat(n+j,i), 2.0); - } - } - - dgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<tmp.m; i++){ - for(CPPL_INT j=0; j<tmp.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve overdetermined or underdetermined A*x=y using dgels - with the sum of residual squares output\n - The residual is set as the sum of residual squares - for overdetermined problems - while it is always zero for underdetermined problems. -*/ -inline CPPL_INT dgematrix::dgels(dcovector& vec, double& residual) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - residual=0.0; - - if(m<n){ //underdetermined - dcovector tmp(n); - for(CPPL_INT i=0; i<vec.l; i++){ - tmp(i)=vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - double *WORK(new double[LWORK]); - dgels_(&TRANS, &m, &n, &NRHS, array, &LDA, vec.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - for(CPPL_INT i=0; i<m-n; i++){ - residual+=std::pow(vec(n+i),2.0); - } - - dcovector tmp(n); - for(CPPL_INT i=0; i<tmp.l; i++){ - tmp(i)=vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate the least-squares-least-norm solution for overdetermined or - underdetermined A*x=y using dgelss\n -*/ -inline CPPL_INT dgematrix::dgelss -( - dcovector& B, - dcovector& S, - CPPL_INT& RANK, - const double RCOND =-1. - ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=B.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << B.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - dcovector tmp(n); - for(CPPL_INT i=0; i<B.l; i++){ - tmp(i)=B(i); - } - B.clear(); - swap(B,tmp); - } - - S.resize(std::min(m,n)); - - CPPL_INT NRHS(1), LDA(m), LDB(B.l), LWORK(3*std::min(m,n)+std::max(std::max(2*std::min(m,n),std::max(m,n)), NRHS)), INFO(1); - double *WORK(new double[LWORK]); - dgelss_(&m, &n, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, WORK, &LWORK, &INFO); - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate the least-squares-least-norm solution for overdetermined or - underdetermined A*x=y using dgelss\n -*/ -inline CPPL_INT dgematrix::dgelss -( - dgematrix& B, - dcovector& S, - CPPL_INT& RANK, - const double RCOND =-1. - ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=B.m){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << B.m << "x" << B.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - dgematrix tmp(n,B.n); - for(CPPL_INT i=0; i<B.m; i++){ - for(CPPL_INT j=0; j<B.n; j++){ - tmp(i,j)=B(i,j); - } - } - B.clear(); - swap(B,tmp); - } - - S.resize(std::min(m,n)); - - CPPL_INT NRHS(B.n), LDA(m), LDB(B.m), LWORK(3*std::min(m,n)+std::max(std::max(2*std::min(m,n),std::max(m,n)), NRHS)), INFO(1); - double *WORK(new double[LWORK]); - dgelss_(&m, &n, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, WORK, &LWORK, &INFO); - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate the least-squares-least-norm solution for overdetermined or underdetermined A*x=y using dgelsd\n -*/ -inline CPPL_INT dgematrix::dgelsd -( - dcovector& B, - dcovector& S, - CPPL_INT& RANK, - const double RCOND =-1. - ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=B.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << B.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// resize //////// - if(m<n){ //underdetermined - dcovector tmp(n); - for(CPPL_INT i=0; i<B.l; i++){ - tmp(i)=B(i); - } - B.clear(); - swap(B,tmp); - } - - S.resize(std::min(m,n)); - - //////// prerun //////// - CPPL_INT M =m; - CPPL_INT N =n; - CPPL_INT NRHS =1; - CPPL_INT LDA =m; - CPPL_INT LDB =B.l; - std::vector<double> WORK(1); - CPPL_INT LWORK =-1; - CPPL_INT MINMN =std::min(M,N); - CPPL_INT SMLSIZ =25; - CPPL_INT NLVL =CPPL_INT( std::log(double(MINMN)/double(SMLSIZ+1))/std::log(2.) ); - CPPL_INT LIWORK =3*MINMN*NLVL+11*MINMN; - std::vector<CPPL_INT> IWORK(LIWORK); - CPPL_INT INFO =1; - dgelsd_(&M, &N, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, &WORK[0], &LWORK, &IWORK[0], &INFO); - LWORK =CPPL_INT(WORK[0]); - WORK.resize(LWORK); - - //////// run //////// - INFO =1; - RANK =1; - dgelsd_(&M, &N, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, &WORK[0], &LWORK, &IWORK[0], &INFO); - - //////// info //////// - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate eigenvalues\n - All of the arguments need not to be initialized. - wr and wi are overwitten and become - real and imaginary part of eigenvalues, respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT dgematrix::dgeev(std::vector<double>& wr, std::vector<double>& wi) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix is not a square matrix." << std::endl - << "This matrix is (" << m << "x" << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - wr.resize(n); - wi.resize(n); - char JOBVL('n'), JOBVR('n'); - CPPL_INT LDA(n), LDVL(1), LDVR(1), LWORK(3*n), INFO(1); - double *VL(NULL), *VR(NULL), *WORK(new double[LWORK]); - dgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &wr[0], &wi[0], VL, &LDVL, VR, &LDVR, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] VL; - delete [] VR; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate eigenvalues\n - All of the arguments need not to be initialized. - w are overwitten and become eigenvalues, respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT dgematrix::dgeev(zcovector& w) -{CPPL_VERBOSE_REPORT; - //// call dgeev //// - std::vector<double> wr, wi; - CPPL_INT INFO =dgeev(wr,wi); - - //// assign //// - w.resize(n); - for(CPPL_INT i=0; i<n; i++){ - w(i) =comple(wr[i],wi[i]); - } - - return INFO; -} - -//============================================================================= -/*! calculate right eigenvalues and right eigenvectors\n - All of the arguments need not to be initialized. - wr, wi, vrr, vri are overwitten and become - real and imaginary part of right eigenvalues and right eigenvectors, - respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT dgematrix::dgeev -( - std::vector<double>& wr, - std::vector<double>& wi, - std::vector<dcovector>& vrr, - std::vector<dcovector>& vri - ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix is not a square matrix." << std::endl - << "This matrix is (" << m << "x" << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - wr.resize(n); - wi.resize(n); - vrr.resize(n); - vri.resize(n); - for(CPPL_INT i=0; i<n; i++){ - vrr[i].resize(n); - vri[i].resize(n); - } - - dgematrix VR(n,n); - char JOBVL('n'), JOBVR('V'); - CPPL_INT LDA(n), LDVL(1), LDVR(n), LWORK(4*n), INFO(1); - double *VL(NULL), *WORK(new double[LWORK]); - dgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &wr[0], &wi[0], VL, &LDVL, VR.array, &LDVR, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] VL; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - if(fabs(wi[j])<DBL_MIN){ - for(CPPL_INT i=0; i<n; i++){ - vrr[j](i) = VR(i,j); - vri[j](i) = 0.0; - } - } - else{ - for(CPPL_INT i=0; i<n; i++){ - vrr[j](i) = VR(i,j); - vri[j](i) = VR(i,j+1); - vrr[j+1](i) = VR(i,j); - vri[j+1](i) =-VR(i,j+1); - } - j++; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate right eigenvalues and right eigenvectors as complex objects\n - All of the arguments need not to be initialized. - w and vr are overwitten and become of right eigenvalues and right eigenvectors, respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT dgematrix::dgeev -( - std::vector<comple>& w, - std::vector<zcovector>& vr - ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix is not a square matrix." << std::endl - << "This matrix is (" << m << "x" << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// resize //////// - w.resize(n); - vr.resize(n); - for(CPPL_INT i=0; i<n; i++){ - vr[i].resize(n); - } - - //////// dgeev_ //////// - char JOBVL ='n'; - char JOBVR ='V'; - CPPL_INT LDA =n; - std::vector<double> wr(n); - std::vector<double> wi(n); - double *VL =NULL; - CPPL_INT LDVL =1; - dgematrix VR(n,n); - CPPL_INT LDVR =n; - CPPL_INT LWORK =4*n; - std::vector<double> WORK(LWORK); - CPPL_INT INFO =1; - dgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &wr[0], &wi[0], VL, &LDVL, VR.array, &LDVR, &WORK[0], &LWORK, &INFO); - delete [] VL; - - //////// convert //////// - for(CPPL_INT i=0; i<n; i++){ - w[i] =comple(wr[i], wi[i]); - } - - for(CPPL_INT j=0; j<n; j++){ - if(fabs(wi[j])<DBL_MIN){ - for(CPPL_INT i=0; i<n; i++){ - vr[j](i) = comple(VR(i,j), 0.); - } - } - else{ - for(CPPL_INT i=0; i<n; i++){ - vr[j](i) = comple(VR(i,j), VR(i,j+1)); - vr[j+1](i) = comple(VR(i,j), -VR(i,j+1)); - } - j++; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate left eigenvalues and left eigenvectors\n - All of the arguments need not to be initialized. - wr, wi, vrr, vri are overwitten and become - real and imaginary part of left eigenvalues and left eigenvectors, - respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT dgematrix::dgeev(std::vector<double>& wr, std::vector<double>& wi, - std::vector<drovector>& vlr, - std::vector<drovector>& vli) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix is not a square matrix." << std::endl - << "This matrix is (" << m << "x" << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - wr.resize(n); - wi.resize(n); - vlr.resize(n); - vli.resize(n); - for(CPPL_INT i=0; i<n; i++){ - vlr[i].resize(n); - vli[i].resize(n); - } - - dgematrix VL(n,n); - char JOBVL('V'), JOBVR('n'); - CPPL_INT LDA(n), LDVL(n), LDVR(1), LWORK(4*n), INFO(1); - double *VR(NULL), *WORK(new double[LWORK]); - dgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &wr[0], &wi[0], VL.array, &LDVL, VR, &LDVR, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] VR; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - if(fabs(wi[j])<DBL_MIN){ - for(CPPL_INT i=0; i<n; i++){ - vlr[j](i) = VL(i,j); - vli[j](i) = 0.0; - } - } - else{ - for(CPPL_INT i=0; i<n; i++){ - vlr[j](i) = VL(i,j); - vli[j](i) =-VL(i,j+1); - vlr[j+1](i) = VL(i,j); - vli[j+1](i) = VL(i,j+1); - } - j++; - } - } - - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate generalized eigenvalues\n - All of the arguments don't need to be initialized. - wr and wi are overwitten and become - real and imaginary part of generalized eigenvalues, respectively. - This matrix and matB are also overwritten. -*/ -inline CPPL_INT dgematrix::dggev(dgematrix& matB, - std::vector<double>& wr, std::vector<double>& wi) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix is not a square matrix." << std::endl - << "This matrix is (" << m << "x" << n << ")." << std::endl; - exit(1); - } - if(matB.m!=n || matB.n!=n){ - ERROR_REPORT; - std::cerr << "The matrix B is not a square matrix having the same size as \"this\" matrix." << std::endl - << "The B matrix is (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - wr.resize(n); - wi.resize(n); - char JOBVL('n'), JOBVR('n'); - CPPL_INT LDA(n), LDB(n), LDVL(1), LDVR(1), LWORK(8*n), INFO(1); - double *BETA(new double[n]), *VL(NULL), *VR(NULL), *WORK(new double[LWORK]); - dggev_(&JOBVL, &JOBVR, &n, array, &LDA, matB.array, &LDB, &wr[0], &wi[0], BETA, VL, &LDVL, VR, &LDVR, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] VL; - delete [] VR; - - //// reforming //// - for(CPPL_INT i=0; i<n; i++){ - wr[i]/=BETA[i]; - wi[i]/=BETA[i]; - } - delete [] BETA; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate generalized eigenvalues and generalized right eigenvectors\n - All of the arguments don't need to be initialized. - wr, wi, vrr and vri are overwitten and become - real and imaginary part of generalized eigenvalue - and generalized right eigenvector, respectively. - This matrix and matB are also overwritten. -*/ -inline CPPL_INT dgematrix::dggev(dgematrix& matB, - std::vector<double>& wr, std::vector<double>& wi, - std::vector<dcovector>& vrr, - std::vector<dcovector>& vri) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix is not a square matrix." << std::endl - << "This matrix is (" << m << "x" << n << ")." << std::endl; - exit(1); - } - if(matB.m!=n || matB.n!=n){ - ERROR_REPORT; - std::cerr << "The matrix B is not a square matrix having the same size as \"this\" matrix." << std::endl - << "The B matrix is (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - wr.resize(n); - wi.resize(n); - vrr.resize(n); - vri.resize(n); - for(CPPL_INT i=0; i<n; i++){ - vrr[i].resize(n); - vri[i].resize(n); - } - - dgematrix VR(n,n); - char JOBVL('n'), JOBVR('V'); - CPPL_INT LDA(n), LDB(n), LDVL(1), LDVR(n), LWORK(8*n), INFO(1); - double *BETA(new double[n]), *VL(NULL), *WORK(new double[LWORK]); - dggev_(&JOBVL, &JOBVR, &n, array, &LDA, matB.array, &LDB, &wr[0], &wi[0], BETA, VL, &LDVL, VR.array, &LDVR, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] VL; - - //// reforming //// - for(CPPL_INT i=0; i<n; i++){ - wr[i]/=BETA[i]; - wi[i]/=BETA[i]; - } - delete [] BETA; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - if(fabs(wi[j])<DBL_MIN){ - for(CPPL_INT i=0; i<n; i++){ - vrr[j](i) = VR(i,j); - vri[j](i) = 0.0; - } - } - else{ - for(CPPL_INT i=0; i<n; i++){ - vrr[j](i) = VR(i,j); - vri[j](i) = VR(i,j+1); - vrr[j+1](i) = VR(i,j); - vri[j+1](i) =-VR(i,j+1); - } - j++; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate generalized eigenvalues and generalized left eigenvectors\n - All of the arguments don't need to be initialized. - wr, wi, vlr and vli are overwitten and become - real and imaginary part of generalized eigenvalue - and generalized left eigenvector, respectively. - This matrix and matB are also overwritten. -*/ -inline CPPL_INT dgematrix::dggev(dgematrix& matB, - std::vector<double>& wr, std::vector<double>& wi, - std::vector<drovector>& vlr, - std::vector<drovector>& vli) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix is not a square matrix." << std::endl - << "This matrix is (" << m << "x" << n << ")." << std::endl; - exit(1); - } - if(matB.m!=n || matB.n!=n){ - ERROR_REPORT; - std::cerr << "The matrix B is not a square matrix having the same size as \"this\" matrix." << std::endl - << "The B matrix is (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - wr.resize(n); - wi.resize(n); - vlr.resize(n); - vli.resize(n); - for(CPPL_INT i=0; i<n; i++){ - vlr[i].resize(n); - vli[i].resize(n); - } - - dgematrix VL(n,n); - char JOBVL('V'), JOBVR('n'); - CPPL_INT LDA(n), LDB(n), LDVL(n), LDVR(1), LWORK(8*n), INFO(1); - double *BETA(new double[n]), *VR(NULL), *WORK(new double[LWORK]); - dggev_(&JOBVL, &JOBVR, &n, array, &LDA, matB.array, &LDB, &wr[0], &wi[0], BETA, VL.array, &LDVL, VR, &LDVR, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] VR; - - //// reforming //// - for(CPPL_INT i=0; i<n; i++){ - wr[i]/=BETA[i]; - wi[i]/=BETA[i]; - } - delete [] BETA; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - if(fabs(wi[j])<DBL_MIN){ - for(CPPL_INT i=0; i<n; i++){ - vlr[j](i) = VL(i,j); - vli[j](i) = 0.0; - } - } - else{ - for(CPPL_INT i=0; i<n; i++){ - vlr[j](i) = VL(i,j); - vli[j](i) =-VL(i,j+1); - vlr[j+1](i) = VL(i,j); - vli[j+1](i) = VL(i,j+1); - } - j++; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! compute the singular value decomposition (SVD)\n - The argument is dgbmatrix S. - S doesn't need to be initialized. - S is overwitten and become singular values. - This matrix also overwritten. -*/ -inline CPPL_INT dgematrix::dgesvd -( - dgbmatrix& S - ) -{CPPL_VERBOSE_REPORT; - char JOBU ='N'; - char JOBVT ='N'; - // M - // N - // A - CPPL_INT LDA =m; - double* U =NULL; - S.resize(m,n,0,0); - CPPL_INT LDU =1; - double* VT =NULL; - CPPL_INT LDVT =1; - CPPL_INT LWORK =std::max(3*std::min(m,n)+std::max(m,n),5*std::min(m,n)); - double *WORK =new double[LWORK]; - CPPL_INT INFO =1; - - dgesvd_(&JOBU, &JOBVT, &m, &n, array, &LDA, S.array, U, &LDU, VT, &LDVT, WORK, &LWORK, &INFO); - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! compute the singular value decomposition (SVD)\n - The arguments are dcocector S, dgematrix 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. -*/ -inline CPPL_INT dgematrix::dgesvd(dcovector& S, dgematrix& U, dgematrix& VT) -{CPPL_VERBOSE_REPORT; - char JOBU('A'), JOBVT('A'); - 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); - double *WORK(new double[LWORK]); - S.resize(std::min(m,n)); - U.resize(LDU,m); - VT.resize(LDVT,n); - - dgesvd_(&JOBU, &JOBVT, &m, &n, array, &LDA, S.array, U.array, &LDU, VT.array, &LDVT, WORK, &LWORK, &INFO); - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! solve the linear equality-constrained least squares (LSE) problem\n - Input matrix and vectors, B, c, and d, are overwitten. - This matrix is also overwritten. - The solution vector x is to be automatically resized. -*/ -inline CPPL_INT dgematrix::dgglse -( - dgematrix& B, - dcovector& c, - dcovector& d, - dcovector& x - ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=c.l){ - ERROR_REPORT; - std::cerr << "A.m and c.l should be the same." << std::endl - << "Your input was A.m=" << m << " and c.l=" << c.l << std::endl; - exit(1); - } - if(B.m!=d.l){ - ERROR_REPORT; - std::cerr << "B.m and d.l should be the same." << std::endl - << "Your input was B.m=" << B.m << " and d.l=" << d.l << std::endl; - exit(1); - } - if( !(B.m<=n) || !(n<=m+B.m) ){ - ERROR_REPORT; - std::cerr << "B.m<=A.n<=A.m+B.m should be satisfied." << std::endl - << "Your input was B.m=" << B.m << ", A.n=" << n << ", and A.m+B.m=" << m+B.m << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT lwork(-1), info(1); - dcovector work(1); - x.resize(n); - - //////// workspace query //////// - CPPL_INT lda =std::max(CPPL_INT(1),m); - CPPL_INT ldb =std::max(CPPL_INT(1),B.m); - dgglse_(&m, &n, &B.m, array, &lda, B.array, &ldb, c.array, d.array, x.array, work.array, &lwork, &info); - lwork =CPPL_INT(work(0)); - work.resize(lwork); - info =1; - - //////// solve //////// - dgglse_(&m, &n, &B.m, array, &lda, B.array, &ldb, c.array, d.array, x.array, work.array, &lwork, &info); - work.clear(); - - if(info!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. info = " << info << "." << std::endl; - } - return info; -} diff --git a/cpplapack-r198/.svn/pristine/39/391b1759703cd08c09fbc0f4ac41ff7fe0e4bc4e.svn-base b/cpplapack-r198/.svn/pristine/39/391b1759703cd08c09fbc0f4ac41ff7fe0e4bc4e.svn-base deleted file mode 100644 index ef1dc0cc14e2e359b365ff312386f5e1614e09d5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/39/391b1759703cd08c09fbc0f4ac41ff7fe0e4bc4e.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! drovector*dgbmatrix operator */ -inline _drovector operator*(const drovector& vec, const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/39/391fd8a4a7e7a5c2d291284c126a078de0561f92.svn-base b/cpplapack-r198/.svn/pristine/39/391fd8a4a7e7a5c2d291284c126a078de0561f92.svn-base deleted file mode 100644 index 7998a90631d3a57be4ef0f940823561544c7a805..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/39/391fd8a4a7e7a5c2d291284c126a078de0561f92.svn-base +++ /dev/null @@ -1,101 +0,0 @@ -############################################################################### -## Makefile.icpc ## -############################################################################### - -####################################### -############### common ################ -####################################### - -CXX = LC_ALL=C icpc - -######## FLAGS ######## -FLAGS += -gcc-name=gcc -gxx-name=g++ -FLAGS += -use-intel-optimized-headers -#FLAGS += -std=c++11 # -std=c++98 -#FLAGS += -fp-model no-except -fp-speculation=strict -FLAGS += -qopenmp -FLAGS += -mkl -#FLAGS += -ipp - -######## CFLAGS ######## -####CFLAGS += -Wall -w1 -Wshadow -Wcheck -Wno-unknown-pragmas -Wno-pragma-once - -######## LFLAGS ######## -####LFLAGS += -shared-intel -shared-libgcc -LFLAGS += -static-intel -static-libgcc -static-libstdc++ - -######## others ######## -INCLUDE_DIRS += -I./ -INCLUDE_DIRS += -I$(HOME)/local/cpplapack/include -INCLUDE_DIRS += -I$(HOME)/local/amgcl-trunk -LIB_DIRS += -LIBS += /usr/lib64/libboost_filesystem.a /usr/lib64/libboost_system.a -##LIBS += -llapack -lblas -lgfortran -#LIBS += -lgsl -lgslcblas -#LIBS += -lboost_filesystem -lboost_system -#LIBS += -lm -MACROS += - -####################################### -############ release mode ############# -####################################### -ifdef RELEASE -MACROS += -DRELEASE -#### FLAGS #### -#FLAGS += -fast -FLAGS += -xHOST -O3 -no-prec-div -static -fp-model fast=2 ## -fast without -ipo -#FLAGS += -axSSE2,SSE3,SSSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I,MIC-AVX512,CORE-AVX512 -O3 -ipo -no-prec-div -static -fp-model fast=2 ## for various arch -#FLAGS += -axSSE2,SSE3,SSSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I,MIC-AVX512,CORE-AVX512 -O3 -no-prec-div -static -fp-model fast=2 ## for various arch without -ipo -#FLAGS += -funroll-loops -fno-math-errno #-mfpmath=sse -#FLAGS += -fomit-frame-pointer -FLAGS += -w2 -diag-disable=remark,vec,par,cpu-dispatch -#### CFLAGS #### -#CFLAGS += -#### LFLAGS #### -#LFLAGS += -#### others #### -MACROS += -DBOOST_DISABLE_ASSERTS -endif - -####################################### -############ profile mode ############# -####################################### -ifdef PROFILE -MACROS += -DPROFILE -#### FLAGS #### -FLAGS += -fast -#### CFLAGS #### -CFLAGS += -pg #-g -#### LFLAGS #### -LFLAGS += -pg #-g -#### others #### -MACROS += -DBOOST_DISABLE_ASSERTS -endif - -####################################### -############## debug mode ############# -####################################### -ifdef DEBUG -MACROS += -DDEBUG -#### FLAGS #### -FLAGS += -g -O0 -w1 -Wcheck -Wno-unknown-pragmas -Wconversion -Wreturn-type -Wshadow -Woverflow -#### CFLAGS #### -#CFLAGS += -mfp-trap-mode=sui -CFLAGS += -fp-stack-check -ftrapuv -fmath-errno #-ffpe-trap=invalid,zero,overflow,underflow -#### LFLAGS #### -#LFLAGS += -lefence -#### others #### -MACROS += -DCPPL_DEBUG -endif - -####################################### -############ verbose mode ############# -####################################### -ifdef VERBOSE -MACROS += -DVERBOSE -DDEBUG -#### FLAGS #### -#### CFLAGS #### -#### LFLAGS #### -#### others #### -##MACROS += -DCPPL_VERBOSE -endif diff --git a/cpplapack-r198/.svn/pristine/39/39b4e5206d1b55f196cc71a49c95230fae40d5e3.svn-base b/cpplapack-r198/.svn/pristine/39/39b4e5206d1b55f196cc71a49c95230fae40d5e3.svn-base deleted file mode 100644 index 089b78205c5ae06e6d3d4de718781750b9055d09..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/39/39b4e5206d1b55f196cc71a49c95230fae40d5e3.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -//============================================================================= -/*! cast to _zgsmatrix */ -inline _zgsmatrix _dgsmatrix::to_zgsmatrix() const -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(m,n,CPPL_INT(data.size())); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, comple(it->v,0.)); - } - - destroy(); - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix _dgsmatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat(m,n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i,it->j) = it->v; - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/39/39f148e9ed02089ce4e517cd2160e477f01ee722.svn-base b/cpplapack-r198/.svn/pristine/39/39f148e9ed02089ce4e517cd2160e477f01ee722.svn-base deleted file mode 100644 index f0426cb10ae4a9fa59da55792032835128482388..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/39/39f148e9ed02089ce4e517cd2160e477f01ee722.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -//============================================================================= -/*! return transposed _dsymatrix */ -inline _dsymatrix t(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - WARNING_REPORT; - std::cerr << "This function call has no effect since the matrix is symmetric." << std::endl; -#endif//CPPL_DEBUG - - return mat; -} - -//============================================================================= -/*! return its inverse matrix */ -inline _dsymatrix i(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - dsymatrix mat_cp(mat); - dsymatrix mat_inv(mat_cp.n); - mat_inv.identity(); - - char UPLO('l'); - CPPL_INT NRHS(mat.n), LDA(mat.n), *IPIV(new CPPL_INT[mat.n]), LDB(mat.n), LWORK(-1), INFO(1); - double *WORK( new double[1] ); - dsysv_(&UPLO, &mat_cp.n, &NRHS, mat_cp.array, &LDA, IPIV, mat_inv.array, &LDB, WORK, &LWORK, &INFO); - - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsysv_(&UPLO, &mat_cp.n, &NRHS, mat_cp.array, &LDA, IPIV, mat_inv.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - dsymatrix newmat =mat; - idamax(i, j, newmat); -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - dsymatrix newmat =mat; - return damax(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/3a/3a10799836a5f7b1dda0f1920fb8aa1abd9de93c.svn-base b/cpplapack-r198/.svn/pristine/3a/3a10799836a5f7b1dda0f1920fb8aa1abd9de93c.svn-base deleted file mode 100644 index c1f7164dbb6ce48143904f9daa66496d63d7c60c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3a/3a10799836a5f7b1dda0f1920fb8aa1abd9de93c.svn-base +++ /dev/null @@ -1,90 +0,0 @@ -//============================================================================= -/*! dgelss_check_vector */ -void dgelss_check_vector() -{ - std::cout << "############ check dgelss vector ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3), N(4); - int RANK(0); - double RCOND(-1.0); - - //// make dgematrix A //// - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make dcovector b //// - CPPL::dcovector b(M); - for(int i=0; i<b.l; i++){ - b(i) =double( rand() /(RAND_MAX/10) ); - } - - //// make dcovector s //// - CPPL::dcovector s; - - //// make A_original //// - CPPL::dgematrix A_original(A); - - //// make A_original //// - CPPL::dcovector b_original(b); - - //// dgels //// - A.dgelss(b,s,RANK,RCOND); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "b_original=\n" << b_original << std::endl; - std::cout << "A=\n" << A << std::endl; - std::cout << "b=\n" << b << std::endl; - std::cout << "s=\n" << s << std::endl; - std::cout << "A_original*b=\n" << A_original*b << std::endl; -} - - -//============================================================================= -/*! dgelss_check_matrix */ -void dgelss_check_matrix() -{ - std::cout << "############ check dgelss matrix ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3), N(4); - int RANK(0); - double RCOND(-1.0); - - //// make dgematrix A //// - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make dgematrix B //// - CPPL::dgematrix b(M,2); - for(int i=0; i<b.m; i++){ - for(int j=0; j<b.n; j++){ - b(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - //// make dcovector s //// - CPPL::dcovector s; - - //// make A_original //// - CPPL::dgematrix A_original(A); - - //// make b_original //// - CPPL::dgematrix b_original(b); - - //// dgels //// - A.dgelss(b,s,RANK,RCOND); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "b_original=\n" << b_original << std::endl; - std::cout << "A=\n" << A << std::endl; - std::cout << "b=\n" << b << std::endl; - std::cout << "s=\n" << s << std::endl; - std::cout << "A_original*b=\n" << A_original*b << std::endl; -} diff --git a/cpplapack-r198/.svn/pristine/3a/3aeb852415a2ad7aad3920a35ae75dd516fc3993.svn-base b/cpplapack-r198/.svn/pristine/3a/3aeb852415a2ad7aad3920a35ae75dd516fc3993.svn-base deleted file mode 100644 index 29fc5065844e8c64b2277e9cc28f166f322988e7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3a/3aeb852415a2ad7aad3920a35ae75dd516fc3993.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _zgematrix+_zgsmatrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - matA(z.i,z.j) += z.v; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix-_zgsmatrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - matA(z.i,z.j) -= z.v; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix*_zgsmatrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,z.j) += matA(i,z.i)*z.v; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/3c/3c0387f7c8b41f1255264b6291a4604e91656447.svn-base b/cpplapack-r198/.svn/pristine/3c/3c0387f7c8b41f1255264b6291a4604e91656447.svn-base deleted file mode 100644 index d089b098d9914edc754d1f4616eb11db2a16c5ec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3c/3c0387f7c8b41f1255264b6291a4604e91656447.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix _zgsmatrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat(m,n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i,it->j) = it->v; - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/3c/3c3d34a4e73113c989f0441f64b1bda3539d2f0c.svn-base b/cpplapack-r198/.svn/pristine/3c/3c3d34a4e73113c989f0441f64b1bda3539d2f0c.svn-base deleted file mode 100644 index 8db5d889cd01e8fd0f28b199957b16a1d46055c1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3c/3c3d34a4e73113c989f0441f64b1bda3539d2f0c.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -//============================================================================= -/*! _zrovector+zrovector operator */ -inline _zrovector operator+(const _zrovector& vecA, const zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] += vecB.array[i]; - } - - return vecA; -} - -//============================================================================= -/*! zrovector-zrovector operator */ -inline _zrovector operator-(const _zrovector& vecA, const zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] -= vecB.array[i]; - } - - return vecA; -} - -//============================================================================= -/*! zrovector^T*zrovector operator (inner product) */ -inline comple operator%(const _zrovector& vecA, const zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/3d/3d08fd156a888f53477d3ad37b26cdc28eab9359.svn-base b/cpplapack-r198/.svn/pristine/3d/3d08fd156a888f53477d3ad37b26cdc28eab9359.svn-base deleted file mode 100644 index 724dea6bac09d303001d4e8e346b150c92b2d364..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3d/3d08fd156a888f53477d3ad37b26cdc28eab9359.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! +dgematrix operator */ -inline const dgematrix& operator+(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -dgematrix operator */ -inline _dgematrix operator-(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(mat.m,mat.n); - for(CPPL_INT i=0; i<newmat.m*newmat.n; i++){ newmat.array[i]=-mat.array[i]; } - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/3d/3d4ae814da494edec78dae872f2e4042b3534803.svn-base b/cpplapack-r198/.svn/pristine/3d/3d4ae814da494edec78dae872f2e4042b3534803.svn-base deleted file mode 100644 index e8102cc72de3532247b02edc4e10958014d06d31..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3d/3d4ae814da494edec78dae872f2e4042b3534803.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zgsmatrix*_zcovector operator */ -inline _zcovector operator*(const _zgsmatrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v*vec(it->j); - } - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/3d/3d6f3094f4eb461d9a77e39a247a1989e9989d95.svn-base b/cpplapack-r198/.svn/pristine/3d/3d6f3094f4eb461d9a77e39a247a1989e9989d95.svn-base deleted file mode 100644 index cb4b8f98a0abf3a9970aad43f6c94985baf50372..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3d/3d6f3094f4eb461d9a77e39a247a1989e9989d95.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! _zrovector*zhsmatrix operator */ -inline _zrovector operator*(const _zrovector& vec, const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) +=vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) +=vec(it->j)*std::conj(it->v); - } - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/3d/3df6c62b0608eab5d94c1ed33ed2be14baccaf73.svn-base b/cpplapack-r198/.svn/pristine/3d/3df6c62b0608eab5d94c1ed33ed2be14baccaf73.svn-base deleted file mode 100644 index ed4a037d21bc6417fada5d13ea81a678332bd2d4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3d/3df6c62b0608eab5d94c1ed33ed2be14baccaf73.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _zrovector*zcovector operator */ -inline comple operator*(const _zrovector& rovec, const zcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - - comple val =zdotu_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - rovec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/3e/3e3e4a9e3b350dbf15e24d126304ceac1ea7d66b.svn-base b/cpplapack-r198/.svn/pristine/3e/3e3e4a9e3b350dbf15e24d126304ceac1ea7d66b.svn-base deleted file mode 100644 index ec9e97271fd68793977314a604f9897465660417..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3e/3e3e4a9e3b350dbf15e24d126304ceac1ea7d66b.svn-base +++ /dev/null @@ -1,225 +0,0 @@ -//============================================================================= -/*! zgbmatrix=zgbmatrix operator\n - The left side matrix is overwritten thoroughly including band width. */ -inline zgbmatrix& zgbmatrix::operator=(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - if(array!=mat.array){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix+=zgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline zgbmatrix& zgbmatrix::operator+=(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) += mat(i,j); - } - } - - return *this; - } - - else{ - zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j) += operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j) += mat(i,j); - } - } - - swap(*this,newmat); - return *this; - } -} - -//============================================================================= -/*! zgbmatrix-=zgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline zgbmatrix& zgbmatrix::operator-=(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - return *this; - } - - else{ - zgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j) += operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j) -= mat(i,j); - } - } - - swap(*this,newmat); - return *this; - } -} - -//============================================================================= -/*! zgbmatrix*=zgbmatrix operator */ -inline zgbmatrix& zgbmatrix::operator*=(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-kl), std::max(CPPL_INT(0),j-mat.ku) ); k<kmax; k++){ - newmat(i,j)+= operator()(i,k)*mat(k,j); - } - } - } - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix+zgbmatrix operator */ -inline _zgbmatrix operator+(const zgbmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) += matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix-zgbmatrix operator */ -inline _zgbmatrix operator-(const zgbmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix*zgbmatrix operator */ -inline _zgbmatrix operator*(const zgbmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/3e/3e82ffdafdfbbab1563d0099aa3067b6bbb95bf0.svn-base b/cpplapack-r198/.svn/pristine/3e/3e82ffdafdfbbab1563d0099aa3067b6bbb95bf0.svn-base deleted file mode 100644 index 0508543e2ccf1a532481ff097bc0ccef188afeae..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3e/3e82ffdafdfbbab1563d0099aa3067b6bbb95bf0.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! zhsmatrix+_zhematrix operator */ -/* -inline _zgematrix operator+(const zhsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matB.destroy(); - return _(newmat); -} -*/ - -//============================================================================= -/*! zhsmatrix-_zhematrix operator */ -/* -inline _zgematrix operator-(const zhsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matB.destroy(); - return _(newmat); -} -*/ - -//============================================================================= -/*! zhsmatrix*_zhematrix operator */ -/* -inline _zgematrix operator*(const zhsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/3f/3f70d36ec5fc0ab5201bac05e299f89a83f351c9.svn-base b/cpplapack-r198/.svn/pristine/3f/3f70d36ec5fc0ab5201bac05e299f89a83f351c9.svn-base deleted file mode 100644 index c7a0d6b0ae4cced3556f3831a24d2c3ca3adab49..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/3f/3f70d36ec5fc0ab5201bac05e299f89a83f351c9.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _dgbmatrix*double operator */ -inline _dgbmatrix operator*(const _dgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - dscal_(&size, &d, mat.array, &inc); - return mat; -} - -//============================================================================= -/*! _dgbmatrix/double operator */ -inline _dgbmatrix operator/(const _dgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - double dinv =1./d; - CPPL_INT inc =1; - dscal_(&size, &dinv, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/40/409bfa139def74b231254e7913d242c406518837.svn-base b/cpplapack-r198/.svn/pristine/40/409bfa139def74b231254e7913d242c406518837.svn-base deleted file mode 100644 index 8f3ea23162f5691d4f4e64cb6f8ff1c05b7e0d84..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/40/409bfa139def74b231254e7913d242c406518837.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*zgematrix operator */ -inline _zgematrix operator*(const double& d, const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m, mat.n); - - const CPPL_INT size =mat.m*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/41/4112be592d77744d97c15098616d7d6ed37c4cec.svn-base b/cpplapack-r198/.svn/pristine/41/4112be592d77744d97c15098616d7d6ed37c4cec.svn-base deleted file mode 100644 index 26d81c595d48428df03ea145cc74158f406d4657..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/41/4112be592d77744d97c15098616d7d6ed37c4cec.svn-base +++ /dev/null @@ -1,32 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::dcovector x(M); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "x =\n" << x << endl; - cout << "t(x) =\n" << CPPL::t(x) << endl; - cout << "idamax(x)=\n" << CPPL::idamax(x) << endl; - cout << "damax(x)=\n" << CPPL::damax(x) << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/41/414411a7dc08762abf8b91c5fea8a584b3c6cefa.svn-base b/cpplapack-r198/.svn/pristine/41/414411a7dc08762abf8b91c5fea8a584b3c6cefa.svn-base deleted file mode 100644 index 01c24bb1cad1b81aa6ca5c13a1495226ec273a4a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/41/414411a7dc08762abf8b91c5fea8a584b3c6cefa.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! return transposed _zhematrix */ -inline _zhematrix t(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - WARNING_REPORT; - std::cerr << "This function call has no effect since the matrix is symmetric." << std::endl; -#endif//CPPL_DEBUG - - return mat; -} - -//============================================================================= -/*! return its inverse matrix */ -inline _zgematrix i(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - zhematrix mat_cp(mat); - zgematrix mat_inv(mat_cp.n,mat_cp.n); - mat_inv.identity(); - mat_cp.zhesv(mat_inv); - - return _(mat_inv); -} diff --git a/cpplapack-r198/.svn/pristine/41/41478147eb1d24628e0584063447fbce88d24b21.svn-base b/cpplapack-r198/.svn/pristine/41/41478147eb1d24628e0584063447fbce88d24b21.svn-base deleted file mode 100644 index 35bac5b89f9fe4e9e051e0612859884daf6297df..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/41/41478147eb1d24628e0584063447fbce88d24b21.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! dsymatrix*dcovector operator */ -inline _dcovector operator*(const dsymatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/41/41a24267ed201059a29a8fd10c12ceae81a437d6.svn-base b/cpplapack-r198/.svn/pristine/41/41a24267ed201059a29a8fd10c12ceae81a437d6.svn-base deleted file mode 100644 index 9235078894936c28e84c3c4003a6de24bdc3faef..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/41/41a24267ed201059a29a8fd10c12ceae81a437d6.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zrovector*_zgematrix operator */ -inline _zrovector operator*(const _zrovector& vec, const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/41/41b367f92900a6dc1f05c041367dd6cbff18389a.svn-base b/cpplapack-r198/.svn/pristine/41/41b367f92900a6dc1f05c041367dd6cbff18389a.svn-base deleted file mode 100644 index 3da30118d6490166ce5ac949be2ee442fe68c1a7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/41/41b367f92900a6dc1f05c041367dd6cbff18389a.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -//============================================================================= -/*! zgematrix constructor without arguments */ -inline zgematrix::zgematrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - array =NULL; - darray =NULL; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix copy constructor */ -inline zgematrix::zgematrix(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =mat.m; - n =mat.n; - array =new comple[m*n]; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } - - //////// copy //////// - CPPL_INT size =m*n; - CPPL_INT inc =1; - zcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! zgematrix constructor to cast _zgematrix */ -inline zgematrix::zgematrix(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix constructor with size specification */ -inline zgematrix::zgematrix(const CPPL_INT& _m, const CPPL_INT& _n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers. " << std::endl - << "Your input was (" << _m << "," << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - m =_m; - n =_n; - array =new comple[m*n]; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } -} - -//============================================================================= -/*! zgematrix constructor with filename */ -inline zgematrix::zgematrix(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - darray =NULL; - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix destructor */ -inline zgematrix::~zgematrix() -{CPPL_VERBOSE_REPORT; - //////// delete array //////// - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/42/42104d0d33001c277e85e3820db55b4719fc581a.svn-base b/cpplapack-r198/.svn/pristine/42/42104d0d33001c277e85e3820db55b4719fc581a.svn-base deleted file mode 100644 index 0828013e5b51a7a91a6a6542afc02ab08f3678b6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/42/42104d0d33001c277e85e3820db55b4719fc581a.svn-base +++ /dev/null @@ -1,160 +0,0 @@ -//============================================================================= -/*! clear vector */ -inline void zrovector::clear() -{CPPL_VERBOSE_REPORT; - l =0; - delete [] array; - array =NULL; -} - -//============================================================================= -/*! make vector into zero vector */ -inline zrovector& zrovector::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - array[i] =comple(0.,0.); - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the vector */ -inline void zrovector::chsign() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - array[i] =-array[i]; - } -} - -//============================================================================= -/*! make a deep copy of the zrovector */ -inline void zrovector::copy(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - delete [] array; - l =vec.l; - array =new comple[vec.l]; - CPPL_INT inc =1; - - zcopy_(&vec.l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the vector\n - This function is not desinged to be used in project codes. */ -inline void zrovector::shallow_copy(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - delete [] array; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! make an alias of the vector\n - Be carefull to use this function not to cause double free. */ -inline void zrovector::alias(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - //cap =vec.cap; - delete [] array; - array =vec.array; -} - -//============================================================================= -/*! unalias the vector */ -inline void zrovector::unalias() -{CPPL_VERBOSE_REPORT; - l =0; - //cap =0; - array =NULL; -} - -//============================================================================= -/*! resize vector */ -inline void zrovector::resize(const CPPL_INT& _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers." << std::endl - << "Your input was (" << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - l =_l; - delete [] array; - array =new comple[_l]; -} - -//============================================================================= -/*! extract the real part of the vector */ -inline _drovector zrovector::real() const -{CPPL_VERBOSE_REPORT; - drovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =array[i].real(); - } - return _(vec); -} - -//============================================================================= -/*! extract the imag part of the vector */ -inline _drovector zrovector::imag() const -{CPPL_VERBOSE_REPORT; - drovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =array[i].imag(); - } - return _(vec); -} - -//============================================================================= -/*! extract the absolute of the vector */ -inline _drovector zrovector::abs() const -{CPPL_VERBOSE_REPORT; - drovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =std::abs(array[i]); - } - return _(vec); -} - -//============================================================================= -/*! extract the argument of the vector */ -inline _drovector zrovector::arg() const -{CPPL_VERBOSE_REPORT; - drovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =std::arg(array[i]); - } - return _(vec); -} - -//============================================================================= -/*! swap two vectors */ -inline void swap(zrovector& u, zrovector& v) -{CPPL_VERBOSE_REPORT; - CPPL_INT u_L =u.l; - comple* u_Array =u.array; - u.l=v.l; u.array=v.array; - v.l=u_L; v.array=u_Array; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _zrovector _(zrovector& vec) -{CPPL_VERBOSE_REPORT; - _zrovector newvec; - - //////// shallow copy //////// - newvec.l =vec.l; - newvec.array =vec.array; - - //////// nullify //////// - vec.l =0; - vec.array =NULL; - - return newvec; -} diff --git a/cpplapack-r198/.svn/pristine/42/423337b1cc8dff18c2fda667ccde5c32fdd7871d.svn-base b/cpplapack-r198/.svn/pristine/42/423337b1cc8dff18c2fda667ccde5c32fdd7871d.svn-base deleted file mode 100644 index bee255c92fc4e6c2e08e546444025d30e31300d0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/42/423337b1cc8dff18c2fda667ccde5c32fdd7871d.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::dsymatrix A(N), B; - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "#### B.copy(A) ####" << endl; - B.copy(A); - cout << "B =\n" << B << endl; - - cout << "#### B.clear() ####" << endl; - B.clear(); - cout << "B =\n" << B << endl; - - cout << "#### B.resize(2) & B.zero() ####" << endl; - B.resize(2); - B.zero(); - cout << "B =\n" << B << endl; - - cout << "#### B.identity() ####" << endl; - B.identity(); - cout << "B =\n" << B << endl; - - cout << "B(0,:)=\n" << B.row(0) << endl; - cout << "B(:,0)=\n" << B.col(0) << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/42/429972f2209ddaa22f39abca37d26a3234d35d08.svn-base b/cpplapack-r198/.svn/pristine/42/429972f2209ddaa22f39abca37d26a3234d35d08.svn-base deleted file mode 100644 index f6f6eb4737dea526eacfe30beeea57dbb7216dce..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/42/429972f2209ddaa22f39abca37d26a3234d35d08.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -//============================================================================= -/*! return transposed dgematrix */ -inline _dsymatrix t(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - WARNING_REPORT; - std::cerr << "This function call has no effect since the matrix is symmetric." << std::endl; -#endif//CPPL_DEBUG - - dsymatrix newmat(mat); - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _dsymatrix i(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - dsymatrix mat_cp =mat; - dsymatrix mat_inv(mat.n); - mat_inv.identity(); - mat_inv.complete(); - - char UPLO('l'); - CPPL_INT NRHS(mat.n), LDA(mat.n), *IPIV(new CPPL_INT[mat.n]), LDB(mat.n), LWORK(-1), INFO(1); - double *WORK( new double[1] ); - dsysv_(&UPLO, &mat.n, &NRHS, mat_cp.array, &LDA, IPIV, mat_inv.array, &LDB, WORK, &LWORK, &INFO); - - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsysv_(&UPLO, &mat.n, &NRHS, mat_cp.array, &LDA, IPIV, mat_inv.array, &LDB, WORK, &LWORK, &INFO); - - delete [] WORK; - delete [] IPIV; - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - i=j=0; - double val =0.; - - for(CPPL_INT J=0; J<mat.n; J++){ - for(CPPL_INT I=J; I<mat.n; I++){ - if(val<fabs(mat.darray[J][I]) ){ - val =fabs(mat.darray[J][I]); - i=I; - j=J; - } - } - } -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT i,j; - idamax(i, j, mat); - return mat(i,j); -} diff --git a/cpplapack-r198/.svn/pristine/42/42bff0fdaf2e4ba18626408b2637f0f9816ecf4b.svn-base b/cpplapack-r198/.svn/pristine/42/42bff0fdaf2e4ba18626408b2637f0f9816ecf4b.svn-base deleted file mode 100644 index 1e975e7b44d326cdbba6074b2c4f7f736bfd75cf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/42/42bff0fdaf2e4ba18626408b2637f0f9816ecf4b.svn-base +++ /dev/null @@ -1,134 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::dsymatrix A(N), B(N); - CPPL::dgematrix X(N,N), Y(N,N), Z(N,N), G(M,N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - Z(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - for(int i=0; i<G.m; i++){ - for(int j=0; j<G.n; j++){ - G(i,j) = double( rand() /(RAND_MAX/10) ); - } - } - for(int i=0; i<A.n; i++){ - for(int j=0; j<A.n; j++){ - X(i,j) = -A(i,j); - Y(i,j) = A(i,j); - } - } - - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - cout << "X =\n" << X << endl; - cout << "Y =\n" << Y << endl; - cout << "Z =\n" << Z << endl; - cout << "G =\n" << G << endl; - - - //dge+dsy - cout << "X+A =\n" << X+A << "<-Should be zero." << endl; - //dge-dsy - cout << "Y-A =\n" << Y-A << "<-Should be zero." << endl; - //dge*dsy, t(_dge), t(dge), dsy*_dge, _dge-_dge - cout << "t(Y*A)-A*t(Y) =\n" << t(Y*A)-A*t(Y) << "<-Should be zero." << endl; - cout << "G*A-G*Y =\n" << G*A-G*Y << "<-Should be zero." << endl; - - //dge/dsy - //N/A - - //dge-dsy - CPPL::dgematrix W; - W =A.to_dgematrix(); - cout << "W-A =\n" << W-A << "<-Should be zero." << endl; - - //dge+=dsy - cout << "W+=A =\n" << (W+=A) << endl; - //dge-=dsy - cout << "W-=B =\n" << (W-=B) << endl; - //dge*=dsy, double*dsy, _dsy-dsy, _dsy*dsy, dge-_dsy - cout << "(W*=B)-((2*A-B)*B) =\n" << (W*=B)-((2*A-B)*B) << "<-Should be zero" << endl; - //W*=B; cout << "W-((2*A-B)*B) =\n" << W-((2*A-B)*B) << "<-Should be zero" << endl; - //N/A - //dge/=dsy - //N/A - - //dge+_dsy, -dsy - cout << "Y+(-A) =\n" << Y+(-A) << "<-Should be zero." << endl; - //dge-_dsy, -dsy - cout << "X-(-A) =\n" << X-(-A) << "<-Should be zero." << endl; - //dge*_dsy, dge*dsy, _dge-_dge - cout << "X*(A+B) - X*A - X*B =\n" << X*(A+B) - X*A - X*B << "<-Should be zero." << endl; - //dge/_dsy - //N/A - //dge+=_dsy, -dsy - cout << "W+=-A =\n" << (W+=-A) << endl; - //dge-=_dsy, dsy+dsy - cout << "W-=(A+B) =\n" << (W-=(A+B)) << endl; - //dge*=_dsy, dsy*dsy, dge+_dge - cout << "(W*=B)+A*B =\n" << (W*=B)+A*B << endl; - //dge/=_dsy - //N/A - - //_dge+dsy - cout << "(-Y)+A =\n" << (-Y)+A << "<-Should be zero." << endl; - //_dge-dsy, -dge - cout << "(-X)-A =\n" << (-X)-A << "<-Should be zero." << endl; - //_dge*dsy, -dge, dge*dsy, _dge+_dge - cout << "(-Z)*A+(Z*A) =\n" << (-Z)*A+(Z*A) << "<-Should be zero." << endl; - //_dge/dsy - //N/A - //_dge=dsy - //N/A - //_dge+=dsy - //N/A - //_dge-=dsy - //N/A - //_dge*=dsy - //N/A - //_dge/=dsy - //N/A - - //_dge+_dsy, -dge, -dsy - cout << "(-X)+(-A) =\n" << (-X)+(-A) << "<-Should be zero." << endl; - //_dge-_dsy, -dge, -dsy - cout << "(-Y)-(-A) =\n" << (-Y)-(-A) << "<-Should be zero." << endl; - //_dge*_dsy, -dge, -dsy, dge*dsy, _dge-_dge - cout << "(-Z)*(-A)-(Z*A) =\n" << (-Z)*(-A)-(Z*A) << "<-Should be zero." << endl; - //_dge/_dsy - //N/A - //_dge=_dsy - //N/A - //_dge+=_dsy - //N/A - //_dge-=_dsy - //N/A - //_dge*=_dsy - //N/A - //_dge/=_dsy - //N/A - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/42/42d69b629179a127d3ada13dd1844b132daac4e5.svn-base b/cpplapack-r198/.svn/pristine/42/42d69b629179a127d3ada13dd1844b132daac4e5.svn-base deleted file mode 100644 index 25700e8cf0fa777ea3fd04ace17a79068ec880ab..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/42/42d69b629179a127d3ada13dd1844b132daac4e5.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+_zhematrix operator */ -/* -inline _zgematrix operator+(const _zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix-_zhematrix operator */ -/* -inline _zgematrix operator-(const _zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to zgematrix //// - zgematrix newmat(-matB); - - //// add //// - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix*_zhematrix operator */ -/* -inline _zgematrix operator*(const _zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/43/434d07749d0ae86835c515a77b3528e0f4007679.svn-base b/cpplapack-r198/.svn/pristine/43/434d07749d0ae86835c515a77b3528e0f4007679.svn-base deleted file mode 100644 index b866205baca9b54600b18bbea6f2185f8e3b7e09..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/43/434d07749d0ae86835c515a77b3528e0f4007679.svn-base +++ /dev/null @@ -1,7 +0,0 @@ -//============================================================================= -/*! complex*_zhsmatrix operator */ -inline _zgsmatrix operator*(const comple& d, const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat =mat.to_zgsmatrix(); - return d*newmat; -} diff --git a/cpplapack-r198/.svn/pristine/43/436058cad873dcce87deb5cd867504c1379d3d90.svn-base b/cpplapack-r198/.svn/pristine/43/436058cad873dcce87deb5cd867504c1379d3d90.svn-base deleted file mode 100644 index c40293a3cdf0d5f38fe6b9457f65d379e2713f79..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/43/436058cad873dcce87deb5cd867504c1379d3d90.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================= -/*! _dgematrix+dgematrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =matA.m*matA.n; - for(CPPL_INT i=0; i<mn; i++){ - matA.array[i]+=matB.array[i]; - } - - return matA; -} - -//============================================================================= -/*! _dgematrix-dgematrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =matA.m*matA.n; - for(CPPL_INT i=0; i<mn; i++){ - matA.array[i]-=matB.array[i]; - } - - return matA; -} - -//============================================================================= -/*! _dgematrix*dgematrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - double alpha =1.; - double beta =0.; - - dgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/43/43a4a89e00a9fb00ea8abe4bacfd6a7b458b940f.svn-base b/cpplapack-r198/.svn/pristine/43/43a4a89e00a9fb00ea8abe4bacfd6a7b458b940f.svn-base deleted file mode 100644 index 328342a031c8d48ac28eac35fc7f0660eea332fe..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/43/43a4a89e00a9fb00ea8abe4bacfd6a7b458b940f.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! dgematrix*dcovector operator */ -inline _dcovector operator*(const dgematrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/43/43d383b2fec61f020a64e91f15c532853058dc9b.svn-base b/cpplapack-r198/.svn/pristine/43/43d383b2fec61f020a64e91f15c532853058dc9b.svn-base deleted file mode 100644 index 9a711289045e67e605323d670a473878faa467a4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/43/43d383b2fec61f020a64e91f15c532853058dc9b.svn-base +++ /dev/null @@ -1,130 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline comple& zrovector::operator()(const CPPL_INT& i) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -//============================================================================= -/*! operator() for const object */ -inline comple zrovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline zrovector& zrovector::set(const CPPL_INT& i, const comple& v) //const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[i] =v; - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zrovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ s << " " << vec.array[i]; } - s << std::endl; - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void zrovector::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zrovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << " "; - } - ofs << std::endl; - - ofs.close(); -} - -//============================================================================= -inline void zrovector::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zrovector" && id != "#zrovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zrovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> l; - resize(l); - for(CPPL_INT i=0; i<l; i++){ - s >> operator()(i); - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/43/43e39dc014bd3d3ae945a3f7e19bbf13c59f008b.svn-base b/cpplapack-r198/.svn/pristine/43/43e39dc014bd3d3ae945a3f7e19bbf13c59f008b.svn-base deleted file mode 100644 index 15bb33adb8303bc0230f27dc93ef518e1fb98f66..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/43/43e39dc014bd3d3ae945a3f7e19bbf13c59f008b.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::dcovector x(M); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "+x=\n" << +x << endl; - cout << "-x=\n" << -x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/44/441d4e2f846f203aad8d540f8243d0406b785cbf.svn-base b/cpplapack-r198/.svn/pristine/44/441d4e2f846f203aad8d540f8243d0406b785cbf.svn-base deleted file mode 100644 index aeaa620c33a6835fd6b5642ea7a8b480ef1f8338..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/44/441d4e2f846f203aad8d540f8243d0406b785cbf.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _zgbmatrix::nullify() const -{CPPL_VERBOSE_REPORT; - m=0; - n=0; - kl=0; - ku=0; - array=NULL; - darray=NULL; -} - - -//============================================================================= -/*! destroy all the matrix data */ -inline void _zgbmatrix::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; - array=NULL; - darray=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/44/44bb8d90c5778256d563bb4ab9c0fbd0577023fa.svn-base b/cpplapack-r198/.svn/pristine/44/44bb8d90c5778256d563bb4ab9c0fbd0577023fa.svn-base deleted file mode 100644 index 202c5fbd92b5c0de486bd7c6c7403ddfa417e7fd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/44/44bb8d90c5778256d563bb4ab9c0fbd0577023fa.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _dsymatrix+_dgsmatrix operator */ -inline _dgematrix operator+(const _dsymatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =matA.to_dgematrix(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix-_dgsmatrix operator */ -inline _dgematrix operator-(const _dsymatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =matA.to_dgematrix(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix*_dgsmatrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,it->j) += matB(i,it->i)*it->v; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/45/456eeef12d5ac8401e6f381375936125e0c4db19.svn-base b/cpplapack-r198/.svn/pristine/45/456eeef12d5ac8401e6f381375936125e0c4db19.svn-base deleted file mode 100644 index fbb5574336c0f3b3f0127ca39220142287527961..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/45/456eeef12d5ac8401e6f381375936125e0c4db19.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -//============================================================================= -/*! comple*_zcovector operator */ -inline _zcovector operator*(const comple& d, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zscal_(&vec.l, &d, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/45/4576b5b49ce2a9b5a7997a4c8244315d523ca67e.svn-base b/cpplapack-r198/.svn/pristine/45/4576b5b49ce2a9b5a7997a4c8244315d523ca67e.svn-base deleted file mode 100644 index cd61dbc3d45e40645ab252fe86c789ce35f1b725..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/45/4576b5b49ce2a9b5a7997a4c8244315d523ca67e.svn-base +++ /dev/null @@ -1,548 +0,0 @@ -//============================================================================= -/*! convert dgematrix_small to dgematrix */ -template<CPPL_INT m, CPPL_INT n> -inline _dgematrix dgematrix_small<m,n>::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix mat(m,n); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - mat(i,j) =(*this)(i,j); - } - } - return _(mat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT m, CPPL_INT n> -inline double& dgematrix_small<m,n>::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i+m*j]; -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT m, CPPL_INT n> -inline double dgematrix_small<m,n>::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i+m*j]; -} - -//============================================================================= -/*! set function */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& dgematrix_small<m,n>::set(const CPPL_INT& i, const CPPL_INT& j, const double& v) -{CPPL_VERBOSE_REPORT; - (*this)(i,j) =v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT m, CPPL_INT n> -inline std::ostream& operator<<(std::ostream& s, const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - s << " " << A(i,j); - } - s << std::endl; - } - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT m, CPPL_INT n> -inline void dgematrix_small<m,n>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - ofs << "#dgematrix" << " " << m << " " << n << std::endl; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - ofs << (*this)(i,j) << " "; - } - ofs << std::endl; - } - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT m, CPPL_INT n> -inline void dgematrix_small<m,n>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dgematrix" && id != "#dgematrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dgematrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _m, _n; - s >> _m >> _n; - if(m!=_m || n!=_n){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++ ){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return transposed matrix */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<n,m> t(const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,m> X; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - X(j,i) =A(i,j); - } - } - return X; -} - -//============================================================================= -/*! return its trace */ -template<CPPL_INT m, CPPL_INT n> -inline double trace(const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - double trace =0.; - - const CPPL_INT imax =std::min(m,n); - for(CPPL_INT i=0; i<imax; i++){ - trace +=A(i,i); - } - - return trace; -} - -//============================================================================= -/*! find index of the maximum component */ -template<CPPL_INT m, CPPL_INT n> -inline void idamax(CPPL_INT& I, CPPL_INT& J, const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - double max(-1.); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - if( max<fabs(A(i,j)) ){ - I=i; - J=j; - max =fabs(A(i,j)); - } - } - } - return; -} - -//============================================================================= -/*! return the maximum component */ -template<CPPL_INT m, CPPL_INT n> -inline double damax(const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - CPPL_INT i(0), j(0); - idamax(i,j,A); - return A(i,j); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zero */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& dgematrix_small<m,n>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ array[k]=0.; } - return *this; -} - -//============================================================================= -/*! identity */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& dgematrix_small<m,n>::identity() -{CPPL_VERBOSE_REPORT; - zero(); - - const CPPL_INT kmax =std::min(m,n); - for(CPPL_INT k=0; k<kmax; k++){ - (*this)(k,k)=1.; - } - - return *this; -} - -//============================================================================= -/*! return the j-th column vector */ -template<CPPL_INT m, CPPL_INT n> -inline dcovector_small<m> dgematrix_small<m,n>::col(const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; - dcovector_small<m> vec; - for(CPPL_INT i=0; i<m; i++){ vec(i)=(*this)(i,j); } - return vec; -} - -//============================================================================= -/*! return the i-th row vector */ -template<CPPL_INT m, CPPL_INT n> -inline drovector_small<n> dgematrix_small<m,n>::row(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; - drovector_small<n> vec; - for(CPPL_INT j=0; j<n; j++){ vec(j)=(*this)(i,j); } - return vec; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix_small+=dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& operator+=(dgematrix_small<m,n>& A, const dgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] +=B.array[k]; - } - return A; -} - -//============================================================================= -/*! dgematrix_small-=dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& operator-=(dgematrix_small<m,n>& A, const dgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] -=B.array[k]; - } - return A; -} - -//============================================================================= -/*! dgematrix_small*=dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT l, CPPL_INT n> -inline dgematrix_small<m,n>& operator*=(dgematrix_small<m,l>& A, const dgematrix_small<l,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> X; - X.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT k=0; k<l; k++){ - X(i,j) += A(i,k)*B(k,j); - } - } - } - A =X; - return A; -} - -//============================================================================= -/*! dgematrix_small*=dsymatrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& operator*=(dgematrix_small<m,n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> X; - X.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT k=0; k<j; k++){ - X(i,j) += A(i,k)*B(j,k); - } - for(CPPL_INT k=j; k<n; k++){ - X(i,j) += A(i,k)*B(k,j); - } - } - } - A =X; - return A; -} - -//============================================================================= -/*! dgematrix_small*=double operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& operator*=(dgematrix_small<m,n>& A, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] *=d; - } - return A; -} - -//============================================================================= -/*! dgematrix_small/double operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>& operator/=(dgematrix_small<m,n>& A, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<m*n; k++){ - A.array[k] /=d; - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary + operator */ -template<CPPL_INT m, CPPL_INT n> -inline const dgematrix_small<m,n>& operator+(const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary - operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator-(const dgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> X; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - X(i,j) =-A(i,j); - } - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix_small+dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator+(const dgematrix_small<m,n>& A, const dgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> C; - for(int i=0; i<m; i++){ - for(int j=0; j<n; j++){ - C(i,j) =A(i,j)+B(i,j); - } - } - return C; -} - -//============================================================================= -/*! dgematrix_small+dsymatrix_small operator */ -template<CPPL_INT n> -inline dgematrix_small<n,n> operator+(const dgematrix_small<n,n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - X(i,j) =A(i,j)+B(i,j); - } - for(CPPL_INT j=i; j<n; j++){ - X(i,j) =A(i,j)+B(j,i); - } - } - return X; -} - -//============================================================================= -/*! dgematrix_small-dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator-(const dgematrix_small<m,n>& A, const dgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> C; - for(int i=0; i<m; i++){ - for(int j=0; j<n; j++){ - C(i,j)=A(i,j)-B(i,j); - } - } - return C; -} - -//============================================================================= -/*! dgematrix_small-dsymatrix_small operator */ -template<CPPL_INT n> -inline dgematrix_small<n,n> operator-(const dgematrix_small<n,n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,n> X; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ X(i,j)=A(i,j)-B(i,j); } - for(CPPL_INT j=i+1; j<n; j++){ X(i,j)=A(i,j)-B(j,i); } - } - return X; -} - -//============================================================================= -/*! dgematrix_small*dcovector_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dcovector_small<m> operator*(const dgematrix_small<m,n>& A, const dcovector_small<n>& B) -{CPPL_VERBOSE_REPORT; - dcovector_small<m> C; - C.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i) +=A(i,j)*B(j); - } - } - return C; -} - -//============================================================================= -/*! dgematrix_small*dgematrix_small operator */ -template<CPPL_INT m, CPPL_INT l, CPPL_INT n> -inline dgematrix_small<m,n> operator*(const dgematrix_small<m,l>& A, const dgematrix_small<l,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> C; - C.zero(); - for(int i=0; i<m; i++){ - for(int j=0; j<n; j++){ - for(int k=0; k<l; k++){ - C(i,j) +=A(i,k)*B(k,j); - } - } - } - return C; -} - -//============================================================================= -/*! dgematrix_small*dsymatrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator*(const dgematrix_small<m,n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> X; - X.zero(); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT k=0; k<j; k++){ - X(i,j)+=A(i,k)*B(j,k); - } - for(CPPL_INT k=j; k<n; k++){ - X(i,j)+=A(i,k)*B(k,j); - } - } - } - return X; -} - -//============================================================================= -/*! dgematrix_small*double operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator*(const dgematrix_small<m,n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)*v; - } - } - return C; -} - -//============================================================================= -/*! dgematrix_small/double operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator/(const dgematrix_small<m,n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)/v; - } - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> hadamard(const dgematrix_small<m,n>& A, const dgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =A(i,j)*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT n> -inline dgematrix_small<n,n> hadamard(const dgematrix_small<n,n>& A, const dsymatrix_small<n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<n,n> C; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - C(i,j) =A(i,j)*B(i,j); - } - for(CPPL_INT j=i+1; j<n; j++){ - C(i,j) =A(i,j)*B(j,i); - } - } - return C; -} diff --git a/cpplapack-r198/.svn/pristine/45/458d2f0c08920baacb48ef3bfba8b17aad4bb66a.svn-base b/cpplapack-r198/.svn/pristine/45/458d2f0c08920baacb48ef3bfba8b17aad4bb66a.svn-base deleted file mode 100644 index 765bd58ad6ff95a65c1bbe566da13bf3f8a87174..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/45/458d2f0c08920baacb48ef3bfba8b17aad4bb66a.svn-base +++ /dev/null @@ -1,126 +0,0 @@ -//============================================================================= -void dggev_check_value() -{ - std::cout << "############ check dggev value ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A and B //// - CPPL::dgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - std::vector<double> wr, wi; - - //// make A_original and B_original //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix B_original(B); - - //// dggev //// - A.dggev(B, wr, wi); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "B_original=\n" << B_original << std::endl; - for(int i=0; i<A.m; i++){ - std::cout << "#### " << i << "th eigen ####" << std::endl; - std::cout << "wr=" << wr[i] <<std::endl; - std::cout << "wi=" << wi[i] <<std::endl; - } -} - -//============================================================================= -void dggev_check_right() -{ - std::cout << "############ check dggev right ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A and B //// - CPPL::dgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - std::vector<double> wr, wi; - std::vector<CPPL::dcovector> vrr, vri; - - //// make A_original and B_original //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix B_original(B); - - //// dggev //// - A.dggev(B, wr, wi ,vrr, vri); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "B_original=\n" << B_original << std::endl; - for(int i=0; i<A.m; i++){ - std::cout << "#### " << i << "th eigen ####" << std::endl; - std::cout << "wr=" << wr[i] <<std::endl; - std::cout << "wi=" << wi[i] <<std::endl; - std::cout << "vrr=\n" << vrr[i] <<std::endl; - std::cout << "vri=\n" << vri[i] <<std::endl; - std::cout << "Real[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n" - << A_original*vrr[i] - -(wr[i]*B_original*vrr[i] - wi[i]*B_original*vri[i]) - << std::endl; - std::cout << "Imag[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n" - << A_original*vri[i] - -(wr[i]*B_original*vri[i] + wi[i]*B_original*vrr[i]) - << std::endl; - } -} - -//============================================================================= -void dggev_check_left() -{ - std::cout << "############ check dggev left ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A and B //// - CPPL::dgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vl //// - std::vector<double> wr, wi; - std::vector<CPPL::drovector> vlr, vli; - - //// make A_original and B_original //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix B_original(B); - - //// dggev //// - A.dggev(B, wr, wi ,vlr, vli); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "B_original=\n" << B_original << std::endl; - for(int i=0; i<A.m; i++){ - std::cout << "#### " << i << "th eigen ####" << std::endl; - std::cout << "wr = " << wr[i] << std::endl; - std::cout << "wi = " << wi[i] << std::endl; - std::cout << "vlr = " << vlr[i]; - std::cout << "vli = " << vli[i] << std::endl; - std::cout << "Real[ {x}*[A] -lambda*{x}*[B] ] = (Should be zeros)\n" - << vlr[i]*A_original - -(wr[i]*vlr[i]*B_original - wi[i]*vli[i]*B_original) - << std::endl; - std::cout << "Imag[ [A]*{x} -lambda*{x}*[B] ] = (Should be zeros)\n" - << vli[i]*A_original - -(wr[i]*vli[i]*B_original + wi[i]*vlr[i]*B_original) - << std::endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/45/45c1fa72db1d8cacc1ed37031b8c96b9cbabd9f5.svn-base b/cpplapack-r198/.svn/pristine/45/45c1fa72db1d8cacc1ed37031b8c96b9cbabd9f5.svn-base deleted file mode 100644 index 5d6aa8112fdaa988660ec0ac8916c721b08ca2b6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/45/45c1fa72db1d8cacc1ed37031b8c96b9cbabd9f5.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! _zhematrix+zhematrix operator */ -inline _zhematrix operator+(const _zhematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] += matB.darray[j][i]; - } - } - - return matA; -} - -//============================================================================= -/*! _zhematrix-zhematrix operator */ -inline _zhematrix operator-(const _zhematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] -= matB.darray[j][i]; - } - } - - return matA; -} - -//============================================================================= -/*! _zhematrix*zhematrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.n, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/45/45c7bf611046a67b4b4373f7a519d2ae0c98b341.svn-base b/cpplapack-r198/.svn/pristine/45/45c7bf611046a67b4b4373f7a519d2ae0c98b341.svn-base deleted file mode 100644 index 934154d24f45cba2bc3676e744a7ade16c749cdb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/45/45c7bf611046a67b4b4373f7a519d2ae0c98b341.svn-base +++ /dev/null @@ -1,273 +0,0 @@ -%TGIF 4.1.43-QPL -state(0,37,100.000,0,200,0,16,1,9,1,1,1,0,0,0,1,0,'Courier',0,63360,0,3,1,5,0,0,1,1,0,16,0,0,1,1,1,1,1050,1485,0,0,2880,0). -% -% @(#)$Header$ -% %W% -% -unit("1 pixel/pixel"). -color_info(59,65535,0,[ - "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, - "red", 65535, 0, 0, 65535, 0, 0, 1, - "green", 0, 65535, 0, 0, 65535, 0, 1, - "blue", 0, 0, 65535, 0, 0, 65535, 1, - "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, - "pink", 65535, 49344, 52171, 65535, 49344, 52171, 1, - "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, - "CadetBlue", 24415, 40606, 41120, 24415, 40606, 41120, 1, - "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, - "black", 0, 0, 0, 0, 0, 0, 1, - "magenta1", 65535, 0, 65535, 65535, 0, 65535, 1, - "red1", 65535, 0, 0, 65535, 0, 0, 1, - "green1", 0, 65535, 0, 0, 65535, 0, 1, - "blue1", 0, 0, 65535, 0, 0, 65535, 1, - "yellow1", 65535, 65535, 0, 65535, 65535, 0, 1, - "pink1", 65535, 46517, 50629, 65535, 46517, 50629, 1, - "cyan1", 0, 65535, 65535, 0, 65535, 65535, 1, - "CadetBlue1", 39064, 62965, 65535, 39064, 62965, 65535, 1, - "gray90", 58853, 58853, 58853, 58853, 58853, 58853, 1, - "gray10", 6682, 6682, 6682, 6682, 6682, 6682, 1, - "magenta4", 35723, 0, 35723, 35723, 0, 35723, 1, - "red4", 35723, 0, 0, 35723, 0, 0, 1, - "green4", 0, 35723, 0, 0, 35723, 0, 1, - "blue4", 0, 0, 35723, 0, 0, 35723, 1, - "yellow4", 35723, 35723, 0, 35723, 35723, 0, 1, - "pink4", 35723, 25443, 27756, 35723, 25443, 27756, 1, - "cyan4", 0, 35723, 35723, 0, 35723, 35723, 1, - "CadetBlue4", 21331, 34438, 35723, 21331, 34438, 35723, 1, - "gray80", 52428, 52428, 52428, 52428, 52428, 52428, 1, - "gray20", 13107, 13107, 13107, 13107, 13107, 13107, 1, - "#ff4d4d", 65535, 19789, 19789, 65280, 19712, 19712, 1, - "#ff9c4d", 65535, 40092, 19789, 65280, 39936, 19712, 1, - "#ffec4d", 65535, 60652, 19789, 65280, 60416, 19712, 1, - "#c4ff4d", 50372, 65535, 19789, 50176, 65280, 19712, 1, - "#75ff4d", 30069, 65535, 19789, 29952, 65280, 19712, 1, - "#4dff75", 19789, 65535, 30069, 19712, 65280, 29952, 1, - "#4dffc4", 19789, 65535, 50372, 19712, 65280, 50176, 1, - "#4decff", 19789, 60652, 65535, 19712, 60416, 65280, 1, - "#4d9cff", 19789, 40092, 65535, 19712, 39936, 65280, 1, - "#4d4dff", 19789, 19789, 65535, 19712, 19712, 65280, 1, - "#fffffe", 65535, 65535, 65278, 65280, 65280, 65024, 1, - "#e0e0e0", 57568, 57568, 57568, 57344, 57344, 57344, 1, - "#d0d0d0", 53456, 53456, 53456, 53248, 53248, 53248, 1, - "#c0c0c0", 49344, 49344, 49344, 49152, 49152, 49152, 1, - "#b0b0b0", 45232, 45232, 45232, 45056, 45056, 45056, 1, - "#a0a0a0", 41120, 41120, 41120, 40960, 40960, 40960, 1, - "#808080", 32896, 32896, 32896, 32768, 32768, 32768, 1, - "#404040", 16448, 16448, 16448, 16384, 16384, 16384, 1, - "#101010", 4112, 4112, 4112, 4096, 4096, 4096, 1, - "#000001", 0, 0, 257, 0, 0, 256, 1, - "DarkSlateGray", 12079, 20303, 20303, 12079, 20303, 20303, 1, - "#00000000c000", 0, 0, 49344, 0, 0, 49152, 1, - "#820782070000", 33410, 33410, 0, 33287, 33287, 0, 1, - "#3cf3fbee34d2", 15420, 64507, 13364, 15603, 64494, 13522, 1, - "#3cf3fbed34d3", 15420, 64507, 13364, 15603, 64493, 13523, 1, - "#ffffa6990000", 65535, 42662, 0, 65535, 42649, 0, 1, - "#ffff0000fffe", 65535, 0, 65535, 65535, 0, 65534, 1, - "#fffe0000fffe", 65535, 0, 65535, 65534, 0, 65534, 1, - "#fffe00000000", 65535, 0, 0, 65534, 0, 0, 1 -]). -script_frac("0.6"). -fg_bg_colors('black','white'). -dont_reencode("FFDingbests:ZapfDingbats"). -page(1,"",1,''). -polygon('black','',7,[ - 150,600,150,650,350,650,375,625,375,500,250,500,150,600],3,2,1,0,259,3,0,0,0,0,'2',0, - "00",[ -]). -polygon('black','',7,[ - 150,100,150,150,350,350,375,350,375,225,250,100,150,100],3,2,1,0,211,0,0,0,0,0,'2',0, - "00",[ -]). -box('black','',150,100,375,350,0,2,1,0,0,0,0,0,0,'2',0,[ -]). -poly('black','',2,[ - 150,150,350,350],0,2,1,1,0,0,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -poly('black','',2,[ - 250,100,375,225],0,2,1,2,0,0,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -poly('black','',2,[ - 150,100,375,325],0,2,1,3,0,0,3,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -group([ -text('black',80,52,1,1,1,107,22,95,18,4,0,0,0,0,2,107,22,0,0,"",0,0,0,0,70,'',[ -minilines(107,22,0,0,1,0,0,[ -mini_line(107,18,4,0,0,0,[ -str_block(0,107,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,107,18,4,0,-1,0,0,0,0,0, - "Actual Matrix")]) -]) -])]), -rcbox('black','',20,45,140,80,0,2,1,0,16,102,0,0,0,0,'2',0,[ -]) -], -105,0,0,[ -]). -group([ -text('black',80,457,1,1,1,113,22,111,18,4,0,0,0,0,2,113,22,0,0,"",0,0,0,0,475,'',[ -minilines(113,22,0,0,1,0,0,[ -mini_line(113,18,4,0,0,0,[ -str_block(0,113,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,113,18,4,0,-1,0,0,0,0,0, - "Stored Matrix")]) -]) -])]), -rcbox('black','',20,450,140,485,0,2,1,0,16,110,0,0,0,0,'2',0,[ -]) -], -109,0,0,[ -]). -box('black','',150,500,375,650,0,2,1,125,0,0,0,0,0,'2',0,[ -]). -group([ -arc('black','',0,1,1,0,-289,-1140,259,-383,150,360,367,360,0,1096,1514,-6464,1472,35,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',262,376,1,1,1,9,17,49,14,3,0,0,0,0,2,9,17,0,0,"",0,0,0,0,390,'',[ -minilines(9,17,0,0,1,0,0,[ -mini_line(9,14,3,0,0,0,[ -str_block(0,9,14,3,0,-1,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,9,14,3,0,-1,0,0,0,0,0, - "n")]) -]) -])]) -], -137,0,0,[ -]). -group([ -arc('black','',0,1,1,0,-281,-200,59,225,385,100,385,350,1,680,850,1088,-2176,30,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',415,214,1,1,1,11,17,45,14,3,0,0,0,0,2,11,17,0,0,"",0,0,0,0,228,'',[ -minilines(11,17,0,0,1,0,0,[ -mini_line(11,14,3,0,0,0,[ -str_block(0,11,14,3,0,0,0,0,0,[ -str_seg('black','Times-Roman',0,80640,11,14,3,0,0,0,0,0,0,0, - "m")]) -]) -])]) -], -140,0,0,[ -]). -group([ -arc('black','',0,1,1,0,130,89,166,125,140,100,140,150,0,72,72,8704,5632,37,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',110,116,1,1,1,30,17,79,14,3,0,0,0,0,2,30,17,0,0,"",0,0,0,0,130,'',[ -minilines(30,17,0,0,1,0,0,[ -mini_line(30,14,3,0,0,0,[ -str_block(0,30,14,3,0,-2,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,30,14,3,0,-2,0,0,0,0,0, - "kl+1")]) -]) -])]) -], -143,0,0,[ -]). -group([ -arc('black','',0,1,1,0,45,80,198,280,150,90,246,90,1,306,400,6912,-2368,36,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',200,61,1,1,1,35,17,75,14,3,0,0,0,0,2,35,17,0,0,"",0,0,0,0,75,'',[ -minilines(35,17,0,0,1,0,0,[ -mini_line(35,14,3,0,0,0,[ -str_block(0,35,14,3,0,-2,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,35,14,3,0,-2,0,0,0,0,0, - "ku+1")]) -]) -])]) -], -146,0,0,[ -]). -group([ -arc('black','',0,1,1,0,-289,-840,259,-83,150,660,367,660,0,1096,1514,-6464,1472,170,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',261,676,1,1,1,9,17,169,14,3,0,0,0,0,2,9,17,0,0,"",0,0,0,0,690,'',[ -minilines(9,17,0,0,1,0,0,[ -mini_line(9,14,3,0,0,0,[ -str_block(0,9,14,3,0,-1,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,9,14,3,0,-1,0,0,0,0,0, - "n")]) -]) -])]) -], -168,0,0,[ -]). -poly('black','',2,[ - 150,600,250,500],0,2,1,171,0,0,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -poly('black','',2,[ - 350,650,375,625],0,2,1,236,0,3,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -arc('black','',0,1,1,0,45,480,198,680,150,490,246,490,1,306,400,6912,-2368,242,0,0,8,3,0,0,0,'1','8','3',0,[ -]). -text('black',200,461,1,1,1,18,17,241,14,3,0,0,0,0,2,18,17,0,0,"",0,0,0,0,475,'',[ -minilines(18,17,0,0,1,0,0,[ -mini_line(18,14,3,0,0,0,[ -str_block(0,18,14,3,0,-1,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,18,14,3,0,-1,0,0,0,0,0, - "ku")]) -]) -])]). -group([ -arc('black','',0,1,1,0,130,589,166,625,140,600,140,650,0,72,72,8704,5632,250,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',110,616,1,1,1,30,17,249,14,3,0,0,0,0,2,30,17,0,0,"",0,0,0,0,630,'',[ -minilines(30,17,0,0,1,0,0,[ -mini_line(30,14,3,0,0,0,[ -str_block(0,30,14,3,0,-2,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,30,14,3,0,-2,0,0,0,0,0, - "kl+1")]) -]) -])]) -], -248,0,0,[ -]). -poly('black','',2,[ - 150,600,375,600],0,2,1,251,0,3,3,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -text('black',155,506,4,0,1,84,44,266,9,2,0,0,0,0,2,84,44,0,0,"",0,0,0,0,515,'',[ -minilines(84,44,0,0,0,0,0,[ -mini_line(84,9,2,0,0,0,[ -str_block(0,84,9,2,0,-3,0,0,0,[ -str_seg('black','Courier',0,63360,84,9,2,0,-3,0,0,0,0,0, - "0 kl+ku+1 . .")]) -]), -mini_line(84,9,2,0,0,0,[ -str_block(0,84,9,2,0,-3,0,0,0,[ -str_seg('black','Courier',0,63360,84,9,2,0,-3,0,0,0,0,0, - "1 kl+ku+2 . .")]) -]), -mini_line(84,9,2,0,0,0,[ -str_block(0,84,9,2,0,-3,0,0,0,[ -str_seg('black','Courier',0,63360,84,9,2,0,-3,0,0,0,0,0, - ". . . .")]) -]), -mini_line(84,9,2,0,0,0,[ -str_block(0,84,9,2,0,-3,0,0,0,[ -str_seg('black','Courier',0,63360,84,9,2,0,-3,0,0,0,0,0, - ". . . .")]) -]) -])]). -group([ -arc('black','',0,1,1,0,-281,320,59,575,385,500,385,650,1,680,510,1088,-2176,152,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',430,567,1,1,1,47,17,151,14,3,0,0,0,0,2,47,17,0,0,"",0,0,0,0,581,'',[ -minilines(47,17,0,0,1,0,0,[ -mini_line(47,14,3,0,0,0,[ -str_block(0,47,14,3,0,-1,0,0,0,[ -str_seg('black','Times-Roman',0,80640,47,14,3,0,-1,0,0,0,0,0, - "kl+ku+1")]) -]) -])]) -], -272,0,0,[ -]). diff --git a/cpplapack-r198/.svn/pristine/46/46034aa17e73f96b3bb05faf878dbd7d92c27bcf.svn-base b/cpplapack-r198/.svn/pristine/46/46034aa17e73f96b3bb05faf878dbd7d92c27bcf.svn-base deleted file mode 100644 index 5304e72d249b6952d3131d2057cc981fe8fca63d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/46/46034aa17e73f96b3bb05faf878dbd7d92c27bcf.svn-base +++ /dev/null @@ -1,2308 +0,0 @@ -# Doxyfile 1.8.6 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = CPPLapack - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is included in -# the documentation. The maximum height of the logo should not exceed 55 pixels -# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo -# to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = ./ - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = NO - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a -# new page for each member. If set to NO, the documentation of a member will be -# part of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 2 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. -# -# Note For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by by putting a % sign in front of the word -# or globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO these classes will be included in the various overviews. This option has -# no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the -# todo list. This list is created by putting \todo commands in the -# documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the -# test list. This list is created by putting \test commands in the -# documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if <section_label> ... \endif and \cond <section_label> -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES the list -# will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. Do not use file names with spaces, bibtex cannot handle them. See -# also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO doxygen will only warn about wrong or incomplete parameter -# documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = doxygen.log - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. -# Note: If this tag is empty the current directory is searched. - -INPUT = ../include \ - main_page/MainPage.html \ - related_pages/RelatedPages.html - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank the -# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, -# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, -# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, -# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, -# *.qsf, *.as and *.js. - -FILE_PATTERNS = *.hpp \ - *.html - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = */.svn/* - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = ./related_pages \ - ../test \ - ../makefiles - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = ./image - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# <filter> <input-file> -# -# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER ) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = NO - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES, then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = NO - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 1 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- -# defined cascading style sheet that is included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefor more robust against future updates. -# Doxygen will copy the style sheet file to the output directory. For an example -# see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the stylesheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler ( hhc.exe). If non-empty -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated ( -# YES) or that it should be included in the master .chm file ( NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated ( -# YES) or a normal table of contents ( NO) in the .chm file. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use <access key> + S -# (what the <access key> is depends on the OS and browser, but it is typically -# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down -# key> to jump into the search results window, the results can be navigated -# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel -# the search. The filter options can be selected when the cursor is inside the -# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> -# to select a filter and <Enter> or <escape> to activate or cancel the filter -# option. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There -# are two flavours of web server based searching depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. See -# the section "External Indexing and Searching" for details. -# The default value is: NO. -# This tag requires that the tag SEARCHENGINE is set to YES. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain the -# search results. -# -# Doxygen ships with an example indexer ( doxyindexer) and search engine -# (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). -# -# See the section "External Indexing and Searching" for details. -# The default value is: NO. -# This tag requires that the tag SEARCHENGINE is set to YES. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will return the search results when EXTERNAL_SEARCH is enabled. -# -# Doxygen ships with an example indexer ( doxyindexer) and search engine -# (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and -# Searching" for details. -# This tag requires that the tag SEARCHENGINE is set to YES. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. -# The default file is: searchdata.xml. -# This tag requires that the tag SEARCHENGINE is set to YES. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. -# This tag requires that the tag SEARCHENGINE is set to YES. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of -# to a relative location where the documentation can be found. The format is: -# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... -# This tag requires that the tag SEARCHENGINE is set to YES. - -EXTRA_SEARCH_MAPPINGS = - -#--------------------------------------------------------------------------- -# Configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output. -# The default value is: YES. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: latex. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. -# -# Note that when enabling USE_PDFLATEX this option is only used for generating -# bitmaps for formulas in the HTML output, but not in the Makefile that is -# written to the output directory. -# The default file is: latex. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate -# index for LaTeX. -# The default file is: makeindex. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX -# documents. This may be useful for small projects and may help to save some -# trees in general. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used by the -# printer. -# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x -# 14 inches) and executive (7.25 x 10.5 inches). -# The default value is: a4. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names -# that should be included in the LaTeX output. To get the times font for -# instance you can specify -# EXTRA_PACKAGES=times -# If left blank no extra packages will be included. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. -# -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will -# replace them by respectively the title of the page, the current date and time, -# only the current date, the version number of doxygen, the project name (see -# PROJECT_NAME), or the project number (see PROJECT_NUMBER). -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. -# -# Note: Only use a user-defined footer if you know what you are doing! -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_FOOTER = - -# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the LATEX_OUTPUT output -# directory. Note that the files will be copied as-is; there are no commands or -# markers available. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_EXTRA_FILES = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is -# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will -# contain links (just like the HTML output) instead of page references. This -# makes the output suitable for online browsing using a PDF viewer. -# The default value is: YES. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -PDF_HYPERLINKS = YES - -# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES to get a -# higher quality PDF documentation. -# The default value is: YES. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode -# command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_BATCHMODE = NO - -# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the -# index chapters (such as File Index, Compound Index, etc.) in the output. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_HIDE_INDICES = NO - -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. -# The default value is: plain. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# Configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The -# RTF output is optimized for Word 97 and may not look too pretty with other RTF -# readers/editors. -# The default value is: NO. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: rtf. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF -# documents. This may be useful for small projects and may help to save some -# trees in general. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will -# contain hyperlink fields. The RTF file will contain links (just like the HTML -# output) instead of page references. This makes the output suitable for online -# browsing using Word or some other Word compatible readers that support those -# fields. -# -# Note: WordPad (write) and others do not support links. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's config -# file, i.e. a series of assignments. You only have to provide replacements, -# missing definitions are set to their default value. -# -# See also section "Doxygen usage" for information on how to generate the -# default style sheet that doxygen normally uses. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an RTF document. Syntax is -# similar to doxygen's config file. A template extensions file can be generated -# using doxygen -e rtf extensionFile. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for -# classes and files. -# The default value is: NO. - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. A directory man3 will be created inside the directory specified by -# MAN_OUTPUT. -# The default directory is: man. -# This tag requires that the tag GENERATE_MAN is set to YES. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to the generated -# man pages. In case the manual section does not start with a number, the number -# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is -# optional. -# The default value is: .3. -# This tag requires that the tag GENERATE_MAN is set to YES. - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it -# will generate one additional man file for each entity documented in the real -# man page(s). These additional files only source the real man page, but without -# them the man command would be unable to find the correct page. -# The default value is: NO. -# This tag requires that the tag GENERATE_MAN is set to YES. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that -# captures the structure of the code including all documentation. -# The default value is: NO. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: xml. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a -# validating XML parser to check the syntax of the XML files. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify a XML DTD, which can be used by a -# validating XML parser to check the syntax of the XML files. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program -# listings (including syntax highlighting and cross-referencing information) to -# the XML output. Note that enabling this will significantly increase the size -# of the XML output. -# The default value is: YES. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the DOCBOOK output -#--------------------------------------------------------------------------- - -# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files -# that can be used to generate PDF. -# The default value is: NO. - -GENERATE_DOCBOOK = NO - -# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in -# front of it. -# The default directory is: docbook. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_OUTPUT = docbook - -#--------------------------------------------------------------------------- -# Configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen -# Definitions (see http://autogen.sf.net) file that captures the structure of -# the code including all documentation. Note that this feature is still -# experimental and incomplete at the moment. -# The default value is: NO. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module -# file that captures the structure of the code including all documentation. -# -# Note that this feature is still experimental and incomplete at the moment. -# The default value is: NO. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary -# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI -# output from the Perl module output. -# The default value is: NO. -# This tag requires that the tag GENERATE_PERLMOD is set to YES. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely -# formatted so it can be parsed by a human reader. This is useful if you want to -# understand what is going on. On the other hand, if this tag is set to NO the -# size of the Perl module output will be much smaller and Perl will parse it -# just the same. -# The default value is: YES. -# This tag requires that the tag GENERATE_PERLMOD is set to YES. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file are -# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful -# so different doxyrules.make files included by the same Makefile don't -# overwrite each other's variables. -# This tag requires that the tag GENERATE_PERLMOD is set to YES. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all -# C-preprocessor directives found in the sources and include files. -# The default value is: YES. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names -# in the source code. If set to NO only conditional compilation will be -# performed. Macro expansion can be done in a controlled way by setting -# EXPAND_ONLY_PREDEF to YES. -# The default value is: NO. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then -# the macro expansion is limited to the macros specified with the PREDEFINED and -# EXPAND_AS_DEFINED tags. -# The default value is: NO. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES the includes files in the -# INCLUDE_PATH will be searched if a #include is found. -# The default value is: YES. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by the -# preprocessor. -# This tag requires that the tag SEARCH_INCLUDES is set to YES. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will be -# used. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that are -# defined before the preprocessor is started (similar to the -D option of e.g. -# gcc). The argument of the tag is a list of macros of the form: name or -# name=definition (no spaces). If the definition and the "=" are omitted, "=1" -# is assumed. To prevent a macro definition from being undefined via #undef or -# recursively expanded use the := operator instead of the = operator. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this -# tag can be used to specify a list of macro names that should be expanded. The -# macro definition that is found in the sources will be used. Use the PREDEFINED -# tag if you want to use a different macro definition that overrules the -# definition found in the source code. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will -# remove all refrences to function-like macros that are alone on a line, have an -# all uppercase name, and do not end with a semicolon. Such function macros are -# typically used for boiler-plate code, and will confuse the parser if not -# removed. -# The default value is: YES. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES tag can be used to specify one or more tag files. For each tag -# file the location of the external documentation should be added. The format of -# a tag file without this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where loc1 and loc2 can be relative or absolute paths or URLs. See the -# section "Linking to external documentation" for more information about the use -# of tag files. -# Note: Each tag file must have an unique name (where the name does NOT include -# the path). If a tag file is not located in the directory in which doxygen is -# run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create a -# tag file that is based on the input files it reads. See section "Linking to -# external documentation" for more information about the usage of tag files. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external class will be listed in the -# class index. If set to NO only the inherited external classes will be listed. -# The default value is: NO. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in -# the modules index. If set to NO, only the current project's groups will be -# listed. -# The default value is: YES. - -EXTERNAL_GROUPS = YES - -# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in -# the related pages index. If set to NO, only the current project's pages will -# be listed. -# The default value is: YES. - -EXTERNAL_PAGES = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# You can include diagrams made with dia in doxygen documentation. Doxygen will -# then run dia to produce the diagram and insert it in the documentation. The -# DIA_PATH tag allows you to specify the directory where the dia binary resides. -# If left empty dia is assumed to be found in the default search path. - -DIA_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide inheritance -# and usage relations if the target is undocumented or is not a class. -# The default value is: YES. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent -# Bell Labs. The other options in this section have no effect if this option is -# set to NO -# The default value is: NO. - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed -# to run in parallel. When set to 0 doxygen will base this on the number of -# processors available in the system. You can set it explicitly to a value -# larger than 0 to get control over the balance between CPU load and processing -# speed. -# Minimum value: 0, maximum value: 32, default value: 0. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_NUM_THREADS = 0 - -# When you want a differently looking font n the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTPATH = - -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a -# graph for each documented class showing the direct and indirect implementation -# dependencies (inheritance, containment, and class references variables) of the -# class with other documented classes. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside the -# class node. If there are many fields or methods and many nodes the graph may -# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the -# number of items for each type to make the size more manageable. Set this to 0 -# for no limit. Note that the threshold may be exceeded by 50% before the limit -# is enforced. So when you set the threshold to 10, up to 15 fields may appear, -# but if the number exceeds 15, the total amount of fields shown is limited to -# 10. -# Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. - -UML_LIMIT_NUM_FIELDS = 10 - -# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and -# collaboration graphs will show the relations between templates and their -# instances. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -TEMPLATE_RELATIONS = YES - -# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to -# YES then doxygen will generate a graph for each documented file showing the -# direct and indirect include dependencies of the file with other documented -# files. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -INCLUDE_GRAPH = YES - -# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are -# set to YES then doxygen will generate a graph for each documented file showing -# the direct and indirect include dependencies of the file with other documented -# files. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH tag is set to YES then doxygen will generate a call -# dependency graph for every global function or class method. -# -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller -# dependency graph for every global function or class method. -# -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical -# hierarchy of all classes instead of a textual one. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the -# dependencies a directory has on other directories in a graphical way. The -# dependency relations are determined by the #include relations between the -# files in the directories. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. -# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order -# to make the SVG files visible in IE 9+ (other browsers do not have this -# requirement). -# Possible values are: png, jpg, gif and svg. -# The default value is: png. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# -# Note that this requires a modern browser other than Internet Explorer. Tested -# and working are Firefox, Chrome, Safari, and Opera. -# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make -# the SVG files visible. Older versions of IE do not have SVG support. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -INTERACTIVE_SVG = NO - -# The DOT_PATH tag can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the \dotfile -# command). -# This tag requires that the tag HAVE_DOT is set to YES. - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the \mscfile -# command). - -MSCFILE_DIRS = - -# The DIAFILE_DIRS tag can be used to specify one or more directories that -# contain dia files that are included in the documentation (see the \diafile -# command). - -DIAFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes -# that will be shown in the graph. If the number of nodes in a graph becomes -# larger than this value, doxygen will truncate the graph, which is visualized -# by representing a node as a red box. Note that doxygen if the number of direct -# children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that -# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. -# Minimum value: 0, maximum value: 10000, default value: 50. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs -# generated by dot. A depth value of 3 means that only nodes reachable from the -# root by following a path via at most 3 edges will be shown. Nodes that lay -# further from the root node will be omitted. Note that setting this option to 1 -# or 2 may greatly reduce the computation time needed for large code bases. Also -# note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. -# Minimum value: 0, maximum value: 1000, default value: 0. -# This tag requires that the tag HAVE_DOT is set to YES. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) support -# this, this feature is disabled by default. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page -# explaining the meaning of the various boxes and arrows in the dot generated -# graphs. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot -# files that are used to generate the various graphs. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_CLEANUP = YES diff --git a/cpplapack-r198/.svn/pristine/46/461c1d0c5a43e90fd32bb9331e624f3f30caae24.svn-base b/cpplapack-r198/.svn/pristine/46/461c1d0c5a43e90fd32bb9331e624f3f30caae24.svn-base deleted file mode 100644 index d4b14c07b633bfcce012aaf4c919906fb800e30a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/46/461c1d0c5a43e90fd32bb9331e624f3f30caae24.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -/*! dgbmatrix+_dgematrix operator */ -inline _dgematrix operator+(const dgbmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) += matA(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! dgbmatrix-_dgematrix operator */ -inline _dgematrix operator-(const dgbmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matB.m*matB.n; i++){ - matB.array[i]=-matB.array[i]; - } - - //// add //// - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) += matA(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! dgbmatrix*_dgematrix operator */ -inline _dgematrix operator*(const dgbmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/46/462fe16912fca201c13c6938ed37544d50dc2870.svn-base b/cpplapack-r198/.svn/pristine/46/462fe16912fca201c13c6938ed37544d50dc2870.svn-base deleted file mode 100644 index 03f162848b094523d5055bc3ef536497af64b459..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/46/462fe16912fca201c13c6938ed37544d50dc2870.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! +_dssmatrix operator */ -inline const _dssmatrix& operator+(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_dssmatrix operator */ -inline _dssmatrix operator-(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v =-it->v; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/46/46717a2d929ed4fe4d142a7191d202f9bad83660.svn-base b/cpplapack-r198/.svn/pristine/46/46717a2d929ed4fe4d142a7191d202f9bad83660.svn-base deleted file mode 100644 index 0e64d61f51a398fa781ce15432df860fee4e15ef..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/46/46717a2d929ed4fe4d142a7191d202f9bad83660.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+zgematrix operator */ -inline _zgematrix operator+(const _zgbmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix-zgematrix operator */ -inline _zgematrix operator-(const _zgbmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix*zgematrix operator */ -inline _zgematrix operator*(const _zgbmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/47/47a0a8ff3421ec3b941b1a02477473f8a38dd937.svn-base b/cpplapack-r198/.svn/pristine/47/47a0a8ff3421ec3b941b1a02477473f8a38dd937.svn-base deleted file mode 100644 index e0b5507790c546e764a6bcc6bd87274ad947776b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/47/47a0a8ff3421ec3b941b1a02477473f8a38dd937.svn-base +++ /dev/null @@ -1,160 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline zhecomplex zhematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(i>=j){ return zhecomplex(i,j, darray[j][i]); } - else { return zhecomplex(i,j, darray[i][j]); } -} - -//============================================================================= -/*! operator() for const object */ -inline comple zhematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(i>=j){ return darray[j][i]; } - else { return std::conj(darray[i][j]); } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline zhematrix& zhematrix::set(const CPPL_INT& i, const CPPL_INT& j, const comple& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //if(i>=j){ array[i+n*j] = v; } - //else{ array[j+n*i] = std::conj(v); } - if(i>=j){ darray[j][i] = v; } - else{ darray[i][j] = std::conj(v); } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if(i>j){ s << " " << mat(i,j) << " "; } - else if(i==j){ s << " " << std::real(mat(i,i)) << " "; } - else{ s << "{" << std::conj(mat(j,i)) << "} "; } - } - s << std::endl; - -#ifdef CPPL_DEBUG - if(std::fabs(std::imag(mat(i,i))) > DBL_MIN){ - WARNING_REPORT; - std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl; - } -#endif//CPPL_DEBUG - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void zhematrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zhematrix " << n << std::endl; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++ ){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - -#ifdef CPPL_DEBUG - if(std::fabs(std::imag(operator()(i,i))) > DBL_MIN){ - WARNING_REPORT; - std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl; - } -#endif//CPPL_DEBUG - } - - ofs.close(); -} - -//============================================================================= -inline void zhematrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s(filename); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zhematrix" && id != "#zhematrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zhematrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> n; - resize(n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++ ){ - s >> darray[j][i]; - //s >> operator()(i,j); //NG - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/48/482fd6b861ded5e86d772e39e7d4aeb1af1ba41f.svn-base b/cpplapack-r198/.svn/pristine/48/482fd6b861ded5e86d772e39e7d4aeb1af1ba41f.svn-base deleted file mode 100644 index 28c8e391b40fafc24a2aa4f17aabe04823f2d1fd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/48/482fd6b861ded5e86d772e39e7d4aeb1af1ba41f.svn-base +++ /dev/null @@ -1,134 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+_dgbmatrix operator */ -inline _dgbmatrix operator+(const _dgbmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>matB.kl && matA.ku>matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) += matB(i,j); - } - } - - matB.destroy(); - return matA; - } - - else if(matB.kl>matA.kl && matB.ku>matA.ku){ - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) += matA(i,j); - } - } - - matA.destroy(); - return matB; - } - - else{ - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) += matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! _dgbmatrix-_dgbmatrix operator */ -inline _dgbmatrix operator-(const _dgbmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>matB.kl && matA.ku>matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return matA; - } - - else{ - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! _dgbmatrix*_dgbmatrix operator */ -inline _dgbmatrix operator*(const _dgbmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/48/486304223ba3dec74418b08c6ca1262dbc6b2917.svn-base b/cpplapack-r198/.svn/pristine/48/486304223ba3dec74418b08c6ca1262dbc6b2917.svn-base deleted file mode 100644 index d4dc60501308182b97f8a3d75b23d35c6f353297..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/48/486304223ba3dec74418b08c6ca1262dbc6b2917.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _dssmatrix+_dgematrix operator */ -/* -inline _dgematrix operator+(const _dssmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return matB; -} -*/ -//============================================================================= -/*! _dssmatrix-_dgematrix operator */ -/* -inline _dgematrix operator-(const _dssmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(int i=0; i<matB.m*matB.n; i++){ - matB.array[i] = -matB.array[i]; - } - - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return matB; -} -*/ -//============================================================================= -/*! _dssmatrix*_dgematrix operator */ -/* -inline _dgematrix operator*(const _dssmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/48/48afe1a0bb4768b3fe13c320e245befdcd5e9c7f.svn-base b/cpplapack-r198/.svn/pristine/48/48afe1a0bb4768b3fe13c320e245befdcd5e9c7f.svn-base deleted file mode 100644 index c196e96152f6a662b17c8447a7291c86142f8082..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/48/48afe1a0bb4768b3fe13c320e245befdcd5e9c7f.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - cout << "A*(1,0) =\n" << A*complex<double>(1.,0.) << endl; - cout << "A*(0,1) =\n" << A*complex<double>(0.,1.) << endl; - cout << "A/(1,0) =\n" << A/complex<double>(1.,0.) << endl; - cout << "A/(0,1) =\n" << A/complex<double>(0.,1.) << endl; - - cout << "#### A*=(1,0); ####" << endl; - A*=complex<double>(1.,0.); - cout << "A =\n" << A << endl; - cout << "#### A*=(0,1); ####" << endl; - A*=complex<double>(0.,1.); - cout << "A =\n" << A << endl; - cout << "#### A/=(1,0); ####" << endl; - A/=complex<double>(1.,0.); - cout << "A =\n" << A << endl; - cout << "#### A/=(0,1); ####" << endl; - A/=complex<double>(0.,1.); - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/48/48b9811fe89abc41198a534ddd97366081db1059.svn-base b/cpplapack-r198/.svn/pristine/48/48b9811fe89abc41198a534ddd97366081db1059.svn-base deleted file mode 100644 index 89f69dd51c2954a72cdbfdcb1ec4bae4b139e21e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/48/48b9811fe89abc41198a534ddd97366081db1059.svn-base +++ /dev/null @@ -1,81 +0,0 @@ -//============================================================================= -/*! operator() for object */ -inline zhecomplex _zhematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is (" << n << "," << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(i>=j){ return zhecomplex(i,j, darray[j][i]); } - else { return zhecomplex(i,j, darray[i][j]); } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if(i>j){ - s << " " << mat(i,j) << " "; - } - else if(i==j){ - s << " " << std::real(mat(i,i)) << " "; - } - else{ - s << "{" << std::conj(mat.darray[i][j]) << "} "; - } - } - s << std::endl; - -#ifdef CPPL_DEBUG - if(std::fabs(std::imag(mat(i,i))) > DBL_MIN){ - WARNING_REPORT; - std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl; - } -#endif//CPPL_DEBUG - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _zhematrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zhematrix " << n << std::endl; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++ ){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - -#ifdef CPPL_DEBUG - if(std::fabs(std::imag(operator()(i,i))) > DBL_MIN){ - WARNING_REPORT; - std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl; - } -#endif//CPPL_DEBUG - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/49/49c4e5b1614f0ad0891f479c3b2ceef9d248e109.svn-base b/cpplapack-r198/.svn/pristine/49/49c4e5b1614f0ad0891f479c3b2ceef9d248e109.svn-base deleted file mode 100644 index 7160d6ecd3d1ef51aa0f2e67045beb3d4bc749dc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/49/49c4e5b1614f0ad0891f479c3b2ceef9d248e109.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix _zhsmatrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat( zgematrix(m,n).zero() ); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - newmat(it->j, it->i) =std::conj(it->v); - } - - destroy(); - return _(newmat); -} - -//============================================================================= -/*! convert to _zhematrix */ -inline _zhematrix _zhsmatrix::to_zhematrix() const -{CPPL_VERBOSE_REPORT; - zhematrix newmat(n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - } - - destroy(); - return _(newmat); -} - -//============================================================================= -/*! convert to _zgsmatrix */ -inline _zgsmatrix _zhsmatrix::to_zgsmatrix() const -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(m,n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, it->v); - if(it->i!=it->j){ - newmat.put(it->j, it->i, std::conj(it->v)); - } - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/49/49cebd584108eb8fb71ed97700adc900d766b47a.svn-base b/cpplapack-r198/.svn/pristine/49/49cebd584108eb8fb71ed97700adc900d766b47a.svn-base deleted file mode 100644 index 85680ab8df13ef502b852c2c96cc1338d125a2bd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/49/49cebd584108eb8fb71ed97700adc900d766b47a.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! dgsmatrix*_dcovector operator */ -inline _dcovector operator*(const dgsmatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v * vec(it->j); - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/4a/4a7eef395e65c203ff59b76bccdddd3d7fef50fa.svn-base b/cpplapack-r198/.svn/pristine/4a/4a7eef395e65c203ff59b76bccdddd3d7fef50fa.svn-base deleted file mode 100644 index 45f97a3743baf434452a203ee0428418364f76b2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4a/4a7eef395e65c203ff59b76bccdddd3d7fef50fa.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double _dgsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is (" << m << "," << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// search (i,j) component //////// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){ return data[*p].v; } - } - - //////// (i,j) component was not found //////// - return 0.0; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - std::vector<CPPL_INT>::iterator q; - const std::vector<CPPL_INT>::iterator mat_rows_i_end =mat.rows[i].end(); - for(q=mat.rows[i].begin(); q!=mat_rows_i_end; q++){ - if(mat.data[*q].j==j){ break; } - } - if(q!=mat_rows_i_end){ s << " " << mat.data[*q].v; } - else{ s << " x"; } - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _dgsmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dgsmatrix " << m << " " << n << " " << data.size() << std::endl; - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/4a/4a98f63a75511be1f18e0f7e11cfa5b428ec4714.svn-base b/cpplapack-r198/.svn/pristine/4a/4a98f63a75511be1f18e0f7e11cfa5b428ec4714.svn-base deleted file mode 100644 index 06c219c4869cebcee3329001c70b404f4efc095f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4a/4a98f63a75511be1f18e0f7e11cfa5b428ec4714.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! nullify all the vector data */ -inline void _zrovector::nullify() const -{CPPL_VERBOSE_REPORT; - l=0; - array=NULL; -} - -//============================================================================= -/*! destroy all the vector data */ -inline void _zrovector::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - array=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/4a/4ae8a24ec3579c7a9465a25693aeb00804558260.svn-base b/cpplapack-r198/.svn/pristine/4a/4ae8a24ec3579c7a9465a25693aeb00804558260.svn-base deleted file mode 100644 index 26174d0893f9ac14d4dda18176273776ac7b9aa7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4a/4ae8a24ec3579c7a9465a25693aeb00804558260.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -//============================================================================= -/*! dcovector*drovector operator */ -inline _dgematrix operator*(const dcovector& covec, const drovector& rovec) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(covec.l, rovec.l); - for(CPPL_INT i=0; i<newmat.m; i++){ for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - }} - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/4a/4ae8ca06c3bde2f03c2ea710c0d453397575d036.svn-base b/cpplapack-r198/.svn/pristine/4a/4ae8ca06c3bde2f03c2ea710c0d453397575d036.svn-base deleted file mode 100644 index 6410a6dcb2ae6fb023f3171790c0e0f06ef074c9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4a/4ae8ca06c3bde2f03c2ea710c0d453397575d036.svn-base +++ /dev/null @@ -1,32 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "+A =\n" << +A << endl; - cout << "-A =\n" << -A << endl; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/4a/4aefc31a2062cde38a17782495e8ae80999b084c.svn-base b/cpplapack-r198/.svn/pristine/4a/4aefc31a2062cde38a17782495e8ae80999b084c.svn-base deleted file mode 100644 index a0d4f5c3eee57ef65c10157ca2dda2caf810115d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4a/4aefc31a2062cde38a17782495e8ae80999b084c.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -//============================================================================= -/*! zcovector constructor */ -inline zcovector::zcovector() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =0; - array =NULL; -} - -//============================================================================= -/*! zcovector copy constructor */ -inline zcovector::zcovector(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - array =new comple[l]; - - //////// copy //////// - CPPL_INT inc =1; - zcopy_(&l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! zcovector constructor to cast _zcovector */ -inline zcovector::zcovector(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! zcovector constructor with size specification */ -inline zcovector::zcovector(const CPPL_INT& _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers. " << std::endl - << "Your input was (" << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - l =_l; - array =new comple[l]; -} - -//============================================================================= -/*! zcovector constructor with filename */ -inline zcovector::zcovector(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - - //// copy //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector destructor */ -inline zcovector::~zcovector() -{CPPL_VERBOSE_REPORT; - //////// delete array //////// - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/4b/4b4f304cb1b3ec095ef8b25284e53eb987d9a0d4.svn-base b/cpplapack-r198/.svn/pristine/4b/4b4f304cb1b3ec095ef8b25284e53eb987d9a0d4.svn-base deleted file mode 100644 index 258e4a7f14aba9a3e391aa4657f8dbc94a3ffd21..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4b/4b4f304cb1b3ec095ef8b25284e53eb987d9a0d4.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -//============================================================================= -/*! _zgematrix+_zgematrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - matA.array[i] += matB.array[i]; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix-_zgematrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - matA.array[i]-=matB.array[i]; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix*_zgematrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/4b/4b5c339c8588258822ff402edce2e4922bee1f02.svn-base b/cpplapack-r198/.svn/pristine/4b/4b5c339c8588258822ff402edce2e4922bee1f02.svn-base deleted file mode 100644 index d5b79b5b16f12dc72fb77c86645094f79ec54c2d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4b/4b5c339c8588258822ff402edce2e4922bee1f02.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! _zhematrix*comple operator */ -inline _zgematrix operator*(const _zhematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgematrix newmat =mat.to_zgematrix(); - - CPPL_INT size =mat.n*mat.n; - CPPL_INT inc =1; - zscal_(&size, &d, newmat.array, &inc); - - return _(newmat); -} - -//============================================================================= -/*! zhematrix/comple operator */ -inline _zgematrix operator/(const _zhematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgematrix newmat =mat.to_zgematrix(); - - CPPL_INT size =mat.n*mat.n; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&size, &dinv, newmat.array, &inc); - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/4b/4b8eacc13cf55890f9c0933b02825aab21a7c71a.svn-base b/cpplapack-r198/.svn/pristine/4b/4b8eacc13cf55890f9c0933b02825aab21a7c71a.svn-base deleted file mode 100644 index 724ae5fbd63f95b01a583d5654b4982f091b0f4a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4b/4b8eacc13cf55890f9c0933b02825aab21a7c71a.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -############################################################################### -## Makefile ## -############################################################################### - -CXX = g++ - -######## FLAGS ######## -FLAGS += -O3 -funroll-loops -ffast-math #-mfpmath=sse -FLAGS += -fomit-frame-pointer #-ftree-vectorizer-verbose=5 -#FLAGS = -march=core2 -msse4.1 -FLAGS += -std=c++0x # -std=c++98 # -##FLAGS += -fprefetch-loop-arrays -fforce-addr -march=pentium4 -ftree-vectorize -funsafe-loop-optimizations -Wunsafe-loop-optimizations -##FLAGS += -malign-double -#FLAGS += -fopenmp - -######## LFLAGS ######## -LFLAGS = $(FLAGS) -#LFLAGS += -static - -######## CFLAGS ######## -CFLAGS = $(FLAGS) -##CFLAGS += --param large-function-growth=99999 --param max-inline-insns-single=99999 --param inline-unit-growth=99999 -Winline -####CFLAGS += -fimplement-inlines -finline-limit=0 --param large-function-growth=0 --param max-inline-insns-single=0 --param inline-unit-growth=0 -CFLAGS += -Wall -Wno-unknown-pragmas -Wextra -ftree-vectorizer-verbose=0 - -######## others ######## -INCLUDE_DIRS = -I./ -I$(HOME)/local/cpplapack/include $(shell Magick++-config --cppflags) -LIB_DIRS = $(shell Magick++-config --ldflags) -#LIBS = /usr/lib/sse2/liblapack.a /usr/lib/sse2/libblas.a -lm -lgfortran -LIBS = -llapack -lblas -lm -lgfortran -LIBS += -lboost_filesystem $(shell Magick++-config --libs) -MACROS = -DCPPL_SECTOR_SIZE=1000000 - -############################# -######### profiling ######### -############################# -#CFLAGS += -pg #-g -#LFLAGS += -pg #-g -#LIBS = $(HOME)/opt/lapack-3.1.1/lapack_gprof.a $(HOME)/opt/lapack-3.1.1/blas_gprof.a -lm -lgfortran -#LIBS = $(HOME)/opt/lapack-3.1.1/lapack_gprof.a $(HOME)/opt/lapack-3.1.1/blas_gprof.a $(HOME)/opt/STLport-5.1.3/lib/libstlport_gprof.a -lm -lgfortran - -############################# -######### debugging ######### -############################# -ifdef DEBUG -FLAGS = -g -O0 -CFLAGS = $(FLAGS) -Wall -Wno-unknown-pragmas -Wextra -fstack-protector-all -fbounds-check -LFLAGS = $(FLAGS) -##LIBS += -lefence -MACROS = -DCPPL_DEBUG ####-DCPPL_VERBOSE -endif diff --git a/cpplapack-r198/.svn/pristine/4b/4bc5cde01a91d73a08238b59103614f660c6fa6a.svn-base b/cpplapack-r198/.svn/pristine/4b/4bc5cde01a91d73a08238b59103614f660c6fa6a.svn-base deleted file mode 100644 index cc3c9448684274a5713fcabd9934d892f5b6b87b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4b/4bc5cde01a91d73a08238b59103614f660c6fa6a.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -//============================================================================= -/*! return a transposed row vector */ -inline _drovector t(const dcovector& covec) -{CPPL_VERBOSE_REPORT; - drovector rovec(covec.l); - - CPPL_INT inc =1; - - dcopy_(&covec.l, covec.array, &inc, rovec.array, &inc); - - return _(rovec); -} - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return dnrm2_(&vec.l, vec.array, &inc); -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc=1; - return idamax_(&vec.l, vec.array, &inc) -1; -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return vec.array[idamax_(&vec.l, vec.array, &inc) -1]; -} diff --git a/cpplapack-r198/.svn/pristine/4b/4be0f2fa660322927d08083257c95c769d7c261b.svn-base b/cpplapack-r198/.svn/pristine/4b/4be0f2fa660322927d08083257c95c769d7c261b.svn-base deleted file mode 100644 index fe635d41df248ba0be9cc1cbf12f3800165a2fda..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4b/4be0f2fa660322927d08083257c95c769d7c261b.svn-base +++ /dev/null @@ -1,161 +0,0 @@ -//============================================================================= -/*! zgematrix+=_zgbmatrix operator */ -inline zgematrix& zgematrix::operator+=(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j)+=mat(i,j); - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zgematrix-=_zgbmatrix operator */ -inline zgematrix& zgematrix::operator-=(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - mat.destroy(); - return *this; -} -//============================================================================= -/*! zgematrix*=_zgbmatrix operator */ -inline zgematrix& zgematrix::operator*=(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(m,mat.n); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(mat.m,j+mat.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-mat.ku); k<kmax; k++){ - newmat(i,j) += operator()(i,k)*mat(k,j); - } - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+_zgbmatrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix-_zgbmatrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix*_zgbmatrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/4b/4bf04bc6349176c83fa25e31b277918f86274aea.svn-base b/cpplapack-r198/.svn/pristine/4b/4bf04bc6349176c83fa25e31b277918f86274aea.svn-base deleted file mode 100644 index a3e88148faf0f42dee69098aa09873e07eb2ee26..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4b/4bf04bc6349176c83fa25e31b277918f86274aea.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+zhematrix operator */ -inline _zgematrix operator+(const _zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)+=matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix-zhematrix operator */ -inline _zgematrix operator-(const _zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)-=matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix*zhematrix operator */ -inline _zgematrix operator*(const _zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=max(0,matB.indx[c]-(matA.ku+1)); - i<min(matA.m,matB.indx[c]+matA.kl); i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/4c/4c1de7b3eca4eaaada686af9ae3f79f824aa2783.svn-base b/cpplapack-r198/.svn/pristine/4c/4c1de7b3eca4eaaada686af9ae3f79f824aa2783.svn-base deleted file mode 100644 index 75e439fa7c7a0f9d8730a575861925a8f35abd07..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4c/4c1de7b3eca4eaaada686af9ae3f79f824aa2783.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(6), N(6), KL(1), KU(1); - - CPPL::zgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - - A.resize(M,M,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - CPPL::zgbmatrix A_orig(A); - - CPPL::zcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "A =\n" << A << endl; - cout << "y =\n" << y << endl; - cout << "#### A.zgbsv(y) ####" << endl; - A.zgbsv(y); - cout << "A =\n" << A << endl; - cout << "y =\n" << y << endl; - cout << "A_orig*y =\n" << A_orig*y << endl; - - - cout << "#### A=A_orig ####" << endl; - A=A_orig; - - CPPL::zgematrix Y(M,N); - for(int i=0; i<Y.m; i++){ for(int j=0; j<Y.n; j++){ - Y(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - cout << "A =\n" << A << endl; - cout << "Y =\n" << Y << endl; - cout << "#### A.zgbsv(Y) ####" << endl; - A.zgbsv(Y); - cout << "A =\n" << A << endl; - cout << "Y =\n" << Y << endl; - cout << "A_orig*Y =\n" << A_orig*Y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/4d/4d3ba882f65e0262b256823529cf426b75b22dbf.svn-base b/cpplapack-r198/.svn/pristine/4d/4d3ba882f65e0262b256823529cf426b75b22dbf.svn-base deleted file mode 100644 index 3b0ac914e1a76c92b26a3f49ede7e9e21dc3a5a5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4d/4d3ba882f65e0262b256823529cf426b75b22dbf.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! zrovector*_zhsmatrix operator */ -inline _zrovector operator*(const zrovector& vec, const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) +=vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) +=vec(it->j)*std::conj(it->v); - } - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/4d/4d933faf06891a77f4a9269537cbbe9d36afa1b2.svn-base b/cpplapack-r198/.svn/pristine/4d/4d933faf06891a77f4a9269537cbbe9d36afa1b2.svn-base deleted file mode 100644 index 8b42d96d87cc44af10b9bdcfead99d90762d2732..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4d/4d933faf06891a77f4a9269537cbbe9d36afa1b2.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*zgbmatrix operator */ -inline _zgbmatrix operator*(const double& d, const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/4d/4dc6be0f9804701137124cbbda625455ba566142.svn-base b/cpplapack-r198/.svn/pristine/4d/4dc6be0f9804701137124cbbda625455ba566142.svn-base deleted file mode 100644 index b189a6c2f581513d55c06ca537a906bf13805a9e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4d/4dc6be0f9804701137124cbbda625455ba566142.svn-base +++ /dev/null @@ -1,124 +0,0 @@ -//============================================================================= -//! Complex Double-precision Row Vector Class -class zrovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT l; //!< vector size - comple* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zrovector(); - inline zrovector(const zrovector&); - inline zrovector(const _zrovector&); - inline zrovector(const CPPL_INT&); - inline zrovector(const char*); - inline ~zrovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - - //////// io //////// - inline comple& operator()(const CPPL_INT&); - inline comple operator()(const CPPL_INT&) const; - inline zrovector& set(const CPPL_INT&, const comple&); - inline friend std::ostream& operator<<(std::ostream&, const zrovector&); - inline void write(const char*) const; - inline void read(const char*); - - //////// calc //////// - inline friend _zcovector t(const zrovector&); - inline friend _zrovector conj(const zrovector&); - inline friend _zcovector conjt(const zrovector&); - inline friend double nrm2(const zrovector&); - inline friend CPPL_INT idamax(const zrovector&); - inline friend comple damax(const zrovector&); - - //////// misc //////// - inline void clear(); - inline zrovector& zero(); - inline void chsign(); - inline void copy(const zrovector&); - inline void shallow_copy(const _zrovector&); - inline void alias(const zrovector&); - inline void unalias(); - inline void resize(const CPPL_INT&); - inline _drovector real() const; - inline _drovector imag() const; - inline _drovector abs() const; - inline _drovector arg() const; - inline friend void swap(zrovector&, zrovector&); - inline friend _zrovector _(zrovector&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline zrovector& operator=(const zrovector&); - inline zrovector& operator=(const _zrovector&); - - //////// += //////// - inline zrovector& operator+=(const zrovector&); - inline zrovector& operator+=(const _zrovector&); - - //////// -= //////// - inline zrovector& operator-=(const zrovector&); - inline zrovector& operator-=(const _zrovector&); - - //////// *= //////// - inline zrovector& operator*=(const double&); - inline zrovector& operator*=(const comple&); - - //////// /= //////// - inline zrovector& operator/=(const double&); - inline zrovector& operator/=(const comple&); - - //////// unary //////// - inline friend const zrovector& operator+(const zrovector&); - inline friend _zrovector operator-(const zrovector&); - - //////// + //////// - inline friend _zrovector operator+(const zrovector&, const zrovector&); - inline friend _zrovector operator+(const zrovector&, const _zrovector&); - - //////// - //////// - inline friend _zrovector operator-(const zrovector&, const zrovector&); - inline friend _zrovector operator-(const zrovector&, const _zrovector&); - - //////// * //////// - inline friend comple operator*(const zrovector&, const zcovector&); - inline friend comple operator*(const zrovector&, const _zcovector&); - inline friend _zrovector operator*(const zrovector&, const zgematrix&); - inline friend _zrovector operator*(const zrovector&, const _zgematrix&); - inline friend _zrovector operator*(const zrovector&, const zhematrix&); - inline friend _zrovector operator*(const zrovector&, const _zhematrix&); - inline friend _zrovector operator*(const zrovector&, const zgbmatrix&); - inline friend _zrovector operator*(const zrovector&, const _zgbmatrix&); - inline friend _zrovector operator*(const zrovector&, const zgsmatrix&); - inline friend _zrovector operator*(const zrovector&, const _zgsmatrix&); - inline friend _zrovector operator*(const zrovector&, const zhsmatrix&); - inline friend _zrovector operator*(const zrovector&, const _zhsmatrix&); - inline friend _zrovector operator*(const zrovector&, const double&); - inline friend _zrovector operator*(const zrovector&, const comple&); - - //////// / //////// - inline friend _zrovector operator/(const zrovector&, const double&); - inline friend _zrovector operator/(const zrovector&, const comple&); - - //////// % //////// - inline friend comple operator%(const zrovector&, const zrovector&); - inline friend comple operator%(const zrovector&, const _zrovector&); - - //////// double, comple //////// - inline friend _zrovector operator*(const double&, const zrovector&); - inline friend _zrovector operator*(const comple&, const zrovector&); - - //////// hadamard //////// - inline friend _zrovector hadamard(const zrovector&, const zrovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/4e/4e035ab2474a70041fce17a1ad335ed38914c908.svn-base b/cpplapack-r198/.svn/pristine/4e/4e035ab2474a70041fce17a1ad335ed38914c908.svn-base deleted file mode 100644 index 5e6135b20f21e3f95c4aef9809fb9bc61f99fd3c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4e/4e035ab2474a70041fce17a1ad335ed38914c908.svn-base +++ /dev/null @@ -1,160 +0,0 @@ -//============================================================================= -/*! clear vector */ -inline void zcovector::clear() -{CPPL_VERBOSE_REPORT; - l =0; - delete [] array; - array =NULL; -} - -//============================================================================= -/*! make vector into zero vector */ -inline zcovector& zcovector::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - array[i] =comple(0.,0.); - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the vector */ -inline void zcovector::chsign() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - array[i] =-array[i]; - } -} - -//============================================================================= -/*! make a deep copy of the zcovector */ -inline void zcovector::copy(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - delete [] array; - array =new comple[vec.l]; - - CPPL_INT inc =1; - zcopy_(&vec.l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the vector\n - This function is not desinged to be used in project codes. */ -inline void zcovector::shallow_copy(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - delete [] array; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! make an alias of the vector\n - Be carefull to use this function not to cause double free. */ -inline void zcovector::alias(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - //cap =vec.cap; - delete [] array; - array =vec.array; -} - -//============================================================================= -/*! unalias the vector */ -inline void zcovector::unalias() -{CPPL_VERBOSE_REPORT; - l =0; - //cap =0; - array =NULL; -} - -//============================================================================= -/*! resize vector */ -inline void zcovector::resize(const CPPL_INT& _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers." << std::endl - << "Your input was (" << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - l =_l; - delete [] array; - array =new comple[_l]; -} - -//============================================================================= -/*! extract the real part of the vector */ -inline _dcovector zcovector::real() const -{CPPL_VERBOSE_REPORT; - dcovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =array[i].real(); - } - return _(vec); -} - -//============================================================================= -/*! extract the imag part of the vector */ -inline _dcovector zcovector::imag() const -{CPPL_VERBOSE_REPORT; - dcovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =array[i].imag(); - } - return _(vec); -} - -//============================================================================= -/*! extract the absolute of the vector */ -inline _dcovector zcovector::abs() const -{CPPL_VERBOSE_REPORT; - dcovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =std::abs(array[i]); - } - return _(vec); -} - -//============================================================================= -/*! extract the argument of the vector */ -inline _dcovector zcovector::arg() const -{CPPL_VERBOSE_REPORT; - dcovector vec(l); - for(CPPL_INT i=0; i<l; i++){ - vec.array[i] =std::arg(array[i]); - } - return _(vec); -} - -//============================================================================= -/*! swap two vectors */ -inline void swap(zcovector& u, zcovector& v) -{CPPL_VERBOSE_REPORT; - CPPL_INT u_l =u.l; - comple* u_array =u.array; - u.l=v.l; u.array=v.array; - v.l=u_l; v.array=u_array; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _zcovector _(zcovector& vec) -{CPPL_VERBOSE_REPORT; - _zcovector newvec; - - //////// shallow copy //////// - newvec.l =vec.l; - newvec.array =vec.array; - - //////// nullify //////// - vec.l =0; - vec.array =NULL; - - return newvec; -} diff --git a/cpplapack-r198/.svn/pristine/4e/4e6b8cd07ef6456780ad90276d22593a956128b8.svn-base b/cpplapack-r198/.svn/pristine/4e/4e6b8cd07ef6456780ad90276d22593a956128b8.svn-base deleted file mode 100644 index b452ef15a3385c6e5df0e51e0509610ea0fc7116..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4e/4e6b8cd07ef6456780ad90276d22593a956128b8.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! solve A*X=Y using zgbsv\n - The argument is zgematrix Y. Y is overwritten and become the solution X. - A is also overwritten. */ -inline CPPL_INT zgbmatrix::zgbsv(zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || n!=mat.m){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat(m,n,kl,ku+kl); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =operator()(i,j); - } - } - - CPPL_INT NRHS(mat.n), LDAB(2*kl+ku+1), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1); - zgbsv_(&n, &kl, &ku, &NRHS, newmat.array, &LDAB, IPIV, mat.array, &LDB, &INFO); - delete [] IPIV; - - swap(*this,newmat); - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve A*x=y using zgbsv\n - The argument is zcovector y. y is overwritten and become the solution x. - A is also overwritten. */ -inline CPPL_INT zgbmatrix::zgbsv(zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat(m,n,kl,ku+kl); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =operator()(i,j); - } - } - - CPPL_INT NRHS(1), LDAB(2*kl+ku+1), *IPIV(new CPPL_INT[n]), LDB(vec.l), INFO(1); - zgbsv_(&n, &kl, &ku, &NRHS, newmat.array, &LDAB, IPIV, vec.array, &LDB, &INFO); - delete [] IPIV; - - swap(*this,newmat); - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} diff --git a/cpplapack-r198/.svn/pristine/4e/4e9a1c6d5dc89c785a43d135e75b52eec37e3fb0.svn-base b/cpplapack-r198/.svn/pristine/4e/4e9a1c6d5dc89c785a43d135e75b52eec37e3fb0.svn-base deleted file mode 100644 index 4633aa2a99a18de96e311be703174764290ecd5c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4e/4e9a1c6d5dc89c785a43d135e75b52eec37e3fb0.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! drovector*dgsmatrix operator */ -inline _drovector operator*(const drovector& vec, const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/4f/4f1d3b578a63dd94217d577c1bbdd41f9904281c.svn-base b/cpplapack-r198/.svn/pristine/4f/4f1d3b578a63dd94217d577c1bbdd41f9904281c.svn-base deleted file mode 100644 index 762edeab94fee66d5f581139eb33ce549fd1df97..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4f/4f1d3b578a63dd94217d577c1bbdd41f9904281c.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _dgsmatrix*dcovector operator */ -inline _dcovector operator*(const _dgsmatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v*vec(it->j); - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/4f/4f6d6720970c51a83c051237fc5d7b20a08fe82c.svn-base b/cpplapack-r198/.svn/pristine/4f/4f6d6720970c51a83c051237fc5d7b20a08fe82c.svn-base deleted file mode 100644 index ad30d3b0ff20995566b6cdb9ec7638302c404622..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4f/4f6d6720970c51a83c051237fc5d7b20a08fe82c.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _dgsmatrix*_dcovector operator */ -inline _dcovector operator*(const _dgsmatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v * vec(it->j); - } - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/4f/4ffcdb17d461662626bae101fb9749c70bfca7bd.svn-base b/cpplapack-r198/.svn/pristine/4f/4ffcdb17d461662626bae101fb9749c70bfca7bd.svn-base deleted file mode 100644 index 24f8d0d1c36096b35fcd1cfcfdd38f5a7319e881..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/4f/4ffcdb17d461662626bae101fb9749c70bfca7bd.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - //// make dgematrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - //// print A in two ways //// - cout << "A =\n" << A << endl; - for(int i=0; i<A.n; i++){ - for(int j=0; j<A.n; j++){ - cout << "A(" << i << "," << j << ") =" << A(i,j) << endl; - } - } - - A.complete(); - for(int i=0; i<A.n; i++){ - for(int j=0; j<=i; j++){ - cout << A.array[i+A.n*j] << ' '; - } - cout << endl; - } - - //// make A 10 times //// - cout << "#### A*=10.; ####" << endl; - A*=10.; - - //// make dgematrix B //// - CPPL::dsymatrix B(A); - cout << "B =\n" << B << endl; - for(int i=0; i<B.n; i++){ - for(int j=0; j<B.n; j++){ - cout << "B(" << i << "," << j << ") =" << B(i,j) << endl; - } - } - - //// print A+B //// - cout << "A+B=\n" << A+B << endl; - - //// write/read //// - B.write( "tmp.txt" ); - CPPL::dsymatrix C; - C.read( "tmp.txt" ); - cout << "C-B =\n" << C-B << "<-Should be zero." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/50/50042064fd4b5aa919bff79cfff430821487c1b5.svn-base b/cpplapack-r198/.svn/pristine/50/50042064fd4b5aa919bff79cfff430821487c1b5.svn-base deleted file mode 100644 index a4c92ed7627d34c92b16ef287d597fd2c1be131d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/50/50042064fd4b5aa919bff79cfff430821487c1b5.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -//============================================================================= -/*! double*_drovector operator */ -inline _drovector operator*(const double& d, const _drovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - dscal_(&vec.l, &d, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/50/500f83abd04ed4b652e1dd583c90f1bd35abe0ae.svn-base b/cpplapack-r198/.svn/pristine/50/500f83abd04ed4b652e1dd583c90f1bd35abe0ae.svn-base deleted file mode 100644 index 8fa032dbb814e16e4404a1d4b14eea56c87ceec6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/50/500f83abd04ed4b652e1dd583c90f1bd35abe0ae.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::zhematrix A(N), B(N); - CPPL::zcovector x(N), y(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - B(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - CPPL::zcovector z(x+y); - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - cout << "x =\n" << x << endl; - cout << "y =\n" << y << endl; - cout << "z =\n" << z << endl; - - cout << "A*z-A*x-A*y = (Should be zero)\n" << A*z-A*x-A*y << endl; - cout << "A*z-A*(x+y) = (Should be zero)\n" << A*z-A*(x+y) << endl; - cout << "(A+B)*x-A*x-B*x = (Should be zero)\n" << (A+B)*x-A*x-B*x << endl; - cout << "(A-B)*(x-y)-A*x+A*y+B*x-B*y = (Should be zero)\n" - << (A-B)*(x-y)-A*x+A*y+B*x-B*y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/50/50698d4f1f16985244deaeab492a2a452f6b3624.svn-base b/cpplapack-r198/.svn/pristine/50/50698d4f1f16985244deaeab492a2a452f6b3624.svn-base deleted file mode 100644 index 2d0c23073f93688911569db992b682002186f750..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/50/50698d4f1f16985244deaeab492a2a452f6b3624.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(3), N(4), KL(2), KU(1); - - CPPL::dgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - cout << "A =\n" << A << endl; - - cout << "#### t(A) ####" << endl; - cout << "t(A) =\n" << CPPL::t(A) << endl; - - cout << "#### i(A) ####" << endl; - A.resize(M,M,KL,KU); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if( !((i-j)>A.kl || (j-i)>A.ku) ){ A(i,j) =double( rand() /(RAND_MAX/10) ); } - }} - CPPL::dgematrix A_inv; - A_inv =CPPL::i(A); - //A_inv =i(A); // g++ cannot compile this line - - cout << "A =\n" << A << endl; - cout << "A_inv =\n" << A_inv << endl; - cout << "A*A_inv =\n" << A*A_inv << endl; - cout << "A_inv*A =\n" << A_inv*A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/50/5071ab22b5dba585588c78bce72becd9c795ed1d.svn-base b/cpplapack-r198/.svn/pristine/50/5071ab22b5dba585588c78bce72becd9c795ed1d.svn-base deleted file mode 100644 index d59aa648edfb6030c72dce0ae85d5101b851ba99..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/50/5071ab22b5dba585588c78bce72becd9c795ed1d.svn-base +++ /dev/null @@ -1,106 +0,0 @@ -//============================================================================= -//! Samll Real Double-precision Column Vector Class -template<CPPL_INT l> class dcovector_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - double array[l]; - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dcovector_small(); - inline explicit dcovector_small(const dcovector&); - inline dcovector_small(const double&, const double&); - inline dcovector_small(const double&, const double&, const double&); - inline dcovector_small(const double&, const double&, const double&, const double&); - inline ~dcovector_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _dcovector to_dcovector() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&); - inline double operator()(const CPPL_INT&) const; - inline dcovector_small<l>& set(const CPPL_INT&, const double&); - template<CPPL_INT _l> inline friend std::ostream& operator<<(std::ostream&, const dcovector_small<_l>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// calc //////// -#ifndef _MSC_VER - template<CPPL_INT _l> inline friend drovector_small<_l> t(const dcovector_small<_l>&); - template<CPPL_INT _l> inline friend double nrm2(const dcovector_small<_l>&); - template<CPPL_INT _l> inline friend CPPL_INT idamax(const dcovector_small<_l>&); - template<CPPL_INT _l> inline friend double damax(const dcovector_small<_l>&); -#endif//_MSC_VER - - //////// misc //////// - inline dcovector_small<l>& zero(); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT L> inline dcovector_small<L>& operator= (const dcovector_small<L>&); - //////// += //////// - template<CPPL_INT L> inline friend dcovector_small<L>& operator+=(dcovector_small<L>&, const dcovector_small<L>&); - //////// -= //////// - template<CPPL_INT L> inline friend dcovector_small<L>& operator-=(dcovector_small<L>&, const dcovector_small<L>&); - //////// *= //////// - template<CPPL_INT L> inline friend dcovector_small<L>& operator*=(dcovector_small<L>&, const double&); - //////// /= //////// - template<CPPL_INT L> inline friend dcovector_small<L>& operator/=(dcovector_small<L>&, const double&); - //////// unary //////// - template<CPPL_INT L> inline friend const dcovector_small<L>& operator+(const dcovector_small<L>&); - template<CPPL_INT L> inline friend dcovector_small<L> operator-(const dcovector_small<L>&); - //////// + //////// - template<CPPL_INT L> inline friend dcovector_small<L> operator+(const dcovector_small<L>&, const dcovector_small<L>&); - //////// - //////// - template<CPPL_INT L> inline friend dcovector_small<L> operator-(const dcovector_small<L>&, const dcovector_small<L>&); - //////// * //////// - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator*(const dcovector_small<M>&, const drovector_small<N>&); - template<CPPL_INT L> inline friend dcovector_small<L> operator*(const dcovector_small<L>&, const double&); - //////// / //////// - template<CPPL_INT L> inline friend dcovector_small<L> operator/(const dcovector_small<L>&, const double&); - //////// double //////// - template<CPPL_INT L> inline friend dcovector_small<L> operator*(const double&, const dcovector_small<L>&); - //////// hadamerd //////// - template<CPPL_INT L> inline friend dcovector_small<L> hadamerd(const dcovector_small<L>&, const dcovector_small<L>&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -//////// dcovec2 //////// -inline double operator/(const dcovec2&, const dcovec2&); -//inline dquater vr2q(const dcovec2&, const double&); -//inline dquater vt2q(const dcovec2&, const double&); -inline dcovec2 rotate(const dcovec2&, const double&); - -//////// dcovec3 //////// -inline dcovec3 operator/(const dcovec3&, const dcovec3&); -inline dcovec3 operator/=(dcovec3&, const dcovec3&); -inline dquater vr2q(const dcovec3&, const double&); -inline dquater vt2q(const dcovec3&, const double&); -inline dcovec3 rotate(const dcovec3&, const dquater&); - -//////// dquater //////// -inline dquater conj(const dquater&); -inline dcovec3 imag(const dquater&); -inline dquater inv(const dquater&); -inline dquater operator*(const dquater&, const dquater&); -inline dquater operator/(const dquater&, const dquater&); -inline dquater operator*=(dquater&, const dquater&); -inline dquater operator/=(dquater&, const dquater&); -inline dcovec3 q2vt(const dquater&); -inline dgemat3 q2m(const dquater&); diff --git a/cpplapack-r198/.svn/pristine/50/507e2a3ee36be618775136cc3cbdb59eb7112289.svn-base b/cpplapack-r198/.svn/pristine/50/507e2a3ee36be618775136cc3cbdb59eb7112289.svn-base deleted file mode 100644 index 4c3515ad6660086dea3b9df7855366be43a96bc1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/50/507e2a3ee36be618775136cc3cbdb59eb7112289.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _zhsmatrix+_zhsmatrix operator */ -inline _zhsmatrix operator+(const _zhsmatrix& matA, const _zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhsmatrix-_zhsmatrix operator */ -inline _zhsmatrix operator-(const _zhsmatrix& matA, const _zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -=it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhsmatrix*_zhsmatrix operator */ -/* -inline _zhsmatrix operator*(const _zhsmatrix& matA, const _zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matA.n); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.line[k].begin(); p!=matB.line[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/50/5084c5e3771fb6da754e0beb718f67eb10834dcf.svn-base b/cpplapack-r198/.svn/pristine/50/5084c5e3771fb6da754e0beb718f67eb10834dcf.svn-base deleted file mode 100644 index 7e60c1d923b8737fcedff0f98299a0f1ac7d53b9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/50/5084c5e3771fb6da754e0beb718f67eb10834dcf.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::dsymatrix A(N); - CPPL::dgematrix X(N,N), Y(N,N), Z(N,N); - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - for(int i=0; i<A.n; i++){ for(int j=0; j<A.n; j++){ - Z(i,j) =double( rand() /(RAND_MAX/10) ); - }} - for(int i=0; i<A.n; i++){ for(int j=0; j<A.n; j++){ - X(i,j) = -A(i,j); - Y(i,j) = A(i,j); - }} - - cout << "A =\n" << A << endl; - cout << "X =\n" << X << endl; - cout << "Y =\n" << Y << endl; - cout << "Z =\n" << Z << endl; - - - //dsy+dge - cout << "A+X =\n" << A+X << "<-Should be zero." << endl; - //dsy-dge - cout << "A-Y =\n" << A-Y << "<-Should be zero." << endl; - //dsy*dge, t(_dge), t(dge), _dge*dsy, _dge-_dge - cout << "A*Y =\n" << t(A*Y)-t(Y)*A << "<-Should be zero." << endl; - - //dsy+_dge, -dge - cout << "A+(-Y) =\n" << A+(-Y) << "<-Should be zero." << endl; - //dsy-_dge, -dge - cout << "A-(-X) =\n" << A-(-X) << "<-Should be zero." << endl; - //dsy*_dge, dge+dge, dsy*dge, _dge+_dge, _dge-_dge - cout << "A*(X+Z) - (A*X+A*Z) =\n" << A*(X+Z) - (A*X+A*Z) << "<-Should be zero." << endl; - - //_dsy+dge, -dsy - cout << "(-A)+Y =\n" << (-A)+Y << "<-Should be zero." << endl; - //_dsy-dge, -dsy - cout << "(-A)-X =\n" << (-A)-X << "<-Should be zero." << endl; - //_dsy*dge, -dsy, dsy*dge, _dge+_dge - cout << "(-A)*Z+(A*Z) =\n" << ((-A)*Z+(A*Z)) << "<-Should be zero." << endl; - - //_dsy+_dge, -dsy, -dge - cout << "(-A)+(-X) =\n" << (-A)+(-X) << "<-Should be zero." << endl; - //_dsy-_dge, -dsy, -dge - cout << "(-A)-(-Y) =\n" << (-A)-(-Y) << "<-Should be zero." << endl; - //_dsy*_dge, -dsy, -dge, dsy*dge, _dge*_dge - cout << "(-A)*(-Z)-(A*Z) =\n" << (-A)*(-Z)-(A*Z) << "<-Should be zero." << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/50/50dd391fa25390f1a73973b7e6fd1e39e0e0f42c.svn-base b/cpplapack-r198/.svn/pristine/50/50dd391fa25390f1a73973b7e6fd1e39e0e0f42c.svn-base deleted file mode 100644 index 6961736b5fd15765e9be98e706ecc9e850c26990..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/50/50dd391fa25390f1a73973b7e6fd1e39e0e0f42c.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -//============================================================================= -/*! dcovector*=double operator */ -inline dcovector& dcovector::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - dscal_(&l, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! dcovector/=double operator */ -inline dcovector& dcovector::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double dinv =1./d; - dscal_(&l, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector*double operator */ -inline _dcovector operator*(const dcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - dcovector newvec(vec.l); - for(CPPL_INT i=0; i<vec.l; i++){ newvec.array[i] =vec.array[i]*d; } - - return _(newvec); -} - -//============================================================================= -/*! dcovector/double operator */ -inline _dcovector operator/(const dcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - dcovector newvec(vec.l); - for(CPPL_INT i=0; i<vec.l; i++){ newvec.array[i] =vec.array[i]/d; } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/51/517ef98807b18e5012534489409e44ef8cf1b8ec.svn-base b/cpplapack-r198/.svn/pristine/51/517ef98807b18e5012534489409e44ef8cf1b8ec.svn-base deleted file mode 100644 index 81e7aca71b3deacdea17bc10e86780c1916b53ec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/51/517ef98807b18e5012534489409e44ef8cf1b8ec.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! +_dcovector operator */ -inline const _dcovector& operator+(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -_dcovector operator */ -inline _dcovector operator-(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ vec.array[i]=-vec.array[i]; } - - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/51/51b25d075f93c641bc254626ac438cb849897adc.svn-base b/cpplapack-r198/.svn/pristine/51/51b25d075f93c641bc254626ac438cb849897adc.svn-base deleted file mode 100644 index 5dbde0454bd8c4ca628b5e2b51d37a35e08bcc93..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/51/51b25d075f93c641bc254626ac438cb849897adc.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================= -/*! zgematrix+zhematrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix-zhematrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c]; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix*zhematrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/51/51dddf87d0030f67b35d1d50d1e20f2953c0d36a.svn-base b/cpplapack-r198/.svn/pristine/51/51dddf87d0030f67b35d1d50d1e20f2953c0d36a.svn-base deleted file mode 100644 index 6c50b8e6c5d2819c2fcb8b8d63a50b491e3e9d40..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/51/51dddf87d0030f67b35d1d50d1e20f2953c0d36a.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(3), N(4); - - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - - cout << "#### t(A) ####" << endl; - cout << "t(A) =\n" << CPPL::t(A) << endl; - - cout << "#### i(A) ####" << endl; - A.resize(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - CPPL::zgematrix A_inv; - A_inv =CPPL::i(A); - //A_inv =i(A); // g++ cannot compile this line - cout << "A =\n" << A << endl; - cout << "A_inv =\n" << A_inv << endl; - cout << "A*A_inv =\n" << A*A_inv << endl; - - //// max //// - cout << "A =\n" << A << endl; - cout << "damax(A) =\n" << damax(A) << endl; - cout << "#### idamax(p,q, A) ####" << endl; - int p,q; - idamax(p,q, A); - cout << "p=" << p << ", q=" << q << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/52/521af338432649b4599bcd758c5f9a12b9cadbc6.svn-base b/cpplapack-r198/.svn/pristine/52/521af338432649b4599bcd758c5f9a12b9cadbc6.svn-base deleted file mode 100644 index 475f10d76ebb5f0a731025fc0a49f652ba5120db..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/52/521af338432649b4599bcd758c5f9a12b9cadbc6.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! zgsmatrix*zcovector operator */ -inline _zcovector operator*(const zgsmatrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v*vec(it->j); - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/52/524961c227febc5525e58de16d4622b47aaaeafa.svn-base b/cpplapack-r198/.svn/pristine/52/524961c227febc5525e58de16d4622b47aaaeafa.svn-base deleted file mode 100644 index e8fc513087d21a6eb34e83a6915d0910483f81b2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/52/524961c227febc5525e58de16d4622b47aaaeafa.svn-base +++ /dev/null @@ -1,292 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void zhsmatrix::clear() -{CPPL_VERBOSE_REPORT; - n =0; - data.clear(); - line.clear(); -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline zhsmatrix& zhsmatrix::zero() -{CPPL_VERBOSE_REPORT; - data.resize(0); - for(CPPL_INT i=0; i<n; i++){ line[i].resize(0); } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline zhsmatrix& zhsmatrix::identity() -{CPPL_VERBOSE_REPORT; - zero(); - for(CPPL_INT i=0; i<n; i++){ - put(i,i, comple(1.,0.)); - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void zhsmatrix::chsign() -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v =-it->v; - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void zhsmatrix::copy(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - n =mat.n; - data =mat.data; - line =mat.line; -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void zhsmatrix::shallow_copy(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); - - n =mat.n; - data.swap(mat.data); - line.swap(mat.line); - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline zhsmatrix& zhsmatrix::resize(const CPPL_INT& _n, const CPPL_INT _c, const CPPL_INT _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _c<0 || _l<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl - << "Your input was (" << _n << "," << _c << "," << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - n =_n; - data.resize(0); - data.reserve(_c); - line.resize(n); - for(CPPL_INT i=0; i<n; i++){ - line[i].resize(0); - line[i].reserve(_l); - } - - return *this; -} - -//============================================================================= -/*! stretch the matrix size */ -inline void zhsmatrix::stretch(const CPPL_INT& dn) -{CPPL_VERBOSE_REPORT; - if(dn==0){ return; } - -#ifdef CPPL_DEBUG - if( n+dn<0 ){ - ERROR_REPORT; - std::cerr << "The new matrix size must be larger than zero." << std::endl - << "Your input was (" << dn << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - n +=dn; - - if(dn<0){ - //// delete components over the new size //// - const std::vector<zcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<zcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( it->i>=n ){ del( CPPL_INT(data_rend-it-1) ); } - } - //// shrink line //// - for(CPPL_INT i=0; i<-dn; i++){ - line.pop_back(); - } - } - else{//dn>0 - //// expand line //// - for(CPPL_INT i=0; i<dn; i++){ - line.push_back( std::vector<CPPL_INT>(0) ); - } - } -} - -//============================================================================= -/*! check if the component is listed */ -inline bool zhsmatrix::isListed(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].j==jj){ return 1; } - } - - return 0; -} - -//============================================================================= -/*! return the element number of the component */ -inline CPPL_INT zhsmatrix::number(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ - return *p; - } - } - - return -1; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _zrovector zhsmatrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector vec( zrovector(n).zero() ); - - const std::vector<CPPL_INT>::const_iterator line__m_end =line[_m].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[_m].begin(); p!=line__m_end; p++){ - if( data[*p].i==_m ){//i>=j - vec(data[*p].j) =data[*p].v; - } - else{//i<j - vec(data[*p].i) =std::conj(data[*p].v); - } - } - - return _(vec); -} - -//============================================================================= -/*! get column of the matrix */ -inline _zcovector zhsmatrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector vec( zcovector(m).zero() ); - - const std::vector<CPPL_INT>::const_iterator line__n_end =line[_n].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[_n].begin(); p!=line__n_end; p++){ - if( data[*p].i==_n ){//i<j - vec(data[*p].j) =std::conj(data[*p].v); - } - else{//i>=j - vec(data[*p].i) =data[*p].v; - } - } - - return _(vec); -} - -//============================================================================= -/*! erase components less than DBL_MIN */ -inline void zhsmatrix::diet(const double eps) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<zcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( fabs(it->v.real())<eps && fabs(it->v.imag())<eps ){ - del( CPPL_INT(data_rend-it-1) ); - } - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(zhsmatrix& A, zhsmatrix& B) -{CPPL_VERBOSE_REPORT; - std::swap(A.n,B.n); - std::swap(A.data,B.data); - std::swap(A.line,B.line); -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _zhsmatrix _(zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - _zhsmatrix newmat; - //////// shallow copy //////// - newmat.n =mat.n; - std::swap(newmat.data, mat.data); - std::swap(newmat.line, mat.line); - //////// nullify //////// - mat.n =0; - return newmat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! health checkup */ -inline void zhsmatrix::checkup() -{CPPL_VERBOSE_REPORT; - //////// complex diagonal //////// - for(CPPL_INT i=0; i<m; i++){ - if( std::fabs((*this)(i,i).imag()) > DBL_MIN ){ - ERROR_REPORT; - std::cerr << "Diagonal components of a Hermitian matrix have to be real numbers." << std::endl - << "(*this)(" << i << "," << i << ") was a complex number, " << (*this)(i,i) << "." << std::endl; - exit(1); - } - } - - //////// NOTE //////// - std::cerr << "# [NOTE]@zhsmatrix::checkup(): This symmetric sparse matrix is fine." << std::endl; -} diff --git a/cpplapack-r198/.svn/pristine/53/5362f797b2e996b9354d5add8f7a9f756d1ab5a4.svn-base b/cpplapack-r198/.svn/pristine/53/5362f797b2e996b9354d5add8f7a9f756d1ab5a4.svn-base deleted file mode 100644 index 8415bc15178230d2d7217d7f21fcdf0ca806c13f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/53/5362f797b2e996b9354d5add8f7a9f756d1ab5a4.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -//============================================================================= -void dsygv_check_value() -{ - cout << "############ check dsygv value ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make dsymatrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - //// make definite dsymatrix B //// - CPPL::dsymatrix B(N); - CPPL::dgematrix pd, ut(N,N); - ut.zero(); - for(int i=0; i<ut.n; i++){ - for(int j=0; j<=i; j++){ - ut(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - pd=t(ut)*ut; - for(int i=0; i<B.n; i++){ - for(int j=0; j<=i; j++){ - B(i,j) =pd(i,j); - } - } - - //// make w //// - vector<double> w; - - //// make A_original and B_original //// - CPPL::dsymatrix A_original(A), B_original(B); - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - - //// dsygv //// - A.dsygv(B, w); - - //// print //// - for(int i=0; i<A.n; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - } -} - -//============================================================================= -void dsygv_check_both() -{ - cout << "############ check dsygv value ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make dsymatrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make definite dsymatrix B //// - CPPL::dsymatrix B(N); - CPPL::dgematrix pd, ut(N,N); - ut.zero(); - for(int i=0; i<ut.n; i++){ for(int j=0; j<=i; j++){ - ut(i,j) =double( rand() /(RAND_MAX/10) ); - }} - pd=t(ut)*ut; - for(int i=0; i<B.n; i++){ for(int j=0; j<=i; j++){ - B(i,j) =pd(i,j); - }} - - //// make w //// - vector<double> w; - vector<CPPL::dcovector> v; - - //// make A_original and B_original //// - CPPL::dsymatrix A_original(A), B_original(B); - - //// dsygv //// - A.dsygv(B, w, v); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - for(int i=0; i<A.n; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - cout << "v=\n" << v[i] <<endl; - cout << "(A_original-w*B_original)*v=\n" << (A_original-w[i]*B_original)*v[i] << "<- Should be zeros" << endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/54/5404edb105441e4e89ea1be8810a4269f484159f.svn-base b/cpplapack-r198/.svn/pristine/54/5404edb105441e4e89ea1be8810a4269f484159f.svn-base deleted file mode 100644 index f2bdb9803e82ee093b4a700af1d1d5db560c31f8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/54/5404edb105441e4e89ea1be8810a4269f484159f.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! dsymatrix*_dcovector operator */ -inline _dcovector operator*(const dsymatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/54/54aa7c37a9fb8ea2c213a8cc1b265bda60e5cc18.svn-base b/cpplapack-r198/.svn/pristine/54/54aa7c37a9fb8ea2c213a8cc1b265bda60e5cc18.svn-base deleted file mode 100644 index 32ae5d8b7b273d559c8c0fa30e2af32569fc4aeb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/54/54aa7c37a9fb8ea2c213a8cc1b265bda60e5cc18.svn-base +++ /dev/null @@ -1,194 +0,0 @@ -//============================================================================= -/*! complete the upper-right components */ -inline void dsymatrix::complete() const -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - darray[i][j] =darray[j][i]; - } - } -} - -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void dsymatrix::clear() -{CPPL_VERBOSE_REPORT; - n =0; - delete [] array; - array =NULL; - delete [] darray; - darray =NULL; -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline dsymatrix& dsymatrix::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] =0.; - } - } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline dsymatrix& dsymatrix::identity() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - darray[j][j] =1.; - for(CPPL_INT i=j+1; i<n; i++){ - darray[j][i] =0.; - } - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void dsymatrix::chsign() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] =-darray[j][i]; - } - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void dsymatrix::copy(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - n =mat.n; - delete [] array; - array =new double[n*n]; - delete [] darray; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] =mat.darray[j][i]; - } - } -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void dsymatrix::shallow_copy(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - n =mat.n; - delete [] array; - array =mat.array; - delete [] darray; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline dsymatrix& dsymatrix::resize(const CPPL_INT& _n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers." << std::endl - << "Your input was (" << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - n =_n; - delete [] array; - array =new double[n*n]; - delete [] darray; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _drovector dsymatrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector v(n); - for(CPPL_INT j=0; j<n; j++){ - v(j)=(*this)(_m,j); - } - return _(v); -} - -//============================================================================= -/*! get column of the matrix */ -inline _dcovector dsymatrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector v(m); - for(CPPL_INT i=0; i<m; i++){ - v(i)=(*this)(i,_n); - } - return _(v); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(dsymatrix& A, dsymatrix& B) -{CPPL_VERBOSE_REPORT; - CPPL_INT A_n =A.n; - double* A_array =A.array; - double** A_darray =A.darray; - A.n=B.n; A.array=B.array; A.darray=B.darray; - B.n=A_n; B.array=A_array; B.darray=A_darray; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _dsymatrix _(dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - _dsymatrix newmat; - - //////// shallow copy //////// - newmat.n =mat.n; - newmat.array =mat.array; - newmat.darray =mat.darray; - - //////// nullify //////// - mat.n =0; - mat.array =NULL; - mat.darray =NULL; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/55/5584dc7977ec90049f80f43e899ce926b29dfce4.svn-base b/cpplapack-r198/.svn/pristine/55/5584dc7977ec90049f80f43e899ce926b29dfce4.svn-base deleted file mode 100644 index c17b17c45c1eaa878c606f0d7244cddb963f8756..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/55/5584dc7977ec90049f80f43e899ce926b29dfce4.svn-base +++ /dev/null @@ -1,176 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double dgrmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - int k_beg =ia[i]-1; - int k_end =ia[i+1]-1; - for(int k=k_beg; k<k_end; k++){ - if(j==ja[k]-1){ - return a[k]; - } - } - - //// (i,j) component was not found //// - return 0.0; -} - -//============================================================================= -/*! operator() for const object */ -inline double& dgrmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - int k_beg =ia[i]-1; - int k_end =ia[i+1]-1; - for(int k=k_beg; k<k_end; k++){ - if(j==ja[k]-1){ - return a[k]; - } - } - - //// (i,j) component was not found //// - ERROR_REPORT; - std::cerr << "dgrmatrix does not allow component addition with operator()." << std::endl; - exit(1); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dgrmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - int k_beg =mat.ia[i]-1; - int k_end =mat.ia[i+1]-1; - int j =0; - for(int k=k_beg; k<k_end; k++){ - if(j<mat.ja[k]-1){ - for(; j<mat.ja[k]-1; j++){ - s << " x"; - } - } - s << " " << mat.a[k]; - j++; - } - for(; j<mat.n; j++){ - s << " x"; - } - s << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void dgrmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dgrmatrix" << " " << m << " " << n << " " << a.size() << std::endl; - - size_t a_size =a.size(); - for(size_t k=0; k<a_size; k++){ - ofs << " " << a[k]; - } - ofs << "\n"; - - size_t ia_size =ia.size(); - for(size_t k=0; k<ia_size; k++){ - ofs << " " << ia[k]; - } - ofs << "\n"; - - size_t ja_size =ja.size(); - for(size_t k=0; k<ja_size; k++){ - ofs << " " << ja[k]; - } - ofs << "\n" << std::flush; - - ofs.close(); -} - -//============================================================================= -inline void dgrmatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dgrmatrix" && id != "#dgrmatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dgrmatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - //////// read //////// - size_t a_size; - s >> m >> n >> a_size; - a.resize(a_size); - ia.resize(m+1); - ja.resize(a_size); - - for(size_t k=0; k<a_size; k++){ - s >> a[k]; - if(s.fail()){ - ERROR_REPORT; - exit(1); - } - } - for(CPPL_INT k=0; k<=m; k++){ - s >> ia[k]; - if(s.fail()){ - ERROR_REPORT; - exit(1); - } - } - for(size_t k=0; k<a_size; k++){ - s >> ja[k]; - if(s.fail()){ - ERROR_REPORT; - exit(1); - } - } - - //////// garbage //////// - s >> a_size; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << " ." << std::endl; - exit(1); - } - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/55/55be3b79ec840fa66390c6c6c28c1d2214eb4cd4.svn-base b/cpplapack-r198/.svn/pristine/55/55be3b79ec840fa66390c6c6c28c1d2214eb4cd4.svn-base deleted file mode 100644 index 52684852b0e0e122a461dbf608baea7e8a6715bb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/55/55be3b79ec840fa66390c6c6c28c1d2214eb4cd4.svn-base +++ /dev/null @@ -1,65 +0,0 @@ -#include <cpplapack.h> - -//============================================================================= -int main(int argc, char** argv) -{ - //////// argc check //////// - if(argc!=2){ - std::cerr << "[ERROR] invalid usage" << std::endl; - std::cerr << "USAGE: " << argv[0] << " xxxx.dgematrix" << std::endl; - exit(1); - } - - //////// open //////// - CPPL::dgematrix mat(argv[1]); - std::cerr << "mat size = " << mat.m << "x" << mat.n << std::endl; - const long mn(mat.m*mat.n); - - - /////// write header /////// - std::cout << "# vtk DataFile Version 2.0" << std::endl; - std::cout << "made by dge2vtk" << std::endl; - std::cout << "ASCII" << std::endl; - std::cout << "DATASET UNSTRUCTURED_GRID" << std::endl; - std::cout << std::endl; - - /////// write POINTS /////// - std::cout << "POINTS " << mn << " double" << std::endl; - for(long i=0; i<mat.m; i++){ - for(long j=0; j<mat.n; j++){ - std::cout << j << " " << i << " " << "0" << std::endl; - } - } - std::cout << std::endl; - - /////// write CELLS /////// - std::cout << "CELLS " << mn << " " << 2*mn << std::endl; - for(long i=0; i<mn; i++){ - std::cout << "1 " << i << std::endl; - } - std::cout << std::endl; - - /////// write CELL_TYPES /////// - std::cout.unsetf(std::ios::showpos); - std::cout << "CELL_TYPES " << mn << std::endl; - std::cout.setf(std::ios::showpos); - for(long i=0; i<mn; i++){ - std::cout << "1" << std::endl; // VTK_VERTEX = 1 - } - std::cout << std::endl; - - //////// write CELL_DATA //////// - std::cout.unsetf(std::ios::showpos); - std::cout << "CELL_DATA " << mn << std::endl; - std::cout.setf(std::ios::showpos); - std::cout << "SCALARS value double 1" << std::endl;// SCALAR = 1 - std::cout << "LOOKUP_TABLE default" << std::endl; - for(long i=0; i<mat.m; i++){ - for(long j=0; j<mat.n; j++){ - std::cout << mat(i,j) << std::endl; - } - } - std::cout << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/55/55c6fd59e808f8ce0a775b4a733b4224f7acf6d8.svn-base b/cpplapack-r198/.svn/pristine/55/55c6fd59e808f8ce0a775b4a733b4224f7acf6d8.svn-base deleted file mode 100644 index 590dd7c302a5feccfd87ef1222fdf74b39be2f8e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/55/55c6fd59e808f8ce0a775b4a733b4224f7acf6d8.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! zhematrix+zgematrix operator */ -inline _zgematrix operator+(const zhematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matB; - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) += matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix-zgematrix operator */ -inline _zgematrix operator-(const zhematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =-matB; - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) += matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix*zgematrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/55/55d748e7f9b174a433209914f0ff822fa33589c7.svn-base b/cpplapack-r198/.svn/pristine/55/55d748e7f9b174a433209914f0ff822fa33589c7.svn-base deleted file mode 100644 index 52a50bad26c0df5a208b84c4922b97a38242ae34..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/55/55d748e7f9b174a433209914f0ff822fa33589c7.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -//============================================================================= -/*! operator() for object */ -inline double& _dsymatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if( i >= j ){ - //return array[i+n*j]; - return darray[j][i]; - } else { - //return array[j+n*i]; - return darray[i][j]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i >= j ){ - s << " " << mat(i,j) << " "; - } else { - s << "{" << mat(i,j) << "} "; - } - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _dsymatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dsymatrix " << n << std::endl; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++ ){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/55/55db70ee71c699c0d8f1eb91dbcfd13590de404f.svn-base b/cpplapack-r198/.svn/pristine/55/55db70ee71c699c0d8f1eb91dbcfd13590de404f.svn-base deleted file mode 100644 index cee10c9487d4d7a624a1528c06f8145d4ed9d967..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/55/55db70ee71c699c0d8f1eb91dbcfd13590de404f.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! dsysv_check */ -void dsysv_check_vector() -{ - cout << "############ check dsysv vector ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make dsymatrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - //// make dcovector b //// - CPPL::dcovector b(N); - for(int i=0; i<b.l; i++){ - b(i) =double( rand() /(RAND_MAX/10) ); - } - - //// make A_original and b_original //// - CPPL::dsymatrix A_original(A); - CPPL::dcovector b_original(b); - cout << "A_original=\n" << A_original << endl; - cout << "b_original=\n" << b_original << endl; - - //// solve Ax=b //// - A.dsysv(b); - - //// print A, b and A_original*y //// - cout << "modified A=\n" << A << endl; - cout << "x=\n" << b << endl; - cout << "b_original -A_original*x = (should be zero)\n" << b_original -A_original*b << endl; -} - -//============================================================================= -void dsysv_check_matrix() -{ - cout << "############ check dsysv matrix ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - - //// make dsymatrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - //// make dsymatrix B //// - CPPL::dgematrix B(N,N); - for(int i=0; i<B.m; i++){ - for(int j=0; j<B.n; j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - //// make A_original and B_original //// - CPPL::dsymatrix A_original(A); - CPPL::dgematrix B_original(B); - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - - //// solve A*X=B //// - A.dsysv(B); - - //// print A, B and A_original*B //// - cout << "modified A=\n" << A << endl; - cout << "X=\n" << B << endl; - cout << "B_original -A_original*X = (should be zero)\n" << B_original -A_original*B << endl; -} diff --git a/cpplapack-r198/.svn/pristine/57/57b3dd6dd9c30bd492b461cbc3104e143458cec9.svn-base b/cpplapack-r198/.svn/pristine/57/57b3dd6dd9c30bd492b461cbc3104e143458cec9.svn-base deleted file mode 100644 index 1c578b26531013c3ba96f1d3cf6cc3074dcc76c8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/57/57b3dd6dd9c30bd492b461cbc3104e143458cec9.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! _zgsmatrix*comple operator */ -inline _zgsmatrix operator*(const _zgsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *=d; - } - - return mat; -} - -//============================================================================= -/*! _zgsmatrix/comple operator */ -inline _zgsmatrix operator/(const _zgsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v /=d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/57/57e29a42947a607cadaa5823b7f33f4945ffca72.svn-base b/cpplapack-r198/.svn/pristine/57/57e29a42947a607cadaa5823b7f33f4945ffca72.svn-base deleted file mode 100644 index 88aafb8115022d9ed661b3d9aec85d050dac51a6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/57/57e29a42947a607cadaa5823b7f33f4945ffca72.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! return transposed dgsmatrix */ -inline _dgsmatrix t(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgsmatrix newmat =mat; - - std::swap(newmat.m,newmat.n); - std::swap(newmat.rows,newmat.cols); - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - std::swap(it->i,it->j); - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - //////// exception //////// - if(mat.data.size()==0){ - WARNING_REPORT; - std::cerr << "The dgsmatrix is a zero matrix." << std::endl; - return; - } - - //////// find //////// - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < fabs(it->v) ){ - vmax =fabs(it->v); - itx =it; - } - } - - i =itx->i; - j =itx->j; -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - //////// exception //////// - if(mat.data.size()==0){ - return 0.; - } - - //////// find //////// - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < fabs(it->v) ){ - vmax =fabs(it->v); - itx =it; - } - } - - return itx->v; -} diff --git a/cpplapack-r198/.svn/pristine/58/581a4ed98e0373107664d24c5769e086cac631bb.svn-base b/cpplapack-r198/.svn/pristine/58/581a4ed98e0373107664d24c5769e086cac631bb.svn-base deleted file mode 100644 index 7cd654f894688e67958356791e305c0e466beab5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/58/581a4ed98e0373107664d24c5769e086cac631bb.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _zhematrix+zgematrix operator */ -inline _zgematrix operator+(const _zhematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j)+matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix-zgematrix operator */ -inline _zgematrix operator-(const _zhematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j)-matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix*zgematrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/58/583520883abf9b26c98f0ba63ccc7066c020c362.svn-base b/cpplapack-r198/.svn/pristine/58/583520883abf9b26c98f0ba63ccc7066c020c362.svn-base deleted file mode 100644 index 8bd1fde41e91c6b615f9c207197311f376ab381a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/58/583520883abf9b26c98f0ba63ccc7066c020c362.svn-base +++ /dev/null @@ -1,118 +0,0 @@ -//============================================================================= -/*! zrovector=_zrovector operator */ -inline zrovector& zrovector::operator=(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - shallow_copy(vec); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector+=_zrovector operator */ -inline zrovector& zrovector::operator+=(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] += vec.array[i]; - } - - vec.destroy(); - return *this; -} - -//============================================================================= -/*! zrovector operator-= */ -inline zrovector& zrovector::operator-=(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] -= vec.array[i]; - } - - vec.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector+zrovector operator */ -inline _zrovector operator+(const zrovector& vecA, const _zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecB.array[i] += vecA.array[i]; - } - - return vecB; -} - -//============================================================================= -/*! zrovector-zrovector operator */ -inline _zrovector operator-(const zrovector& vecA, const _zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecB.array[i] =vecA.array[i]-vecB.array[i]; - } - - return vecB; -} - -//============================================================================= -/*! zrovector^T*zrovector operator (inner product) */ -inline comple operator%(const zrovector& vecA, const _zrovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/58/585ef9d8d72e9adf4ae0620314bfd1d592685e2e.svn-base b/cpplapack-r198/.svn/pristine/58/585ef9d8d72e9adf4ae0620314bfd1d592685e2e.svn-base deleted file mode 100644 index 1e0d12e9f8a2748966383076664ea68bd17103d6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/58/585ef9d8d72e9adf4ae0620314bfd1d592685e2e.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::zgematrix A(M,N); - CPPL::zcovector x(N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "A =\n" << A << endl; - cout << "x =\n" << x << endl; - cout << "A*x =\n" << A*x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/58/587b79f1c2f3c2bb05747a47d2c742b4e492ab42.svn-base b/cpplapack-r198/.svn/pristine/58/587b79f1c2f3c2bb05747a47d2c742b4e492ab42.svn-base deleted file mode 100644 index d6c617967445bd2f15bce2cf6cc78c4daae176e5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/58/587b79f1c2f3c2bb05747a47d2c742b4e492ab42.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(5), CAP(4); - - CPPL::zhsmatrix A(N,CAP); - A.put(0,0, complex<double>(1.,0.) ); - A.put(3,2, complex<double>(3.,4.) ); - A.put(1,2, complex<double>(5.,6.) ); - A.put(4,1, complex<double>(7.,8.) ); - cout << "A =\n" << A << endl; - cout << "A(0,0) = " << A(0,0) << endl; - cout << "A(3,2) = " << A(3,2) << endl; - cout << "A(1,2) = " << A(1,2) << endl; - cout << "A(4,1) = " << A(4,1) << endl; - - //A.put(1,2, 4.5); - //A.add(1,2, 0.1); - //A.sub(1,2, 0.1); - //A.mult(1,2, 10.); - //A.div(1,2, 10.); - //A.del(1,2); - A.del(1); - cout << "A =\n" << A << endl; - - //// write/read //// - const CPPL::zhsmatrix B(A); - cout << "B =\n" << B << endl; - B.write( "tmp.txt" ); - - CPPL::zhsmatrix C; - C.read( "tmp.txt" ); - cout << "C =\n" << C << endl; - cout << "C-B =\n" << C-B << "<-Should be zero." << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/58/58a495cffb24a399a5e8f9d23f6e49681dd7f2b1.svn-base b/cpplapack-r198/.svn/pristine/58/58a495cffb24a399a5e8f9d23f6e49681dd7f2b1.svn-base deleted file mode 100644 index dae37402a55f7e82194f24c2e1b07a57921ac6ca..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/58/58a495cffb24a399a5e8f9d23f6e49681dd7f2b1.svn-base +++ /dev/null @@ -1,91 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -bool cg -( - //const CPPL::dsymatrix& A, - const CPPL::dssmatrix& A, - CPPL::dcovector& x, - const double& eps -) -{ - double alpha, beta, rho(1.0), rho2; - const CPPL::dcovector y(x); - CPPL::dcovector r(x), p(x.l), q; - x.zero(); p.zero(); - - int itc(0); - const int itmax(2*x.l); - while(fabs(damax(r))>eps && itc<itmax){ - std::cout << itc << " " << fabs(damax(y-A*x)) << std::endl; - //std::cerr << "itc=" << itc << ", fabs(damax(r))=" << fabs(damax(r)) << std::endl; - rho2=r%r; - beta=rho2/rho; - rho=rho2; - - p =r +beta*p; - q=A*p; - alpha=rho/(p%q); - - x+=alpha*p; - r-=alpha*q; - - itc++; - } - std::cerr << "itc=" << itc << " fabs(damax(r))=" << fabs(damax(r)) << std::endl; - - if(itc<itmax){ return 0; } - else{ return 1; } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - srand(time(NULL)); - - const int size(100); - //CPPL::dsymatrix A(size); - CPPL::dssmatrix A(size); - - for(int i=0; i<size; i++){ - for(int j=0; j<=i; j++){ - if(rand()%2){ A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; } - } - A(i,i)+=10.; - } - A.write("A.dsymatrix"); - - CPPL::dcovector x(size); - for(int i=0; i<size; i++){ - x(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - x.write("answer.dcovector");//solution - std::cerr << "answer=\n" << t(x) << std::endl; - - CPPL::dcovector y(size); - y=A*x; - y.write("y.dcovector"); - - double eps(fabs(damax(y))*1e-6); - //std::cerr << "eps=" << eps << std::endl; - if( cg(A, y, eps) ){ - std::cerr << "failed." << std::endl; - exit(1); - } - y.write("solution.dcovector"); - std::cout << "solution=\n" << t(y) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/59/59196703759d8839abff0faf702da0ee41a77857.svn-base b/cpplapack-r198/.svn/pristine/59/59196703759d8839abff0faf702da0ee41a77857.svn-base deleted file mode 100644 index 0458dd40a7f58e698517bba3de740f16e1b9d5f3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/59/59196703759d8839abff0faf702da0ee41a77857.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! _zgematrix+zhematrix operator */ -inline _zgematrix operator+(const _zhematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - matB(i,j) += matA(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _zhematrix-zgematrix operator */ -inline _zgematrix operator-(const _zhematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - matB(i,j) =matA(i,j)-matB(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _zgematrix*zgematrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/59/598076280f50d771f7ec7f6b1160ef68a08b6876.svn-base b/cpplapack-r198/.svn/pristine/59/598076280f50d771f7ec7f6b1160ef68a08b6876.svn-base deleted file mode 100644 index b9bf56968df9f2cb8815cd5f5a10a44546799cb3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/59/598076280f50d771f7ec7f6b1160ef68a08b6876.svn-base +++ /dev/null @@ -1,128 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Complex-double Class for Hermitian matrices -class zhecomplex : public comple -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT i, j; - comple& v; - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zhecomplex(const CPPL_INT&, const CPPL_INT&, comple&); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - inline zhecomplex& operator=(const comple&); - inline zhecomplex& operator+=(const comple&); - inline zhecomplex& operator-=(const comple&); - inline zhecomplex& operator*=(const comple&); -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! constructor */ -inline zhecomplex::zhecomplex(const CPPL_INT& _i, const CPPL_INT& _j, comple& _v) - : comple( _i < _j ? std::conj( _v ) : _v ), - v( _v ) -{CPPL_VERBOSE_REPORT; - i = _i; - j = _j; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator= */ -inline zhecomplex& zhecomplex::operator=(const comple& _v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i==j && std::fabs(_v.imag()) > DBL_MIN ){ - WARNING_REPORT; - std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl - << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl; - } -#endif//CPPL_DEBUG - - //comple::operator=( _v ); - //v = ( i < j ? std::conj( _v ) : _v ); - if(i>=j){ - v =_v; - } - else{//i<j - v =std::conj(_v); - } - return *this; -} - -//============================================================================= -/*! operator+= */ -inline zhecomplex& zhecomplex::operator+=(const comple& _v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i==j && std::fabs(_v.imag()) > DBL_MIN ){ - WARNING_REPORT; - std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl - << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl; - } -#endif//CPPL_DEBUG - - if(i>=j){ - v +=_v; - } - else{//i<j - v +=std::conj(_v); - } - return *this; -} - -//============================================================================= -/*! operator-= */ -inline zhecomplex& zhecomplex::operator-=(const comple& _v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i==j && std::fabs(_v.imag()) > DBL_MIN ){ - WARNING_REPORT; - std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl - << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl; - } -#endif//CPPL_DEBUG - - if(i>=j){ - v -=_v; - } - else{//i<j - v -=std::conj(_v); - } - return *this; -} - -//============================================================================= -/*! operator*= */ -inline zhecomplex& zhecomplex::operator*=(const comple& _v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i==j && std::fabs(_v.imag()) > DBL_MIN ){ - WARNING_REPORT; - std::cerr << "Diagonal components of a hermitian matrix have to be real numbers." << std::endl - << "Your input to the (" << i << "," << j << ") element was a complex number, " << _v << "." << std::endl; - } -#endif//CPPL_DEBUG - - if(i>=j){ - v *=_v; - } - else{//i<j - v *=std::conj(_v); - } - return *this; -} diff --git a/cpplapack-r198/.svn/pristine/5a/5a13b1f3c0a3912379c253e6304d0688065a41ec.svn-base b/cpplapack-r198/.svn/pristine/5a/5a13b1f3c0a3912379c253e6304d0688065a41ec.svn-base deleted file mode 100644 index 8b3dfbf57f4d56522a01c8ef0b9f6e1e894b85fb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5a/5a13b1f3c0a3912379c253e6304d0688065a41ec.svn-base +++ /dev/null @@ -1,126 +0,0 @@ -//============================================================================= -void dggev_check_value() -{ - cout << "############ check dggev value ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A and B //// - CPPL::dgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - vector<double> wr, wi; - - //// make A_original and B_original //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix B_original(B); - - //// dggev //// - A.dggev(B, wr, wi); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "wr=" << wr[i] <<endl; - cout << "wi=" << wi[i] <<endl; - } -} - -//============================================================================= -void dggev_check_right() -{ - cout << "############ check dggev right ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A and B //// - CPPL::dgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - vector<double> wr, wi; - vector<CPPL::dcovector> vrr, vri; - - //// make A_original and B_original //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix B_original(B); - - //// dggev //// - A.dggev(B, wr, wi ,vrr, vri); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "wr=" << wr[i] <<endl; - cout << "wi=" << wi[i] <<endl; - cout << "vrr=\n" << vrr[i] <<endl; - cout << "vri=\n" << vri[i] <<endl; - cout << "Real[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n" - << A_original*vrr[i] - -(wr[i]*B_original*vrr[i] - wi[i]*B_original*vri[i]) - << endl; - cout << "Imag[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n" - << A_original*vri[i] - -(wr[i]*B_original*vri[i] + wi[i]*B_original*vrr[i]) - << endl; - } -} - -//============================================================================= -void dggev_check_left() -{ - cout << "############ check dggev left ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A and B //// - CPPL::dgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vl //// - vector<double> wr, wi; - vector<CPPL::drovector> vlr, vli; - - //// make A_original and B_original //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix B_original(B); - - //// dggev //// - A.dggev(B, wr, wi ,vlr, vli); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "wr = " << wr[i] << endl; - cout << "wi = " << wi[i] << endl; - cout << "vlr = " << vlr[i]; - cout << "vli = " << vli[i] << endl; - cout << "Real[ {x}*[A] -lambda*{x}*[B] ] = (Should be zeros)\n" - << vlr[i]*A_original - -(wr[i]*vlr[i]*B_original - wi[i]*vli[i]*B_original) - << endl; - cout << "Imag[ [A]*{x} -lambda*{x}*[B] ] = (Should be zeros)\n" - << vli[i]*A_original - -(wr[i]*vli[i]*B_original + wi[i]*vlr[i]*B_original) - << endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/5a/5aaddacb2da452b2bbfd20972ff2de1a0c04753d.svn-base b/cpplapack-r198/.svn/pristine/5a/5aaddacb2da452b2bbfd20972ff2de1a0c04753d.svn-base deleted file mode 100644 index d2b2a9bff6e425f971fbea8ebc5ac9b9b8e5c0d5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5a/5aaddacb2da452b2bbfd20972ff2de1a0c04753d.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::zrovector x(M); - CPPL::zcovector y(M); - - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "x =\n" << x << endl; - cout << "y =\n" << y << endl; - cout << "x*y =\n" << x*y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/5a/5aafeb42eb0370895c2b945fe00029d322253621.svn-base b/cpplapack-r198/.svn/pristine/5a/5aafeb42eb0370895c2b945fe00029d322253621.svn-base deleted file mode 100644 index 3095076a841f7d525c8532211ccd570a0cd20b4e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5a/5aafeb42eb0370895c2b945fe00029d322253621.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -//============================================================================= -/*! _zgematrix+zhematrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - matA(i,j) += matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _zgematrix-zhematrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - matA(i,j) -= matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _zgematrix*zhematrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - char side ='R'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/5a/5ad6ddc307e277ab1952fb27faf129022cf20fe4.svn-base b/cpplapack-r198/.svn/pristine/5a/5ad6ddc307e277ab1952fb27faf129022cf20fe4.svn-base deleted file mode 100644 index 0c69f1cf49982e5ab0bd2666349f2556e9a3d380..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5a/5ad6ddc307e277ab1952fb27faf129022cf20fe4.svn-base +++ /dev/null @@ -1,90 +0,0 @@ -//============================================================================= -//! Samll Complex Double-precision Row Vector Class -template<CPPL_INT l> class zrovector_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - comple array[l]; - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zrovector_small(); - inline explicit zrovector_small(const zrovector&); - inline zrovector_small(const comple&, const comple&); - inline zrovector_small(const comple&, const comple&, const comple&); - inline ~zrovector_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zrovector to_zrovector() const; - - //////// io //////// - inline comple& operator()(const CPPL_INT&); - inline comple operator()(const CPPL_INT&) const; - inline zrovector_small<l>& set(const CPPL_INT&, const comple&); - template<CPPL_INT _l> inline friend std::ostream& operator<<(std::ostream&, const zrovector_small<_l>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// calc //////// -#ifndef _MSC_VER - template<CPPL_INT _l> inline friend zcovector_small<_l> t(const zrovector_small<_l>&); - template<CPPL_INT _l> inline friend comple nrm2(const zrovector_small<_l>&); - template<CPPL_INT _l> inline friend CPPL_INT idamax(const zrovector_small<_l>&); - template<CPPL_INT _l> inline friend comple damax(const zrovector_small<_l>&); -#endif//_MSC_VER - - //////// misc //////// - inline zrovector_small<l>& zero(); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT L> inline zrovector_small<L>& operator= (const zrovector_small<L>&); - //////// += //////// - template<CPPL_INT L> inline friend zrovector_small<L>& operator+=(zrovector_small<L>&, const zrovector_small<L>&); - //////// -= //////// - template<CPPL_INT L> inline friend zrovector_small<L>& operator-=(zrovector_small<L>&, const zrovector_small<L>&); - //////// *= //////// - template<CPPL_INT L> inline friend zrovector_small<L>& operator*=(zrovector_small<L>&, const double&); - template<CPPL_INT L> inline friend zrovector_small<L>& operator*=(zrovector_small<L>&, const comple&); - //////// /= //////// - template<CPPL_INT L> inline friend zrovector_small<L>& operator/=(zrovector_small<L>&, const double&); - template<CPPL_INT L> inline friend zrovector_small<L>& operator/=(zrovector_small<L>&, const comple&); - //////// unary //////// - template<CPPL_INT L> inline friend const zrovector_small<L>& operator+(const zrovector_small<L>&); - template<CPPL_INT L> inline friend zrovector_small<L> operator-(const zrovector_small<L>&); - //////// + //////// - template<CPPL_INT L> inline friend zrovector_small<L> operator+(const zrovector_small<L>&, const zrovector_small<L>&); - //////// - //////// - template<CPPL_INT L> inline friend zrovector_small<L> operator-(const zrovector_small<L>&, const zrovector_small<L>&); - //////// * //////// - template<CPPL_INT L> inline friend comple operator*(const zrovector_small<L>&, const zcovector_small<L>&); - template<CPPL_INT M, CPPL_INT N> inline friend zrovector_small<N> operator*(const zrovector_small<M>&, const zgematrix_small<M,N>&); - template<CPPL_INT L> inline friend zrovector_small<L> operator*(const zrovector_small<L>&, const dsymatrix_small<L>&); - template<CPPL_INT L> inline friend zrovector_small<L> operator*(const zrovector_small<L>&, const comple&); - template<CPPL_INT L> inline friend zrovector_small<L> operator*(const zrovector_small<L>&, const comple&); - //////// / //////// - template<CPPL_INT L> inline friend zrovector_small<L> operator/(const zrovector_small<L>&, const double&); - template<CPPL_INT L> inline friend zrovector_small<L> operator/(const zrovector_small<L>&, const comple&); - //////// comple //////// - template<CPPL_INT L> inline friend zrovector_small<L> operator*(const double&, const zrovector_small<L>&); - template<CPPL_INT L> inline friend zrovector_small<L> operator*(const comple&, const zrovector_small<L>&); - //////// hadamerd //////// - template<CPPL_INT L> inline friend zrovector_small<L> hadamerd(const zrovector_small<L>&, const zrovector_small<L>&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline comple operator/(const zrovec2&, const zrovec2&); -inline zrovec3 operator/(const zrovec3&, const zrovec3&); diff --git a/cpplapack-r198/.svn/pristine/5a/5ae3763895fe7d8f81a8480672d65c65a6344666.svn-base b/cpplapack-r198/.svn/pristine/5a/5ae3763895fe7d8f81a8480672d65c65a6344666.svn-base deleted file mode 100644 index 5de9a3bcd4bf0a63ab2ff79a2decaac3b26d19ff..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5a/5ae3763895fe7d8f81a8480672d65c65a6344666.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _zrovector*zgsmatrix operator */ -inline _zrovector operator*(const _zrovector& vec, const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/5b/5b6e1855add727ad52ec7bcd2ca0ca0a8c2fa815.svn-base b/cpplapack-r198/.svn/pristine/5b/5b6e1855add727ad52ec7bcd2ca0ca0a8c2fa815.svn-base deleted file mode 100644 index 3926743c1cfef85d20c68e1f1182da36b97cd36c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5b/5b6e1855add727ad52ec7bcd2ca0ca0a8c2fa815.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! zrovector*_zgbmatrix operator */ -inline _zrovector operator*(const zrovector& vec, const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/5c/5ccddc596f4c8d822f53e0e7b861cd3b9e15ff27.svn-base b/cpplapack-r198/.svn/pristine/5c/5ccddc596f4c8d822f53e0e7b861cd3b9e15ff27.svn-base deleted file mode 100644 index 025c477eed25ff5141e633447c914352d2f84435..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5c/5ccddc596f4c8d822f53e0e7b861cd3b9e15ff27.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -//============================================================================= -/*! zrovector constructor */ -inline zrovector::zrovector() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =0; - array =NULL; -} - -//============================================================================= -/*! zrovector copy constructor */ -inline zrovector::zrovector(const zrovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - array =new comple[l]; - - //////// copy //////// - CPPL_INT inc =1; - zcopy_(&l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! zrovector constructor to cast _zrovector */ -inline zrovector::zrovector(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! zrovector constructor with size specification */ -inline zrovector::zrovector(const CPPL_INT& _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers. " << std::endl - << "Your input was (" << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - l =_l; - array =new comple[l]; -} - -//============================================================================= -/*! zrovector constructor with filename */ -inline zrovector::zrovector(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector destructor */ -inline zrovector::~zrovector() -{CPPL_VERBOSE_REPORT; - //////// delete array //////// - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/5d/5d2353f0de666cf86c897cb5b5b44e47a5138b91.svn-base b/cpplapack-r198/.svn/pristine/5d/5d2353f0de666cf86c897cb5b5b44e47a5138b91.svn-base deleted file mode 100644 index 06462a7de93ac505c1d1d37d3c090fc495da1e1d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5d/5d2353f0de666cf86c897cb5b5b44e47a5138b91.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! zrovector*zgematrix operator */ -inline _zrovector operator*(const zrovector& vec, const zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/5d/5defd92257d4d7c7681d3984312c3f0fd7e34de9.svn-base b/cpplapack-r198/.svn/pristine/5d/5defd92257d4d7c7681d3984312c3f0fd7e34de9.svn-base deleted file mode 100644 index 6957845d63df8f80adcbc31c2fae2e101ff64f30..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5d/5defd92257d4d7c7681d3984312c3f0fd7e34de9.svn-base +++ /dev/null @@ -1,97 +0,0 @@ -//============================================================================= -/*! zhematrix constructor without arguments */ -inline zhematrix::zhematrix() - : m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n = 0; - array =NULL; - darray =NULL; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix copy constructor */ -inline zhematrix::zhematrix(const zhematrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =mat.n; - array =new comple[n*n]; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } - - //////// copy //////// - CPPL_INT size =n*n; - CPPL_INT inc =1; - zcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! zhematrix constructor to cast _zhematrix */ -inline zhematrix::zhematrix(const _zhematrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix constructor with size specification */ -inline zhematrix::zhematrix(const CPPL_INT& _n) - : m(n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers. " << std::endl - << "Your input was (" << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - n =_n; - array =new comple[n*n]; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } -} - -//============================================================================= -/*! zhematrix constructor with filename */ -inline zhematrix::zhematrix(const char* filename) - : m(n) -{CPPL_VERBOSE_REPORT; - array =NULL; - darray =NULL; - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix destructor */ -inline zhematrix::~zhematrix() -{CPPL_VERBOSE_REPORT; - //////// delete array //////// - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/5e/5e087e6c7d1faed945260fbe2a0ad885e613b630.svn-base b/cpplapack-r198/.svn/pristine/5e/5e087e6c7d1faed945260fbe2a0ad885e613b630.svn-base deleted file mode 100644 index 827e1700a45f423567a2f6cd9a2590ad674af4df..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5e/5e087e6c7d1faed945260fbe2a0ad885e613b630.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(3), N(3), KL(1), KU(2); - - CPPL::zhematrix A(N); - CPPL::zgbmatrix B(M,N,KL,KU); - - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - for(int i=0; i<B.m; i++){ - for(int j=std::max(0,i-B.kl); j<std::min(B.n,i+B.ku+1); j++){ - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - - cout << "A+B =\n" << A+B << endl; - cout << "A-B =\n" << A-B << endl; - cout << "A*B =\n" << A*B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/5e/5eec2a2f4a791a0927887bbc5ca4a392c378940c.svn-base b/cpplapack-r198/.svn/pristine/5e/5eec2a2f4a791a0927887bbc5ca4a392c378940c.svn-base deleted file mode 100644 index f1cd1dc5b7c3a3d8477a4dbf73d6e794e21177ad..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5e/5eec2a2f4a791a0927887bbc5ca4a392c378940c.svn-base +++ /dev/null @@ -1,337 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline comple zhsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ - if( i>j ){ return data[*p].v; }//ii=i - else{ return std::conj(data[*p].v); }//ii=j - } - } - - //// (i,j) component was not found //// - return comple(0.0,0.0); -} - -//============================================================================= -/*! operator() */ -inline zhecomplex zhsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// search (i,j) component //////// - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ - return zhecomplex(i,j, data[*p].v); - } - } - - //////// (i,j) component not found //////// - if(i>j){ - line[i].push_back(CPPL_INT(data.size())); - line[j].push_back(CPPL_INT(data.size())); - data.push_back(zcomponent(i,j,comple(0.,0.))); - } - else if(i<j){ - line[i].push_back(CPPL_INT(data.size())); - line[j].push_back(CPPL_INT(data.size())); - data.push_back(zcomponent(j,i,comple(0.,0.))); - } - else{//i==j - line[i].push_back(CPPL_INT(data.size())); - data.push_back(zcomponent(i,i,comple(0.,0.))); - } - - return zhecomplex(i,j, data.back().v); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! put value with volume cheack without isListed check */ -inline zhsmatrix& zhsmatrix::put(const CPPL_INT& i, const CPPL_INT& j, const comple& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } - - if( isListed(i,j) ){ - ERROR_REPORT; - std::cerr << "The required component is already listed." << std::endl - << "Your input was (" << i << "," << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// push //// - if(i==j){ - line[i].push_back(CPPL_INT(data.size())); - data.push_back(zcomponent(i,j,v)); - } - else if(i>j){ - line[i].push_back(CPPL_INT(data.size())); - line[j].push_back(CPPL_INT(data.size())); - data.push_back(zcomponent(i,j,v)); - } - else{//i<j - line[i].push_back(CPPL_INT(data.size())); - line[j].push_back(CPPL_INT(data.size())); - data.push_back(zcomponent(j,i,conj(v))); - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! delete the entry of a component */ -inline zhsmatrix& zhsmatrix::del(const CPPL_INT i, const CPPL_INT j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input was (" << i << "," << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - //////// search (i,j) component //////// - const std::vector<CPPL_INT>::iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if( data[*p].i==ii && data[*p].j==jj ){//exists - //// save position //// - CPPL_INT c =*p; - CPPL_INT C =CPPL_INT(data.size()-1); - - //// data translation //// - data[c]=data.back(); - data.pop_back(); - - //// remove from List //// - line[ii].erase(p); - if(i!=j){//off-diagonal - const std::vector<CPPL_INT>::iterator line_jj_end =line[jj].end(); - for(std::vector<CPPL_INT>::iterator pj=line[jj].begin(); pj!=line_jj_end; pj++){ - if(*pj==c){ line[jj].erase(pj); break; } - } - } - - //// modify the entry of translated component //// - CPPL_INT I(data[c].i), J(data[c].j); - const std::vector<CPPL_INT>::iterator line_I_end =line[I].end(); - for(std::vector<CPPL_INT>::iterator q=line[I].begin(); q!=line_I_end; q++){ - if(*q==C){ *q=c; break; } - } - if(I!=J){//off-diagonal - const std::vector<CPPL_INT>::iterator line_J_end =line[J].end(); - for(std::vector<CPPL_INT>::iterator q=line[J].begin(); q!=line_J_end; q++){ - if(*q==C){ *q=c; break; } - } - } - return *this; - } - } - -#ifdef CPPL_DEBUG - std::cerr << "# [NOTE]@zhsmatrix::del(CPPL_INT&, CPPL_INT&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; -#endif//CPPL_DEBUG - - return *this; -} - -//============================================================================= -/*! delete the entry of an element */ -inline zhsmatrix& zhsmatrix::del(const CPPL_INT c) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( c<0 || c>=CPPL_INT(data.size()) ){ - ERROR_REPORT; - std::cerr << "The required element is out of the matrix volume." << std::endl - << "Your input was (" << c << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if( c==CPPL_INT(data.size()-1) ){//if c is the last element - CPPL_INT i(data[c].i), j(data[c].j); - const std::vector<CPPL_INT>::iterator line_i_end =line[i].end(); - for(std::vector<CPPL_INT>::iterator q=line[i].begin(); q!=line_i_end; q++){ - if( *q==c ){ line[i].erase(q); break; } - } - if(i!=j){//off-diagonal - const std::vector<CPPL_INT>::iterator line_j_end =line[j].end(); - for(std::vector<CPPL_INT>::iterator q=line[j].begin(); q!=line_j_end; q++){ - if( *q==c ){ line[j].erase(q); break; } - } - } - data.pop_back(); - } - - else{//c is NOT the last element - //// data translation //// - CPPL_INT C =CPPL_INT(data.size()-1); - CPPL_INT i(data[c].i), j(data[c].j), I(data.back().i), J(data.back().j); - data[c]=data.back(); - //std::cerr << "c=" << c << " i=" << i << " j=" << j << " C=" << vol << " I=" << I << " J=" << J << std::endl; - //// remove entry of component //// - const std::vector<CPPL_INT>::iterator line_i_end =line[i].end(); - for(std::vector<CPPL_INT>::iterator q=line[i].begin(); q!=line_i_end; q++){ - if( *q==c ){ line[i].erase(q); break; } - } - if(i!=j){//off-diagonal - const std::vector<CPPL_INT>::iterator line_j_end =line[j].end(); - for(std::vector<CPPL_INT>::iterator q=line[j].begin(); q!=line_j_end; q++){ - if( *q==c ){ line[j].erase(q); break; } - } - } - //// modify the entry of translated component //// - const std::vector<CPPL_INT>::iterator line_I_end =line[I].end(); - for(std::vector<CPPL_INT>::iterator q=line[I].begin(); q!=line_I_end; q++){ - if(*q==C){ *q=c; break; } - } - if(I!=J){//off-diagonal - const std::vector<CPPL_INT>::iterator line_J_end =line[J].end(); - for(std::vector<CPPL_INT>::iterator q=line[J].begin(); q!=line_J_end; q++){ - if(*q==C){ *q=c; break; } - } - } - //// pop_back //// - data.pop_back(); - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - CPPL_INT c =mat.number(i,j); - if(c<0){ - s << " x "; - } - else{ - s << " " << mat.data[c].v << " "; - } - } - for(CPPL_INT j=i+1; j<mat.n; j++){ - CPPL_INT c =mat.number(i,j); - if(c<0){ - s << "{x}"; - } - else{ - s << "{" << std::conj(mat.data[c].v) << "}"; - } - } - s << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void zhsmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zhsmatrix " << n << " " << data.size() << std::endl; - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void zhsmatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zhsmatrix" && id != "#zhsmatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zhsmatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - //////// n, size //////// - size_t size; - s >> n >> size; - resize(n); - data.reserve(size);//NOT resize. - - //////// i, j, v //////// - CPPL_INT i, j; - comple v; - for(size_t k=0; k<size; k++){ - s >> i >> j >> v; - put(i,j, v); - } - - //////// check //////// - s >> i; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << " ." << std::endl - << "Most likely, there are too many data components over the context." << std::endl; - exit(1); - } - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/5f/5f2fe3a6ae108aea12d9074894a6ef7b8a4b9181.svn-base b/cpplapack-r198/.svn/pristine/5f/5f2fe3a6ae108aea12d9074894a6ef7b8a4b9181.svn-base deleted file mode 100644 index 39ec027905ada43922ac95b64f1cc9e17626f164..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5f/5f2fe3a6ae108aea12d9074894a6ef7b8a4b9181.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! +_dgsmatrix operator */ -inline const _dgsmatrix& operator+(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_dgsmatrix operator */ -inline _dgsmatrix operator-(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v = -it->v; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/5f/5f4e99cd15a40d3f558b9d6aae50f3009b5358f6.svn-base b/cpplapack-r198/.svn/pristine/5f/5f4e99cd15a40d3f558b9d6aae50f3009b5358f6.svn-base deleted file mode 100644 index 208bccbeb11a65e88eb3d91c66b8f53918ceac15..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5f/5f4e99cd15a40d3f558b9d6aae50f3009b5358f6.svn-base +++ /dev/null @@ -1,59 +0,0 @@ -//============================================================================= -/*! dsymatrix*=double operator */ -inline dsymatrix& dsymatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] *=d; - } - } - - return *this; -} - -//============================================================================= -/*! dsymatrix/=double operator */ -inline dsymatrix& dsymatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] /=d; - } - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix*double operator */ -inline _dsymatrix operator*(const dsymatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dsymatrix newmat(mat.n); - - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - newmat.darray[j][i] =mat.darray[j][i]*d; - } - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix/double operator */ -inline _dsymatrix operator/(const dsymatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dsymatrix newmat(mat.n); - - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - newmat.darray[j][i] =mat.darray[j][i]/d; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/5f/5f6d144ecfe3e3e8cc5cf92375c8cd6eb1db595e.svn-base b/cpplapack-r198/.svn/pristine/5f/5f6d144ecfe3e3e8cc5cf92375c8cd6eb1db595e.svn-base deleted file mode 100644 index e7b1ebac51bb1fdc0c348bd84a135e97bc4b2e7f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5f/5f6d144ecfe3e3e8cc5cf92375c8cd6eb1db595e.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix zgbmatrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat( zgematrix(m,n).zero() ); - - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/5f/5f6dc984fd69773d72f01f3bd8da69fba1a63e3b.svn-base b/cpplapack-r198/.svn/pristine/5f/5f6dc984fd69773d72f01f3bd8da69fba1a63e3b.svn-base deleted file mode 100644 index a3552e8ad48e24d7abc7cd82d03ab6e04061110b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/5f/5f6dc984fd69773d72f01f3bd8da69fba1a63e3b.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _zgsmatrix*zcovector operator */ -inline _zcovector operator*(const _zgsmatrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v*vec(it->j); - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/60/6075a0c1f885f7b81fa22bdd57ac8ec0ddcced8c.svn-base b/cpplapack-r198/.svn/pristine/60/6075a0c1f885f7b81fa22bdd57ac8ec0ddcced8c.svn-base deleted file mode 100644 index 09c59b885ad2f20c689dc07352ba70606a8da3c8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/60/6075a0c1f885f7b81fa22bdd57ac8ec0ddcced8c.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(2), KU(1); - - CPPL::zgbmatrix A(M,N,KL,KU); - CPPL::zgematrix B(M,N), C(N,M); - - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - for(int i=0; i<C.m; i++){ for(int j=0; j<C.n; j++){ - C(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - cout << "C =\n" << C << endl; - - cout << "A+B =\n" << A+B << endl; - cout << "A-B =\n" << A-B << endl; - cout << "A*C =\n" << A*C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/60/60e5aceb32fa52b73e81552ade7c3dcfbcdb6669.svn-base b/cpplapack-r198/.svn/pristine/60/60e5aceb32fa52b73e81552ade7c3dcfbcdb6669.svn-base deleted file mode 100644 index d4fc85bf63e1641df6dad9286049a1fd163b0190..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/60/60e5aceb32fa52b73e81552ade7c3dcfbcdb6669.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -rpmbuild -bb cpplapack.spec diff --git a/cpplapack-r198/.svn/pristine/61/610a6d8d7f4c3d3b208f89d90d8c6d0ea2b5b769.svn-base b/cpplapack-r198/.svn/pristine/61/610a6d8d7f4c3d3b208f89d90d8c6d0ea2b5b769.svn-base deleted file mode 100644 index 5028571b6926e3b2f1e35ce750f80eda4f44d1e6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/61/610a6d8d7f4c3d3b208f89d90d8c6d0ea2b5b769.svn-base +++ /dev/null @@ -1,282 +0,0 @@ -%TGIF 4.1.43-QPL -state(0,37,100.000,0,100,0,16,1,9,1,1,1,0,0,3,1,1,'Helvetica',0,80640,0,3,1,5,0,0,1,1,0,16,0,0,1,1,1,1,1050,1485,0,0,2880,0). -% -% @(#)$Header$ -% %W% -% -unit("1 pixel/pixel"). -color_info(59,65535,0,[ - "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, - "red", 65535, 0, 0, 65535, 0, 0, 1, - "green", 0, 65535, 0, 0, 65535, 0, 1, - "blue", 0, 0, 65535, 0, 0, 65535, 1, - "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, - "pink", 65535, 49344, 52171, 65535, 49344, 52171, 1, - "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, - "CadetBlue", 24415, 40606, 41120, 24415, 40606, 41120, 1, - "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, - "black", 0, 0, 0, 0, 0, 0, 1, - "magenta1", 65535, 0, 65535, 65535, 0, 65535, 1, - "red1", 65535, 0, 0, 65535, 0, 0, 1, - "green1", 0, 65535, 0, 0, 65535, 0, 1, - "blue1", 0, 0, 65535, 0, 0, 65535, 1, - "yellow1", 65535, 65535, 0, 65535, 65535, 0, 1, - "pink1", 65535, 46517, 50629, 65535, 46517, 50629, 1, - "cyan1", 0, 65535, 65535, 0, 65535, 65535, 1, - "CadetBlue1", 39064, 62965, 65535, 39064, 62965, 65535, 1, - "gray90", 58853, 58853, 58853, 58853, 58853, 58853, 1, - "gray10", 6682, 6682, 6682, 6682, 6682, 6682, 1, - "magenta4", 35723, 0, 35723, 35723, 0, 35723, 1, - "red4", 35723, 0, 0, 35723, 0, 0, 1, - "green4", 0, 35723, 0, 0, 35723, 0, 1, - "blue4", 0, 0, 35723, 0, 0, 35723, 1, - "yellow4", 35723, 35723, 0, 35723, 35723, 0, 1, - "pink4", 35723, 25443, 27756, 35723, 25443, 27756, 1, - "cyan4", 0, 35723, 35723, 0, 35723, 35723, 1, - "CadetBlue4", 21331, 34438, 35723, 21331, 34438, 35723, 1, - "gray80", 52428, 52428, 52428, 52428, 52428, 52428, 1, - "gray20", 13107, 13107, 13107, 13107, 13107, 13107, 1, - "#ff4d4d", 65535, 19789, 19789, 65280, 19712, 19712, 1, - "#ff9c4d", 65535, 40092, 19789, 65280, 39936, 19712, 1, - "#ffec4d", 65535, 60652, 19789, 65280, 60416, 19712, 1, - "#c4ff4d", 50372, 65535, 19789, 50176, 65280, 19712, 1, - "#75ff4d", 30069, 65535, 19789, 29952, 65280, 19712, 1, - "#4dff75", 19789, 65535, 30069, 19712, 65280, 29952, 1, - "#4dffc4", 19789, 65535, 50372, 19712, 65280, 50176, 1, - "#4decff", 19789, 60652, 65535, 19712, 60416, 65280, 1, - "#4d9cff", 19789, 40092, 65535, 19712, 39936, 65280, 1, - "#4d4dff", 19789, 19789, 65535, 19712, 19712, 65280, 1, - "#fffffe", 65535, 65535, 65278, 65280, 65280, 65024, 1, - "#e0e0e0", 57568, 57568, 57568, 57344, 57344, 57344, 1, - "#d0d0d0", 53456, 53456, 53456, 53248, 53248, 53248, 1, - "#c0c0c0", 49344, 49344, 49344, 49152, 49152, 49152, 1, - "#b0b0b0", 45232, 45232, 45232, 45056, 45056, 45056, 1, - "#a0a0a0", 41120, 41120, 41120, 40960, 40960, 40960, 1, - "#808080", 32896, 32896, 32896, 32768, 32768, 32768, 1, - "#404040", 16448, 16448, 16448, 16384, 16384, 16384, 1, - "#101010", 4112, 4112, 4112, 4096, 4096, 4096, 1, - "#000001", 0, 0, 257, 0, 0, 256, 1, - "DarkSlateGray", 12079, 20303, 20303, 12079, 20303, 20303, 1, - "#00000000c000", 0, 0, 49344, 0, 0, 49152, 1, - "#820782070000", 33410, 33410, 0, 33287, 33287, 0, 1, - "#3cf3fbee34d2", 15420, 64507, 13364, 15603, 64494, 13522, 1, - "#3cf3fbed34d3", 15420, 64507, 13364, 15603, 64493, 13523, 1, - "#ffffa6990000", 65535, 42662, 0, 65535, 42649, 0, 1, - "#ffff0000fffe", 65535, 0, 65535, 65535, 0, 65534, 1, - "#fffe0000fffe", 65535, 0, 65535, 65534, 0, 65534, 1, - "#fffe00000000", 65535, 0, 0, 65534, 0, 0, 1 -]). -script_frac("0.6"). -fg_bg_colors('black','white'). -dont_reencode("FFDingbests:ZapfDingbats"). -page(1,"",1,''). -polygon('black','',7,[ - 150,100,150,150,350,350,375,350,375,225,250,100,150,100],3,2,1,0,211,0,0,0,0,0,'2',0, - "00",[ -]). -box('black','',150,100,375,350,0,2,1,0,0,0,0,0,0,'2',0,[ -]). -poly('black','',2,[ - 150,150,350,350],0,2,1,1,0,0,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -poly('black','',2,[ - 250,100,375,225],0,2,1,2,0,0,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -poly('black','',2,[ - 150,100,375,325],0,2,1,3,0,0,3,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -group([ -polygon('black','',8,[ - 235,440,248,440,248,405,277,405,277,440,290,440,262,475,235,440],0,2,1,0,80,0,0,0,0,0,'2',0, - "00",[ -]), -box('black','',239,409,286,454,0,2,0,81,0,0,0,0,0,'2',0,[ -attr("", "auto_center_attr", 0, 1, 0, -text('black',262,408,1,1,1,0,17,82,14,3,0,0,0,0,2,0,17,0,0,"",0,0,0,0,422,'',[ -minilines(0,17,0,0,1,0,0,[ -mini_line(0,14,3,0,0,0,[ -str_block(0,0,14,3,0,0,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,207360,0,14,3,0,0,0,0,0,0,0, - "auto_center_attr")]) -]) -])])), -attr("label=", "", 1, 0, 0, -text('black',262,422,1,1,1,0,17,83,14,3,0,0,0,0,2,0,17,0,0,"",0,0,0,0,436,'',[ -minilines(0,17,0,0,1,0,0,[ -mini_line(0,14,3,0,0,0,[ -str_block(0,0,14,3,0,0,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,207360,0,14,3,0,0,0,0,0,0,0, - "")]) -]) -])])) -]) -], -84,0,0,[ -]). -group([ -text('black',80,52,1,1,1,107,22,95,18,4,0,0,0,0,2,107,22,0,0,"",0,0,0,0,70,'',[ -minilines(107,22,0,0,1,0,0,[ -mini_line(107,18,4,0,0,0,[ -str_block(0,107,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,107,18,4,0,-1,0,0,0,0,0, - "Actual Matrix")]) -]) -])]), -rcbox('black','',20,45,140,80,0,2,1,0,16,102,0,0,0,0,'2',0,[ -]) -], -105,0,0,[ -]). -group([ -text('black',80,457,1,1,1,113,22,111,18,4,0,0,0,0,2,113,22,0,0,"",0,0,0,0,475,'',[ -minilines(113,22,0,0,1,0,0,[ -mini_line(113,18,4,0,0,0,[ -str_block(0,113,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,113,18,4,0,-1,0,0,0,0,0, - "Stored Matrix")]) -]) -])]), -rcbox('black','',20,450,140,485,0,2,1,0,16,110,0,0,0,0,'2',0,[ -]) -], -109,0,0,[ -]). -box('black','',150,500,375,650,0,2,1,125,0,0,0,0,0,'2',0,[ -]). -group([ -arc('black','',0,1,1,0,-289,-1140,259,-383,150,360,367,360,0,1096,1514,-6464,1472,35,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',262,376,1,1,1,9,17,49,14,3,0,0,0,0,2,9,17,0,0,"",0,0,0,0,390,'',[ -minilines(9,17,0,0,1,0,0,[ -mini_line(9,14,3,0,0,0,[ -str_block(0,9,14,3,0,-1,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,9,14,3,0,-1,0,0,0,0,0, - "n")]) -]) -])]) -], -137,0,0,[ -]). -group([ -arc('black','',0,1,1,0,-281,-200,59,225,385,100,385,350,1,680,850,1088,-2176,30,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',415,214,1,1,1,11,17,45,14,3,0,0,0,0,2,11,17,0,0,"",0,0,0,0,228,'',[ -minilines(11,17,0,0,1,0,0,[ -mini_line(11,14,3,0,0,0,[ -str_block(0,11,14,3,0,0,0,0,0,[ -str_seg('black','Times-Roman',0,80640,11,14,3,0,0,0,0,0,0,0, - "m")]) -]) -])]) -], -140,0,0,[ -]). -group([ -arc('black','',0,1,1,0,130,89,166,125,140,100,140,150,0,72,72,8704,5632,37,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',110,116,1,1,1,30,17,79,14,3,0,0,0,0,2,30,17,0,0,"",0,0,0,0,130,'',[ -minilines(30,17,0,0,1,0,0,[ -mini_line(30,14,3,0,0,0,[ -str_block(0,30,14,3,0,-2,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,30,14,3,0,-2,0,0,0,0,0, - "kl+1")]) -]) -])]) -], -143,0,0,[ -]). -group([ -arc('black','',0,1,1,0,45,80,198,280,150,90,246,90,1,306,400,6912,-2368,36,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',200,61,1,1,1,35,17,75,14,3,0,0,0,0,2,35,17,0,0,"",0,0,0,0,75,'',[ -minilines(35,17,0,0,1,0,0,[ -mini_line(35,14,3,0,0,0,[ -str_block(0,35,14,3,0,-2,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,35,14,3,0,-2,0,0,0,0,0, - "ku+1")]) -]) -])]) -], -146,0,0,[ -]). -group([ -arc('black','',0,1,1,0,-289,-840,259,-83,150,660,367,660,0,1096,1514,-6464,1472,170,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',261,676,1,1,1,9,17,169,14,3,0,0,0,0,2,9,17,0,0,"",0,0,0,0,690,'',[ -minilines(9,17,0,0,1,0,0,[ -mini_line(9,14,3,0,0,0,[ -str_block(0,9,14,3,0,-1,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,9,14,3,0,-1,0,0,0,0,0, - "n")]) -]) -])]) -], -168,0,0,[ -]). -poly('black','',2,[ - 150,600,250,500],0,2,1,171,0,0,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -group([ -arc('black','',0,1,1,0,-281,320,59,575,385,500,385,650,1,680,510,1088,-2176,152,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',430,562,1,1,1,47,17,151,14,3,0,0,0,0,2,47,17,0,0,"",0,0,0,0,576,'',[ -minilines(47,17,0,0,1,0,0,[ -mini_line(47,14,3,0,0,0,[ -str_block(0,47,14,3,0,-1,0,0,0,[ -str_seg('black','Times-Roman',0,80640,47,14,3,0,-1,0,0,0,0,0, - "kl+ku+1")]) -]) -])]) -], -229,0,0,[ -]). -poly('black','',2,[ - 350,650,375,625],0,2,1,236,0,3,0,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -group([ -arc('black','',0,1,1,0,45,480,198,680,150,490,246,490,1,306,400,6912,-2368,242,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',200,461,1,1,1,35,17,241,14,3,0,0,0,0,2,35,17,0,0,"",0,0,0,0,475,'',[ -minilines(35,17,0,0,1,0,0,[ -mini_line(35,14,3,0,0,0,[ -str_block(0,35,14,3,0,-2,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,35,14,3,0,-2,0,0,0,0,0, - "ku+1")]) -]) -])]) -], -240,0,0,[ -]). -group([ -arc('black','',0,1,1,0,130,589,166,625,140,600,140,650,0,72,72,8704,5632,250,0,0,8,3,0,0,0,'1','8','3',0,[ -]), -text('black',110,616,1,1,1,30,17,249,14,3,0,0,0,0,2,30,17,0,0,"",0,0,0,0,630,'',[ -minilines(30,17,0,0,1,0,0,[ -mini_line(30,14,3,0,0,0,[ -str_block(0,30,14,3,0,-2,0,0,0,[ -str_seg('black','NewCenturySchlbk-Roman',0,80640,30,14,3,0,-2,0,0,0,0,0, - "kl+1")]) -]) -])]) -], -248,0,0,[ -]). -poly('black','',2,[ - 150,600,375,600],0,2,1,251,0,3,3,0,0,0,0,'2',0,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -polygon('black','',7,[ - 150,600,150,650,350,650,375,625,375,500,250,500,150,600],3,2,1,0,259,3,0,0,0,0,'2',0, - "00",[ -]). diff --git a/cpplapack-r198/.svn/pristine/61/614a17eb10e9221e93f4a0c0ce08420c668f722d.svn-base b/cpplapack-r198/.svn/pristine/61/614a17eb10e9221e93f4a0c0ce08420c668f722d.svn-base deleted file mode 100644 index e4cd6f78da66dc2364a1c3e9c3b540fa0034e65d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/61/614a17eb10e9221e93f4a0c0ce08420c668f722d.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -void random( CPPL::drovector & x ) { - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } -} - -void random( CPPL::dcovector & x ) { - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } -} - -void random( CPPL::dgematrix & A ) { - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} -} - -void random( CPPL::dsymatrix & A ) { - for(int i=0; i<A.n; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} -} - -void random( CPPL::dgbmatrix & A ) { - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } -} - -void random( CPPL::dgsmatrix & A ) { - for(int i=0; i<A.m; i++){ - for(int j=0; j<=i; j++){ - if(rand()%2==0){ - A(i,j) =double( rand() / (RAND_MAX/10) ); - } - } - } -} - -//============================================================================= -/*! main */ - -int main( int argc, char * argv[] ) -{ - srand(unsigned(time(NULL))); - - int M(9), N(11); - int KL(2), KU(1); - int CAP(4); - - CPPL::dgematrix A(M,N); - CPPL::dgbmatrix B(M,N,KL,KU); - CPPL::dgsmatrix C(M,N,CAP); - CPPL::dsymatrix D(M); - CPPL::drovector x(M); - CPPL::dcovector y(M); - - random( A ); - random( B ); - random( C ); - random( D ); - random( x ); - random( y ); - - std::cout << "A =\n" << A << std::endl; - std::cout << "C =\n" << C << std::endl; - std::cout << "t(C) =\n" << t(C) << std::endl; - - /* - //////// cause memory leak //////// - t( A ); - t( B ); - t( C ); - t( D ); - t( x ); - t( y ); - - A + B; - + A; - i( D ); - y + t( x ); - C * t(C); - */ - return 0; -} - diff --git a/cpplapack-r198/.svn/pristine/61/618b3e8185ba64c27ef5b3d6f6cf96744b2cdb0f.svn-base b/cpplapack-r198/.svn/pristine/61/618b3e8185ba64c27ef5b3d6f6cf96744b2cdb0f.svn-base deleted file mode 100644 index e9246e8e575716b8866ff5547a0c18022f1aebda..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/61/618b3e8185ba64c27ef5b3d6f6cf96744b2cdb0f.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _drovector*_dcovector operator */ -inline double operator*(const _drovector& rovec, const _dcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - rovec.destroy(); - covec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/62/62188c51872f9c87c0ea27bf86fefd327785f974.svn-base b/cpplapack-r198/.svn/pristine/62/62188c51872f9c87c0ea27bf86fefd327785f974.svn-base deleted file mode 100644 index c66194f296eba699b1beeba108fa3785591de2ed..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/62/62188c51872f9c87c0ea27bf86fefd327785f974.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -/*! zgbmatrix+_zhematrix operator */ -inline _zgematrix operator+(const zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB.n,matB.n); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) =matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix-_zhematrix operator */ -inline _zgematrix operator-(const zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB.n,matB.n); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) =-matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) +=matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix*_zhematrix operator */ -inline _zgematrix operator*(const zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/62/621f2177bf7ed18cbe633c24f7e7757a3174f0f5.svn-base b/cpplapack-r198/.svn/pristine/62/621f2177bf7ed18cbe633c24f7e7757a3174f0f5.svn-base deleted file mode 100644 index c0acba0bfcf13baf21a9f99ad6dfdad1afa62e0e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/62/621f2177bf7ed18cbe633c24f7e7757a3174f0f5.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! dssmatrix+dgbmatrix operator */ -/* -inline _dgematrix operator+(const dssmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! dssmatrix-dgbmatrix operator */ -/* -inline _dgematrix operator-(const dssmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - return _(newmat); -} -*/ - -//============================================================================= -/*! dssmatrix*dgbmatrix operator */ -/* -inline _dgematrix operator*(const dssmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=max(0,matA.jndx[c]-matB.kl); - j<min(matB.n,matA.jndx[c]+matB.ku+1); j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/62/6240fd4a2f0a14669a85fde8d2caffa9670dfaa7.svn-base b/cpplapack-r198/.svn/pristine/62/6240fd4a2f0a14669a85fde8d2caffa9670dfaa7.svn-base deleted file mode 100644 index 3a4127175629d87b6c6d052e361b17a5d864a312..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/62/6240fd4a2f0a14669a85fde8d2caffa9670dfaa7.svn-base +++ /dev/null @@ -1,129 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(5), KL(2), KU(3); - - CPPL::dsymatrix X(N), Y(N), Z(N); - CPPL::dgbmatrix A(M,N,KL,KU); - A.zero(); - X.zero(); - Y.zero(); - Z.zero(); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - if( i>=j && (std::max(0,j-A.kl) <= i && i < std::min(A.n,j+A.ku+1) )){ - A(i,j) = double( rand() /(RAND_MAX/10) ); - A(j,i) = A(i,j); - X(i,j) = -A(i,j); - Y(i,j) = A(i,j); - } - } - } - for(int i=0; i<Z.n; i++){ - for(int j=0; j<Z.n; j++){ - Z(i,j) = double( rand() /(RAND_MAX/10) ); - } - } - - cout << "A =\n" << A << endl; - cout << "X =\n" << X << endl; - cout << "Y =\n" << Y << endl; - cout << "Z =\n" << Z << endl; - - - //dgb+dsy - cout << "A+X =\n" << A+X << "<-Should be zero." << endl; - //dgb-dsy - cout << "A-Y =\n" << A-Y << "<-Should be zero." << endl; - //dgb*dsy - cout << "t(A*Z)-Z*t(A) =\n" << t(A*Z)-Z*t(A) << "<-Should be zero." << endl; - - //dgb/dsy - //N/A - //dgb=dsy - //N/A - //dgb+=dsy - //N/A - //dgb-=dsy - //N/A - //dgb*=dsy - //N/A - //dgb/=dsy - //N/A - - //dgb+_dsy, -dsy - cout << "A+(-Y) =\n" << A+(-Y) << "<-Should be zero." << endl; - //dgb-_dsy, -dsy - cout << "A-(-X) =\n" << A-(-X) << "<-Should be zero." << endl; - //dgb*_dsy, dsy+dsy, dgb*dsy, _dge+_dge, _dge-_dge - cout << "A*(X+Z) - (A*X+A*Z) =\n" << A*(X+Z) - (A*X+A*Z) << "<-Should be zero." << endl; - //dgb/_dsy - //N/A - //dgb=_dsy - //N/A - //dgb+=_dsy - //N/A - //dgb-=_dsy - //N/A - //dgb*=_dsy - //N/A - //dgb/=_dsy - //N/A - - //_dgb+dsy, -dgb - cout << "(-A)+Y =\n" << (-A)+Y << "<-Should be zero." << endl; - //_dgb-dsy, -dgb - cout << endl << endl << endl << endl; - cout << "(-A)-X =\n" << (-A)-X << "<-Should be zero." << endl; - cout << endl << endl << endl << endl; - //_dgb*dsy, -dgb, dgb*dsy, _dge+_dge - cout << "(-A)*Z+(A*Z) =\n" << ((-A)*Z+(A*Z)) << "<-Should be zero." << endl; - //_dgb/dsy - //N/A - //_dgb=dsy - //N/A - //_dgb+=dsy - //N/A - //_dgb-=dsy - //N/A - //_dgb*=dsy - //N/A - //_dgb/=dsy - //N/A - - //_dgb+_dsy, -dgb, -dsy - cout << "(-A)+(-X) =\n" << (-A)+(-X) << "<-Should be zero." << endl; - //_dgb-_dsy, -dgb, -dsy - cout << "(-A)-(-Y) =\n" << (-A)-(-Y) << "<-Should be zero." << endl; - //_dgb*_dsy, -dgb, -dsy, dgb*dsy, _dge-_dge - cout << "(-A)*(-Z)-(A*Z) =\n" << (-A)*(-Z)-(A*Z) << "<-Should be zero." << endl; - //_dgb/_dsy - //N/A - //_dgb=_dsy - //N/A - //_dgb+=_dsy - //N/A - //_dgb-=_dsy - //N/A - //_dgb*=_dsy - //N/A - //_dgb/=_dsy - //N/A - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/62/625e5f1196d67051e39945eaf4540e8b7e9c0678.svn-base b/cpplapack-r198/.svn/pristine/62/625e5f1196d67051e39945eaf4540e8b7e9c0678.svn-base deleted file mode 100644 index 5605ef1b5e2374c83db0e01b105238d15304b07c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/62/625e5f1196d67051e39945eaf4540e8b7e9c0678.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3), M(2); - - CPPL::zrovector x(M), y; - CPPL::zgematrix A(M,N); - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "x =\n" << x << endl; - cout << "A =\n" << A << endl; - - cout << "#### y=x*A; ####" << endl; - y=x*A; - cout << "y =\n" << y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/62/62b8e8872b6e9cc2b9785a927433723c6cf72be9.svn-base b/cpplapack-r198/.svn/pristine/62/62b8e8872b6e9cc2b9785a927433723c6cf72be9.svn-base deleted file mode 100644 index 77473876d19b30cfd0d78643970ff86396d379ad..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/62/62b8e8872b6e9cc2b9785a927433723c6cf72be9.svn-base +++ /dev/null @@ -1,387 +0,0 @@ -//============================================================================= -/*! convert dcovector_small to dcovector */ -template<CPPL_INT l> -inline _dcovector dcovector_small<l>::to_dcovector() const -{CPPL_VERBOSE_REPORT; - dcovector vec(l); - for(CPPL_INT k=0; k<l; k++){ - vec(k)=(*this)(k); - } - return _(vec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT l> -inline double& dcovector_small<l>::operator()(const CPPL_INT& k) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT l> -inline double dcovector_small<l>::operator()(const CPPL_INT& k) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! set */ -template<CPPL_INT l> -inline dcovector_small<l>& dcovector_small<l>::set(const CPPL_INT& k, const double& v) -{CPPL_VERBOSE_REPORT; - (*this)(k) =v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT l> -inline std::ostream& operator<<(std::ostream& s, const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<l; i++){ - s << A(i) << std::endl; - } - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT l> -inline void dcovector_small<l>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dcovector" << " " << l << std::endl; - for(CPPL_INT k=0; k<l; k++){ - ofs << (*this)(k) << std::endl; - } - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT l> -inline void dcovector_small<l>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dcovector" && id != "#dcovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dcovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _l; - s >> _l; - if(l!=_l){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - for(CPPL_INT k=0; k<l; k++){ - s >> (*this)(k); - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id;//tmp - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return transposed drovector_small */ -template<CPPL_INT l> -inline drovector_small<l> t(const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - drovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i); - } - return X; -} - -//============================================================================= -/*! return its 2-norm */ -template<CPPL_INT l> -inline double nrm2(const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - double v(0); - for(CPPL_INT i=0; i<l; i++){ - v+=A(i)*A(i); - } - return std::sqrt(v); -} - -//============================================================================= -/*! return index of the maximum component */ -template<CPPL_INT l> -inline void idamax(CPPL_INT& K, const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - double max(-1.); - for(int k=0; k<l; k++){ - if( max<fabs(A(k)) ){ - K=k; - max =fabs(A(k)); - } - } - return; -} - -//============================================================================= -/*! return the maximum component */ -template<CPPL_INT l> -inline double damax(const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - CPPL_INT k(0); - idamax(k,A); - return A(k); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zero */ -template<CPPL_INT l> -inline dcovector_small<l>& dcovector_small<l>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<l; k++){ - array[k] =0.; - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector_small+=dcovector_small operator */ -template<CPPL_INT l> -inline dcovector_small<l>& operator+=(dcovector_small<l>& A, const dcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) +=B(i); - } - return A; -} - -//============================================================================= -/*! dcovector_small-=dcovector_small operator */ -template<CPPL_INT l> -inline dcovector_small<l>& operator-=(dcovector_small<l>& A, const dcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) -=B(i); - } - return A; -} - -//============================================================================= -/*! dcovector_small*=double operator */ -template<CPPL_INT l> -inline dcovector_small<l>& operator*=(dcovector_small<l>& A, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) *=d; - } - return A; -} - -//============================================================================= -/*! dcovector_small/=double operator */ -template<CPPL_INT l> -inline dcovector_small<l>& operator/=(dcovector_small<l>& A, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) /=d; - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary + operator*/ -template<CPPL_INT l> -inline const dcovector_small<l>& operator+(const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary - operator*/ -template<CPPL_INT l> -inline dcovector_small<l> operator-(const dcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - dcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =-A(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector_small+dcovector_small operator */ -template<CPPL_INT l> -inline dcovector_small<l> operator+(const dcovector_small<l>& A, const dcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - dcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)+B(i); - } - return X; -} - -//============================================================================= -/*! dcovector_small-dcovector_small operator */ -template<CPPL_INT l> -inline dcovector_small<l> operator-(const dcovector_small<l>& A, const dcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - dcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)-B(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector_small*double operator */ -template<CPPL_INT n> -inline dcovector_small<n> operator*(const dcovector_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - dcovector_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - C(i) =A(i)*v; - } - return C; -} - -//============================================================================= -/*! dcovector_small*drovector_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n> operator*(const dcovector_small<m>& A, const drovector_small<n>& B) -{CPPL_VERBOSE_REPORT; - dgematrix_small<m,n> mat; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - mat(i,j) =A(i)*B(j); - } - } - return mat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector_small/double operator */ -template<CPPL_INT n> -inline dcovector_small<n> operator/(const dcovector_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - dcovector_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - C(i) =A(i)/v; - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector_small%dcovector_small (inner product) operator */ -template<CPPL_INT l> -inline double operator%(const dcovector_small<l>& A, const dcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - double v(0.); - for(CPPL_INT i=0; i<l; i++){ - v +=A(i)*B(i); - } - return v; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT l> -inline dcovector_small<l> hadamard(const dcovector_small<l>& A, const dcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - dcovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)*B(i); - } - return C; -} - diff --git a/cpplapack-r198/.svn/pristine/63/6303fef3e4c1be672bfcb7abbaf36738719e2618.svn-base b/cpplapack-r198/.svn/pristine/63/6303fef3e4c1be672bfcb7abbaf36738719e2618.svn-base deleted file mode 100644 index 69aa5f1df5577804e18991bc02d3a76eceb619f1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/6303fef3e4c1be672bfcb7abbaf36738719e2618.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::dcovector x(M), y(M), z; - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - for(int i=0; i<y.l; i++){ - y(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "x =\n" << x << endl; - cout << "y =\n" << y << endl; - - cout << "x+x =\n" << x+x << endl; - cout << "x-x =\n" << x-x << endl; - cout << "x%y =\n" << x%y << endl; - - cout << "#### z=x; ####" << endl; - z=x; - cout << "z =\n" << z << endl; - cout << "#### z=x+x-x; ####" << endl; - z=x+x-x; - cout << "z =\n" << z << endl; - cout << "#### z+=x; ####" << endl; - z+=x; - cout << "z =\n" << z << endl; - cout << "#### z-=x; ####" << endl; - z-=x; - cout << "z =\n" << z << endl; - - cout << "hadamerd(x,x) =\n" << hadamerd(x,x) << endl; - cout << "hadamerd(x,x) =\n" << hadamerd(x,hadamerd(x,x)) << endl; - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/63/630b4be479ab3322cf381d0e1536b5e1fc1ecb9f.svn-base b/cpplapack-r198/.svn/pristine/63/630b4be479ab3322cf381d0e1536b5e1fc1ecb9f.svn-base deleted file mode 100644 index 1b827364dc41d4b28d2e1a26beb6baa8995f787a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/630b4be479ab3322cf381d0e1536b5e1fc1ecb9f.svn-base +++ /dev/null @@ -1,142 +0,0 @@ -//============================================================================= -//! Real Double-precision Symmetric Sparse Matrix Class -class dssmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT const& m; //!< matrix row size - CPPL_INT n; //!< matrix column size - std::vector<dcomponent> data; //!< matrix data - std::vector< std::vector<CPPL_INT> > line; //!< vector of vector to store the entry information of component for each row and column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dssmatrix(); - inline dssmatrix(const dssmatrix&); - inline dssmatrix(const _dssmatrix&); - inline dssmatrix(const CPPL_INT&, const CPPL_INT=0); - inline dssmatrix(const char*); - inline ~dssmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zhsmatrix to_zhsmatrix() const; - inline _dgematrix to_dgematrix() const; - inline _dsymatrix to_dsymatrix() const; - inline _dgsmatrix to_dgsmatrix() const; - - //////// io //////// - inline double operator()(const CPPL_INT&, const CPPL_INT&) const; - inline double& operator()(const CPPL_INT&, const CPPL_INT&); - inline dssmatrix& put(const CPPL_INT&, const CPPL_INT&, const double&); - inline dssmatrix& del(const CPPL_INT, const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline dssmatrix& del(const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline friend std::ostream& operator<<(std::ostream&, const dssmatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline dssmatrix& zero(); - inline dssmatrix& identity(); - inline void chsign(); - inline void copy(const dssmatrix&); - inline void shallow_copy(const _dssmatrix&); - inline dssmatrix& resize(const CPPL_INT&, const CPPL_INT=0, const CPPL_INT=0); - inline void stretch(const CPPL_INT&); - inline bool isListed(const CPPL_INT&, const CPPL_INT&) const; - inline CPPL_INT number(const CPPL_INT&, const CPPL_INT&) const; - inline _drovector row(const CPPL_INT&) const; - inline _dcovector col(const CPPL_INT&) const; - inline void diet(const double=DBL_MIN); - inline CPPL_INT diag_front(); - inline void reorder(const bool=0); - inline void rebuild(); - inline void checkup(); - inline friend void swap(dssmatrix&, dssmatrix&); - inline friend _dssmatrix _(dssmatrix&); - - //////// calc //////// - inline friend _dssmatrix t(const dssmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const dssmatrix&); - inline friend double damax(const dssmatrix&); - - //////// pardiso //////// - inline CPPL_INT pardiso_definite(dcovector&) const; - inline CPPL_INT pardiso_indefinite(dcovector&) const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline dssmatrix& operator=(const dssmatrix&); - inline dssmatrix& operator=(const _dssmatrix&); - - //////// += //////// - inline dssmatrix& operator+=(const dssmatrix&); - inline dssmatrix& operator+=(const _dssmatrix&); - - //////// -= //////// - inline dssmatrix& operator-=(const dssmatrix&); - inline dssmatrix& operator-=(const _dssmatrix&); - - //////// *= //////// - inline dssmatrix& operator*=(const double&); - - //////// /= //////// - inline dssmatrix& operator/=(const double&); - - //////// unary //////// - inline friend const dssmatrix& operator+(const dssmatrix&); - inline friend _dssmatrix operator-(const dssmatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const dssmatrix&, const dgematrix&); - inline friend _dgematrix operator+(const dssmatrix&, const _dgematrix&); - inline friend _dgematrix operator+(const dssmatrix&, const dsymatrix&); - inline friend _dgematrix operator+(const dssmatrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const dssmatrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const dssmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator+(const dssmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator+(const dssmatrix&, const _dgsmatrix&); - inline friend _dssmatrix operator+(const dssmatrix&, const dssmatrix&); - inline friend _dssmatrix operator+(const dssmatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const dssmatrix&, const dgematrix&); - inline friend _dgematrix operator-(const dssmatrix&, const _dgematrix&); - inline friend _dgematrix operator-(const dssmatrix&, const dsymatrix&); - inline friend _dgematrix operator-(const dssmatrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const dssmatrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const dssmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator-(const dssmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator-(const dssmatrix&, const _dgsmatrix&); - inline friend _dssmatrix operator-(const dssmatrix&, const dssmatrix&); - inline friend _dssmatrix operator-(const dssmatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const dssmatrix&, const dcovector&); - inline friend _dcovector operator*(const dssmatrix&, const _dcovector&); - inline friend _dgematrix operator*(const dssmatrix&, const dgematrix&); - inline friend _dgematrix operator*(const dssmatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const dssmatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const dssmatrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const dssmatrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const dssmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator*(const dssmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator*(const dssmatrix&, const _dgsmatrix&); - inline friend _dgsmatrix operator*(const dssmatrix&, const dssmatrix&); - inline friend _dgsmatrix operator*(const dssmatrix&, const _dssmatrix&); - inline friend _dssmatrix operator*(const dssmatrix&, const double&); - - //////// / //////// - inline friend _dssmatrix operator/(const dssmatrix&, const double&); - - //////// double //////// - inline friend _dssmatrix operator*(const double&, const dssmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/63/6341f8e32f6482fd5d97ac1bfdd444116798d099.svn-base b/cpplapack-r198/.svn/pristine/63/6341f8e32f6482fd5d97ac1bfdd444116798d099.svn-base deleted file mode 100644 index 8a06ccf2b19d8e2125fabbc7944f0004b81c64e2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/6341f8e32f6482fd5d97ac1bfdd444116798d099.svn-base +++ /dev/null @@ -1,63 +0,0 @@ -//============================================================================= -/*! _drovector+_drovector operator */ -inline _drovector operator+(const _drovector& vecA, const _drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i]+=vecB.array[i]; - } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _drovector-_drovector operator */ -inline _drovector operator-(const _drovector& vecA, const _drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i]-=vecB.array[i]; - } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _drovector^T*_drovector operator (inner product) */ -inline double operator%(const _drovector& vecA, const _drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/63/635ff7eec35e4012e38d33b7b8e4f002c1ba4022.svn-base b/cpplapack-r198/.svn/pristine/63/635ff7eec35e4012e38d33b7b8e4f002c1ba4022.svn-base deleted file mode 100644 index fb9545ab1acea2a55eb3a3f72e392f37eda1b0db..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/635ff7eec35e4012e38d33b7b8e4f002c1ba4022.svn-base +++ /dev/null @@ -1,127 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline double& drovector::operator()(const CPPL_INT& i) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -//============================================================================= -/*! operator() for const object */ -inline double drovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline drovector& drovector::set(const CPPL_INT& i, const double& v) //const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[i] =v; - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const drovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ s << " " << vec.array[i]; } - s << std::endl; - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void drovector::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#drovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << " "; - } - ofs << std::endl; - - ofs.close(); -} - -//============================================================================= -inline void drovector::read(const char *filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "drovector" && id != "#drovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not drovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> l; - resize(l); - for(CPPL_INT i=0; i<l; i++) { s >> operator()(i); } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/63/637c59b1dfb4992ecfd8f172486c81f19e98cfd9.svn-base b/cpplapack-r198/.svn/pristine/63/637c59b1dfb4992ecfd8f172486c81f19e98cfd9.svn-base deleted file mode 100644 index b5919f1501e1085346833e611284753a05cb40fb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/637c59b1dfb4992ecfd8f172486c81f19e98cfd9.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! +dsymatrix operator */ -inline const dsymatrix& operator+(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -dsymatrix operator */ -inline _dsymatrix operator-(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - dsymatrix newmat(mat.n); - - const CPPL_INT size =newmat.n*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =-mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/63/63a0c4a8602e51498670ad0d5e3afa4277a794b0.svn-base b/cpplapack-r198/.svn/pristine/63/63a0c4a8602e51498670ad0d5e3afa4277a794b0.svn-base deleted file mode 100644 index 66da0d0b021f1b336e6fdcd5c4936d1c6c7c46d6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/63a0c4a8602e51498670ad0d5e3afa4277a794b0.svn-base +++ /dev/null @@ -1,75 +0,0 @@ -//============================================================================= -/*! return its transposed matrix */ -inline _zhsmatrix t(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v =std::conj(it->v); - } - - return mat; -} - -//============================================================================= -/*! return its conjugate matrix */ -inline _zhsmatrix conj(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v =std::conj(it->v); - } - - return mat; -} - -//============================================================================= -/*! return its conjugate transposed matrix */ -inline _zhsmatrix conjt(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - i=itx->i; - j=itx->j; - - mat.destroy(); -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - mat.destroy(); - return itx->v; -} diff --git a/cpplapack-r198/.svn/pristine/63/63ac3f145520e4ed403663298de1967adbba3f4f.svn-base b/cpplapack-r198/.svn/pristine/63/63ac3f145520e4ed403663298de1967adbba3f4f.svn-base deleted file mode 100644 index 74f508750b663ae3433fe4107f0283b7525ed8ee..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/63ac3f145520e4ed403663298de1967adbba3f4f.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -//============================================================================= -/*! calculate vector product only for 2D vector */ -inline comple operator/(const zcovec2& A, const zcovec2& B) -{CPPL_VERBOSE_REPORT; - return A(0)*B(1) -A(1)*B(0); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate vector product only for 3D vector */ -inline zcovec3 operator/(const zcovec3& A, const zcovec3& B) -{CPPL_VERBOSE_REPORT; - zcovec3 C; - C(0) =A(1)*B(2) -A(2)*B(1); - C(1) =A(2)*B(0) -A(0)*B(2); - C(2) =A(0)*B(1) -A(1)*B(0); - return C; -} - -//============================================================================= -/*! calculate vector product only for 3D vector */ -inline zcovec3 operator/=(zcovec3& A, const zcovec3& B) -{CPPL_VERBOSE_REPORT; - A =A/B; - return A; -} diff --git a/cpplapack-r198/.svn/pristine/63/63e09a14593d65f3cb717f88eafc051c44333d87.svn-base b/cpplapack-r198/.svn/pristine/63/63e09a14593d65f3cb717f88eafc051c44333d87.svn-base deleted file mode 100644 index 3e405c8367363d0eb123f9d959f45b520fb8fb42..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/63/63e09a14593d65f3cb717f88eafc051c44333d87.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! dsymatrix_small constructor */ -template<CPPL_INT n> -inline dsymatrix_small<n>::dsymatrix_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! dsymatrix_small constructor */ -template<CPPL_INT n> -inline dsymatrix_small<n>::dsymatrix_small(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( n!=mat.n ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be the same." << std::endl - << "Your input was " << n << "x" << n << " and " << mat.m << "x" << mat.n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ - array[k] =mat.array[k]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix_small destructor */ -template<CPPL_INT n> -inline dsymatrix_small<n>::~dsymatrix_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/64/643875e637bf65735c44531f94e8d96b5f215716.svn-base b/cpplapack-r198/.svn/pristine/64/643875e637bf65735c44531f94e8d96b5f215716.svn-base deleted file mode 100644 index 9eb5cab27eea6000e47f479e70262b96ba3f154f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/64/643875e637bf65735c44531f94e8d96b5f215716.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zhematrix*_zcovector operator */ -inline _zcovector operator*(const _zhematrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/64/64d2c99bd25a7519fa2ca86e4fb4187ea37ad9ca.svn-base b/cpplapack-r198/.svn/pristine/64/64d2c99bd25a7519fa2ca86e4fb4187ea37ad9ca.svn-base deleted file mode 100644 index 595d8ee98ff711c3ac4df1fd1072ece5744de1ea..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/64/64d2c99bd25a7519fa2ca86e4fb4187ea37ad9ca.svn-base +++ /dev/null @@ -1,401 +0,0 @@ -/*! -\mainpage -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr><hr> -<h2>What's new?</h2> -<p> -[May 11th 2015] -"cpplapack-2015.05.11" has been released. -This release is only for the users who don't like to use svn. -(We still highly recommend users to use the latest svn code!!) -Not only "tar.gz", "rpm" and "deb" (made by alien) packages were prepared. -There are some major modifications in this release, and thus users may need to modify the following points in your codes: -<ul> - <li> - The BLAS/LAPACK fictions are put in CPPL namespace. - Put "CPPL::" at the head of each direct call of BLAS/LAPACK fictions. - </li> - <li> - The argument style of the BLAS/LAPACK fictions is changed to FORTRAN style. - Not only array objects but also non-array objects must be passed as the addresses of the objects. - Put "&" at the head of each non-array argument of directly-called BLAS/LAPACK fictions. - </li> - <li> - The default type of an integer is revised to "CPPL_INT" from "long". - "CPPL_INT" denotes "MKL_INT" on Intel/MKL and "int" on g++ etc.. - Note that "long" is no longer valid. - </li> -</ul> -e.g.)<br> -Old code:<br> -<code> - long NRHS(mat.n), LDA(n), *IPIV(new long[n]), LDB(mat.m), INFO(1);<br> - dgesv_(n, NRHS, array, LDA, IPIV, mat.array, LDB, INFO);<br> -</code> -New code:<br> -<code> - CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1);<br> - CPPL::dgesv_(&n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, &INFO);<br> -</code> -or<br> -<code> - int NRHS(mat.n), LDA(n), *IPIV(new int[n]), LDB(mat.m), INFO(1);<br> - CPPL::dgesv_(&n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, &INFO);<br> -</code> -(It is OK to use "int" instead of "CPPL_INT" on most platforms.) -</p> - -<p> -[Feb. 8th 2014] -"cpplapack-2014.02.08" has been released. -This release is only for the users who don't like to use svn. -(We still highly recommend users to use the latest svn code!!) -Not only "tar.gz", "rpm" and "deb" (made by alien) packages were prepared. -See the logs of svn to get the "ChangeLog". -</p> - -<p> -[Mar. 27th 2010] -"cpplapack-2010.03.27" has been released. -This release is only for the users who don't like to use svn. -(We still recommend users to use svn.:)) -Not only "tar.gz" but also "rpm" and "deb" packages were prepared. -See the logs of svn to get the "ChangeLog". -</p> - -<p> -[Sep. 25th 2006] -"cpplapack-2006_09_25" has been released. -The general sparse matrix(dgsmatrix, zgsmatrix) and symmetric or hermitial sparse matrix(dssmatrix,zhsmatrix) were formally added. -This release also contains some bug fixes. -See "ChangeLog" for the detail. -</p> - -<p> -[Mar. 25th 2005] -"cpplapack-2005_03_25" has been released. -This release contains some bug fixes and modification. -See "ChangeLog" for the detail. -It also contains the alpha version of sparse matrix classes (dssmatrix and zssmatrix). -These classes are still so buggy, but it is OK as long as you don't use these classes in your code. -</p> - -<p> -[Oct. 15th 2004] -Mr. Ueshima wrote a tutorial of CPPLapack in Japanese. -"cpplapack-2004_04_24" has been released. -It is very useful for beginners of CPPLapack. -The HTML version is available at -<a href="http://cpplapack.sourceforge.net/tutorial/japanese/index.html"> -http://cpplapack.sourceforge.net/tutorial/japanese/index.html</a>, -and the PDF version is available at -<a href="http://cpplapack.sourceforge.net/tutorial/japanese/CPPLapack_Tutorial-Japanese.pdf">http://cpplapack.sourceforge.net/tutorial/japanese/CPPLapack_Tutorial-Japanese.pdf</a> -</p> - -<p> -[Apr. 24th 2004] -"cpplapack-2004_04_24" has been released. -OpenMP macros (<code>\#pragma omp parallel for private(j,k)</code>) -are added to all triple for-loops. -The search engine for this documentation is added. -This search engine is case-sensitive. -</p> - -<p> -[Apr. 1st 2004] -"cpplapack-2004_04_01" has been released. -The complex double-precision matrix and vector classes -(zgematrix, zgbmatrix, zhematrix, zcovector, zrovector) -are newly added. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr><hr> -<h2>Introduction</h2> -<p> -CPPLapack is a C++ class wrapper for BLAS, LAPACK and PARDISO. -</p> - -<p> -The interfaces of Fortran BLAS, LAPACK, CBLAS, and CLAPACK are not user-friendly, and induce a lot of coding mistakes not only for LAPACK beginners but also experienced programmers. -Because of its difficult interface, BLAS functions are not widely used for simple matrix calculations such as "+", "-", "*", and so on even though these calculations are frequently required. -If there is a user-friendly library using BLAS and LAPACK in the background, it is really useful to minimize the program development time and computational time at the same time. -Existing matrix libraries, however, are not sufficient as far as we know. -</p> - -<p> -CPPLapack has a very user-friendly interface -as same as ordinary C++ matrix libraries. -Moreover, CPPLapack uses BLAS and LAPACK functions in the background though programmers just need to write simple codes such as <code>"A=B*C;"</code>, <code>"A.dgesv(y);"</code>, and so on. -</p> - -<p> -The advantage of using CPPLapack are not only user-friendly interface and fast computational speed but also saving memory space. -In case of large-size matrix calculation, the number of copy times of objects affects required memory space and computational time materially. -CPPLapack has a mechanism called "Smart-Temporary" system to minimize the number of copy times. -The "Smart-Temporary" system is also hidden in CPPLapack library so that programmers don't need to pay any attention for this system. -(CPPLapack used to employed "to_return" system. -Now CPPLapack uses this system to realize the same purpose with keeping the compatibility with old versions.) -</p> - -<p> -This program is designed for large matrix calculation. -If you don't have mind to handle large matrices, -to use another matrix library is recommended. -</p> - -<p> -CPPLapack is still a beta program so far. -It is a shame but there are a few bugs and unsupported BLAS and LAPACK functions. -If you are going to use CPPLapack, please be aware this situation. -Of course, it is very nice if you help us to develop CPPLapack. -</p> - - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Special Features</h2> -<ul> -<li> -User-friendly interface<br> -</li> -<li> -Hi-speed matrix calculations using BLAS, LAPACK and PARDISO<br> -</li> -<li> -Minimized number of copy times of objects using "Smart-Temporary" system<br> -</li> -</ul> -All of the features are hidden in C++ class library -so that programmers are not required to do any special programming. - - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Where to Get</h2> -<p> -The official distribution site of CPPLapack is -<a href="http://sourceforge.net/projects/cpplapack/">here</a>. -It is highly recommended to use the latest svn code on the linked page. -</p> - - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>How to Install</h2> -<p> -Actually, you don't need to install CPPLapack. -CPPLapack is a bunch of C++ header files. -Just expand the package at somewhere you like, -and write a include path in your "Makefile". -All you need to include is only "cpplapack.h". -</p> - -<p> -But CPPLapack needs BLAS and LAPACK written in Fortran installed. -Just make sure these two libraries are installed and modify "Makefile" to include and link to them. -In stead of original BLAS and LAPACK packages, bender-supplied libraries such as Intel math kernel library (MKL) are also acceptable. -Note that Intel MKL is necessary to use PARDISO for sparse matrices. -</p> - -<p> -What BLAS and LAPACK need to link depends on your platform. -Some examples of "Makefile" are prepared. -See \ref pg-makefile. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Important Specification</h2> -<ul> -<li> -The namespace for CPPLapack is "CPPL". -</li> -<li> -You should not and don't need to use underscored matrix classes. -These classes are not for project codes. -The underscored classes are called "Smart-Temporary" classes. -The detail of "Smart-Temporary" system is explained in \ref pg-nt. -</li> -<li> -The numbering system of the matrix component is NOT 1-based but 0-based. -In case of m x n matrix, -the element number at the upper left is (0,0), and the element number at the lower right is (m-1,n-1). -See \ref pg-bandmatrix for information of a band matrix. -</li> -<li> -The matrix arrays are stored in column-major style. -although most of C programmers like to use row-major style. -This is because of the conventional Fortran LAPACK style. -</li> -<li> -The matrix and vector member objects m, n, l, and array are the const reference objects so that they can be used to obtain the data but cannot be overwritten. -</li> -<li> -LAPACK member functions implemented in CPPLapack, such as A.dgesv(y), overwrite the matrix A. -When you need to keep the original matrix A, you have to make a copy of the matrix A before using LAPACK member functions. -</li> -<li> -For easy debugging, "CPPL_VERBOSE" and "CPPL_DEBUG" macros are prepared. -When "-DCPPL_VERBOSE" is specified in compilation commands, every called function outputs its function name to stderr. -When "-DCPPL_DEBUG" is specified in compilation commands, matrix bounds checking are enabled. -We recommend you to enable these macros during the program testing, then recompile codes without these macros for CPPLapack's best performance. -</li> -<li> -It is important NOT to leave out the returned object. -The calculated and returned object must be substituted to an object. -For example, <code>A+B;</code> is not good. -For another example, -<code>"dcovector f(const dcovector& x){ return 2*x; }"</code>, -<code>f(x);</code> is also not good. -These are because of the "Smart-Temporary" system. -See \ref pg-nt. -</li> -</ul> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Test Programs</h2> -Test programs to check the operations are there in "test" directory. -They are also easy examples for you to learn how to use CPPLapack. - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Benchmark Programs</h2> -<p> -Some programs to estimate the speed of CPPLapack are prepared in "benchmark" directory. -</p> - -<p> -The performance of CPPLapack is almost the same as the performance of original BLAS and LAPACK. -However, some of arguments of BLAS and LAPACK functions such as ALPHA, BETA, TRANS, and so on are fixed at certain values. -When you want to make the full-use of BLAS and LAPACK functions, you can call their functions directory in codes of CPPLapack as usual. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>FAQ</h2> -<p> -(Q)I found my program using CPPLapack consuming the memory larger and larger in a loop. Why does this happen? -<br> -(A)Most likely, you leave out some returned matrix or vector object in the loop. -Please read "Important Specification" section carefully. -</p> - - -<p> -(Q)When I print components of a matrix or vector, I sometimes see "nan" printed. What is the possible reason? -<br> -(A)First of all, please make sure that your objects are initialized. -The constructor with size arguments such as -<code>"CPPL::dgematrix A(5,10);"</code> -does NOT initialize its array components. -The "resize" function does NOT initialize, neither. -Please initialize objects using substitutions, or use "identity" or "zero" function to initialize them. -</p> - -<p> -(Q)All the member variables are in "public". -Why don't you set "private" for capsulation? -<br> -(A)Matrix programings are frequently required to be custom-made. -Choosing "public" or "private" was a tough choice, and we chose "public" so that users could make custom-made functions without modifying CPPLapack itself. -</p> - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>License</h2> -CPPLapack is a GPL software without any guarantee. - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Author and Cooperators</h2> -Author: -Yuki ONISHI<br> -Cooperator: -Masafumi IAI, -Toshiyasu SHIMIZU, -Masashi UESHIMA - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Bug Report</h2> -Please send bug reports to -<a href="mailto:yuki.onishi@gmail.com">yuki.onishi@gmail.com</a>. -I also welcome any kind of comments. - -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<hr> -<h2>Links</h2> -CPPLapack Documents in Japanese: -<ul> -<li><a target="_blank" href="../main_page/Japanese.html"> -CPPLapack Document in Japanese</a></li> -<li><a target="_blank" href="http://cpplapack.sourceforge.net/tutorial/japanese/index.html"> -CPPLapack Tutorial in Japanese</a></li> -<li><a href="http://cpplapack.sourceforge.net/tutorial/japanese/CPPLapack_Tutorial-Japanese.pdf">PDF of CPPLapack Tutorial in Japanese</a> -</ul> - -The sister project of CPPLapack: -<ul> -<li><a target="_blank" href="http://sourceforge.net/projects/cppscalapack/"> -CPPScaLapack</a></li> -</ul> - -CPPLapack is based on and thanks to: -<ul> -<li><a target="_blank" href="http://netlib.caspur.it/blas/"> -BLAS</a></li> -<li><a target="_blank" href="http://netlib.caspur.it/atlas/"> -ATLAS</a></li> -<li><a target="_blank" href="http://www.netlib.org/lapack/"> -LAPACK</a></li> -</ul> - -<ul> -<li><a target="_blank" href="http://developer.intel.com/software/products/compilers/"> -Intel C++ Compiler (ICC)</a></li> -<li><a target="_blank" href="http://developer.intel.com/software/products/mkl/index.htm"> -Intel Math Kernel Library (MKL)</a></li> -<li><a target="_blank" href="http://h30097.www3.hp.com/linux/compaq_cxx/"> -HP(Compaq) C++ Compiler for Linux Alpha (CXX)</a></li> -<li><a target="_blank" href="http://h18000.www1.hp.com/math/"> -HP(Compaq) Math Libraries (CPML, CXML)</a></li> -<li><a target="_blank" href="http://www.mpack.com/"> -NEC MathKeisan Library (MPACK)</a></li> -<li><a target="_blank" href="http://www.sgi.com/developers/devtools/apis/scsl.html"> -SGI Scientific Computing Software Library (SCSL)</a></li> -<li><a target="_blank" href="http://www.amd.com/home/dev01"> -AMD Core Math Library (ACML)</a></li> -</ul> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<!----------------------------------------------------------------------------> -<center><h3>Have fun.</h3></center> -*/ diff --git a/cpplapack-r198/.svn/pristine/64/64de2b925bf0529c4ffc7b367b80f54100d21c01.svn-base b/cpplapack-r198/.svn/pristine/64/64de2b925bf0529c4ffc7b367b80f54100d21c01.svn-base deleted file mode 100644 index ed51788991798f2a275310d22170eb480a600981..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/64/64de2b925bf0529c4ffc7b367b80f54100d21c01.svn-base +++ /dev/null @@ -1,144 +0,0 @@ -//============================================================================= -//! Complex Double-precision Hermitian Matrix Class [l-type (UPLO=l) Strage] -/*! The imaginary part of every diagonal component is not referenced. */ -class zhematrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT const& m; //!< matrix row size - CPPL_INT n; //!< matrix column size - comple* array; //!< 1D array to store matrix data - comple** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zhematrix(); - inline zhematrix(const zhematrix&); - inline zhematrix(const _zhematrix&); - inline zhematrix(const CPPL_INT&); - inline zhematrix(const char*); - inline ~zhematrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline zhecomplex operator()(const CPPL_INT&, const CPPL_INT&); - inline comple operator()(const CPPL_INT&, const CPPL_INT&) const; - inline zhematrix& set(const CPPL_INT&, const CPPL_INT&, const comple&); - inline friend std::ostream& operator<<(std::ostream&, const zhematrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void complete() const; - inline void clear(); - inline zhematrix& zero(); - inline zhematrix& identity(); - inline void chsign(); - inline void copy(const zhematrix&); - inline void shallow_copy(const _zhematrix&); - inline void resize(const CPPL_INT&); - inline _zrovector row(const CPPL_INT&) const; - inline _zcovector col(const CPPL_INT&) const; - inline _dsymatrix real() const; - inline _dgematrix imag() const; - inline _dsymatrix abs() const; - inline _dgematrix arg() const; - inline friend void swap(zhematrix&, zhematrix&); - inline friend _zhematrix _(zhematrix&); - - //////// calc //////// - inline friend _zhematrix t(const zhematrix&); - inline friend _zgematrix i(const zhematrix&); - inline friend _zhematrix conj(const zhematrix&); - inline friend _zhematrix conjt(const zhematrix&); - - //////// lapack //////// - inline CPPL_INT zhesv(zgematrix&); - inline CPPL_INT zhesv(zcovector&); - inline CPPL_INT zheev(std::vector<double>&, const bool&); - inline CPPL_INT zheev(std::vector<double>&, std::vector<zcovector>&); - inline CPPL_INT zheev(std::vector<double>&, std::vector<zrovector>&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline zhematrix& operator=(const zhematrix&); - inline zhematrix& operator=(const _zhematrix&); - - //////// += //////// - inline zhematrix& operator+=(const zhematrix&); - inline zhematrix& operator+=(const _zhematrix&); - - //////// -= //////// - inline zhematrix& operator-=(const zhematrix&); - inline zhematrix& operator-=(const _zhematrix&); - - //////// *= //////// - inline zhematrix& operator*=(const zhematrix&); - inline zhematrix& operator*=(const _zhematrix&); - inline zhematrix& operator*=(const double&); - - //////// /= //////// - inline zhematrix& operator/=(const double&); - - //////// unary //////// - inline friend const zhematrix& operator+(const zhematrix&); - inline friend _zhematrix operator-(const zhematrix&); - - //////// + //////// - inline friend _zgematrix operator+(const zhematrix&, const zgematrix&); - inline friend _zgematrix operator+(const zhematrix&, const _zgematrix&); - inline friend _zhematrix operator+(const zhematrix&, const zhematrix&); - inline friend _zhematrix operator+(const zhematrix&, const _zhematrix&); - inline friend _zgematrix operator+(const zhematrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const zhematrix&, const _zgbmatrix&); - inline friend _zgematrix operator+(const zhematrix&, const zgsmatrix&); - inline friend _zgematrix operator+(const zhematrix&, const _zgsmatrix&); - inline friend _zgematrix operator+(const zhematrix&, const zhsmatrix&); - inline friend _zgematrix operator+(const zhematrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const zhematrix&, const zgematrix&); - inline friend _zgematrix operator-(const zhematrix&, const _zgematrix&); - inline friend _zhematrix operator-(const zhematrix&, const zhematrix&); - inline friend _zhematrix operator-(const zhematrix&, const _zhematrix&); - inline friend _zgematrix operator-(const zhematrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const zhematrix&, const _zgbmatrix&); - inline friend _zgematrix operator-(const zhematrix&, const zgsmatrix&); - inline friend _zgematrix operator-(const zhematrix&, const _zgsmatrix&); - inline friend _zgematrix operator-(const zhematrix&, const zhsmatrix&); - inline friend _zgematrix operator-(const zhematrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const zhematrix&, const zcovector&); - inline friend _zcovector operator*(const zhematrix&, const _zcovector&); - inline friend _zgematrix operator*(const zhematrix&, const zgematrix&); - inline friend _zgematrix operator*(const zhematrix&, const _zgematrix&); - inline friend _zgematrix operator*(const zhematrix&, const zhematrix&); - inline friend _zgematrix operator*(const zhematrix&, const _zhematrix&); - inline friend _zgematrix operator*(const zhematrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const zhematrix&, const _zgbmatrix&); - inline friend _zgematrix operator*(const zhematrix&, const zgsmatrix&); - inline friend _zgematrix operator*(const zhematrix&, const _zgsmatrix&); - inline friend _zgematrix operator*(const zhematrix&, const zhsmatrix&); - inline friend _zgematrix operator*(const zhematrix&, const _zhsmatrix&); - inline friend _zhematrix operator*(const zhematrix&, const double&); - inline friend _zgematrix operator*(const zhematrix&, const comple&); - - //////// / //////// - inline friend _zhematrix operator/(const zhematrix&, const double&); - inline friend _zgematrix operator/(const zhematrix&, const comple&); - - //////// double, comple //////// - inline friend _zhematrix operator*(const double&, const zhematrix&); - inline friend _zgematrix operator*(const comple&, const zhematrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/64/64f0f69149f1fbfab6a0d92d867a9081b770297c.svn-base b/cpplapack-r198/.svn/pristine/64/64f0f69149f1fbfab6a0d92d867a9081b770297c.svn-base deleted file mode 100644 index 552c36fa105a371f78ff4b3a6fd29eb7b9e1a45c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/64/64f0f69149f1fbfab6a0d92d867a9081b770297c.svn-base +++ /dev/null @@ -1,98 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class -class _zgbmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable CPPL_INT kl; //!< lower band width - mutable CPPL_INT ku; //!< upper band width - mutable comple* array; //!< 1D array to store matrix data - mutable comple** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _zgbmatrix(); - inline _zgbmatrix(const _zgbmatrix&); - inline ~_zgbmatrix();//destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline comple& operator()(const CPPL_INT&, const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const _zgbmatrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _zgbmatrix t(const _zgbmatrix&); - inline friend _zgematrix i(const _zgbmatrix&); - inline friend _zgbmatrix conj(const _zgbmatrix&); - inline friend _zgbmatrix conjt(const _zgbmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _zgbmatrix& operator+(const _zgbmatrix&); - inline friend _zgbmatrix operator-(const _zgbmatrix&); - - //////// + //////// - inline friend _zgematrix operator+(const _zgbmatrix&, const zgematrix&); - inline friend _zgematrix operator+(const _zgbmatrix&, const _zgematrix&); - inline friend _zgematrix operator+(const _zgbmatrix&, const zhematrix&); - inline friend _zgematrix operator+(const _zgbmatrix&, const _zhematrix&); - inline friend _zgbmatrix operator+(const _zgbmatrix&, const zgbmatrix&); - inline friend _zgbmatrix operator+(const _zgbmatrix&, const _zgbmatrix&); - inline friend _zgematrix operator+(const _zgbmatrix&, const zgsmatrix&); - inline friend _zgematrix operator+(const _zgbmatrix&, const _zgsmatrix&); - inline friend _zgematrix operator+(const _zgbmatrix&, const zhsmatrix&); - inline friend _zgematrix operator+(const _zgbmatrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const _zgbmatrix&, const zgematrix&); - inline friend _zgematrix operator-(const _zgbmatrix&, const _zgematrix&); - inline friend _zgematrix operator-(const _zgbmatrix&, const zhematrix&); - inline friend _zgematrix operator-(const _zgbmatrix&, const _zhematrix&); - inline friend _zgbmatrix operator-(const _zgbmatrix&, const zgbmatrix&); - inline friend _zgbmatrix operator-(const _zgbmatrix&, const _zgbmatrix&); - inline friend _zgematrix operator-(const _zgbmatrix&, const zgsmatrix&); - inline friend _zgematrix operator-(const _zgbmatrix&, const _zgsmatrix&); - inline friend _zgematrix operator-(const _zgbmatrix&, const zhsmatrix&); - inline friend _zgematrix operator-(const _zgbmatrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const _zgbmatrix&, const zcovector&); - inline friend _zcovector operator*(const _zgbmatrix&, const _zcovector&); - inline friend _zgematrix operator*(const _zgbmatrix&, const zgematrix&); - inline friend _zgematrix operator*(const _zgbmatrix&, const _zgematrix&); - inline friend _zgematrix operator*(const _zgbmatrix&, const zhematrix&); - inline friend _zgematrix operator*(const _zgbmatrix&, const _zhematrix&); - inline friend _zgbmatrix operator*(const _zgbmatrix&, const zgbmatrix&); - inline friend _zgbmatrix operator*(const _zgbmatrix&, const _zgbmatrix&); - inline friend _zgematrix operator*(const _zgbmatrix&, const zgsmatrix&); - inline friend _zgematrix operator*(const _zgbmatrix&, const _zgsmatrix&); - inline friend _zgematrix operator*(const _zgbmatrix&, const zhsmatrix&); - inline friend _zgematrix operator*(const _zgbmatrix&, const _zhsmatrix&); - inline friend _zgbmatrix operator*(const _zgbmatrix&, const double&); - inline friend _zgbmatrix operator*(const _zgbmatrix&, const comple&); - - //////// / //////// - inline friend _zgbmatrix operator/(const _zgbmatrix&, const double&); - inline friend _zgbmatrix operator/(const _zgbmatrix&, const comple&); - - //////// double, complex //////// - inline friend _zgbmatrix operator*(const double&, const _zgbmatrix&); - inline friend _zgbmatrix operator*(const comple&, const _zgbmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/65/65038a8945285ff7abe977d7c78fcaa039f62e4f.svn-base b/cpplapack-r198/.svn/pristine/65/65038a8945285ff7abe977d7c78fcaa039f62e4f.svn-base deleted file mode 100644 index 439905d3b68a3eb6c11baffde004b9418edcc708..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/65/65038a8945285ff7abe977d7c78fcaa039f62e4f.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -#undef CPPL_VERBOSE -#undef CPPL_DEBUG - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - //int size(2500); - int size(1000); - CPPL::dgematrix A(size,size); - CPPL::dcovector y(size); - - srand(unsigned(time(NULL))); - for(int i=0; i<size; i++){ - for(int j=0; j<size; j++){ - A(i,j) =double(rand())/double(RAND_MAX); - } - y(i) =double(rand())/double(RAND_MAX); - } - - clock_t t0, t1; - - t0=clock(); - A.dgesv(y); - t1=clock(); - - cout << "dgesv took "<< (1000./CLOCKS_PER_SEC)*(t1-t0) << "[ms]." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/65/6511bb7adda4370b2369a743d8e1174d21c6205c.svn-base b/cpplapack-r198/.svn/pristine/65/6511bb7adda4370b2369a743d8e1174d21c6205c.svn-base deleted file mode 100644 index 234adf64e4cd4d397e0e97868479d7c6033e20bf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/65/6511bb7adda4370b2369a743d8e1174d21c6205c.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zgematrix*_zcovector operator */ -inline _zcovector operator*(const _zgematrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/65/6554a5286ba4a1fac3edd0964c41eb1570994ae8.svn-base b/cpplapack-r198/.svn/pristine/65/6554a5286ba4a1fac3edd0964c41eb1570994ae8.svn-base deleted file mode 100644 index b49565589e5e040679ff36730af938e61cf1f3fa..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/65/6554a5286ba4a1fac3edd0964c41eb1570994ae8.svn-base +++ /dev/null @@ -1,44 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(4), KL(1), KU(2); - - CPPL::zgbmatrix A(M,N,KL,KU); - CPPL::zhematrix X(N); - - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - }} - - for(int i=0; i<X.n; i++){ - for(int j=0; j<i; j++){ - X(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - X(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - cout << "A =\n" << A << endl; - cout << "X =\n" << X << endl; - - cout << "A+X =\n" << A+X << endl; - cout << "A-X =\n" << A-X << endl; - cout << "A*X =\n" << A*X << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/65/6589e889dea35b826c74fee44be1c61d6b93e965.svn-base b/cpplapack-r198/.svn/pristine/65/6589e889dea35b826c74fee44be1c61d6b93e965.svn-base deleted file mode 100644 index ba5140107149325949c0f8b3b296ed9934c076be..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/65/6589e889dea35b826c74fee44be1c61d6b93e965.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -//============================================================================= -/*! calculate vector product for 2D vector */ -inline comple operator/(const zrovec2& A, const zrovec2& B) -{CPPL_VERBOSE_REPORT; - return A(0)*B(1)-A(1)*B(0); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate vector product only for 3D vector */ -inline zrovec3 operator/(const zrovec3& A, const zrovec3& B) -{CPPL_VERBOSE_REPORT; - zrovec3 C; - C(0) =A(1)*B(2) -A(2)*B(1); - C(1) =A(2)*B(0) -A(0)*B(2); - C(2) =A(0)*B(1) -A(1)*B(0); - return C; -} diff --git a/cpplapack-r198/.svn/pristine/65/65a90e8089847bc1de16738978d760aa861d0626.svn-base b/cpplapack-r198/.svn/pristine/65/65a90e8089847bc1de16738978d760aa861d0626.svn-base deleted file mode 100644 index e3a057b60ba437872d58d5faa30a66a9ee03ba65..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/65/65a90e8089847bc1de16738978d760aa861d0626.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class -class _zcovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT l; //!< vector size - mutable comple* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _zcovector(); - inline _zcovector(const _zcovector&); - inline ~_zcovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - - //////// io //////// - inline comple& operator()(const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const _zcovector&); - inline void write(const char*) const; - - //////// calc //////// - inline friend _zrovector t(const _zcovector&); - inline friend _zcovector conj(const _zcovector&); - inline friend _zrovector conjt(const _zcovector&); - inline friend double nrm2(const _zcovector&); - inline friend CPPL_INT idamax(const _zcovector&); - inline friend comple damax(const _zcovector&); - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _zcovector& operator+(const _zcovector&); - inline friend _zcovector operator-(const _zcovector&); - - //////// + //////// - inline friend _zcovector operator+(const _zcovector&, const zcovector&); - inline friend _zcovector operator+(const _zcovector&, const _zcovector&); - - //////// - //////// - inline friend _zcovector operator-(const _zcovector&, const zcovector&); - inline friend _zcovector operator-(const _zcovector&, const _zcovector&); - - //////// * //////// - inline friend _zgematrix operator*(const _zcovector&, const zrovector&); - inline friend _zgematrix operator*(const _zcovector&, const _zrovector&); - inline friend _zcovector operator*(const _zcovector&, const double&); - inline friend _zcovector operator*(const _zcovector&, const comple&); - - //////// / //////// - inline friend _zcovector operator/(const _zcovector&, const double&); - inline friend _zcovector operator/(const _zcovector&, const comple&); - - //////// % //////// - inline friend comple operator%(const _zcovector&, const zcovector&); - inline friend comple operator%(const _zcovector&, const _zcovector&); - - //////// double, complex //////// - inline friend _zcovector operator*(const double&, const _zcovector&); - inline friend _zcovector operator*(const comple&, const _zcovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/65/65bd4142a279982a392df56a0d542a0807b5ae1f.svn-base b/cpplapack-r198/.svn/pristine/65/65bd4142a279982a392df56a0d542a0807b5ae1f.svn-base deleted file mode 100644 index d0286c29ec5217f5ef90730c5826a52d256903db..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/65/65bd4142a279982a392df56a0d542a0807b5ae1f.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================= -/*! drovector*=double operator */ -inline drovector& drovector::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - dscal_(&l, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! drovector/=double operator */ -inline drovector& drovector::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - double dinv =1./d; - CPPL_INT inc =1; - dscal_(&l, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector*double operator */ -inline _drovector operator*(const drovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - drovector newvec(vec.l); - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]*d; - } - - return _(newvec); -} - -//============================================================================= -/*! drovector/double operator */ -inline _drovector operator/(const drovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - drovector newvec(vec.l); - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]/d; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/66/6611da8b50aa2a71b5ec5a6252293e8474e900ea.svn-base b/cpplapack-r198/.svn/pristine/66/6611da8b50aa2a71b5ec5a6252293e8474e900ea.svn-base deleted file mode 100644 index e9388079a0b7ae871d35946665fe1139629e80df..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/66/6611da8b50aa2a71b5ec5a6252293e8474e900ea.svn-base +++ /dev/null @@ -1,102 +0,0 @@ -//============================================================================= -void dsyev_check_value() -{ - cout << "############ check dsyev value ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make dsymatrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<N; i++){ for(int j=0; j<N; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - vector<double> w; - - //// make A_original //// - CPPL::dsymatrix A_original(A); - - //// dsyev //// - A.dsyev(w); - //A.dsyev(w,1); - - //// print //// - cout << "A=\n" << A << endl; - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<N; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - } -} - -//============================================================================= -void dsyev_check_right() -{ - cout << "############ check dsyev right ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make dsymatrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - vector<double> w; - vector<CPPL::dcovector> v; - - //// make A_original //// - CPPL::dsymatrix A_original(A); - - //// dsyev //// - A.dsyev(w,v); - - //// print //// - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<A.n; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - cout << "v=\n" << v[i] <<endl; - cout << "[A]*{x} -lambda*{x} = (Should be zeros)\n" - << A_original*v[i] -w[i]*v[i] << endl; - } -} - -//============================================================================= -void dsyev_check_left() -{ - cout << "############ check dsyev left ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make dsymatrix A //// - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vl //// - vector<double> w; - vector<CPPL::drovector> v; - - //// make A_original //// - CPPL::dsymatrix A_original(A); - - //// dsyev //// - A.dsyev(w, v); - - //// print //// - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<A.n; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w = " << w[i] << endl; - cout << "v = " << v[i] << endl; - cout << "{x}*[A] -{x}*lambda = (Should be zeros)\n" - << v[i]*A_original -v[i]*w[i] << endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/66/662dbd240b20758d02505aade9f1dbbfb300bbc8.svn-base b/cpplapack-r198/.svn/pristine/66/662dbd240b20758d02505aade9f1dbbfb300bbc8.svn-base deleted file mode 100644 index d672de13d50f6908ba5d40b3a9f9ab0a3a17c24d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/66/662dbd240b20758d02505aade9f1dbbfb300bbc8.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! _zrovector*comple operator */ -inline _zrovector operator*(const _zrovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zscal_(&vec.l, &d, vec.array, &inc); - return vec; -} - -//============================================================================= -/*! _zrovector/comple operator */ -inline _zrovector operator/(const _zrovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&vec.l, &dinv, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/66/66864d6cde52080839a2bcde3f878e2f27948233.svn-base b/cpplapack-r198/.svn/pristine/66/66864d6cde52080839a2bcde3f878e2f27948233.svn-base deleted file mode 100644 index f0118456fad1045d91d2e72467d0259fe6cbc6f8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/66/66864d6cde52080839a2bcde3f878e2f27948233.svn-base +++ /dev/null @@ -1,148 +0,0 @@ -//============================================================================= -/*! dgematrix+=_dsymatrix operator */ -inline dgematrix& dgematrix::operator+=(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - operator()(i,j) += mat(i,j); - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dgematrix-=_dsymatrix operator */ -inline dgematrix& dgematrix::operator-=(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m;i++){ - for(CPPL_INT j=0; j<n; j++){ - operator()(i,j) -= mat(i,j); - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dgematrix*=_dsymatrix operator */ -inline dgematrix& dgematrix::operator*=(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( m, mat.n ); - char side ='R'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &mat.n, &n, &alpha, mat.array, &mat.n, array, &m, &beta, newmat.array, &newmat.m ); - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+_dsymatrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) += matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgematrix-_dsymatrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgematrix*_dsymatrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char side ='R'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/67/6711236ba6c81210e93af8b46b5e3d9f70176a27.svn-base b/cpplapack-r198/.svn/pristine/67/6711236ba6c81210e93af8b46b5e3d9f70176a27.svn-base deleted file mode 100644 index 01490798deb4399f35ef0407b145e1329bf00716..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/67/6711236ba6c81210e93af8b46b5e3d9f70176a27.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! dgematrix*_dcovector operator */ -inline _dcovector operator*(const dgematrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/67/6736d65c2a3a849b9c8ca6d9d85aa0dc0072c417.svn-base b/cpplapack-r198/.svn/pristine/67/6736d65c2a3a849b9c8ca6d9d85aa0dc0072c417.svn-base deleted file mode 100644 index 9dad887e9f0dabfdd4d229667e323b007c4c3b08..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/67/6736d65c2a3a849b9c8ca6d9d85aa0dc0072c417.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -//============================================================================= -/*! _dsymatrix constructor without arguments */ -inline _dsymatrix::_dsymatrix() - :m(n) -{CPPL_VERBOSE_REPORT; - n =0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! _dsymatrix copy constructor */ -inline _dsymatrix::_dsymatrix(const _dsymatrix& mat) - :m(n) -{CPPL_VERBOSE_REPORT; - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix destructor */ -inline _dsymatrix::~_dsymatrix() -{CPPL_VERBOSE_REPORT; - delete[] array; - delete[] darray; -} diff --git a/cpplapack-r198/.svn/pristine/68/681def88fcbe00ae011674a6339458de9829befc.svn-base b/cpplapack-r198/.svn/pristine/68/681def88fcbe00ae011674a6339458de9829befc.svn-base deleted file mode 100644 index 088ced73e835b90db72e145b6b134c9a83b8eed5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/68/681def88fcbe00ae011674a6339458de9829befc.svn-base +++ /dev/null @@ -1,31 +0,0 @@ -//============================================================================= -/*! _dgematrix*dssmatrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,it->j) +=matA(i,it->i)*it->v; - } - if(it->i!=it->j){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,it->i) +=matA(i,it->j)*it->v; - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/68/6840681386a8409b4e024ce7e2189da262d97e61.svn-base b/cpplapack-r198/.svn/pristine/68/6840681386a8409b4e024ce7e2189da262d97e61.svn-base deleted file mode 100644 index a4d632af0c1bef2610bbc317925ad4fc9d38ad1c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/68/6840681386a8409b4e024ce7e2189da262d97e61.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - //int M(5), N(4), KL(2), KU(1); - int M(10), N(10), KL(1), KU(1); - - CPPL::dgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - //if(!( i-j>A.kl || j-i>A.ku )){ A(i,j) =double( rand() /(RAND_MAX/10) ); } - if(!( i-j>A.kl || j-i>A.ku )){ A(i,j) =10.*double(i)+double(j); } - }} - - cout << "A =\n" << A << endl; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ - cout << "A(" << i << "," << j << ") =" << A(i,j) << endl; - } - }} - - - - const CPPL::dgbmatrix B(A); - cout << "B =\n" << B << endl; - - //B*=10.; //compile error - //B(0,0)=0.; //compile error - - //cout << "A+B=\n" << A+B << endl; - - //// write/read //// - B.write( "tmp.txt" ); - CPPL::dgbmatrix C; - C.read( "tmp.txt" ); - cout << "C-B =\n" << C-B << "<-Should be zero." << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/68/68453b524eea13e059b4091f1c3ca098b831f558.svn-base b/cpplapack-r198/.svn/pristine/68/68453b524eea13e059b4091f1c3ca098b831f558.svn-base deleted file mode 100644 index aa3d9023224df269e4c8b03919ef87da34c9a8be..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/68/68453b524eea13e059b4091f1c3ca098b831f558.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! _zgematrix+_zhematrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - matA(i,j) += matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix-_zhematrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - matA(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix*_zhematrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - char side ='R'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/68/68a5065ba845df562bf0a7d11df9f81c61e63b78.svn-base b/cpplapack-r198/.svn/pristine/68/68a5065ba845df562bf0a7d11df9f81c61e63b78.svn-base deleted file mode 100644 index 33ae343f2f3ec4357ab11444099d96832931f3a5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/68/68a5065ba845df562bf0a7d11df9f81c61e63b78.svn-base +++ /dev/null @@ -1,134 +0,0 @@ -//============================================================================= -/*! dssmatrix=_dssmatrix operator */ -inline dssmatrix& dssmatrix::operator=(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix+=_dssmatrix operator */ -inline dssmatrix& dssmatrix::operator+=(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) +=it->v; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dssmatrix-=_dssmatrix operator */ -inline dssmatrix& dssmatrix::operator-=(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -=it->v; - } - - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix+_dssmatrix operator */ -inline _dssmatrix operator+(const dssmatrix& matA, const _dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matB); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dssmatrix-_dssmatrix operator */ -inline _dssmatrix operator-(const dssmatrix& matA, const _dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matB); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) -=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dssmatrix*_dssmatrix operator */ -/* -inline _dgsmatrix operator*(const dssmatrix& matA, const _dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat( matA.n, 0 ); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.line[k].begin(); p!=matB.line[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/68/68b45158ff18674ff0c7254b7dba99eb9676b32a.svn-base b/cpplapack-r198/.svn/pristine/68/68b45158ff18674ff0c7254b7dba99eb9676b32a.svn-base deleted file mode 100644 index b5648af36d373b8f95dce16bd6a1c8e93ca61472..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/68/68b45158ff18674ff0c7254b7dba99eb9676b32a.svn-base +++ /dev/null @@ -1,97 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Complex Double-precision General Dence Matrix Class -class _zgematrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable comple* array; //!< 1D array to store matrix data - mutable comple** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _zgematrix(); - inline _zgematrix(const _zgematrix&); - inline ~_zgematrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - - //////// io //////// - inline comple& operator()(const CPPL_INT&, const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const zgematrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _zgematrix t(const _zgematrix&); - inline friend _zgematrix i(const _zgematrix&); - inline friend _zgematrix conj(const _zgematrix&); - inline friend _zgematrix conjt(const _zgematrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const _zgematrix&); - inline friend comple damax(const _zgematrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _zgematrix& operator+(const _zgematrix&); - inline friend _zgematrix operator-(const _zgematrix&); - - //////// + //////// - inline friend _zgematrix operator+(const _zgematrix&, const zgematrix&); - inline friend _zgematrix operator+(const _zgematrix&, const _zgematrix&); - inline friend _zgematrix operator+(const _zgematrix&, const zhematrix&); - inline friend _zgematrix operator+(const _zgematrix&, const _zhematrix&); - inline friend _zgematrix operator+(const _zgematrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const _zgematrix&, const _zgbmatrix&); - inline friend _zgematrix operator+(const _zgematrix&, const zgsmatrix&); - inline friend _zgematrix operator+(const _zgematrix&, const _zgsmatrix&); - inline friend _zgematrix operator+(const _zgematrix&, const zhsmatrix&); - inline friend _zgematrix operator+(const _zgematrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const _zgematrix&, const zgematrix&); - inline friend _zgematrix operator-(const _zgematrix&, const _zgematrix&); - inline friend _zgematrix operator-(const _zgematrix&, const zhematrix&); - inline friend _zgematrix operator-(const _zgematrix&, const _zhematrix&); - inline friend _zgematrix operator-(const _zgematrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const _zgematrix&, const _zgbmatrix&); - inline friend _zgematrix operator-(const _zgematrix&, const zgsmatrix&); - inline friend _zgematrix operator-(const _zgematrix&, const _zgsmatrix&); - inline friend _zgematrix operator-(const _zgematrix&, const zhsmatrix&); - inline friend _zgematrix operator-(const _zgematrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const _zgematrix&, const zcovector&); - inline friend _zcovector operator*(const _zgematrix&, const _zcovector&); - inline friend _zgematrix operator*(const _zgematrix&, const zgematrix&); - inline friend _zgematrix operator*(const _zgematrix&, const _zgematrix&); - inline friend _zgematrix operator*(const _zgematrix&, const zhematrix&); - inline friend _zgematrix operator*(const _zgematrix&, const _zhematrix&); - inline friend _zgematrix operator*(const _zgematrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const _zgematrix&, const _zgbmatrix&); - inline friend _zgematrix operator*(const _zgematrix&, const zgsmatrix&); - inline friend _zgematrix operator*(const _zgematrix&, const _zgsmatrix&); - inline friend _zgematrix operator*(const _zgematrix&, const zhsmatrix&); - inline friend _zgematrix operator*(const _zgematrix&, const _zhsmatrix&); - inline friend _zgematrix operator*(const _zgematrix&, const double&); - inline friend _zgematrix operator*(const _zgematrix&, const comple&); - - //////// / //////// - inline friend _zgematrix operator/(const _zgematrix&, const double&); - inline friend _zgematrix operator/(const _zgematrix&, const comple&); - - //////// double, complex //////// - inline friend _zgematrix operator*(const double&, const _zgematrix&); - inline friend _zgematrix operator*(const comple&, const _zgematrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/68/68e3db5b6f71045d5a6fab03ade554fcbf7da634.svn-base b/cpplapack-r198/.svn/pristine/68/68e3db5b6f71045d5a6fab03ade554fcbf7da634.svn-base deleted file mode 100644 index 64e00f6f4f7fde32b46ab937f6a8508ac8b2276a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/68/68e3db5b6f71045d5a6fab03ade554fcbf7da634.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! zhsmatrix+_zgematrix operator */ -/* -inline _zgematrix operator+(const zhsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - matB(matA.jndx[c],matA.indx[c]) += matA.array[c]; - } - - return matB; -} -*/ - -//============================================================================= -/*! zhsmatrix-_zgematrix operator */ -/* -inline _zgematrix operator-(const zhsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matB.m*matB.n; i++){ - matB.array[i]=-matB.array[i]; - } - - //// add //// - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return matB; -} -*/ -//============================================================================= -/*! zhsmatrix*_zgematrix operator */ -/* -inline _zgematrix operator*(const zhsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/69/695cbe977bcc3b0306502eb067bdf81c8af687da.svn-base b/cpplapack-r198/.svn/pristine/69/695cbe977bcc3b0306502eb067bdf81c8af687da.svn-base deleted file mode 100644 index bee7bf8d19bc547ab9c983312c0546fa7e595571..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/69/695cbe977bcc3b0306502eb067bdf81c8af687da.svn-base +++ /dev/null @@ -1,163 +0,0 @@ -//============================================================================= -/*! zgsmatrix=_zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator=(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix+=_zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator+=(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) += it->v; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zgsmatrix-=_zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator-=(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -= it->v; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zgsmatrix*=_zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator*=(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat( m, mat.n, 0 ); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::iterator mat_rows_k_end =mat.rows[k].end(); - for(std::vector<CPPL_INT>::iterator p=mat.rows[k].begin(); p!=mat_rows_k_end; p++){ - newmat(it->i,mat.data[*p].j) += it->v*mat.data[*p].v; - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix+_zgsmatrix operator */ -inline _zgsmatrix operator+(const zgsmatrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matB); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix-_zgsmatrix operator */ -inline _zgsmatrix operator-(const zgsmatrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matB); - newmat.chsign(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix*_zgsmatrix operator */ -inline _zgsmatrix operator*(const zgsmatrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA.m, matB.n); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/69/696a2b134d99a65b08255c87ae914f645c11497f.svn-base b/cpplapack-r198/.svn/pristine/69/696a2b134d99a65b08255c87ae914f645c11497f.svn-base deleted file mode 100644 index ee1266bd8003218260266f82eef27faa693daf25..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/69/696a2b134d99a65b08255c87ae914f645c11497f.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! zhsmatrix*zcovector operator */ -inline _zcovector operator*(const zhsmatrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=std::conj(it->v)*vec(it->i); - } - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/69/698a9c061703f52e227f3bdf7a5e541d36fb9939.svn-base b/cpplapack-r198/.svn/pristine/69/698a9c061703f52e227f3bdf7a5e541d36fb9939.svn-base deleted file mode 100644 index fd49842f1990b7151d1c4fe4a3ff800e01423303..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/69/698a9c061703f52e227f3bdf7a5e541d36fb9939.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -//============================================================================= -/*! double*_zrovector operator */ -inline _zrovector operator*(const double& d, const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zdscal_(&vec.l, &d, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/69/698aa3ee2bda970e065f5909a4b5dbe857afdf9c.svn-base b/cpplapack-r198/.svn/pristine/69/698aa3ee2bda970e065f5909a4b5dbe857afdf9c.svn-base deleted file mode 100644 index bae8eec6c41d2c58f2931bdf3758934cde29668f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/69/698aa3ee2bda970e065f5909a4b5dbe857afdf9c.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -/*! zhematrix+_zgbmatrix operator */ -inline _zgematrix operator+(const zhematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zhematrix-_zgbmatrix operator */ -inline _zgematrix operator-(const zhematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zhematrix*_zgbmatrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6a/6a282cbdb39a717da205e134be6627cdcac83bf5.svn-base b/cpplapack-r198/.svn/pristine/6a/6a282cbdb39a717da205e134be6627cdcac83bf5.svn-base deleted file mode 100644 index 091de3f01076476f8cb052717e951b0f1cc2a1b5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6a/6a282cbdb39a717da205e134be6627cdcac83bf5.svn-base +++ /dev/null @@ -1,134 +0,0 @@ -//============================================================================= -/*! zhsmatrix=_zhsmatrix operator */ -inline zhsmatrix& zhsmatrix::operator=(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix+=_zhsmatrix operator */ -inline zhsmatrix& zhsmatrix::operator+=(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) +=it->v; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zhsmatrix-=_zhsmatrix operator */ -inline zhsmatrix& zhsmatrix::operator-=(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -=it->v; - } - - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix+_zhsmatrix operator */ -inline _zhsmatrix operator+(const zhsmatrix& matA, const _zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matB); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zhsmatrix-_zhsmatrix operator */ -inline _zhsmatrix operator-(const zhsmatrix& matA, const _zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(-matB); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zhsmatrix*_zhsmatrix operator */ -/* -inline _zgsmatrix operator*(const zhsmatrix& matA, const _zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat( matA.n, 0 ); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.line[k].begin(); p!=matB.line[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/6a/6a544bfd1f115c158e8f0bede237acda58fbbac0.svn-base b/cpplapack-r198/.svn/pristine/6a/6a544bfd1f115c158e8f0bede237acda58fbbac0.svn-base deleted file mode 100644 index 0fd868f2d9272b239f6cbf52275f285a97ac3640..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6a/6a544bfd1f115c158e8f0bede237acda58fbbac0.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+_zgbmatrix operator */ -inline _zgematrix operator+(const _zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) +=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix-_zgbmatrix operator */ -inline _zgematrix operator-(const _zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix*_zgbmatrix operator */ -inline _zgematrix operator*(const _zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6a/6a69af273eb6a134d6c6cb54c5eb8f982b703afa.svn-base b/cpplapack-r198/.svn/pristine/6a/6a69af273eb6a134d6c6cb54c5eb8f982b703afa.svn-base deleted file mode 100644 index ec99f175feace6c069c2dad161a05f26efafe5c7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6a/6a69af273eb6a134d6c6cb54c5eb8f982b703afa.svn-base +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -rm -f std err doxygen.log -rm -rf html -doxygen > std diff --git a/cpplapack-r198/.svn/pristine/6a/6ac2823eb3b68cb47182c9d4e0a1d79179626f0f.svn-base b/cpplapack-r198/.svn/pristine/6a/6ac2823eb3b68cb47182c9d4e0a1d79179626f0f.svn-base deleted file mode 100644 index 6cf00ada55adf17301b17ad6303b9cd7c6c610ac..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6a/6ac2823eb3b68cb47182c9d4e0a1d79179626f0f.svn-base +++ /dev/null @@ -1,336 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html lang="ja"> -<head> - <link href="../html/doxygen.css" rel="stylesheet" type="text/css"> - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <meta name="Author" content="Yuki ONISHI"> - <title>CPPLapackドキュメント日本語版</title> -</head> -<body bgcolor="silver" text="black" link="blue" alink="red" vlink="purple"> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h1>CPPLapackドキュメント日本語版</h1> - -<table bgcolor="silver" width="100%"><td align="center"> -CPPLapackの正式なドキュメント(英語)は<a target="_blank" href="http://cpplapack.sourceforge.net/">こちら</a>で御覧下さい. -</td></table> - -<br> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr><hr> -<h2>最新情報</h2> -<p> -[2015年05月11日] -"cpplapack-2015.05.11"をリリースしました. -このリリースはsvnの使用を好まないユーザに対するものです. -tar.gz版,rpm版,deb版(alienで作成)も用意しました. -今回のリリースは幾つかの大幅な変更がなされており,ユーザーは次の様なコードの修正が必要かも知れません. -<ul> - <li> - BLAS/LAPACK関数はCPPL名前空間に入れられました. - BLAS/LAPACK関数を直接コールする場合は"CPPL::"を関数名の頭に付けて下さい. - </li> - <li> - BLAS/LAPACK関数の引数スタイルをFORTRANスタイルに変更しました. - 配列変数だけでなく配列以外の変数もアドレス渡しとなります. - BLAS/LAPACK関数を直接コールする場合は"&"を配列以外の変数名の頭に付けて下さい. - </li> - <li> - デフォルトの整数型が"long"から"CPPL_INT"に修正されました. - "CPPL_INT"はIntel/MKLでは"MKL_INT"に,g++他では"int"になります. - これまで用いていた"long"は使用不可となりますので注意してください. - </li> -</ul> -【具体例】<br> -旧コード:<br> -<code> - long NRHS(mat.n), LDA(n), *IPIV(new long[n]), LDB(mat.m), INFO(1);<br> - dgesv_(n, NRHS, array, LDA, IPIV, mat.array, LDB, INFO);<br> -</code> -新コード:<br> -<code> - CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1);<br> - CPPL::dgesv_(&n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, &INFO);<br> -</code> -または<br> -<code> - int NRHS(mat.n), LDA(n), *IPIV(new int[n]), LDB(mat.m), INFO(1);<br> - CPPL::dgesv_(&n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, &INFO);<br> -</code> -("CPPL_INT"の代わりに"int"を指定しても大抵のプラットフォームで正常に動きます.) -</p> - -<p> -[2014年02月08日] -"cpplapack-2014.02.08"をリリースしました. -このリリースはsvnの使用を好まないユーザに対するものです. -tar.gz版,rpm版,deb版(alienで作成)も用意しました. -"ChangeLog"が知りたい場合はsvnのログをご覧ください. -</p> - -<p> -[2010年03月27日] -"cpplapack-2010.03.27"をリリースしました. -このリリースはsvnの使用を好まないユーザに対するものです. -tar.gz版の他に,rpm版とdeb版も用意しました. -"ChangeLog"が知りたい場合はsvnのログをご覧ください. -</p> - -<p> -[2005年03月25日] -"cpplapack-2005_03_25"をリリースしました. -このリリースには幾つかのバグフィックスと改良がなされています. -詳しくは"ChangeLog"を御覧下さい. -また,このリリースにはスパース行列クラス(dssmatrix, zssmatrix)のアルファ版も含まれています. -これらクラスは未だ非常にバギーですが,これらのクラスを使わない限り問題は無いと思います. -</p> - -<p> -[2004年10月15日] -上島君によるCPPLapackの日本語チュートリアルが出来ました. -これからCPPLapackを使ってみようという方々,必見です. -HTML版は -<a href="http://cpplapack.sourceforge.net/tutorial/japanese/index.html"> -http://cpplapack.sourceforge.net/tutorial/japanese/index.html</a> -から,PDF版は -<a href="http://cpplapack.sourceforge.net/tutorial/japanese/CPPLapack_Tutorial-Japanese.pdf">http://cpplapack.sourceforge.net/tutorial/japanese/CPPLapack_Tutorial-Japanese.pdf</a> -から御覧になれます. -</p> - -<p> -[2004年4月24日] -"cpplapack-2004_04_24"をリリースしました. -OpenMPのマクロ (#pragma omp parallel for private(j,k)) -を全ての3重forループに付け加えました. -このドキュメントに検索機能を付けました. -大文字小文字は区別されます. -</p> - -<p> -[2004年4月1日] -"cpplapack-2004_04_01"をリリースしました. -倍精度複素数マトリックス,ベクトルクラス -(zgematrix, zgbmatrix, zhematrix, zcovector, zrovector) -が新たに追加されています. -</p> - - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr><hr> -<h2>CPPLapackとは?</h2> -<p> -CPPLapackは BLAS,LAPACK,および PARDISO の C++ クラスラッパーです. -</p> - -<p> -Fortran BLAS,LAPACK,CBLAS,CLAPACKでは,インタフェースがユーザーフレンドリーでないため,LAPACK初心者に限らず,経験を積んだプログラマでも間違いを起こしやすくなっています.また,そのインタフェースの使いにくさから,BLASの関数は,"+","-","*"等の利用頻度の高い単純な演算にはあまり利用されていません. -したがって,BLASやLAPACKに対するインタフェースをユーザーフレンドリーな形で提供するライブラリがあれば,プログラム開発期間と計算時間をともに最小化できることになります.しかし,この両方の点において十分満足できるものは,既存の行列計算ライブラリにはないようです. -</p> - -<p> -CPPLapackのインタフェースは,普通の行列計算ライブラリと同じく,非常にユーザーフレンドリーになっています.たとえば,<code>"A=B*C;"</code>や<code>"A.dgesv(y);"</code>のような表記が使えます.それと同時に,CPPLapackでは,内部でBLASとLAPACKの関数を使って高速な行列計算を提供しています. -</p> - -<p> -CPPLapackの利点としては,ユーザーフレンドリーなインタフェースや高速な行列計算だけではなく,無駄のないメモリ利用もあります.大規模な行列を扱う場合,行列オブジェクトのコピー回数はメモリ消費量と計算時間に大きく影響します.CPPLapackでは,コピー回数を必要最小限に抑えるために,"Smart Temporary"システムという機構を導入しています."Smart Temporary"システムはCPPLapackの内部的な機構ですので,CPPLapackのユーザーはこれについて気にする必要はありません.(2003年リリースのバージョンでは,"to_return"システムを利用していましたが,2004年以降リリースのバージョンでは,その代わりに,禁止コードのない"Smart Temporary"システムを利用しています.双方のバージョンで互換性は完全に保たれています.) -</p> - -<p> -CPPLapackは大規模行列の計算のためのライブラリです.したがって,大規模行列を扱わない場合には,他のライブラリを使うことをおすすめします. -</p> - -<p> -本プログラムはベータ版ですので,まだバグが残っている可能性があります.また,BLASやLAPACKの関数の中にまだ未対応のものもあります.CPPLapackを利用する場合には,この点にお気をつけ下さい.CPPLapackの開発へのご協力は,もちろん歓迎いたします. -</p> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>CPPLapackの特徴</h2> -<ul> -<li> -ユーザーフレンドリーなインタフェース<br> -</li> -<li> -BLAS,LAPACK,およびPARDISOを利用した高速行列計算<br> -</li> -<li> -"Smart Temporary" システムを利用したオブジェクトコピー回数の最小化<br> -</li> -</ul> -高速化などのための仕組みはCPPLapack内部に隠されているため,CPPLapackを利用するプログラマが特殊なプログラミングをする必要は一切ありません. - - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>配布元</h2> -<p> -CPPLapackの公式配布元は -<a target="_blank" href="http://sourceforge.net/projects/cpplapack/">こちら</a>です. -リンク先のページの最新版svnコードを利用することを強くお奨めします. -</p> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>インストール方法</h2> -<p> -CPPLapackはC++のヘッダファイル群ですので,「インストール」と呼ぶ程の作業は必要はありません. -ダウンロードしたファイルをお好きな場所に展開し,Makefileのインクルードパスを適当に書き換えるだけです. -インクルードしなければならないファイルは"cpplapack.h"だけです. -</p> - -<p> -とはいうものの,CPPLapackを使うにはBLASとLAPACKがインストールされている必要があります. -オリジナルのBLAS,LAPACKの他にも Intel math kernel library (MKL)など,ベンダーの提供するライブラリにBLASやLAPACKが含まれているものでも結構です. -ただし,スパース行列に対してPARDISOを使うためにはIntel MKLが必須です. - -<p> -お使いの環境に合わせてMakefileを書き換えて下さい. -幾つかのプラットフォームでのMakefile例が[typical Makefiles]に用意されていますので参考にしてみて下さい. -<p> - -<p> -プラットフォームによって,利用するBLASやLAPACKのライブラリは異なります. -Makefileの例を[typical Makefiles]に用意してありますのでご覧下さい. -</p> - -<p> -Cygwinユーザー向けに,ATLASとLAPACKのインストール手順の説明を用意しました. -[How to install ATLAS and LAPACK on Cygwin]をご覧下さい. -</p> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>重要な仕様</h2> -<ul> -<li> -CPPLapackの名前空間は"CPPL"です. -</li> -<li> -アンダースコアのついたクラスをCPPLapackのユーザーが利用する必要はありませんので,利用しないで下さい. -アンダースコアのついた行列クラスは,"Smart Temporary"クラスです. -"Smart Temporary"システムの詳細は[Mechanism of Smart Temporary system]をご覧下さい. -</li> - -<li> -マトリックス成分の番号は1ベースではなく0ベースです. -すなわち,m x nマトリックスの場合,左上の成分は(0,0),右下の成分は(m-1,n-1)といった具合になります. -バンドマトリックスに関しては[illustration of band matrix]をご覧下さい. -</li> -<li> -マトリックスは列メジャー方式で蓄えられています. -ほとんどのCおよびC++プログラマーは行メジャー方式を好みますが,CPPLapackはFortranで元々開発されていた経緯を持つBLASやLAPACKを用いる為,やむなく列メジャー方式を採用しているのです. -</li> -<li> -マトリックスの行数はm,列数はn,データ配列の先頭はarrayでそれぞれ参照することが出来ます. -しかしこれらの値を代入演算子=で書き換えることは出来ません. -m,nの変更はresize関数を,マトリックス成分の値の変更にはoperator()を用いて下さい. -またマトリックス成分は"A.array[10]=3.14"の様にして書き換えることも可能となっているので注意して下さい. -</li> -<li> -LAPACKの関数に対応するCPPLapackのメンバ関数(たとえば,A.dgesv(y))は,行列Aを上書きします. -Aの元の値を保持したい場合は,LAPACKメンバ関数を呼び出す前に,Aのコピーを作っておいて下さい. -</li> -<li> -デバッグを容易にするために,"CPPL_VERBOSE"および"CPPL_DEBUG"マクロを用意してあります. -"-DCPPL_VERBOSE"をコンパイルコマンドに指定すると,呼ばれた全ての関数が標準エラー出力に関数名を出力します. -"-DCPPL_DEBUG"をコンパイルコマンドに指定すると,範囲検査(bounds checking)が有効になります. -デバッグ作業の間は,このマクロを有効にし,その後,CPPLapackの最高性能を得るために,このマクロを無効にしてから再コンパイルして下さい. -</li> -<li> -関数が返すオブジェクトを放置しないように注意して下さい. -計算したあとに返されるオブジェクトは,必ず何らかのオブジェクトに代入しなければなりません. -たとえば,<code>A+B;</code>というコードはよくありません. -また, -<code>"dcovector f(const dcovector& x){ return 2*x; }"</code>, -<code>f(x);</code>なども同様です. -これは,"Smart Temporary"システムの特性から起こる現象です. -詳しくは,[Mechanism of Smart Temporary system]をご覧下さい. -</li> -</ul> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>テストプログラム</h2> -<p> -CPPLapackの動作を確認するためのテストプログラム群が"test"ディレクトリ以下に収められています. -そこに置かれているプログラムはCPPLapackの使いかたを学ぶ為の良い易しいプログラム例にもなると思います. -</p> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>ベンチマークプログラム</h2> -<p> -CPPLapackの速度を評価するためのベンチマークプログラム群が"benchmark"ディレクトリ以下に収められています. -</p> - -<p> -CPPLapackのパフォーマンスはオリジナルのBLASやLAPACKと同等です. -しかしながら,BLASやLAPACKで用いられるalpha,beta,Transposeといった引数をフルに用いたオリジナルのBLASやLAPACKのプログラムに比べると,シンプルな演算子だけを用いたCPPLapackのプログラムは遅くなってしまいます. -どうしてもこれらの引数をフルに使いたい場合は,CPPLapackのプログラム内でオリジナルのBLASやLAPACKの関数を呼んで下さい. -そうすれば,CPPLapackを用いつつオリジナルのBLASやLAPACKと同等のパフォーマンスが得られます. -</p> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>よくある質問</h2> -<p> -(質問) -CPPLapackのプログラム書いてみたところ,ループの中でメモリ使用量がどんどん膨らんで行くという現象が見られました. -どうしてこんなことが起こるのでしょうか? -<br> -(回答) -恐らく,そのループの中でマトリックスやベクトルの返り値を放置してしまっていると思われます. -"重要な仕様"の章を注意深く読んでみて下さい. -</p> - -<p> -(質問) -マトリックスやベクトルの中身を表示させると,おかしな数字や"nan"が表示されます. -これは何故でしょうか? -<br> -(回答) -まず,そのオブジェクトが初期化されているかどうかを確認して下さい. -CPPLapackではサイズ指定のコンストラクター,例えば"CPPL::dgematrix A(5,10);",はその成分を一切初期化しません. -"resize"関数も同様で,初期化を行いません. -代入によって値を設定するか,もしくは"identity"関数や"zero"関数を使って初期化作業を行って下さい. -</p> - - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>ライセンス</h2> -CPPLapackはオープンソースでフリー,かつ無保証なソフトウェアです. - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>著者と協力者</h2> -著者:大西有希<br> -協力者:居相政史,清水利恭,上島正史 - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<h2>バグレポート</h2> -バグレポートは<a href="mailto:yuki.onishi@gmail.com">yuki.onishi@gmail.com</a>にお願いします. -コメントも歓迎します. - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -</body> -</html> diff --git a/cpplapack-r198/.svn/pristine/6a/6ac9bc249c55976c8f997a91e7ce9445f4b6ed7f.svn-base b/cpplapack-r198/.svn/pristine/6a/6ac9bc249c55976c8f997a91e7ce9445f4b6ed7f.svn-base deleted file mode 100644 index 6d8bee4d3f32844a2db0658d349e75e406ade262..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6a/6ac9bc249c55976c8f997a91e7ce9445f4b6ed7f.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! double*drovector operator */ -inline _drovector operator*(const double& d, const drovector& vec) -{CPPL_VERBOSE_REPORT; - drovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =d*vec.array[i]; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/6b/6b3da5c0a6f3846eded4a3ad112a4f65c36db7dc.svn-base b/cpplapack-r198/.svn/pristine/6b/6b3da5c0a6f3846eded4a3ad112a4f65c36db7dc.svn-base deleted file mode 100644 index 5d0f31d4a61f8180852327bea248f27ce8821cee..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6b/6b3da5c0a6f3846eded4a3ad112a4f65c36db7dc.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! zcovector*_zrovector operator */ -inline _zgematrix operator*(const zcovector& covec, const _zrovector& rovec) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(covec.l, rovec.l); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - } - } - - rovec.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6b/6b7ed97f9f0a2e319eff709a3613aee173edec1e.svn-base b/cpplapack-r198/.svn/pristine/6b/6b7ed97f9f0a2e319eff709a3613aee173edec1e.svn-base deleted file mode 100644 index 2b285488afd4bace9e1434fa0dd782b67e8d65fa..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6b/6b7ed97f9f0a2e319eff709a3613aee173edec1e.svn-base +++ /dev/null @@ -1,128 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline double& dcovector::operator()(const CPPL_INT& i) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -//============================================================================= -/*! operator() for const object */ -inline double dcovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline dcovector& dcovector::set(const CPPL_INT& i, const double& v) //const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[i] =v; - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dcovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ - s << " " << vec.array[i] << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void dcovector::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dcovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void dcovector::read(const char *filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s(filename); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dcovector" && id != "#dcovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dcovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> l; - resize(l); - for(CPPL_INT i=0; i<l; i++) { s >> operator()(i); } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/6c/6c07fc8990c458f498a25de0237b06b206d96ca6.svn-base b/cpplapack-r198/.svn/pristine/6c/6c07fc8990c458f498a25de0237b06b206d96ca6.svn-base deleted file mode 100644 index 3aa8015854c7a16ae780683783a906b02f78c23f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6c/6c07fc8990c458f498a25de0237b06b206d96ca6.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -//============================================================================= -/*! dgrmatrix*dcovector operator */ -inline _dcovector operator*(const dgrmatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - -#ifdef __INTEL_COMPILER - dcovector newvec(mat.m); - char transa ='N'; - MKL_INT m =MKL_INT(mat.m); - double* a =const_cast<double*>(&mat.a[0]); - MKL_INT* ia =const_cast<MKL_INT*>(&mat.ia[0]); - MKL_INT* ja =const_cast<MKL_INT*>(&mat.ja[0]); - MKL_DCSRGEMV(&transa, &m, a, ia, ja, vec.array, newvec.array); - return _(newvec); - - -#else //__INTEL_COMPILER is not defined - dcovector newvec(mat.m); -#pragma omp parallel for - for(CPPL_INT i=0; i<mat.m; i++){ - double sum =0.; - int k_beg =mat.ia[i]-1; - int k_end =mat.ia[i+1]-1; - for(int k=k_beg; k<k_end; k++){ - int j =mat.ja[k]-1; - sum += mat.a[k] * vec(j); - } - newvec(i) =sum; - } - return _(newvec); -#endif//__INTEL_COMPILER -} diff --git a/cpplapack-r198/.svn/pristine/6c/6c1eee77220598b47b8328c802b1ed310d1aab81.svn-base b/cpplapack-r198/.svn/pristine/6c/6c1eee77220598b47b8328c802b1ed310d1aab81.svn-base deleted file mode 100644 index 2f5ec688f545d86605ca365efa9ca16f16d86a71..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6c/6c1eee77220598b47b8328c802b1ed310d1aab81.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _drovector*dgbmatrix operator */ -inline _drovector operator*(const _drovector& vec, const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/6c/6cbfb9e0f660c53c9ccd8cab66ee006f59ff85c1.svn-base b/cpplapack-r198/.svn/pristine/6c/6cbfb9e0f660c53c9ccd8cab66ee006f59ff85c1.svn-base deleted file mode 100644 index a5bc8a93162106d604783d56cd66a36121a5a0c3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6c/6cbfb9e0f660c53c9ccd8cab66ee006f59ff85c1.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -//============================================================================= -/*! double*_zhematrix operator */ -inline _zhematrix operator*(const double& d, const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.n*mat.n; - CPPL_INT inc =1; - zdscal_(&size, &d, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/6d/6d1b9d9925614a08c3035d6bb29aa50cfe3151c0.svn-base b/cpplapack-r198/.svn/pristine/6d/6d1b9d9925614a08c3035d6bb29aa50cfe3151c0.svn-base deleted file mode 100644 index ad6469aa5a546af09950b03c7b131ab026c4e74b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6d1b9d9925614a08c3035d6bb29aa50cfe3151c0.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -//============================================================================= -/*! dcovector_small constructor */ -template<CPPL_INT l> -inline dcovector_small<l>::dcovector_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! dcovector_small constructor */ -template<CPPL_INT l> -inline dcovector_small<l>::dcovector_small(const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "Vector sizes must be the same." << std::endl - << "Your input was " << l << " and " << vec.l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<l; k++){ - array[k] =vec.array[k]; - } -} - -//============================================================================= -/*! dcovector_small constructor */ -template<CPPL_INT l> -inline dcovector_small<l>::dcovector_small(const double& x, const double& y) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=2 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 2." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; -} - -//============================================================================= -/*! dcovector_small constructor */ -template<CPPL_INT l> -inline dcovector_small<l>::dcovector_small(const double& x, const double& y, const double& z) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=3 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 3." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; - array[2] =z; -} - -//============================================================================= -/*! dcovector_small constructor */ -template<CPPL_INT l> -inline dcovector_small<l>::dcovector_small(const double& x, const double& y, const double& z, const double& r) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=4 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 4." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; - array[2] =z; - array[3] =r; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector_small destructor */ -template<CPPL_INT l> -inline dcovector_small<l>::~dcovector_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/6d/6d23affb77536b3d60dfedc993f54e33273a0150.svn-base b/cpplapack-r198/.svn/pristine/6d/6d23affb77536b3d60dfedc993f54e33273a0150.svn-base deleted file mode 100644 index a3763255099896c1c8ee036e9a79d6d2f8760ff6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6d23affb77536b3d60dfedc993f54e33273a0150.svn-base +++ /dev/null @@ -1,312 +0,0 @@ -The followings are the examples file formats for read and write functions. -Only the order of data is important. -The "#" at the first line is optional. -In ceses of complex matrixes and vecotors, -"(", real part, ",", imaginary part, and ")" should be arranged -without any linefeed code or space code. -The linefeed code and more than two space codes are optional. -However, the file should be end with the linefeed code or space code. - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>dgematrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>0.0</td> <td>0.1</td> <td>0.3</td> <td>0.4</td> </tr> -<tr> <td>1.0</td> <td>1.1</td> <td>1.2</td> <td>1.3</td> </tr> -<tr> <td>2.0</td> <td>2.1</td> <td>2.2</td> <td>2.3</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#dgematrix 3 4</td> </tr> -<tr> <td>0.0 0.1 0.2 0.3</td> </tr> -<tr> <td>1.0 1.1 1.2 1.3</td> </tr> -<tr> <td>2.0 2.1 2.2 2.3</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>dgbmatrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>0.0</td> <td>0.1</td> <td>0.2</td> <td>x </td> </tr> -<tr> <td>1.0</td> <td>1.1</td> <td>1.2</td> <td>1.3</td> </tr> -<tr> <td>x </td> <td>2.1</td> <td>2.2</td> <td>2.3</td> </tr> -<tr> <td>x </td> <td>x </td> <td>3.2</td> <td>3.3</td> </tr> -<tr> <td>x </td> <td>x </td> <td>x </td> <td>4.3</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#dgbmatrix 5 4 1 2</td> </tr> -<tr> <td>0.0 0.1 0.2</td> </tr> -<tr> <td>1.0 1.1 1.2 1.3</td> </tr> -<tr> <td>2.1 2.2 2.3</td> </tr> -<tr> <td>3.2 3.3</td> </tr> -<tr> <td>4.3</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>dsymatrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>0.0</td> <td>{1.0}</td> <td>{2.0}</td> <td>{3.1}</td> </tr> -<tr> <td>1.0</td> <td> 1.1 </td> <td>{2.1}</td> <td>{3.1}</td> </tr> -<tr> <td>2.0</td> <td> 2.1 </td> <td> 2.2 </td> <td>{3.2}</td> </tr> -<tr> <td>3.0</td> <td> 3.1 </td> <td> 3.2 </td> <td> 3.3 </td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#dsymatrix 4</td> </tr> -<tr> <td>0.0</td> </tr> -<tr> <td>1.0 1.1</td> </tr> -<tr> <td>2.0 2.1 2.2</td> </tr> -<tr> <td>3.0 3.1 3.2 3.3</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>dssmatrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>{0}</td> <td>0.1</td> <td>{0}</td> <td>{0}</td> </tr> -<tr> <td>{0}</td> <td>{0}</td> <td>1.2</td> <td>{0}</td> </tr> -<tr> <td>2.0</td> <td>{0}</td> <td>{0}</td> <td>2.3</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#dssmatrix 3 4 4</td> </tr> -<tr> <td>0 1 0.1</td> </tr> -<tr> <td>1 2 1.2</td> </tr> -<tr> <td>2 0 2.0</td> </tr> -<tr> <td>2 3 2.3</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>dcovector</h2> -<center> -<table border="2"> -<caption align="top">Vector Data</caption> -<tr> <td>0</td> </tr> -<tr> <td>1</td> </tr> -<tr> <td>2</td> </tr> -<tr> <td>3</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#dcovector 4</td> </tr> -<tr> <td>0</td> </tr> -<tr> <td>1</td> </tr> -<tr> <td>2</td> </tr> -<tr> <td>3</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>drovector</h2> -<center> -<table border="2"> -<caption align="top">Vector Data</caption> -<tr> <td>0</td> <td>1</td> <td>2</td> <td>3</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#drovector 4</td> </tr> -<tr> <td>0 1 2 3</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<hr> -<hr> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>zgematrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>0+0i</td> <td>0+1i</td> <td>0+2i</td> <td>0+3i</td> </tr> -<tr> <td>1+0i</td> <td>1+1i</td> <td>1+2i</td> <td>1+3i</td> </tr> -<tr> <td>2+0i</td> <td>2+1i</td> <td>2+2i</td> <td>2+3i</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#zgematrix 3 4</td> </tr> -<tr> <td>(0,0) (0,1) (0,2) (0,3)</td> </tr> -<tr> <td>(1,0) (1,1) (1,2) (1,3)</td> </tr> -<tr> <td>(2,0) (2,1) (2,2) (2,3)</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>zgbmatrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>0+0i</td> <td>0+1i</td> <td>0+2i</td> <td>x </td> </tr> -<tr> <td>1+0i</td> <td>1+1i</td> <td>1+2i</td> <td>1+3i</td> </tr> -<tr> <td>x </td> <td>2+1i</td> <td>2+2i</td> <td>2+3i</td> </tr> -<tr> <td>x </td> <td>x </td> <td>3+2i</td> <td>3+3i</td> </tr> -<tr> <td>x </td> <td>x </td> <td>x </td> <td>4+3i</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#zgbmatrix 5 4 1 2</td> </tr> -<tr> <td>(0,0) (0,1) (0,2)</td> </tr> -<tr> <td>(1,0) (1,1) (1,2) (1,3)</td> </tr> -<tr> <td>(2,1) (2,2) (2,3)</td> </tr> -<tr> <td>(3,2) (3,3)</td> </tr> -<tr> <td>(4,3)</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>zhematrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>0 </td> <td>{2-0i}</td> <td>{3-0i}</td> <td>{4-0i}</td> </tr> -<tr> <td>1+0i</td> <td> 1 </td> <td>{3-1i}</td> <td>{4-1i}</td> </tr> -<tr> <td>2+0i</td> <td> 2+1i </td> <td> 2 </td> <td>{4-2i}</td> </tr> -<tr> <td>3+0i</td> <td> 3+1i </td> <td> 3+2i </td> <td> 3 </td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#zhematrix 4</td> </tr> -<tr> <td>(0,0)</td> </tr> -<tr> <td>(1,0) (1,0)</td> </tr> -<tr> <td>(2,0) (2,1) (2,0)</td> </tr> -<tr> <td>(3,0) (3,1) (3,2) (3,0)</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>zssmatrix</h2> -<center> -<table border="2"> -<caption align="top">Matrix Data</caption> -<tr> <td>{0}</td> <td>0+1i</td> <td>{0}</td> <td>{0}</td> </tr> -<tr> <td>{0}</td> <td>{0}</td> <td>1+2i</td> <td>{0}</td> </tr> -<tr> <td>2+0i</td> <td>{0}</td> <td>{0}</td> <td>2+3i</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#zssmatrix 3 4 4</td> </tr> -<tr> <td>0 1 (0,1)</td> </tr> -<tr> <td>1 2 (1,2)</td> </tr> -<tr> <td>2 0 (2,0)</td> </tr> -<tr> <td>2 3 (2,3)</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>zcovector</h2> -<center> -<table border="2"> -<caption align="top">Vector Data</caption> -<tr> <td>0+0i</td> </tr> -<tr> <td>1+0i</td> </tr> -<tr> <td>2+0i</td> </tr> -<tr> <td>3+0i</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#zcovector 4</td> </tr> -<tr> <td>(0,0)</td> </tr> -<tr> <td>(1,0)</td> </tr> -<tr> <td>(2,0)</td> </tr> -<tr> <td>(3,0)</td> </tr> -</table> -</center> - -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<!-----------------------------------------------------------------------------> -<hr> -<h2>zrovector</h2> -<center> -<table border="2"> -<caption align="top">Vector Data</caption> -<tr> <td>0+0i</td> <td>0+1i</td> <td>0+2i</td> <td>0+3i</td> </tr> -</table> - -<br> - -<table border="0"> -<caption align="top">File Format</caption> -<tr> <td>#zrovector 4</td> </tr> -<tr> <td>(0,0) (0,1) (0,2) (0,3)</td> </tr> -</table> -</center> diff --git a/cpplapack-r198/.svn/pristine/6d/6d3ce712044af715adfa3d0a60406b71a04e8dff.svn-base b/cpplapack-r198/.svn/pristine/6d/6d3ce712044af715adfa3d0a60406b71a04e8dff.svn-base deleted file mode 100644 index 5cf86a46365f18ab7bd2baa2ad016b3722f30e7b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6d3ce712044af715adfa3d0a60406b71a04e8dff.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::zcovector x(M); - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "+x=\n" << +x << endl; - cout << "-x=\n" << -x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/6d/6da224748cc99c2da50ac79b7d025cfc3e0d6629.svn-base b/cpplapack-r198/.svn/pristine/6d/6da224748cc99c2da50ac79b7d025cfc3e0d6629.svn-base deleted file mode 100644 index 9ed78614ae120aa7099bdca5b2fead23d16fb88c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6da224748cc99c2da50ac79b7d025cfc3e0d6629.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! _zhsmatrix*comple operator */ -inline _zgsmatrix operator*(const _zhsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat( mat.to_zgsmatrix() ); - return newmat*d; -} - -//============================================================================= -/*! _zhsmatrix/comple operator */ -inline _zgsmatrix operator/(const _zhsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat( mat.to_zgsmatrix() ); - return newmat/d; -} diff --git a/cpplapack-r198/.svn/pristine/6d/6dec26f31cb635c000e7d266bb7ba0a172a55623.svn-base b/cpplapack-r198/.svn/pristine/6d/6dec26f31cb635c000e7d266bb7ba0a172a55623.svn-base deleted file mode 100644 index f2107873a5a6de8ebd0f5d47e619839c887b2da1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6dec26f31cb635c000e7d266bb7ba0a172a55623.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! cast to _zrovector */ -inline _zrovector _drovector::to_zrovector() const -{CPPL_VERBOSE_REPORT; - zrovector newvec(l); - - for(CPPL_INT i=0; i<l; i++){ - newvec.array[i] =comple(array[i], 0.); - } - - destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/6d/6dec4e491a4c2a9077d361432e98864089966a0b.svn-base b/cpplapack-r198/.svn/pristine/6d/6dec4e491a4c2a9077d361432e98864089966a0b.svn-base deleted file mode 100644 index 5535213ccd3515fc2dcf93cac5ae3977941c4925..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6dec4e491a4c2a9077d361432e98864089966a0b.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! dsymatrix+dgsmatrix operator */ -inline _dgematrix operator+(const dsymatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix-dgsmatrix operator */ -inline _dgematrix operator-(const dsymatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix*dgsmatrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,it->j) += matB(i,it->i)*it->v; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6d/6df12e96d917be2ed4759ddd2e95fcae37c4f04e.svn-base b/cpplapack-r198/.svn/pristine/6d/6df12e96d917be2ed4759ddd2e95fcae37c4f04e.svn-base deleted file mode 100644 index c8c6596307e9934356d66decbf135c96ce48a656..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6df12e96d917be2ed4759ddd2e95fcae37c4f04e.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _dsymatrix+dgsmatrix operator */ -inline _dgematrix operator+(const _dsymatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =matA.to_dgematrix(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix-dgsmatrix operator */ -inline _dgematrix operator-(const _dsymatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =matA.to_dgematrix(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix*dgsmatrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,it->j) += matB(i,it->i)*it->v; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6d/6df222688dc2b79ad99a34957dd92f41b8796f20.svn-base b/cpplapack-r198/.svn/pristine/6d/6df222688dc2b79ad99a34957dd92f41b8796f20.svn-base deleted file mode 100644 index f641e20f680de984b8a18f41b0cb7fe92bc7f7fa..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6d/6df222688dc2b79ad99a34957dd92f41b8796f20.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! _zcovector*zrovector operator */ -inline _zgematrix operator*(const _zcovector& covec, const zrovector& rovec) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(covec.l, rovec.l); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - } - } - - covec.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6e/6e5b96bb1269d09348eb8d84cb8af573f2f8bcc4.svn-base b/cpplapack-r198/.svn/pristine/6e/6e5b96bb1269d09348eb8d84cb8af573f2f8bcc4.svn-base deleted file mode 100644 index 3a6e1de89bbdae37ecfae87b7b1ecedd54cb371e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6e/6e5b96bb1269d09348eb8d84cb8af573f2f8bcc4.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - //// make drovector x //// - CPPL::drovector x(L); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - - //// print x in two ways //// - cout << "x =\n" << x << endl; - for(int i=0; i<x.l; i++){ - cout << "x(" << i << ") =" << x(i) << endl; - } - - //// make drovector y //// - CPPL::drovector y(x); - - //// print y in two ways //// - cout << "y =\n" << y << endl; - for(int i=0; i<y.l; i++){ - cout << "y(" << i << ") =" << y(i) << endl; - } - - //// print x+y //// - cout << "x+y=\n" << x+y << endl; - - //// write/read //// - x.write( "tmp.txt" ); - CPPL::drovector z; - z.read( "tmp.txt" ); - cout << "z-x =\n" << z-x << "<-Should be zero." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/6e/6e789611efcc1e2baada812cb8e26849798c4d1a.svn-base b/cpplapack-r198/.svn/pristine/6e/6e789611efcc1e2baada812cb8e26849798c4d1a.svn-base deleted file mode 100644 index e41a5aa4e4efc72be164000cde7b65af6877940c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6e/6e789611efcc1e2baada812cb8e26849798c4d1a.svn-base +++ /dev/null @@ -1,145 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -bool qmr -( - const CPPL::dgematrix& A, - CPPL::dcovector& x, - const double& eps -) -{ - CPPL::dcovector r(x), d(x.l), s(x.l); - CPPL::dcovector v, v2(r), w, w2(r), p(x.l), p2, q(x.l); - double xi(nrm2(w2)), eta(-1.0), epsilon(1.0), delta(0.0), - rho, rho_old(nrm2(v2)), gamma, gamma_old(1.0), theta, theta_old(0.0), beta; - x.zero(); - p.zero(); - q.zero(); - d.zero(); - s.zero(); - - int itc(0); - const int itmax(2*x.l); - do{ - std::cout << "itc=" << itc << ", fabs(damax(r))=" << fabs(damax(r)) << std::endl; - - v =v2/rho_old; - w =w2/xi; - delta =v%w; - p =v -(xi*delta/epsilon)*p; - q =w -(rho_old*delta/epsilon)*q; - p2 =A*p; - epsilon =q%p2; - beta =epsilon/delta; - v2 =p2-beta*v; - rho =nrm2(v2); - w2 =CPPL::t(t(q)*A)-beta*w; - xi =nrm2(w2); - theta =rho/(gamma_old*beta); - gamma =1./sqrt(1.+theta*theta); - eta = -eta*rho_old*gamma*gamma/(beta*gamma_old*gamma_old); - d =eta*p +pow(theta_old*gamma, 2)*d; - s =eta*p2 +pow(theta_old*gamma, 2)*s; - - x+=d; - r-=s; - gamma_old =gamma; - rho_old =rho; - theta_old =theta; - itc++; - }while(fabs(damax(r))>eps && itc<itmax); - - if(fabs(damax(r))<eps){ return 0; } - else{ return 1; } -} -//============================================================================= -bool bicg -( - const CPPL::dgematrix& A, - CPPL::dcovector x, - const double& eps -) -{ - double alpha, beta(0.0); - const CPPL::dcovector y(x); - CPPL::dcovector p_0(x.l), p_1, q_0(x.l), q_1, Ap1, Aq1; - CPPL::dcovector r_1(y-A*x), r_2, s_1(r_1), s_2; - //p_0.zero(); q_0.zero(); - - int itc(0); - const int itmax(2*x.l); - while(fabs(damax(r_1))>eps && ++itc<itmax){ - std::cout << itc << " " << fabs(damax(y-A*x)) << std::endl; - - p_1 =r_1 +beta*p_0; - q_1 =s_1 +beta*q_0; - - Ap1 =A*p_1; - Aq1 =t(t(q_1)*A); - alpha =(s_1%r_1)/(q_1%Ap1); - - x +=alpha*p_1; - - r_2 =r_1 -alpha*Ap1; - s_2 =s_1 -alpha*Aq1; - beta =(s_2%r_2)/(s_1%r_1); - - swap(p_0, p_1); swap(q_0, q_1); - swap(r_1, r_2); swap(s_1, s_2); - } - std::cerr << "itc=" << itc << " fabs(damax(r_1))=" << fabs(damax(r_1)) << std::endl; - - if(itc<itmax){ return 0; } - else{ return 1; } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - srand(time(NULL)); - - const int size(100); - CPPL::dgematrix A(size,size); - - for(int i=0; i<size; i++){ - for(int j=0; j<size; j++){ - A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; - } - A(i,i)+=10.; - } - A.write("A.dgematrix"); - - CPPL::dcovector x(size); - for(int i=0; i<size; i++){ - x(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - x.write("answer.dcovector");//solution - std::cerr << "answer=\n" << t(x) << std::endl; - - CPPL::dcovector y(size); - y=A*x; - y.write("y.dcovector"); - - double eps(fabs(damax(y))*1e-6); - //std::cerr << "eps=" << eps << std::endl; - if( qmr(A, y, eps) ){ - std::cerr << "failed." << std::endl; - exit(1); - } - y.write("solution.dcovector"); - std::cout << "solution=\n" << t(y) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/6e/6e8b40e4bbb898c2ca3146c340984ff9a8aeaed4.svn-base b/cpplapack-r198/.svn/pristine/6e/6e8b40e4bbb898c2ca3146c340984ff9a8aeaed4.svn-base deleted file mode 100644 index a24b921144b1dda2d54a4b9dd91ef01bb8c4be90..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6e/6e8b40e4bbb898c2ca3146c340984ff9a8aeaed4.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -CONTENTS - inlude\: CPPLapack header files - lib\: BLAS and LAPACK libraries for 32bit Windows - lib64\: BLAS and LAPACK libraries for 64bit Windows - vc_sample\: A sample project for Visual C++ 2008 Express (vcproj) - and Visual C++ 2010 Express (vcxproj) - README.txt: This file - -UNINSTALL - Simplly remove the "c:\cpplapack" directory. - -LIBRARIES - The BLAS and LAPACK libraries are NOT products of CPPLapack. - They are originally distributed at http://www.netlib.org/clapack/ . - Authors of CPPLapack deeply appliciate the developers of BLAS and LAPACK. - -USAGE - Add "c:\cpplapack\include" to the include path of your project. - You may also need to add either "c:\cpplapack\lib" or "c:\cpplapack\lib64" - to the library path of your project and then link with the "libf2c.lib", - "BLAS.lib", and "clapack.lib". - -DOCUMENTATION - An online documentation is available at http://cpplapack.sourceforge.net/ . - -LICENCE - CPPLapack is a GPL software. diff --git a/cpplapack-r198/.svn/pristine/6e/6ea1933aad8c4e033671bdfb197a6499b0fb9298.svn-base b/cpplapack-r198/.svn/pristine/6e/6ea1933aad8c4e033671bdfb197a6499b0fb9298.svn-base deleted file mode 100644 index a1dad1e7d1d35da023e985724742d8fae57e8173..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6e/6ea1933aad8c4e033671bdfb197a6499b0fb9298.svn-base +++ /dev/null @@ -1,132 +0,0 @@ -//============================================================================= -/*! dsymatrix=_dsymatrix operator */ -inline dsymatrix& dsymatrix::operator=(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix+=_dsymatrix operator */ -inline dsymatrix& dsymatrix::operator+=(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] +=mat.darray[j][i]; - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dsymatrix-=_dsymatrix operator */ -inline dsymatrix& dsymatrix::operator-=(const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] -=mat.darray[j][i]; - } - } - - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix+_dsymatrix operator */ -inline _dsymatrix operator+(const dsymatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matB.darray[j][i] +=matA.darray[j][i]; - } - } - - return matB; -} - -//============================================================================= -/*! dsymatrix-_dsymatrix operator */ -inline _dsymatrix operator-(const dsymatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matB.darray[j][i] =matA.darray[j][i] -matB.darray[j][i]; - } - } - - return matB; -} - -//============================================================================= -/*! dsymatrix*_dsymatrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - dgematrix newmat( matA.n, matA.n ); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6e/6eb6ef5675a5e205bb760caa4eb16f86863a59b9.svn-base b/cpplapack-r198/.svn/pristine/6e/6eb6ef5675a5e205bb760caa4eb16f86863a59b9.svn-base deleted file mode 100644 index 110b7a31a8b061dd3fedeffcd0aacf627947c13b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6e/6eb6ef5675a5e205bb760caa4eb16f86863a59b9.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -//============================================================================= -/*! _zgematrix+zhematrix operator */ -inline _zgematrix operator+(const zhematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - matB(i,j) += matA(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! _zgematrix-zgematrix operator */ -inline _zgematrix operator-(const zhematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - matB(i,j) =matA(i,j)-matB(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! _zgematrix*zgematrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/6e/6ec5f8e5794b0e8d2c1cc4e218959fce6ce9e5f6.svn-base b/cpplapack-r198/.svn/pristine/6e/6ec5f8e5794b0e8d2c1cc4e218959fce6ce9e5f6.svn-base deleted file mode 100644 index a5f5b59fda2b8c9c8ff1cbf5eedd80a311770725..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6e/6ec5f8e5794b0e8d2c1cc4e218959fce6ce9e5f6.svn-base +++ /dev/null @@ -1,194 +0,0 @@ -extern "C" { - // Level 1 BLAS - /* Vector rotation: x := c*x[i] + s*y[i], y[i] := - s*x[i] + c*y[i] */ - void zdrot_( const CPPL_INT *N, std::complex<double> *x, const CPPL_INT *incx, - std::complex<double> *y, const CPPL_INT *incy, - const double *c, const double *s ); - /* x <--> y */ - void zswap_( const CPPL_INT *N, std::complex<double> *x, const CPPL_INT *incx, - std::complex<double> *y, const CPPL_INT *incy ); - /* x := alpha * x (alpha: double) */ - void zdscal_( const CPPL_INT *N, const double *alpha, - std::complex<double> *x, const CPPL_INT *incx ); - /* x := alpha * x (alpha: double complex) */ - void zscal_( const CPPL_INT *N, const std::complex<double> *alpha, - std::complex<double> *x, const CPPL_INT *incx ); - /* y := x */ - void zcopy_( const CPPL_INT *N, const std::complex<double> *x, const CPPL_INT *incx, - std::complex<double> *y, const CPPL_INT *incy ); - /* y := alpha * x + y */ - void zaxpy_( const CPPL_INT *N, const std::complex<double> *alpha, - const std::complex<double> *x, const CPPL_INT *incx, - std::complex<double> *y, const CPPL_INT *incy ); - /* return x^T y */ - std::complex<double> zdotu_( const CPPL_INT *N, const std::complex<double> *x, - const CPPL_INT *incx, const std::complex<double> *y, - const CPPL_INT *incy ); - /* return conjg(x)^T y */ - std::complex<double> zdotc_( const CPPL_INT *N, const std::complex<double> *x, - const CPPL_INT *incx, const std::complex<double> *y, - const CPPL_INT *incy ); - /* return N2 norm */ - double dznrm2_( const CPPL_INT *N, const std::complex<double> *x, - const CPPL_INT *incx ); - /* return sum of abs(x[i]) */ - double dzasum_( const CPPL_INT *N, const std::complex<double> *x, - const CPPL_INT *incx ); - /* return the index of element having the largest absolute value */ - CPPL_INT izamax_( const CPPL_INT *N, const std::complex<double> *x, const CPPL_INT *incx ); - - // Level 2 BLAS - /* y := alpha * A * x + beta * y for General M by N Matrix */ - void zgemv_( const char *trans, const CPPL_INT *M, const CPPL_INT *N, - const std::complex<double> *alpha, const std::complex<double> *a, - const CPPL_INT *lda, const std::complex<double> *x, const CPPL_INT *incx, - const std::complex<double> *beta, std::complex<double> *y, - const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for General M by N Band Matrix */ - void zgbmv_( const char *trans, const CPPL_INT *M, const CPPL_INT *N, - const CPPL_INT *KL, const CPPL_INT *KU, - const std::complex<double> *alpha, const std::complex<double> *a, - const CPPL_INT *lda, const std::complex<double> *x, const CPPL_INT *incx, - const std::complex<double> *beta, std::complex<double> *y, - const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for Hermitian Matrix */ - void zhemv_( const char *uplo, const CPPL_INT *N, - const std::complex<double> *alpha, const std::complex<double> *a, - const CPPL_INT *lda, const std::complex<double> *x, const CPPL_INT *incx, - const std::complex<double> *beta, std::complex<double> *y, - const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for Hermitian Band Matrix */ - void zhbmv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *k, - const std::complex<double> *alpha, const std::complex<double> *a, - const CPPL_INT *lda, const std::complex<double> *x, const CPPL_INT *incx, - const std::complex<double> *beta, std::complex<double> *y, - const CPPL_INT *incy ); - /* y := alpha * A * x + beta * y for Hermitian Packed Matrix */ - void zhpmv_( const char *uplo, const CPPL_INT *N, - const std::complex<double> *alpha, const std::complex<double> *ap, - const std::complex<double> *x, const CPPL_INT *incx, - const std::complex<double> *beta, std::complex<double> *y, - const CPPL_INT *incy ); - - /* x := A * x for Triangular Matrix */ - void ztrmv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const std::complex<double> *a, const CPPL_INT *lda, - std::complex<double> *x, const CPPL_INT *incx ); - /* x := A * x for Triangular (Banded Storage) Matrix */ - void ztbmv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const CPPL_INT *k, const std::complex<double> *a, - const CPPL_INT *lda, std::complex<double> *x, const CPPL_INT *incx ); - /* x := A * x for Triangular (Packed Storage) Matrix */ - void ztpmv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const std::complex<double> *ap, - std::complex<double> *x, const CPPL_INT *incx ); - - /* Solve A * x = b for Triangular Matrix */ - void ztrsv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const std::complex<double> *a, const CPPL_INT *lda, - std::complex<double> *x, const CPPL_INT *incx ); - /* Solve A * x = b for Triangular (Banded Storage) Matrix */ - void ztbsv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const CPPL_INT *k, const std::complex<double> *a, - const CPPL_INT *lda, std::complex<double> *x, const CPPL_INT *incx ); - /* Solve A * x = b for Triangular (Packed Storage) Matrix */ - void ztpsv_( const char *uplo, const char *trans, const char *diag, - const CPPL_INT *N, const std::complex<double> *ap, - std::complex<double> *x, const CPPL_INT *incx ); - - /* A := alpha * x * y' + A (A: M by N Matrix) */ - void zgeru_( const CPPL_INT *M, const CPPL_INT *N, const std::complex<double> *alpha, - const std::complex<double> *x, const CPPL_INT *incx, - const std::complex<double> *y, const CPPL_INT *incy, - std::complex<double> *a, const CPPL_INT *lda ); - /* A := alpha * x * conjg(y') + A (A: M by N Matrix) */ - void zgerc_( const CPPL_INT *M, const CPPL_INT *N, const std::complex<double> *alpha, - const std::complex<double> *x, const CPPL_INT *incx, - const std::complex<double> *y, const CPPL_INT *incy, - std::complex<double> *a, const CPPL_INT *lda ); - /* A := alpha * x * conjg(x') + A (A: Hermitian N by N Matrix) */ - void zher_( const char *uplo, const CPPL_INT *N, const double *alpha, - const std::complex<double> *x, const CPPL_INT *incx, - std::complex<double> *a, const CPPL_INT *lda ); - /* A := alpha * x * conjg(x') + A - (A: Hermitian N by N Packed Storage Matrix) */ - void zhpr_( const char *uplo, const CPPL_INT *N, const double *alpha, - const std::complex<double> *x, const CPPL_INT *incx, - std::complex<double> *ap ); - /* A := alpha * x * conjg(y') + conjg(alpha) * y * conjg(x') + A - (A: Hermitian N by N Matrix) */ - void zher2_( const char *uplo, const CPPL_INT *N, - const std::complex<double> *alpha, const std::complex<double> *x, - const CPPL_INT *incx, const std::complex<double> *y, - const CPPL_INT *incy, std::complex<double> *a, const CPPL_INT *lda ); - /* A := alpha * x * conjg(y') + conjg(alpha) * y * conjg(x') + A - (A: Hermitian N by N Packed Matrix) */ - void zhpr2_( const char *uplo, const CPPL_INT *N, - const std::complex<double> *alpha, const std::complex<double> *x, - const CPPL_INT *incx, const std::complex<double> *y, - const CPPL_INT *incy, std::complex<double> *ap ); - - // Level 3 BLAS - /* C := alpha * A * B + beta * C (C: M by N Matrix) */ - void zgemm_( const char *transa, const char *transb, const CPPL_INT *M, - const CPPL_INT *N, const CPPL_INT *k, const std::complex<double> *alpha, - const std::complex<double> *a, const CPPL_INT *lda, - const std::complex<double> *b, const CPPL_INT *ldb, - const std::complex<double> *beta, std::complex<double> *c, - const CPPL_INT *ldc ); - /* C := alpha * A * B + beta * C - (A: Symmetric Matrix, B, C: M by N Matrices) */ - void zsymm_( const char *side, const char *uplo, const CPPL_INT *M, - const CPPL_INT *N, const std::complex<double> *alpha, - const std::complex<double> *a, const CPPL_INT *lda, - const std::complex<double> *b, const CPPL_INT *ldb, - const std::complex<double> *beta, std::complex<double> *c, - const CPPL_INT *ldc ); - /* C := alpha * A * B + beta * C - (A: Hermitian Matrix, B, C: M by N Matrices) */ - void zhemm_( const char *side, const char *uplo, const CPPL_INT *M, - const CPPL_INT *N, const std::complex<double> *alpha, - const std::complex<double> *a, const CPPL_INT *lda, - const std::complex<double> *b, const CPPL_INT *ldb, - const std::complex<double> *beta, std::complex<double> *c, - const CPPL_INT *ldc ); - /* C:= alpha * A * A' + beta * C - (A: N by k Matrix, C: Symmetric Matrix) */ - void zsyrk_( const char *uplo, const char *trans, const CPPL_INT *N, - const CPPL_INT *k, const std::complex<double> *alpha, - const std::complex<double> *a, const CPPL_INT *lda, - const std::complex<double> *beta, std::complex<double> *c, - const CPPL_INT *ldc ); - /* C:= alpha * A * conjg(A') + beta * C - (A: N by k Matrix, C: Hermirian Matrix) */ - void zherk_( const char *uplo, const char *trans, const CPPL_INT *N, - const CPPL_INT *k, const double *alpha, - const std::complex<double> *a, const CPPL_INT *lda, - const double *beta, std::complex<double> *c, const CPPL_INT *ldc ); - /* C := alpha * A * B' + alpha * B * A' + beta * C - (A, B: N by k Marices, C: Symmetric Matrix ) */ - void zsyr2k_( const char *uplo, const char *trans, const CPPL_INT *N, - const CPPL_INT *k, const std::complex<double> *alpha, - const std::complex<double> *a, const CPPL_INT *lda, - const std::complex<double> *b, const CPPL_INT *ldb, - const std::complex<double> *beta, std::complex<double> *c, - const CPPL_INT *ldc ); - /* C := alpha * A * conjg(B') + conjg(alpha) * B * conjg(A') + beta * C - (A, B: N by k Marices, C: Hermitian Matrix ) */ - void zher2k_( const char *uplo, const char *trans, const CPPL_INT *N, - const CPPL_INT *k, const std::complex<double> *alpha, - const std::complex<double> *a, const CPPL_INT *lda, - const std::complex<double> *b, const CPPL_INT *ldb, - const double *beta, std::complex<double> *c, const CPPL_INT *ldc ); - /* B := alpha * A * B (A: Triangular Matrix, B: M by N Matrix) */ - void ztrmm_( const char *side, const char *uplo, const char *transa, - const char *diag, const CPPL_INT *M, const CPPL_INT *N, - const std::complex<double> *alpha, const std::complex<double> *a, - const CPPL_INT *lda, std::complex<double> *b, const CPPL_INT *ldb ); - /* Solve A * X = alpha * B - (A: Triangular Matrix, X, B: M by N Matrices) */ - void ztrsm_( const char *side, const char *uplo, const char *transa, - const char *diag, const CPPL_INT *M, const CPPL_INT *N, - const std::complex<double> *alpha, const std::complex<double> *a, - const CPPL_INT *lda, std::complex<double> *b, const CPPL_INT *ldb ); -} diff --git a/cpplapack-r198/.svn/pristine/6e/6ee8590da43125eadd7ca6296c387ca19dfb720f.svn-base b/cpplapack-r198/.svn/pristine/6e/6ee8590da43125eadd7ca6296c387ca19dfb720f.svn-base deleted file mode 100644 index f1dd51e4b65f7466903cda468edac461005e81f3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6e/6ee8590da43125eadd7ca6296c387ca19dfb720f.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! return a transposed row vector */ -inline _zrovector t(const _zcovector& covec) -{CPPL_VERBOSE_REPORT; - _zrovector rovec; - rovec.l =covec.l; - delete [] rovec.array; - rovec.array =covec.array; - - return rovec; -} - -//============================================================================= -/*! return its conjugated vector */ -inline _zcovector conj(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ - vec(i) =std::conj(vec(i)); - } - return vec; -} - -//============================================================================= -/*! return a conjugate transposed row vector */ -inline _zrovector conjt(const _zcovector& covec) -{CPPL_VERBOSE_REPORT; - zrovector rovec(covec.l); - - for(CPPL_INT i=0; i<covec.l; i++){ - rovec(i) =std::conj(covec(i)); - } - - covec.destroy(); - return _(rovec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double val =dznrm2_(&vec.l, vec.array, &inc); - vec.destroy(); - return val; -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - CPPL_INT i =izamax_(&vec.l, vec.array, &inc) -1; - vec.destroy(); - return i; -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - comple val =vec.array[izamax_(&vec.l, vec.array, &inc) -1]; - vec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/6f/6f261e8b35c84ac79cb19e8c4e5f67c4809c4a0a.svn-base b/cpplapack-r198/.svn/pristine/6f/6f261e8b35c84ac79cb19e8c4e5f67c4809c4a0a.svn-base deleted file mode 100644 index dd7b53975cf8f6bfe2fb7ded864e3ee3e960a9bc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/6f/6f261e8b35c84ac79cb19e8c4e5f67c4809c4a0a.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _dssmatrix::nullify() const -{CPPL_VERBOSE_REPORT; - n=0; - data.clear(); - line.clear(); -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _dssmatrix::destroy() const -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/70/7023b7eb3b5eec0f5c9995524eb5bc1085ddc192.svn-base b/cpplapack-r198/.svn/pristine/70/7023b7eb3b5eec0f5c9995524eb5bc1085ddc192.svn-base deleted file mode 100644 index d07bce233db7efaf2a29ddac7f4c12aac3ad0929..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/70/7023b7eb3b5eec0f5c9995524eb5bc1085ddc192.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -//============================================================================= -/*! +zhematrix operator */ -inline const zhematrix& operator+(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -zgematrix operator */ -inline _zhematrix operator-(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - zhematrix newmat(mat.n); - - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - newmat(i,j) =-mat(i,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/70/703be71630666f3e8fb68bc8a62d9e39b9643c36.svn-base b/cpplapack-r198/.svn/pristine/70/703be71630666f3e8fb68bc8a62d9e39b9643c36.svn-base deleted file mode 100644 index 3c00f56f1c9fa8eff03e235f03a5274c6fa6bacc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/70/703be71630666f3e8fb68bc8a62d9e39b9643c36.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -#include <iostream> -#include "cpplapack.h" - - -int main(int argc, char *argv[]) -{ - CPPL::zhematrix Z(4), W(4); - // Assign values to lower triangle only. - for( int i = 0; i < Z.n; i++ ) { - for( int j = 0; j <=i; j++ ) { - std::complex<double> x = std::complex<double>(i,j); - if( i == j ) { - Z(i,j) = std::complex<double>(i,0); - } else { - Z(i,j) = x; - } - std::cout << "(" << i << "," << j << "):Z(i,j)=" << Z(i,j) << std::endl; - } - } - - std::cout << "Z = " << Z << std::endl; - - // Assing values to upper triangle only. - for( int i = 0; i < W.n; i++ ) { - for( int j = i; j < W.n; j++ ) { - std::complex<double> x = std::complex<double>(j,i); - if( i == j ) { - W(i,j) = std::complex<double>(j,0); - } else { - W(i,j) = x; - } - std::cout << "(" << i << "," << j << "):W(i,j)=" << W(i,j) << std::endl; - } - } - - std::cout << "W = " << W << std::endl; - - std::cout << "Z+W = " << Z+W << "<-Should have all imaginary parts zero." << std::endl; - std::cout << "Z-W = " << Z-W << "<-Should have all real parts zero." << std::endl; - - CPPL::zgematrix G(Z.n, Z.n); - for( int i = 0; i < Z.n; i++ ) { - for( int j = 0; j < Z.n; j++ ) { - std::cout << "sqrt( " << Z(i,j) << " ) = " << std::sqrt( Z(i,j) ) << std::endl; - G(i,j) = std::sqrt( Z(i,j) ) * std::sqrt( Z(i,j) ); - } - } - - std::cout << "G-Z = " << G-Z << "<-Should be zero." << std::endl; - - W.write( "zhe.txt" ); - CPPL::zhematrix WW; - WW.read( "zhe.txt" ); - std::cout << "W-WW = " << W-WW << "<-Should be zero." << std::endl; - return 0; -} - diff --git a/cpplapack-r198/.svn/pristine/70/709df5684d14ef09bf3c8c330ed41e2735ada902.svn-base b/cpplapack-r198/.svn/pristine/70/709df5684d14ef09bf3c8c330ed41e2735ada902.svn-base deleted file mode 100644 index a9ab9d926f3eb8a8c827b3731cd4f66f9c4dd1ff..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/70/709df5684d14ef09bf3c8c330ed41e2735ada902.svn-base +++ /dev/null @@ -1,113 +0,0 @@ -//============================================================================= -/*! dcovector=_dcovector operator */ -inline dcovector& dcovector::operator=(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - shallow_copy(vec); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector+=_dcovector operator */ -inline dcovector& dcovector::operator+=(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]+=vec.array[i]; } - - vec.destroy(); - return *this; -} - -//============================================================================= -/*! dcovector operator-= */ -inline dcovector& dcovector::operator-=(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]-=vec.array[i]; } - - vec.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector+dcovector operator */ -inline _dcovector operator+(const dcovector& vecA, const _dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ vecB.array[i]+=vecA.array[i]; } - - return vecB; -} - -//============================================================================= -/*! dcovector-dcovector operator */ -inline _dcovector operator-(const dcovector& vecA, const _dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecB.array[i] =vecA.array[i]-vecB.array[i]; - } - - return vecB; -} - -//============================================================================= -/*! dcovector^T*dcovector operator (inner product) */ -inline double operator%(const dcovector& vecA, const _dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - - double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/71/7111f28e443592ec0aa665bc9693da6e87a47cb3.svn-base b/cpplapack-r198/.svn/pristine/71/7111f28e443592ec0aa665bc9693da6e87a47cb3.svn-base deleted file mode 100644 index 0c5ee4fd6aca0d38e4bf6aa98c6e7794bf4d0e9b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/71/7111f28e443592ec0aa665bc9693da6e87a47cb3.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! _zgematrix+zhematrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT c=0; c<matB.vol; c++){ - matA(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - return matA; -} - -//============================================================================= -/*! _zgematrix-zhematrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matA.m*matA.n; i++){ - matA.array[i]=-matA.array[i]; - } - - //// add //// - for(CPPL_INT c=0; c<matB.vol; c++){ - matA(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - return matA; -} - -//============================================================================= -/*! _zgematrix*zhematrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/71/716564eadcf74368262ee13766d26a5981c7c0de.svn-base b/cpplapack-r198/.svn/pristine/71/716564eadcf74368262ee13766d26a5981c7c0de.svn-base deleted file mode 100644 index 8961d415687dc04eea15523ff559513e8c7f9862..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/71/716564eadcf74368262ee13766d26a5981c7c0de.svn-base +++ /dev/null @@ -1,1012 +0,0 @@ -%!PS-Adobe-3.0 EPSF-3.0 -%%BoundingBox: 23 442 399 520 -%%Title: dssmatrix-put -%%CreationDate: Thu Nov 4 02:04:07 2004 -%%Creator: Tgif-4.1.43-QPL written by William Chia-Wei Cheng (bill.cheng@acm.org) -%%ProducedBy: (unknown) -%%Pages: 1 -%%DocumentFonts: (atend) -%%EndComments -%%BeginProlog - -/tgifdict 88 dict def -tgifdict begin - -/tgifellipsedict 6 dict def -tgifellipsedict /mtrx matrix put - -/TGEL % tgifellipse - { tgifellipsedict begin - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y translate - xrad yrad scale - 0 0 1 0 360 arc - savematrix setmatrix - end - } def - -/tgifarrowtipdict 8 dict def -tgifarrowtipdict /mtrx matrix put - -/TGAT % tgifarrowtip - { tgifarrowtipdict begin - /dy exch def - /dx exch def - /h exch def - /w exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y translate - dy dx atan rotate - 0 0 moveto - w neg h lineto - w neg h neg lineto - savematrix setmatrix - end - } def - -/tgifpatdict 10 dict def - -/tgifpatbyte - { currentdict /retstr get exch - pat i cellsz mod get put - } def - -/tgifpatproc - { 0 1 widthlim {tgifpatbyte} for retstr - /i i 1 add def - } def - -/TGPF % tgifpatfill - { tgifpatdict begin - /h exch def - /w exch def - /lty exch def - /ltx exch def - /cellsz exch def - /pat exch def - - /widthlim w cellsz div cvi 1 sub def - /retstr widthlim 1 add string def - /i 0 def - - tgiforigctm setmatrix - ltx lty translate - w h true [1 0 0 1 0 0] {tgifpatproc} imagemask - ltx neg lty neg translate - end - } def - -/pat3 <8000000008000000> def -/pat4 <8800000022000000> def -/pat5 <8800220088002200> def -/pat6 <8822882288228822> def -/pat7 <aa55aa55aa55aa55> def -/pat8 <77dd77dd77dd77dd> def -/pat9 <77ffddff77ffddff> def -/pat10 <77ffffff77ffffff> def -/pat11 <7fffffff7fffffff> def -/pat12 <8040200002040800> def -/pat13 <40a00000040a0000> def -/pat14 <ff888888ff888888> def -/pat15 <ff808080ff080808> def -/pat16 <f87422478f172271> def -/pat17 <038448300c020101> def -/pat18 <081c22c180010204> def -/pat19 <8080413e080814e3> def -/pat20 <8040201008040201> def -/pat21 <8844221188442211> def -/pat22 <77bbddee77bbddee> def -/pat23 <c1e070381c0e0783> def -/pat24 <7fbfdfeff7fbfdfe> def -/pat25 <3e1f8fc7e3f1f87c> def -/pat26 <0102040810204080> def -/pat27 <1122448811224488> def -/pat28 <eeddbb77eeddbb77> def -/pat29 <83070e1c3870e0c1> def -/pat30 <fefdfbf7efdfbf7f> def -/pat31 <7cf8f1e3c78f1f3e> def - -/TGMAX - { exch dup 3 1 roll exch dup 3 1 roll gt { pop } { exch pop } ifelse - } def -/TGMIN - { exch dup 3 1 roll exch dup 3 1 roll lt { pop } { exch pop } ifelse - } def -/TGSW { stringwidth pop } def - -/bd { bind def } bind def - -/GS { gsave } bd -/GR { grestore } bd -/NP { newpath } bd -/CP { closepath } bd -/CHP { charpath } bd -/CT { curveto } bd -/L { lineto } bd -/RL { rlineto } bd -/M { moveto } bd -/RM { rmoveto } bd -/S { stroke } bd -/F { fill } bd -/TR { translate } bd -/RO { rotate } bd -/SC { scale } bd -/MU { mul } bd -/DI { div } bd -/DU { dup } bd -/NE { neg } bd -/AD { add } bd -/SU { sub } bd -/PO { pop } bd -/EX { exch } bd -/CO { concat } bd -/CL { clip } bd -/EC { eoclip } bd -/EF { eofill } bd -/IM { image } bd -/IMM { imagemask } bd -/ARY { array } bd -/SG { setgray } bd -/RG { setrgbcolor } bd -/SD { setdash } bd -/W { setlinewidth } bd -/SM { setmiterlimit } bd -/SLC { setlinecap } bd -/SLJ { setlinejoin } bd -/SH { show } bd -/FF { findfont } bd -/MS { makefont setfont } bd -/AR { arcto 4 {pop} repeat } bd -/CURP { currentpoint } bd -/FLAT { flattenpath strokepath clip newpath } bd -/TGSM { tgiforigctm setmatrix } def -/TGRM { savematrix setmatrix } def - -end - -%%EndProlog -%%Page: 1 1 - -%%PageBoundingBox: 23 442 399 520 -tgifdict begin -/tgifsavedpage save def - -1 SM -1 W - -0 SG - -72 0 MU 72 8.203 MU TR -72 128 DI 100.000 MU 100 DI DU NE SC - -GS - -/tgiforigctm matrix currentmatrix def - -% BOX -0 SG -GS - 10 SM - GS - NP 652 128 M 708 128 L 708 164 L 652 164 L CP - S - GR -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 552 128 M 608 128 L 608 164 L 552 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 496 128 M 552 128 L 552 164 L 496 164 L CP EC NP - pat5 8 488 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 496 128 M 552 128 L 552 164 L 496 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 440 128 M 496 128 L 496 164 L 440 164 L CP EC NP - pat5 8 432 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 440 128 M 496 128 L 496 164 L 440 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 340 128 M 396 128 L 396 164 L 340 164 L CP EC NP - pat5 8 336 120 64 48 TGPF -GR -GS - 10 SM - GS - NP 340 128 M 396 128 L 396 164 L 340 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 240 128 M 296 128 L 296 164 L 240 164 L CP EC NP - pat5 8 232 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 240 128 M 296 128 L 296 164 L 240 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 184 128 M 240 128 L 240 164 L 184 164 L CP EC NP - pat5 8 176 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 184 128 M 240 128 L 240 164 L 184 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 128 128 M 184 128 L 184 164 L 128 164 L CP EC NP - pat5 8 120 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 128 128 M 184 128 L 184 164 L 128 164 L CP - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 156 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (0) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (0) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 212 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 268 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 368 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (c) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (c) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 468 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 680 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) SH - GR - GR - -% OVAL -0 SG -NP 306 146 2 2 TGEL F -GS - GS - NP 306 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 318 146 2 2 TGEL F -GS - GS - NP 318 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 330 146 2 2 TGEL F -GS - GS - NP 330 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 406 146 2 2 TGEL F -GS - GS - NP 406 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 418 146 2 2 TGEL F -GS - GS - NP 418 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 430 146 2 2 TGEL F -GS - GS - NP 430 146 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 524 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 580 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) SH - GR - GR - -% OVAL -0 SG -NP 618 146 2 2 TGEL F -GS - GS - NP 618 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 630 146 2 2 TGEL F -GS - GS - NP 630 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 642 146 2 2 TGEL F -GS - GS - NP 642 146 2 2 TGEL - 3 W - S - GR -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 652 224 M 708 224 L 708 260 L 652 260 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 552 224 M 608 224 L 608 260 L 552 260 L CP 1 SG F - 0 SG - NP 552 224 M 608 224 L 608 260 L 552 260 L CP EC NP - pat5 8 544 216 72 48 TGPF -GR -GS - 10 SM - GS - NP 552 224 M 608 224 L 608 260 L 552 260 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 496 224 M 552 224 L 552 260 L 496 260 L CP EC NP - pat5 8 488 216 72 48 TGPF -GR -GS - 10 SM - GS - NP 496 224 M 552 224 L 552 260 L 496 260 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 440 224 M 496 224 L 496 260 L 440 260 L CP EC NP - pat5 8 432 216 72 48 TGPF -GR -GS - 10 SM - GS - NP 440 224 M 496 224 L 496 260 L 440 260 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 340 224 M 396 224 L 396 260 L 340 260 L CP EC NP - pat5 8 336 216 64 48 TGPF -GR -GS - 10 SM - GS - NP 340 224 M 396 224 L 396 260 L 340 260 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 240 224 M 296 224 L 296 260 L 240 260 L CP EC NP - pat5 8 232 216 72 48 TGPF -GR -GS - 10 SM - GS - NP 240 224 M 296 224 L 296 260 L 240 260 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 184 224 M 240 224 L 240 260 L 184 260 L CP EC NP - pat5 8 176 216 72 48 TGPF -GR -GS - 10 SM - GS - NP 184 224 M 240 224 L 240 260 L 184 260 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 128 224 M 184 224 L 184 260 L 128 260 L CP EC NP - pat5 8 120 216 72 48 TGPF -GR -GS - 10 SM - GS - NP 128 224 M 184 224 L 184 260 L 128 260 L CP - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 156 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (0) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (0) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 212 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 268 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 368 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (c) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (c) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 468 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-3) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-3) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 680 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) SH - GR - GR - -% OVAL -0 SG -NP 306 242 2 2 TGEL F -GS - GS - NP 306 242 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 318 242 2 2 TGEL F -GS - GS - NP 318 242 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 330 242 2 2 TGEL F -GS - GS - NP 330 242 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 406 242 2 2 TGEL F -GS - GS - NP 406 242 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 418 242 2 2 TGEL F -GS - GS - NP 418 242 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 430 242 2 2 TGEL F -GS - GS - NP 430 242 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 524 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 580 248 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) SH - GR - GR - -% OVAL -0 SG -NP 618 242 2 2 TGEL F -GS - GS - NP 618 242 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 630 242 2 2 TGEL F -GS - GS - NP 630 242 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 642 242 2 2 TGEL F -GS - GS - NP 642 242 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 80 200 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (put\(i,j,x\);) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (put\(i,j,x\);) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 400 200 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (automatically "vol++;") TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (automatically "vol++;") SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 652 200 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (assign x) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (assign x) SH - GR - GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 612 196 M - 580 208 L - 16 0 atan DU cos 10.000 MU 580 exch SU - exch sin 10.000 MU 224 exch SU L - TGSM - 2 W - S - 1 W -GR -GS - TGSM - NP - 580 224 10.000 4.000 0 16 TGAT - CP F -GR - -GR -tgifsavedpage restore -end -showpage - -%%Trailer -%MatchingCreationDate: Thu Nov 4 02:04:07 2004 -%%DocumentFonts: Helvetica -%%EOF diff --git a/cpplapack-r198/.svn/pristine/71/71cfce7ed8085570d72da5e3a439c3ed91f1034f.svn-base b/cpplapack-r198/.svn/pristine/71/71cfce7ed8085570d72da5e3a439c3ed91f1034f.svn-base deleted file mode 100644 index 8d4f715addb45cf96ae1fca5d01ed535868fc4a2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/71/71cfce7ed8085570d72da5e3a439c3ed91f1034f.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _zgematrix+zgbmatrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) += matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _zgematrix-zgbmatrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) -= matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _zgematrix*zgbmatrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/72/729441c8a212415ad1bb4aa806abcc147aad004a.svn-base b/cpplapack-r198/.svn/pristine/72/729441c8a212415ad1bb4aa806abcc147aad004a.svn-base deleted file mode 100644 index e8226ecccad34f0375a7185f2c67a92624e13647..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/72/729441c8a212415ad1bb4aa806abcc147aad004a.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! dgbmatrix+dgematrix operator */ -inline _dgematrix operator+(const dgbmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix-dgematrix operator */ -inline _dgematrix operator-(const dgbmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix*dgematrix operator */ -inline _dgematrix operator*(const dgbmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/72/72aaf09f5b9c89a3d18e0506d5eba4ae50e3ab11.svn-base b/cpplapack-r198/.svn/pristine/72/72aaf09f5b9c89a3d18e0506d5eba4ae50e3ab11.svn-base deleted file mode 100644 index bb967fbe42df82eddcd14988c2ed2921ff0f2b25..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/72/72aaf09f5b9c89a3d18e0506d5eba4ae50e3ab11.svn-base +++ /dev/null @@ -1,93 +0,0 @@ -//============================================================================= -//! Samll Complex Double-precision Column Vector Class -template<CPPL_INT l> class zcovector_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - comple array[l]; - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zcovector_small(); - inline explicit zcovector_small(const zcovector&); - inline zcovector_small(const comple&, const comple&); - inline zcovector_small(const comple&, const comple&, const comple&); - inline ~zcovector_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zcovector to_zcovector() const; - - //////// io //////// - inline comple& operator()(const CPPL_INT&); - inline comple operator()(const CPPL_INT&) const; - inline zcovector_small<l>& set(const CPPL_INT&, const comple&); - template<CPPL_INT _l> inline friend std::ostream& operator<<(std::ostream&, const zcovector_small<_l>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// calc //////// -#ifndef _MSC_VER - template<CPPL_INT _l> inline friend zrovector_small<_l> t(const zcovector_small<_l>&); - template<CPPL_INT _l> inline friend comple nrm2(const zcovector_small<_l>&); - template<CPPL_INT _l> inline friend CPPL_INT idamax(const zcovector_small<_l>&); - template<CPPL_INT _l> inline friend comple damax(const zcovector_small<_l>&); -#endif//_MSC_VER - - //////// misc //////// - inline zcovector_small<l>& zero(); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT L> inline zcovector_small<L>& operator= (const zcovector_small<L>&); - //////// += //////// - template<CPPL_INT L> inline friend zcovector_small<L>& operator+=(zcovector_small<L>&, const zcovector_small<L>&); - //////// -= //////// - template<CPPL_INT L> inline friend zcovector_small<L>& operator-=(zcovector_small<L>&, const zcovector_small<L>&); - //////// *= //////// - template<CPPL_INT L> inline friend zcovector_small<L>& operator*=(zcovector_small<L>&, const double&); - template<CPPL_INT L> inline friend zcovector_small<L>& operator*=(zcovector_small<L>&, const comple&); - //////// /= //////// - template<CPPL_INT L> inline friend zcovector_small<L>& operator/=(zcovector_small<L>&, const double&); - template<CPPL_INT L> inline friend zcovector_small<L>& operator/=(zcovector_small<L>&, const comple&); - //////// unary //////// - template<CPPL_INT L> inline friend const zcovector_small<L>& operator+(const zcovector_small<L>&); - template<CPPL_INT L> inline friend zcovector_small<L> operator-(const zcovector_small<L>&); - //////// + //////// - template<CPPL_INT L> inline friend zcovector_small<L> operator+(const zcovector_small<L>&, const zcovector_small<L>&); - //////// - //////// - template<CPPL_INT L> inline friend zcovector_small<L> operator-(const zcovector_small<L>&, const zcovector_small<L>&); - //////// * //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator*(const zcovector_small<M>&, const zrovector_small<N>&); - template<CPPL_INT L> inline friend zcovector_small<L> operator*(const zcovector_small<L>&, const double&); - template<CPPL_INT L> inline friend zcovector_small<L> operator*(const zcovector_small<L>&, const comple&); - //////// / //////// - template<CPPL_INT L> inline friend zcovector_small<L> operator/(const zcovector_small<L>&, const double&); - template<CPPL_INT L> inline friend zcovector_small<L> operator/(const zcovector_small<L>&, const comple&); - //////// comple //////// - template<CPPL_INT L> inline friend zcovector_small<L> operator*(const double&, const zcovector_small<L>&); - template<CPPL_INT L> inline friend zcovector_small<L> operator*(const comple&, const zcovector_small<L>&); - //////// hadamerd //////// - template<CPPL_INT L> inline friend zcovector_small<L> hadamerd(const zcovector_small<L>&, const zcovector_small<L>&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -//////// zcovec2 //////// -inline comple operator/(const zcovec2&, const zcovec2&); - -//////// zcovec3 //////// -inline zcovec3 operator/(const zcovec3&, const zcovec3&); -inline zcovec3 operator/=(zcovec3&, const zcovec3&); diff --git a/cpplapack-r198/.svn/pristine/72/72bd5eb13043aac06369f24a0b9a39ab673ffe4f.svn-base b/cpplapack-r198/.svn/pristine/72/72bd5eb13043aac06369f24a0b9a39ab673ffe4f.svn-base deleted file mode 100644 index a31aace3e729e63e7540b16e9e5764c5156d4e25..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/72/72bd5eb13043aac06369f24a0b9a39ab673ffe4f.svn-base +++ /dev/null @@ -1,144 +0,0 @@ -//============================================================================= -//! Complex Double-precision General Sparse Matrix Class -class zgsmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT m; //!< matrix row size - CPPL_INT n; //!< matrix column size - std::vector<zcomponent> data; //!< matrix data - std::vector< std::vector<CPPL_INT> > rows; //!< array of vector to store the entry information of component for each row - std::vector< std::vector<CPPL_INT> > cols; //!< array of vector to store the entry information of component for each column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zgsmatrix(); - inline zgsmatrix(const zgsmatrix&); - inline zgsmatrix(const _zgsmatrix&); - inline zgsmatrix(const CPPL_INT&, const CPPL_INT&, const CPPL_INT=0); - inline zgsmatrix(const char*); - inline ~zgsmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline comple operator()(const CPPL_INT&, const CPPL_INT&) const; - inline comple& operator()(const CPPL_INT&, const CPPL_INT&); - inline zgsmatrix& put(const CPPL_INT&, const CPPL_INT&, const comple&); - inline zgsmatrix& del(const CPPL_INT, const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline zgsmatrix& del(const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline friend std::ostream& operator<<(std::ostream&, const zgsmatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline zgsmatrix& zero(); - inline zgsmatrix& identity(); - inline void chsign(); - inline void copy(const zgsmatrix&); - inline void shallow_copy(const _zgsmatrix&); - inline zgsmatrix& resize(const CPPL_INT&, const CPPL_INT&, const CPPL_INT=0, const CPPL_INT=0); - inline void stretch(const CPPL_INT&, const CPPL_INT&); - inline void expand(const CPPL_INT&); - inline bool isListed(const CPPL_INT&, const CPPL_INT&); - inline CPPL_INT number(const CPPL_INT&, const CPPL_INT&); - inline void checkup(); - inline void diet(const double=DBL_MIN); - inline _zrovector row(const CPPL_INT&) const; - inline _zcovector col(const CPPL_INT&) const; - inline friend void swap(zgsmatrix&, zgsmatrix&); - inline friend _zgsmatrix _(zgsmatrix&); - - //////// calc //////// - inline friend _zgsmatrix t(const zgsmatrix&); - ////inline friend _zgematrix i(const zgsmatrix&); - inline friend _zgsmatrix conj(const zgsmatrix&); - inline friend _zgsmatrix conjt(const zgsmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const zgsmatrix&); - inline friend comple damax(const zgsmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline zgsmatrix& operator=(const zgsmatrix&); - inline zgsmatrix& operator=(const _zgsmatrix&); - - //////// += //////// - inline zgsmatrix& operator+=(const zgsmatrix&); - inline zgsmatrix& operator+=(const _zgsmatrix&); - - //////// -= //////// - inline zgsmatrix& operator-=(const zgsmatrix&); - inline zgsmatrix& operator-=(const _zgsmatrix&); - - //////// *= //////// - inline zgsmatrix& operator*=(const zgsmatrix&); - inline zgsmatrix& operator*=(const _zgsmatrix&); - inline zgsmatrix& operator*=(const double&); - inline zgsmatrix& operator*=(const comple&); - - //////// /= //////// - inline zgsmatrix& operator/=(const double&); - inline zgsmatrix& operator/=(const comple&); - - //////// unary //////// - inline friend const zgsmatrix& operator+(const zgsmatrix&); - inline friend _zgsmatrix operator-(const zgsmatrix&); - - //////// + //////// - inline friend _zgematrix operator+(const zgsmatrix&, const zgematrix&); - inline friend _zgematrix operator+(const zgsmatrix&, const _zgematrix&); - inline friend _zgematrix operator+(const zgsmatrix&, const zhematrix&); - inline friend _zgematrix operator+(const zgsmatrix&, const _zhematrix&); - inline friend _zgematrix operator+(const zgsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const zgsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator+(const zgsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator+(const zgsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator+(const zgsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator+(const zgsmatrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const zgsmatrix&, const zgematrix&); - inline friend _zgematrix operator-(const zgsmatrix&, const _zgematrix&); - inline friend _zgematrix operator-(const zgsmatrix&, const zhematrix&); - inline friend _zgematrix operator-(const zgsmatrix&, const _zhematrix&); - inline friend _zgematrix operator-(const zgsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const zgsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator-(const zgsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator-(const zgsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator-(const zgsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator-(const zgsmatrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const zgsmatrix&, const zcovector&); - inline friend _zcovector operator*(const zgsmatrix&, const _zcovector&); - inline friend _zgematrix operator*(const zgsmatrix&, const zgematrix&); - inline friend _zgematrix operator*(const zgsmatrix&, const _zgematrix&); - inline friend _zgematrix operator*(const zgsmatrix&, const zhematrix&); - inline friend _zgematrix operator*(const zgsmatrix&, const _zhematrix&); - inline friend _zgematrix operator*(const zgsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const zgsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator*(const zgsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator*(const zgsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator*(const zgsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator*(const zgsmatrix&, const _zhsmatrix&); - inline friend _zgsmatrix operator*(const zgsmatrix&, const double&); - inline friend _zgsmatrix operator*(const zgsmatrix&, const comple&); - - //////// / //////// - inline friend _zgsmatrix operator/(const zgsmatrix&, const double&); - inline friend _zgsmatrix operator/(const zgsmatrix&, const comple&); - - //////// double, comple //////// - inline friend _zgsmatrix operator*(const double&, const zgsmatrix&); - inline friend _zgsmatrix operator*(const comple&, const zgsmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/73/730e361435ee1808af207272d92b8c503b4e5239.svn-base b/cpplapack-r198/.svn/pristine/73/730e361435ee1808af207272d92b8c503b4e5239.svn-base deleted file mode 100644 index 76383c6b9483016e0e69b9b8ed56752c325bf3eb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/73/730e361435ee1808af207272d92b8c503b4e5239.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -!define version "2010.03.27-3" - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;; base setting ;;;;;;;; -!include MUI2.nsh -Name "CPPLapack" -OutFile "cpplapack-${version}-setup.exe" -InstallDir "c:\cpplapack" - -;;;;;;;; welcome ;;;;;;;; -;!define MUI_WELCOMEFINISHPAGE_BITMAP "C:\Program Files\NSIS\Contrib\Graphics\Wizard\win.bmp" - -!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" -!define MUI_WELCOMEPAGE_TITLE "Welcome to CPPLapack installer." -!define MUI_WELCOMEPAGE_TEXT "Press $\"next$\" to procced." -!insertmacro MUI_PAGE_WELCOME - -;;!insertmacro MUI_PAGE_LICENSE ".\LICENSE.txt" -;;!insertmacro MUI_PAGE_COMPONENTS -!insertmacro MUI_PAGE_DIRECTORY -;;!insertmacro MUI_PAGE_STARTMENU -!insertmacro MUI_PAGE_INSTFILES - -;;;;;;;; finish ;;;;;;;; -!define MUI_FINISHPAGE_TITLE "CPPLapack was installed successfully." -!define MUI_FINISHPAGE_TEXT "Press $\"Finish$\"." -!define MUI_FINISHPAGE_LINK "Click here to see the online documentation." -!define MUI_FINISHPAGE_LINK_LOCATION "http://cpplapack.sourceforge.net/" -!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR/README.txt" -!insertmacro MUI_PAGE_FINISH - -;;;;;;;; language ;;;;;;;; -!insertmacro MUI_LANGUAGE "English" - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Section "Install" - SetOutPath $INSTDIR - File .\README.txt - - SetOutPath $INSTDIR\lib - File /r .\win32\* - - SetOutPath $INSTDIR\lib64 - File /r .\win64\* - - SetOutPath $INSTDIR\vc_sample -!system "mkdir vc_sample" -!system "xcopy ..\..\test\vc_sample .\vc_sample /s /e /q /r /y" - File /r .\vc_sample\* -!system "rmdir /s /q .\vc_sample" - - SetOutPath $INSTDIR\include - File .\stdint.h - - SetOutPath $INSTDIR -!system "mkdir include" -!system "xcopy ..\..\include .\include /s /e /q /r /y" - File /r .\include -!system "rmdir /s /q include" - -;; WriteUninstaller $INSTDIR\uninstall.exe -SectionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;Section "Uninstall" -; Delete $INSTDIR\uninstall.exe -; RMDir /r $INSTDIR -;SectionEnd diff --git a/cpplapack-r198/.svn/pristine/73/732a1eb3ba8866fd7f85c38e03b30f4d76f9b5ab.svn-base b/cpplapack-r198/.svn/pristine/73/732a1eb3ba8866fd7f85c38e03b30f4d76f9b5ab.svn-base deleted file mode 100644 index 3572fb193ebd8f380995e484ef82b6c5a3ea8854..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/73/732a1eb3ba8866fd7f85c38e03b30f4d76f9b5ab.svn-base +++ /dev/null @@ -1,692 +0,0 @@ -%!PS-Adobe-3.0 EPSF-3.0 -%%BoundingBox: 9 443 256 811 -%%Title: bandmatrix -%%CreationDate: Fri Jan 28 11:06:04 2005 -%%Creator: Tgif-4.1.43-QPL written by William Chia-Wei Cheng (bill.cheng@acm.org) -%%ProducedBy: (unknown) -%%Pages: 1 -%%DocumentFonts: (atend) -%%EndComments -%%BeginProlog - -/tgifdict 87 dict def -tgifdict begin - -/tgifarcdict 8 dict def -tgifarcdict /mtrx matrix put - -/TGAN % tgifarcn - { tgifarcdict begin - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y translate - xrad yrad scale - 0 0 1 startangle endangle arc - savematrix setmatrix - end - } def - -/TGAR % tgifarc - { tgifarcdict begin - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y translate - xrad yrad scale - 0 0 1 startangle endangle arcn - savematrix setmatrix - end - } def - -/tgifpatdict 10 dict def - -/tgifpatbyte - { currentdict /retstr get exch - pat i cellsz mod get put - } def - -/tgifpatproc - { 0 1 widthlim {tgifpatbyte} for retstr - /i i 1 add def - } def - -/TGPF % tgifpatfill - { tgifpatdict begin - /h exch def - /w exch def - /lty exch def - /ltx exch def - /cellsz exch def - /pat exch def - - /widthlim w cellsz div cvi 1 sub def - /retstr widthlim 1 add string def - /i 0 def - - tgiforigctm setmatrix - ltx lty translate - w h true [1 0 0 1 0 0] {tgifpatproc} imagemask - ltx neg lty neg translate - end - } def - -/pat3 <8000000008000000> def -/pat4 <8800000022000000> def -/pat5 <8800220088002200> def -/pat6 <8822882288228822> def -/pat7 <aa55aa55aa55aa55> def -/pat8 <77dd77dd77dd77dd> def -/pat9 <77ffddff77ffddff> def -/pat10 <77ffffff77ffffff> def -/pat11 <7fffffff7fffffff> def -/pat12 <8040200002040800> def -/pat13 <40a00000040a0000> def -/pat14 <ff888888ff888888> def -/pat15 <ff808080ff080808> def -/pat16 <f87422478f172271> def -/pat17 <038448300c020101> def -/pat18 <081c22c180010204> def -/pat19 <8080413e080814e3> def -/pat20 <8040201008040201> def -/pat21 <8844221188442211> def -/pat22 <77bbddee77bbddee> def -/pat23 <c1e070381c0e0783> def -/pat24 <7fbfdfeff7fbfdfe> def -/pat25 <3e1f8fc7e3f1f87c> def -/pat26 <0102040810204080> def -/pat27 <1122448811224488> def -/pat28 <eeddbb77eeddbb77> def -/pat29 <83070e1c3870e0c1> def -/pat30 <fefdfbf7efdfbf7f> def -/pat31 <7cf8f1e3c78f1f3e> def - -/TGMAX - { exch dup 3 1 roll exch dup 3 1 roll gt { pop } { exch pop } ifelse - } def -/TGMIN - { exch dup 3 1 roll exch dup 3 1 roll lt { pop } { exch pop } ifelse - } def -/TGSW { stringwidth pop } def - -/bd { bind def } bind def - -/GS { gsave } bd -/GR { grestore } bd -/NP { newpath } bd -/CP { closepath } bd -/CHP { charpath } bd -/CT { curveto } bd -/L { lineto } bd -/RL { rlineto } bd -/M { moveto } bd -/RM { rmoveto } bd -/S { stroke } bd -/F { fill } bd -/TR { translate } bd -/RO { rotate } bd -/SC { scale } bd -/MU { mul } bd -/DI { div } bd -/DU { dup } bd -/NE { neg } bd -/AD { add } bd -/SU { sub } bd -/PO { pop } bd -/EX { exch } bd -/CO { concat } bd -/CL { clip } bd -/EC { eoclip } bd -/EF { eofill } bd -/IM { image } bd -/IMM { imagemask } bd -/ARY { array } bd -/SG { setgray } bd -/RG { setrgbcolor } bd -/SD { setdash } bd -/W { setlinewidth } bd -/SM { setmiterlimit } bd -/SLC { setlinecap } bd -/SLJ { setlinejoin } bd -/SH { show } bd -/FF { findfont } bd -/MS { makefont setfont } bd -/AR { arcto 4 {pop} repeat } bd -/CURP { currentpoint } bd -/FLAT { flattenpath strokepath clip newpath } bd -/TGSM { tgiforigctm setmatrix } def -/TGRM { savematrix setmatrix } def - -end - -%%EndProlog -%%Page: 1 1 - -%%PageBoundingBox: 9 443 256 811 -tgifdict begin -/tgifsavedpage save def - -1 SM -1 W - -0 SG - -72 0 MU 72 11.602 MU TR -72 128 DI 100.000 MU 100 DI DU NE SC - -GS - -/tgiforigctm matrix currentmatrix def - -% POLYGON/CLOSED-SPLINE -0 SG -NP - 150 600 M - 150 650 L - 350 650 L - 375 625 L - 375 500 L - 250 500 L -CP -GS - 1 SG EF -GR -GS - EC NP - pat3 8 144 496 240 160 TGPF -GR -GS - 2 W - [12 4] 0 SD - S -GR - -% POLYGON/CLOSED-SPLINE -0 SG -NP - 150 100 M - 150 150 L - 350 350 L - 375 350 L - 375 225 L - 250 100 L -CP -GS - 1 SG EF -GR -GS - EC NP - pat3 8 144 96 240 256 TGPF -GR -GS - 2 W - S -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 150 100 M 375 100 L 375 350 L 150 350 L CP - 2 W - S - GR -GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 150 150 M - 350 350 L - TGSM - 2 W - S - 1 W -GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 250 100 M - 375 225 L - TGSM - 2 W - S - 1 W -GR - -% POLY/OPEN-SPLINE -0 SG -GS - [12 4] 0 SD - NP - 150 100 M - 375 325 L - TGSM - 2 W - S - [] 0 SD - 1 W -GR - -% TEXT -NP -0 SG - GS - 1 W - 80 70 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (Actual Matrix) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (Actual Matrix) SH - GR - GR - -% RCBOX -0 SG -GS - GS - NP - 124 45 M - 140 45 140 80 16 AR - 140 64 L - 140 80 20 80 16 AR - 36 80 L - 20 80 20 45 16 AR - 20 61 L - 20 45 140 45 16 AR - CP - 2 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 80 475 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (Stored Matrix) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (Stored Matrix) SH - GR - GR - -% RCBOX -0 SG -GS - GS - NP - 124 450 M - 140 450 140 485 16 AR - 140 469 L - 140 485 20 485 16 AR - 36 485 L - 20 485 20 450 16 AR - 20 466 L - 20 450 140 450 16 AR - CP - 2 W - S - GR -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 150 500 M 375 500 L 375 650 L 150 650 L CP - 2 W - S - GR -GR - -% ARC -0 SG -GS - GS - NP - 259 -383 548 757 101 78 TGAR - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 262 390 M - GS - GS - 0 - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (n) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (n) SH - GR - GR - -% ARC -0 SG -GS - GS - NP - 59 225 340 425 -17 17 TGAN - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 415 228 M - GS - GS - 0 - /Times-Roman FF [14 0 0 -14 0 0] MS - (m) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Times-Roman FF [14 0 0 -14 0 0] MS - (m) SH - GR - GR - -% ARC -0 SG -GS - GS - NP - 166 125 36 36 -136 -224 TGAR - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 110 130 M - GS - GS - 0 - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (kl+1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (kl+1) SH - GR - GR - -% ARC -0 SG -GS - GS - NP - 198 280 153 200 -108 -71 TGAN - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 200 75 M - GS - GS - 0 - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (ku+1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (ku+1) SH - GR - GR - -% ARC -0 SG -GS - GS - NP - 259 -83 548 757 101 78 TGAR - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 261 690 M - GS - GS - 0 - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (n) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (n) SH - GR - GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 150 600 M - 250 500 L - TGSM - 2 W - S - 1 W -GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 350 650 M - 375 625 L - TGSM - 2 W - S - 1 W -GR - -% ARC -0 SG -GS - GS - NP - 198 680 153 200 -108 -71 TGAN - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 200 475 M - GS - GS - 0 - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (ku) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (ku) SH - GR - GR - -% ARC -0 SG -GS - GS - NP - 166 625 36 36 -136 -224 TGAR - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 110 630 M - GS - GS - 0 - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (kl+1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /NewCenturySchlbk-Roman FF [14 0 0 -14 0 0] MS - (kl+1) SH - GR - GR - -% POLY/OPEN-SPLINE -0 SG -GS - [12 4] 0 SD - NP - 150 600 M - 375 600 L - TGSM - 2 W - S - [] 0 SD - 1 W -GR - -% TEXT -NP -0 SG - GS - 1 W - 155 515 M - GS - 0 SG - /Courier FF [11 0 0 -11 0 0] MS - (0 kl+ku+1 . .) SH - GR - 0 11 RM - GS - 0 SG - /Courier FF [11 0 0 -11 0 0] MS - (1 kl+ku+2 . .) SH - GR - 0 11 RM - GS - 0 SG - /Courier FF [11 0 0 -11 0 0] MS - (. . . .) SH - GR - 0 11 RM - GS - 0 SG - /Courier FF [11 0 0 -11 0 0] MS - (. . . .) SH - GR - GR - -% ARC -0 SG -GS - GS - NP - 59 575 340 255 -17 17 TGAN - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 430 581 M - GS - GS - 0 - /Times-Roman FF [14 0 0 -14 0 0] MS - (kl+ku+1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Times-Roman FF [14 0 0 -14 0 0] MS - (kl+ku+1) SH - GR - GR - -GR -tgifsavedpage restore -end -showpage - -%%Trailer -%MatchingCreationDate: Fri Jan 28 11:06:04 2005 -%%DocumentFonts: Courier -%%+ Times-Roman -%%+ NewCenturySchlbk-Roman -%%+ Helvetica -%%EOF diff --git a/cpplapack-r198/.svn/pristine/73/73b69299f29e5547cb4efb9b7bce055538e4ee16.svn-base b/cpplapack-r198/.svn/pristine/73/73b69299f29e5547cb4efb9b7bce055538e4ee16.svn-base deleted file mode 100644 index c75df26e289ba5b3057e756d09e29ff347699cf8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/73/73b69299f29e5547cb4efb9b7bce055538e4ee16.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -//============================================================================= -/*! _dssmatrix*_dcovector operator */ -inline _dcovector operator*(const _dssmatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=it->v*vec(it->i); - } - } - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/73/73fe37362e12221a4fb355618e4aee6d339c0d72.svn-base b/cpplapack-r198/.svn/pristine/73/73fe37362e12221a4fb355618e4aee6d339c0d72.svn-base deleted file mode 100644 index bbb472e1ad0cf8b256f3f642f62235e5c5b78a51..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/73/73fe37362e12221a4fb355618e4aee6d339c0d72.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -//============================================================================= -/*! dsymatrix+dgematrix operator */ -inline _dgematrix operator+(const dsymatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =matB; - - for(CPPL_INT i=0; i<matA.n; i++) { - for(CPPL_INT j=0; j<matA.n; j++) { - newmat(i,j) += matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix-dgematrix operator */ -inline _dgematrix operator-(const dsymatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =-matB; - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) += matA(i,j); - } - } - - return _(newmat); -} - - -//============================================================================= -/*! dsymatrix*dgematrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/74/741157d28f5d7633ab97e3693b255036457c6ab6.svn-base b/cpplapack-r198/.svn/pristine/74/741157d28f5d7633ab97e3693b255036457c6ab6.svn-base deleted file mode 100644 index ab7184700bdd5344b3757d50116b7b33c21c38f6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/74/741157d28f5d7633ab97e3693b255036457c6ab6.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -//============================================================================= -/*! _zrovector*_zhsmatrix operator */ -inline _zrovector operator*(const _zrovector& vec, const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) +=vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) +=vec(it->j)*std::conj(it->v); - } - } - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/74/74119b63e623f9c8d7393c8727c65d493e37834d.svn-base b/cpplapack-r198/.svn/pristine/74/74119b63e623f9c8d7393c8727c65d493e37834d.svn-base deleted file mode 100644 index 7d46a284ec37f2a11bc2e983a086f058a60e38b8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/74/74119b63e623f9c8d7393c8727c65d493e37834d.svn-base +++ /dev/null @@ -1,131 +0,0 @@ -//============================================================================= -/*! zhematrix=zhematrix operator */ -inline zhematrix& zhematrix::operator=(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - if(array!=mat.array){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix+=zhematrix operator */ -inline zhematrix& zhematrix::operator+=(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] += mat.darray[j][i]; - } - } - - return *this; -} - -//============================================================================= -/*! zhematrix operator-= */ -inline zhematrix& zhematrix::operator-=(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] -= mat.darray[j][i]; - } - } - - return *this; -} - -//============================================================================= -/*! zhematrix+zhematrix operator */ -inline _zhematrix operator+(const zhematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhematrix newmat(matA.n); - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - newmat.darray[j][i] =matA.darray[j][i] +matB.darray[j][i]; - } - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix-zhematrix operator */ -inline _zhematrix operator-(const zhematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhematrix newmat(matA.n); - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - newmat.darray[j][i] =matA.darray[j][i] -matB.darray[j][i]; - } - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix*zhematrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - zgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.n, &beta, newmat.array, &newmat.m ); - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/74/744144541a42899b66b56484160f2f017b73cfe3.svn-base b/cpplapack-r198/.svn/pristine/74/744144541a42899b66b56484160f2f017b73cfe3.svn-base deleted file mode 100644 index cf865c2b24d10c0b5ed8895581afb2192d37111a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/74/744144541a42899b66b56484160f2f017b73cfe3.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -//============================================================================= -/*! double*_zgsmatrix operator */ -inline _zgsmatrix operator*(const double& d, const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *= d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/74/7452ca86f2dad993d1da91185e48a3dcaedc38d9.svn-base b/cpplapack-r198/.svn/pristine/74/7452ca86f2dad993d1da91185e48a3dcaedc38d9.svn-base deleted file mode 100644 index 9b101c05fe91b6ed3a09c37e80de602ea18e0e12..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/74/7452ca86f2dad993d1da91185e48a3dcaedc38d9.svn-base +++ /dev/null @@ -1,263 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void zgbmatrix::clear() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - kl =0; - ku =0; - delete [] array; - array =NULL; - delete [] darray; - darray =NULL; -} - - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline zgbmatrix& zgbmatrix::zero() -{CPPL_VERBOSE_REPORT; - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =comple(0.,0.); - } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline zgbmatrix& zgbmatrix::identity() -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "Only square matrix can be a identity matrix." << std::endl - << "The matrix size was " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =comple(0.,0.); - } - for(CPPL_INT i=0; i<m; i++){ - operator()(i,i) =comple(1.,0.); - } - - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void zgbmatrix::chsign() -{CPPL_VERBOSE_REPORT; - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =-array[i]; - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void zgbmatrix::copy(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - delete [] array; - array =new comple[(mat.kl+mat.ku+1)*mat.n]; - delete [] darray; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*(kl+ku+1)]; - } - - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - zcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void zgbmatrix::shallow_copy(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - delete [] array; - array =mat.array; - delete [] darray; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline void zgbmatrix::resize(const CPPL_INT& _m, const CPPL_INT& _n, - const CPPL_INT& _kl, const CPPL_INT& _ku) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){ - ERROR_REPORT; - std::cerr << "It is impossible to make a matrix you ordered. " << std::endl - << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - m =_m; - n =_n; - kl =_kl; - ku =_ku; - delete [] array; - array =new comple[(kl+ku+1)*n]; - delete [] darray; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*(kl+ku+1)]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _zrovector zgbmatrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector v =zrovector(n).zero(); - - const CPPL_INT jmax =std::min(n,_m+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),_m-kl); j<jmax; j++){ - v(j)=(*this)(_m,j); - } - - return _(v); -} - -//============================================================================= -/*! get column of the matrix */ -inline _zcovector zgbmatrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector v =zcovector(m).zero(); - - const CPPL_INT imax =std::min(m,_n+kl+1); - for(CPPL_INT i=std::max(CPPL_INT(0),_n-ku); i<imax; i++){ - v(i)=(*this)(i,_n); - } - - return _(v); -} - -//============================================================================= -/*! extract the real part of the matrix */ -inline _dgbmatrix zgbmatrix::real() const -{CPPL_VERBOSE_REPORT; - dgbmatrix mat(m,n,kl,ku); - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =array[i].real(); - } - return _(mat); -} - -//============================================================================= -/*! extract the imag part of the matrix */ -inline _dgbmatrix zgbmatrix::imag() const -{CPPL_VERBOSE_REPORT; - dgbmatrix mat(m,n,kl,ku); - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =array[i].imag(); - } - return _(mat); -} - -//============================================================================= -/*! extract the absolute of the matrix */ -inline _dgbmatrix zgbmatrix::abs() const -{CPPL_VERBOSE_REPORT; - dgbmatrix mat(m,n,kl,ku); - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =std::abs(array[i]); - } - return _(mat); -} - -//============================================================================= -/*! extract the argument of the matrix */ -inline _dgbmatrix zgbmatrix::arg() const -{CPPL_VERBOSE_REPORT; - dgbmatrix mat(m,n,kl,ku); - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =std::arg(array[i]); - } - return _(mat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(zgbmatrix& A, zgbmatrix& B) -{CPPL_VERBOSE_REPORT; - CPPL_INT A_m =A.m, A_n =A.n, A_kl =A.kl, A_ku =A.ku; - comple* A_array =A.array; - comple** A_darray =A.darray; - - A.m=B.m; A.n=B.n; A.kl=B.kl; A.ku=B.ku; A.array=B.array; A.darray=B.darray; - B.m=A_m; B.n=A_n; B.kl=A_kl; B.ku=A_ku; B.array=A_array; B.darray=A_darray; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _zgbmatrix _(zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - _zgbmatrix newmat; - - //////// shallow copy //////// - newmat.m =mat.m; - newmat.n =mat.n; - newmat.kl =mat.kl; - newmat.ku =mat.ku; - newmat.array =mat.array; - newmat.darray =mat.darray; - - //////// nullify //////// - mat.m =0; - mat.n =0; - mat.kl =0; - mat.ku =0; - mat.array =NULL; - mat.darray =NULL; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/74/74858d77623a8706c8d9d66b0498a9f6eeb34b6a.svn-base b/cpplapack-r198/.svn/pristine/74/74858d77623a8706c8d9d66b0498a9f6eeb34b6a.svn-base deleted file mode 100644 index b8a502c0106c5777815726e221339b32206ec570..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/74/74858d77623a8706c8d9d66b0498a9f6eeb34b6a.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -//============================================================================= -/*! zgematrix+_zhematrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix-_zhematrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c]; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix*_zhematrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/75/75813d2ecc17271323194fb794de0a791b6a3398.svn-base b/cpplapack-r198/.svn/pristine/75/75813d2ecc17271323194fb794de0a791b6a3398.svn-base deleted file mode 100644 index cc6db455005b7a1a6f9f089129b55777d8d9650b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/75/75813d2ecc17271323194fb794de0a791b6a3398.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! _dgematrix+dsymatrix operator */ -inline _dgematrix operator+(const _dsymatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++) { - for(CPPL_INT j=0; j<matA.n; j++) { - matB(i,j) += matA(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _dsymatrix-dgematrix operator */ -inline _dgematrix operator-(const _dsymatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++) { - for(CPPL_INT j=0; j<matA.n; j++) { - matB(i,j) =matA(i,j)-matB(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _dgematrix*dgematrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/75/75ad00df1f33ce4291a43b31d94c1bd21f26ed7a.svn-base b/cpplapack-r198/.svn/pristine/75/75ad00df1f33ce4291a43b31d94c1bd21f26ed7a.svn-base deleted file mode 100644 index 8a4082b9b5c99c913a16e61a933eeb6e984cca1c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/75/75ad00df1f33ce4291a43b31d94c1bd21f26ed7a.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -#undef CPPL_VERBOSE -#undef CPPL_DEBUG - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - int size(500); - CPPL::dgematrix A(size,size), B(size,size), C; - - srand(unsigned(time(NULL))); - for(int i=0; i<size; i++){ for(int j=0; j<size; j++){ - A(i,j) =double(rand())/double(RAND_MAX); - B(i,j) =double(rand())/double(RAND_MAX); - }} - - clock_t t0, t1, t2; - - t0=clock(); - - C=A*B; - - t1=clock(); - - C.resize(size,size); - for(int i=0; i<size; i++){ - for(int j=0; j<size; j++){ - C(i,j) =0.0; - for(int k=0; k<size; k++){ C(i,j) +=A(i,k)*B(k,j); } - } - } - - t2=clock(); - - cout << "\"A*B\" took "<< (1000./CLOCKS_PER_SEC)*(t1-t0) << "[ms]." << endl; - cout << "\"loop\" took "<< (1000./CLOCKS_PER_SEC)*(t2-t1) << "[ms]." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/76/760b6f5dddcc1a2b834797328598c03050c67138.svn-base b/cpplapack-r198/.svn/pristine/76/760b6f5dddcc1a2b834797328598c03050c67138.svn-base deleted file mode 100644 index dd273f7192ae82fa832c4fdae7976a4b223cfc5f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/76/760b6f5dddcc1a2b834797328598c03050c67138.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+_dgsmatrix operator */ -inline _dgematrix operator+(const _dgbmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix-_dgsmatrix operator */ -inline _dgematrix operator-(const _dgbmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( (-matB).to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)-=matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix*_dgsmatrix operator */ -inline _dgematrix operator*(const _dgbmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - const CPPL_INT imax =std::min(matA.m,it->i+matA.kl); - for(CPPL_INT i=std::max(CPPL_INT(0),it->i-(matA.ku+1)); i<imax; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/77/771a6b224774b90d79ffb837b5db81e46d625117.svn-base b/cpplapack-r198/.svn/pristine/77/771a6b224774b90d79ffb837b5db81e46d625117.svn-base deleted file mode 100644 index 54850b30c592579f193beb96f321aa0149d052e5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/77/771a6b224774b90d79ffb837b5db81e46d625117.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! zgbmatrix*=comple operator */ -inline zgbmatrix& zgbmatrix::operator*=(const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(kl+ku+1)*n; - CPPL_INT inc =1; - zscal_(&size, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zgbmatrix/=comple operator */ -inline zgbmatrix& zgbmatrix::operator/=(const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(kl+ku+1)*n; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&size, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix*comple operator */ -inline _zgbmatrix operator*(const zgbmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix/comple operator */ -inline _zgbmatrix operator/(const zgbmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/77/773fff42361533fb5edbe501b1298dd48ca16b95.svn-base b/cpplapack-r198/.svn/pristine/77/773fff42361533fb5edbe501b1298dd48ca16b95.svn-base deleted file mode 100644 index 7d070277f3104b637f8b39d2fede08b80d277b0d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/77/773fff42361533fb5edbe501b1298dd48ca16b95.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! comple*zhematrix operator */ -inline _zgematrix operator*(const comple& d, const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - mat.complete(); - zgematrix newmat(mat.n, mat.n); - - const CPPL_INT size =mat.n*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/77/7779aec690a59cf637415f48c45e58569b9c235a.svn-base b/cpplapack-r198/.svn/pristine/77/7779aec690a59cf637415f48c45e58569b9c235a.svn-base deleted file mode 100644 index 1a5c54774f2145476db24c6d1fc4793188b78fff..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/77/7779aec690a59cf637415f48c45e58569b9c235a.svn-base +++ /dev/null @@ -1,150 +0,0 @@ -//============================================================================= -/*! zgematrix+=_zhematrix operator */ -inline zgematrix& zgematrix::operator+=(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - operator()(i,j) +=mat(i,j); - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zgematrix-=_zhematrix operator */ -inline zgematrix& zgematrix::operator-=(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - operator()(i,j) -=mat(i,j); - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zgematrix*=_zhematrix operator */ -inline zgematrix& zgematrix::operator*=(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( m, mat.n ); - char side ='R'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &mat.n, &n, &alpha, mat.array, &mat.n, array, &m, &beta, newmat.array, &newmat.m ); - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+_zhematrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) +=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix-_zhematrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) -=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgematrix*_zhematrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - char side ='R'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/77/77b127a725a4f15c9a3be40e1ad0910b120525a4.svn-base b/cpplapack-r198/.svn/pristine/77/77b127a725a4f15c9a3be40e1ad0910b120525a4.svn-base deleted file mode 100644 index 918a1aab19829097262138845b663f8120e689d4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/77/77b127a725a4f15c9a3be40e1ad0910b120525a4.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! drovector*_dssmatrix operator */ -inline _drovector operator*(const drovector& vec, const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) += vec(it->j)*it->v; - } - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/77/77c7bc60952e87a2df995208d041dcf4fccc611a.svn-base b/cpplapack-r198/.svn/pristine/77/77c7bc60952e87a2df995208d041dcf4fccc611a.svn-base deleted file mode 100644 index de9b6df2ef45ead3d967539a510f87e3f358232b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/77/77c7bc60952e87a2df995208d041dcf4fccc611a.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! complex*zgsmatrix operator */ -inline _zgsmatrix operator*(const comple& d, const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat =mat; - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *= d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/77/77cca1325ece50a6b426ebb7c647e0156ccd4bef.svn-base b/cpplapack-r198/.svn/pristine/77/77cca1325ece50a6b426ebb7c647e0156ccd4bef.svn-base deleted file mode 100644 index 00183df8c3179848f417ee29c7e0847424424849..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/77/77cca1325ece50a6b426ebb7c647e0156ccd4bef.svn-base +++ /dev/null @@ -1,142 +0,0 @@ -//============================================================================= -/*! dgematrix+=dsymatrix operator */ -inline dgematrix& dgematrix::operator+=(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m; i++){ - for( CPPL_INT j=0; j<n; j++){ - operator() (i,j) += mat(i,j); - } - } - - return *this; -} - -//============================================================================= -/*! dgematrix-=dsymatrix operator */ -inline dgematrix& dgematrix::operator-=(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - operator() (i,j) -= mat(i,j); - } - } - - return *this; -} - -//============================================================================= -/*! dgematrix*=dsymatrix operator */ -inline dgematrix& dgematrix::operator*=(const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( m, mat.n ); - char side ='R'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &mat.n, &n, &alpha, mat.array, &mat.n, array, &m, &beta, newmat.array, &newmat.m ); - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+dsymatrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) += matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix-dsymatrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix*dsymatrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char side ='R'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/78/784dbbad6e9079a8c5bc368fe2a9a6e21ba2d6b6.svn-base b/cpplapack-r198/.svn/pristine/78/784dbbad6e9079a8c5bc368fe2a9a6e21ba2d6b6.svn-base deleted file mode 100644 index 109739133917df1bb3eb18002c5e6ea517fbf38b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/78/784dbbad6e9079a8c5bc368fe2a9a6e21ba2d6b6.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -//============================================================================= -/*! double*_dgbmatrix operator */ -inline _dgbmatrix operator*(const double& d, const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - dscal_(&size, &d, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/78/78f2faf91370dac7b9f4ebed9989871a50c211f9.svn-base b/cpplapack-r198/.svn/pristine/78/78f2faf91370dac7b9f4ebed9989871a50c211f9.svn-base deleted file mode 100644 index 49cb5ff4ba32fa69701122e2772cfd03e557a4db..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/78/78f2faf91370dac7b9f4ebed9989871a50c211f9.svn-base +++ /dev/null @@ -1,187 +0,0 @@ -//============================================================================= -/*! solve A*x=b for real and symmetric positive definite matrix using Intel PARDISO.\n - The argument is dcovector b. - b is overwritten and become the solution x. - A is not overwritten. -*/ -inline CPPL_INT dssmatrix::pardiso_definite(dcovector& b) const -{CPPL_VERBOSE_REPORT; -#ifndef __INTEL_COMPILER - ERROR_REPORT; - std::cerr << "dssmatrix::pardiso_definite is only for intel c++ compiler (icpc)." << std::endl; - std::cerr << "Recompile your code with icpc to use pardiso." << std::endl; - (void)b; - exit(1); -#else //__INTEL_COMPILER - - - //#ifdef CPPL_DEBUG - if(m!=b.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << b.l << ")." << std::endl; - exit(1); - } - //#endif//CPPL_DEBUG - - //////// convert matrix storage into compressed sparse row format //////// - //std::cerr << "converting" << std::endl; - std::vector<double> a(data.size()); - std::vector<MKL_INT> ja(data.size()); - std::vector<MKL_INT> ia(m+1); - ia[0] =0; - MKL_INT k=0; - for(CPPL_INT i=0; i<m; i++){ - //// make map //// - const std::vector<CPPL_INT>::const_iterator line_i_end =line[i].end(); - std::map<CPPL_INT,CPPL_INT> jc; - for(std::vector<CPPL_INT>::const_iterator lit=line[i].begin(); lit!=line_i_end; lit++){ - if(data[*lit].j==i){//pardiso needs upper triangle part. - jc.insert( std::make_pair(data[*lit].i, *lit) ); - } - } - //// assign //// - const std::map<CPPL_INT,CPPL_INT>::const_iterator jc_end =jc.end(); - for(std::map<CPPL_INT,CPPL_INT>::const_iterator jcit=jc.begin(); jcit!=jc_end; jcit++){ - a[k] =data[(*jcit).second].v; - ja[k] =MKL_INT((*jcit).first);//zero-base - k++; - } - ia[i+1] =k;//zero-base - } - - //////// pardisoinit //////// - //std::cerr << "initializing" << std::endl; - //_MKL_DSS_HANDLE_t pt[64]; - void* pt[64]; - MKL_INT mtype =2;//real and symmetric positive definite - MKL_INT iparm[64]; - PARDISOINIT(pt, &mtype, iparm); - //iparm[1] =3;//parallel fill-in reducing ordering [BUGGY on MKL 11.3]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - iparm[1] =0;//serial fill-in reducing ordering [STABLE] - iparm[23] =1;//use two-level scheduling factorization algorithm - iparm[26] =0;//disable matrix checker - iparm[34] =-1;//use zero-base array index - - //////// pardiso //////// - //std::cerr << "solving" << std::endl; - MKL_INT maxfct =1; - MKL_INT mnum =1; - MKL_INT phase =13; - MKL_INT MKL_INT_n =MKL_INT(n); - std::vector<MKL_INT> perm(n); - MKL_INT nrhs =1; - MKL_INT msglvl =0; - dcovector x(b.l); - MKL_INT error =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, &a[0], &ia[0], &ja[0], &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error); - swap(b,x);//set b as x - if(error!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. error = " << error << "." << std::endl; - } - - //////// release memory //////// - phase =-1; - MKL_INT error2 =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, &a[0], &ia[0], &ja[0], &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error2); - - return error; -#endif //__INTEL_COMPILER -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! solve A*x=b for real and symmetric indefinite matrix using Intel PARDISO.\n - The argument is dcovector b. - b is overwritten and become the solution x. - A is not overwritten. -*/ -inline CPPL_INT dssmatrix::pardiso_indefinite(dcovector& b) const -{CPPL_VERBOSE_REPORT; -#ifndef __INTEL_COMPILER - ERROR_REPORT; - std::cerr << "dssmatrix::pardiso_indefinite is only for intel c++ compiler (icpc)." << std::endl; - std::cerr << "Recompile your code with icpc to use pardiso." << std::endl; - (void)b; - exit(1); -#else //__INTEL_COMPILER - - - //#ifdef CPPL_DEBUG - if(m!=b.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << b.l << ")." << std::endl; - exit(1); - } - //#endif//CPPL_DEBUG - - //////// convert matrix storage into compressed sparse row format //////// - //std::cerr << "converting" << std::endl; - std::vector<double> a(data.size()); - std::vector<MKL_INT> ja(data.size()); - std::vector<MKL_INT> ia(m+1); - ia[0] =0; - MKL_INT k=0; - for(CPPL_INT i=0; i<m; i++){ - //// make map //// - const std::vector<CPPL_INT>::const_iterator line_i_end =line[i].end(); - std::map<CPPL_INT,CPPL_INT> jc; - for(std::vector<CPPL_INT>::const_iterator lit=line[i].begin(); lit!=line_i_end; lit++){ - if(data[*lit].j==i){//pardiso needs upper triangle part. - jc.insert( std::make_pair(data[*lit].i, *lit) ); - } - } - //// assign //// - const std::map<CPPL_INT,CPPL_INT>::const_iterator jc_end =jc.end(); - for(std::map<CPPL_INT,CPPL_INT>::const_iterator jcit=jc.begin(); jcit!=jc_end; jcit++){ - a[k] =data[(*jcit).second].v; - ja[k] =MKL_INT((*jcit).first);//zero-base - k++; - } - ia[i+1] =k;//zero-base - } - - //////// pardisoinit //////// - //std::cerr << "initializing" << std::endl; - //_MKL_DSS_HANDLE_t pt[64]; - void* pt[64]; - MKL_INT mtype =-2;//real and symmetric indefinite - MKL_INT iparm[64]; - PARDISOINIT(pt, &mtype, iparm); - //iparm[1] =3;//parallel fill-in reducing ordering [BUGGY on MKL 11.3]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - iparm[1] =0;//serial fill-in reducing ordering [STABLE] - iparm[23] =1;//use two-level scheduling factorization algorithm - iparm[26] =0;//disable matrix checker - iparm[34] =-1;//use zero-base array index - - //////// pardiso //////// - //std::cerr << "solving" << std::endl; - MKL_INT maxfct =1; - MKL_INT mnum =1; - MKL_INT phase =13; - MKL_INT MKL_INT_n =MKL_INT(n); - std::vector<MKL_INT> perm(n); - MKL_INT nrhs =1; - MKL_INT msglvl =0; - dcovector x(b.l); - MKL_INT error =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, &a[0], &ia[0], &ja[0], &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error); - swap(b,x);//set b as x - if(error!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. error = " << error << "." << std::endl; - } - - //////// release memory //////// - phase =-1; - MKL_INT error2 =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, &a[0], &ia[0], &ja[0], &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error2); - - return error; -#endif //__INTEL_COMPILER -} diff --git a/cpplapack-r198/.svn/pristine/79/796538d2d4a7097fb96a605d3fc71f45ccbb9858.svn-base b/cpplapack-r198/.svn/pristine/79/796538d2d4a7097fb96a605d3fc71f45ccbb9858.svn-base deleted file mode 100644 index 2ddfa10d7a44b72460dce8b400be31e1ee436833..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/79/796538d2d4a7097fb96a605d3fc71f45ccbb9858.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - //// make dgematrix A //// - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// print A in two ways //// - std::cout << "A =\n" << A << std::endl; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - std::cout << "A(" << i << "," << j << ") =" << A(i,j) << std::endl; - }} - - //// make A 10 times //// - std::cout << "#### A*=10.; ####" << std::endl; - A*=10.; - - //// make dgematrix B //// - CPPL::dgematrix B(A); - std::cout << "B =\n" << B << std::endl; - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - std::cout << "B(" << i << "," << j << ") =" << B(i,j) << std::endl; - }} - - //// print A+B //// - std::cout << "A+B=\n" << A+B << std::endl; - - //// write/read //// - std::cout << "writeing B into tmp.txt" << std::endl; - B.write( "tmp.txt" ); - CPPL::dgematrix C; - std::cout << "reading tmp.txt into C" << std::endl; - C.read( "tmp.txt" ); - std::cout << "C-B =\n" << C-B << "<-Should be zero." << std::endl; - - - //// const //// - const CPPL::dgematrix X( CPPL::dgematrix(2,2) - .set(0,0,1).set(0,1,2).set(1,0,3).set(1,1,4) ); - std::cout << "X=\n" << X << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/79/7989116864f94938bf5dadafdf3c10571c7a8ba7.svn-base b/cpplapack-r198/.svn/pristine/79/7989116864f94938bf5dadafdf3c10571c7a8ba7.svn-base deleted file mode 100644 index d2250b18c8dde749b806272bd54e0929c89d9d4d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/79/7989116864f94938bf5dadafdf3c10571c7a8ba7.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(4), KL(2), KU(1); - - CPPL::dgbmatrix A(M,N,KL,KU), B; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ A(i,j) =double( rand() /(RAND_MAX/10) ); } - }} - - cout << "A =\n" << A << endl; - cout << "#### B.copy(A) ####" << endl; - B.copy(A); - cout << "B =\n" << B << endl; - - cout << "#### B.clear() ####" << endl; - B.clear(); - cout << "B =\n" << B << endl; - - cout << "#### B.resize(4,4,1,2) & B.zero() ####" << endl; - B.resize(4,4,1,2); - B.zero(); - cout << "B =\n" << B << endl; - - cout << "#### B.identity() ####" << endl; - B.identity(); - cout << "B =\n" << B << endl; - - cout << "B(0,:)=\n" << B.row(0) << endl; - cout << "B(:,0)=\n" << B.col(0) << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/79/79891de5cda4d8f30379a011fc45f62b340cae4c.svn-base b/cpplapack-r198/.svn/pristine/79/79891de5cda4d8f30379a011fc45f62b340cae4c.svn-base deleted file mode 100644 index 1643c255ecfb1c719b5f7a470bbe9b4285c5839d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/79/79891de5cda4d8f30379a011fc45f62b340cae4c.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! zgematrix_small constructor */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>::zgematrix_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! zgematrix_small constructor */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>::zgematrix_small(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( m!=mat.m || n!=mat.n ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be the same." << std::endl - << "Your input was " << m << "x" << n << " and " << mat.m << "x" << mat.n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<m*n; k++){ - array[k] =mat.array[k]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix_small destructor */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n>::~zgematrix_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/79/79aaffb5dc71fc34511597cab5bfe51e837cae49.svn-base b/cpplapack-r198/.svn/pristine/79/79aaffb5dc71fc34511597cab5bfe51e837cae49.svn-base deleted file mode 100644 index 20c262117b738602c69310d4ee1b1d31b7326d0e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/79/79aaffb5dc71fc34511597cab5bfe51e837cae49.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! +zgematrix operator */ -inline const zgematrix& operator+(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -zgematrix operator */ -inline _zgematrix operator-(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m,mat.n); - for(CPPL_INT i=0; i<newmat.m*newmat.n; i++){ newmat.array[i]=-mat.array[i]; } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/79/79bc3b82963ecdc65ed5b0bcf492aa6b384a3b83.svn-base b/cpplapack-r198/.svn/pristine/79/79bc3b82963ecdc65ed5b0bcf492aa6b384a3b83.svn-base deleted file mode 100644 index fd067464d5746ff1ae3cbde846def182d2c05445..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/79/79bc3b82963ecdc65ed5b0bcf492aa6b384a3b83.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -//============================================================================= -/*! dssmatrix*=double operator */ -inline dssmatrix& dssmatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v *=d; - } - - return *this; -} - -//============================================================================= -/*! dssmatrix/=double operator */ -inline dssmatrix& dssmatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v /=d; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix*double operator */ -inline _dssmatrix operator*(const dssmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dssmatrix newmat(mat); - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *=d; - } - - return _(newmat); -} - -//============================================================================= -/*! dssmatrix/double operator */ -inline _dssmatrix operator/(const dssmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dssmatrix newmat(mat); - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v /=d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/7a/7aa659b1bca1b249ac0780961a35ec36e94c5dea.svn-base b/cpplapack-r198/.svn/pristine/7a/7aa659b1bca1b249ac0780961a35ec36e94c5dea.svn-base deleted file mode 100644 index bc5c77c0bf57c2611ab24007ef9d36896ded6c32..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7a/7aa659b1bca1b249ac0780961a35ec36e94c5dea.svn-base +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################### -## Makefile ## -############################################################################### - -CXX = g++ - -######## FLAGS ######## -FLAGS += -O3 -funroll-loops -ffast-math #-mfpmath=sse -FLAGS += -fomit-frame-pointer #-ftree-vectorizer-verbose=5 -#FLAGS = -march=core2 -msse4.1 -FLAGS += -std=c++0x # -std=c++98 # -##FLAGS += -fprefetch-loop-arrays -fforce-addr -march=pentium4 -ftree-vectorize -funsafe-loop-optimizations -Wunsafe-loop-optimizations -##FLAGS += -malign-double -#FLAGS += -fopenmp - -######## LFLAGS ######## -LFLAGS = $(FLAGS) -#LFLAGS += -static - -######## CFLAGS ######## -CFLAGS = $(FLAGS) -##CFLAGS += --param large-function-growth=99999 --param max-inline-insns-single=99999 --param inline-unit-growth=99999 -Winline -####CFLAGS += -fimplement-inlines -finline-limit=0 --param large-function-growth=0 --param max-inline-insns-single=0 --param inline-unit-growth=0 -CFLAGS += -Wall -Wno-unknown-pragmas -Wextra -ftree-vectorizer-verbose=0 - -######## others ######## -INCLUDE_DIRS = -I./ -I$(HOME)/local/cpplapack/include -#INCLUDE_DIRS += $(shell Magick++-config --cppflags) -#LIB_DIRS = $(shell Magick++-config --ldflags) -#LIBS = /usr/lib/sse2/liblapack.a /usr/lib/sse2/libblas.a -lm -lgfortran -LIBS = -llapack -lblas -lm -lgfortran -LIBS += -lboost_filesystem -#LIBS += $(shell Magick++-config --libs) -MACROS = - -############################# -######### profiling ######### -############################# -#CFLAGS += -pg #-g -#LFLAGS += -pg #-g -#LIBS = $(HOME)/opt/lapack-3.1.1/lapack_gprof.a $(HOME)/opt/lapack-3.1.1/blas_gprof.a -lm -lgfortran -#LIBS = $(HOME)/opt/lapack-3.1.1/lapack_gprof.a $(HOME)/opt/lapack-3.1.1/blas_gprof.a $(HOME)/opt/STLport-5.1.3/lib/libstlport_gprof.a -lm -lgfortran - -############################# -######### debugging ######### -############################# -ifdef DEBUG -FLAGS = -g -O0 -CFLAGS = $(FLAGS) -Wall -Wno-unknown-pragmas -Wextra -fstack-protector-all -fbounds-check -LFLAGS = $(FLAGS) -##LIBS += -lefence -MACROS = -DCPPL_DEBUG ####-DCPPL_VERBOSE -endif diff --git a/cpplapack-r198/.svn/pristine/7a/7af0d3d90be449756a63bf512ba10d84c341ffd0.svn-base b/cpplapack-r198/.svn/pristine/7a/7af0d3d90be449756a63bf512ba10d84c341ffd0.svn-base deleted file mode 100644 index 3ba2a6210512d834c48c4c5c49383f90e1557d4d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7a/7af0d3d90be449756a63bf512ba10d84c341ffd0.svn-base +++ /dev/null @@ -1,151 +0,0 @@ -%TGIF 4.1.43-QPL -state(0,37,100.000,0,0,0,4,1,9,1,1,1,0,1,0,1,1,'Helvetica',0,103680,0,0,0,10,0,0,1,1,0,16,0,0,1,1,1,1,1485,1050,0,0,2880,1). -% -% @(#)$Header$ -% %W% -% -unit("1 pixel/pixel"). -color_info(30,65535,0,[ - "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, - "red", 65535, 0, 0, 65535, 0, 0, 1, - "green", 0, 65535, 0, 0, 65535, 0, 1, - "blue", 0, 0, 65535, 0, 0, 65535, 1, - "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, - "pink", 65535, 49344, 52171, 65535, 49344, 52171, 1, - "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, - "CadetBlue", 24415, 40606, 41120, 24415, 40606, 41120, 1, - "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, - "black", 0, 0, 0, 0, 0, 0, 1, - "#ff4d4d", 65535, 19789, 19789, 65280, 19712, 19712, 1, - "#ff9c4d", 65535, 40092, 19789, 65280, 39936, 19712, 1, - "#ffec4d", 65535, 60652, 19789, 65280, 60416, 19712, 1, - "#c4ff4d", 50372, 65535, 19789, 50176, 65280, 19712, 1, - "#75ff4d", 30069, 65535, 19789, 29952, 65280, 19712, 1, - "#4dff75", 19789, 65535, 30069, 19712, 65280, 29952, 1, - "#4dffc4", 19789, 65535, 50372, 19712, 65280, 50176, 1, - "#4decff", 19789, 60652, 65535, 19712, 60416, 65280, 1, - "#4d9cff", 19789, 40092, 65535, 19712, 39936, 65280, 1, - "#4d4dff", 19789, 19789, 65535, 19712, 19712, 65280, 1, - "#fffffe", 65535, 65535, 65278, 65280, 65280, 65024, 1, - "#e0e0e0", 57568, 57568, 57568, 57344, 57344, 57344, 1, - "#d0d0d0", 53456, 53456, 53456, 53248, 53248, 53248, 1, - "#c0c0c0", 49344, 49344, 49344, 49152, 49152, 49152, 1, - "#b0b0b0", 45232, 45232, 45232, 45056, 45056, 45056, 1, - "#a0a0a0", 41120, 41120, 41120, 40960, 40960, 40960, 1, - "#808080", 32896, 32896, 32896, 32768, 32768, 32768, 1, - "#404040", 16448, 16448, 16448, 16384, 16384, 16384, 1, - "#101010", 4112, 4112, 4112, 4096, 4096, 4096, 1, - "#000001", 0, 0, 257, 0, 0, 256, 1 -]). -script_frac("0.6"). -fg_bg_colors('black','white'). -dont_reencode("FFDingbests:ZapfDingbats"). -page(1,"",1,''). -box('black','',552,128,608,164,0,1,1,80,0,0,0,0,0,'1',0,[ -]). -box('black','',452,128,508,164,0,1,1,170,0,0,0,0,0,'1',0,[ -]). -box('black','',396,128,452,164,5,1,1,168,0,0,0,0,0,'1',1,[ -]). -box('black','',340,128,396,164,5,1,1,164,0,0,0,0,0,'1',1,[ -]). -box('black','',240,128,296,164,5,1,1,127,0,0,0,0,0,'1',1,[ -]). -box('black','',184,128,240,164,5,1,1,126,0,0,0,0,0,'1',1,[ -]). -box('black','',128,128,184,164,5,1,1,122,0,0,0,0,0,'1',1,[ -]). -text('black',156,134,1,1,1,10,22,36,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "0")]) -]) -])]). -text('black',212,134,1,1,1,10,22,38,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-3,0,0,0,0,0, - "1")]) -]) -])]). -text('black',268,134,1,1,1,10,22,45,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "2")]) -]) -])]). -text('black',368,134,1,1,1,42,22,87,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,152,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-1,0,0,0,0,0, - "vol-2")]) -]) -])]). -text('black',580,134,1,1,1,47,22,96,18,4,0,0,0,0,2,47,22,0,0,"",0,0,0,0,152,'',[ -minilines(47,22,0,0,1,0,0,[ -mini_line(47,18,4,0,0,0,[ -str_block(0,47,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,47,18,4,0,-3,0,0,0,0,0, - "cap-1")]) -]) -])]). -oval('black','',304,144,308,148,1,3,1,135,0,0,0,0,0,'3',0,[ -]). -oval('black','',316,144,320,148,1,3,1,148,0,0,0,0,0,'3',0,[ -]). -oval('black','',328,144,332,148,1,3,1,149,0,0,0,0,0,'3',0,[ -]). -text('black',424,134,1,1,1,42,22,167,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,152,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-3,0,0,0,0,0, - "vol-1")]) -]) -])]). -text('black',480,134,1,1,1,25,22,169,18,4,0,0,0,0,2,25,22,0,0,"",0,0,0,0,152,'',[ -minilines(25,22,0,0,1,0,0,[ -mini_line(25,18,4,0,0,0,[ -str_block(0,25,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,25,18,4,0,-1,0,0,0,0,0, - "vol")]) -]) -])]). -oval('black','',516,144,520,148,1,3,1,181,0,0,0,0,0,'3',0,[ -]). -oval('black','',528,144,532,148,1,3,1,182,0,0,0,0,0,'3',0,[ -]). -oval('black','',540,144,544,148,1,3,1,183,0,0,0,0,0,'3',0,[ -]). -poly('black','',4,[ - 128,124,128,116,452,116,452,124],0,2,1,347,0,0,0,0,0,0,0,'2',1,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -text('black',288,94,1,1,1,115,22,350,18,4,0,0,0,0,2,115,22,0,0,"",0,0,0,1,112,'',[ -minilines(115,22,0,0,1,0,0,[ -mini_line(115,18,4,0,0,0,[ -str_block(0,115,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,115,18,4,0,-1,0,0,0,0,0, - "Effective Data")]) -]) -])]). -poly('black','',4,[ - 128,96,128,76,608,76,608,96],0,2,1,353,0,0,0,0,0,0,0,'2',1,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -text('black',368,54,1,1,1,115,22,361,18,4,0,0,0,0,2,115,22,0,0,"",0,0,0,1,72,'',[ -minilines(115,22,0,0,1,0,0,[ -mini_line(115,18,4,0,0,0,[ -str_block(0,115,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,115,18,4,0,-1,0,0,0,0,0, - "Data Capacity")]) -]) -])]). diff --git a/cpplapack-r198/.svn/pristine/7b/7b783f5322d58dda351cf2bdc474d69f8c72040c.svn-base b/cpplapack-r198/.svn/pristine/7b/7b783f5322d58dda351cf2bdc474d69f8c72040c.svn-base deleted file mode 100644 index e93d71feb2c2d1029bb4cb747b860515273bceb3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7b/7b783f5322d58dda351cf2bdc474d69f8c72040c.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! +_zgsmatrix operator */ -inline const _zgsmatrix& operator+(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_zgsmatrix operator */ -inline _zgsmatrix operator-(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v = -it->v; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/7b/7b814d08bad878c35bd132fd025d850c13d151ad.svn-base b/cpplapack-r198/.svn/pristine/7b/7b814d08bad878c35bd132fd025d850c13d151ad.svn-base deleted file mode 100644 index 6aaaf401a224ec1bd243e574b459531161320d8a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7b/7b814d08bad878c35bd132fd025d850c13d151ad.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -//============================================================================= -/*! dgsmatrix*=double operator */ -inline dgsmatrix& dgsmatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v *=d; - } - - return *this; -} - -//============================================================================= -/*! dgsmatrix/=double operator */ -inline dgsmatrix& dgsmatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v /=d; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix*double operator */ -inline _dgsmatrix operator*(const dgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgsmatrix newmat(mat); - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *=d; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix/double operator */ -inline _dgsmatrix operator/(const dgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgsmatrix newmat(mat); - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v /=d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/7b/7be82f314e204d754747d135fdd512da86c6536d.svn-base b/cpplapack-r198/.svn/pristine/7b/7be82f314e204d754747d135fdd512da86c6536d.svn-base deleted file mode 100644 index c96e3002db89701e471a3f65f86a503f7528b199..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7b/7be82f314e204d754747d135fdd512da86c6536d.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -//============================================================================= -/*! _dgematrix+dsymatrix operator */ -inline _dgematrix operator+(const dsymatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++) { - for(CPPL_INT j=0; j<matA.n; j++) { - matB(i,j) += matA(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! _dgematrix-dgematrix operator */ -inline _dgematrix operator-(const dsymatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - matB(i,j) =matA(i,j)-matB(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! _dgematrix*dgematrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/7b/7beb78fc4567e9e5cb05ce69b5e4467f369f02b7.svn-base b/cpplapack-r198/.svn/pristine/7b/7beb78fc4567e9e5cb05ce69b5e4467f369f02b7.svn-base deleted file mode 100644 index 9ee2963efe0ecc9f70fda1191c41ebaa548fe8cf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7b/7beb78fc4567e9e5cb05ce69b5e4467f369f02b7.svn-base +++ /dev/null @@ -1,39 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::zhematrix A(N), B(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - B(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - - cout << "A+B =\n" << A+B << endl; - cout << "A-B =\n" << A-B << endl; - cout << "A*B =\n" << A*B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/7c/7cc34a7b1ee11e4820fdf2e4ecbfbde337c29ea2.svn-base b/cpplapack-r198/.svn/pristine/7c/7cc34a7b1ee11e4820fdf2e4ecbfbde337c29ea2.svn-base deleted file mode 100644 index e87b9d367a9acd4579e6a24ebc6552f46b36f526..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7c/7cc34a7b1ee11e4820fdf2e4ecbfbde337c29ea2.svn-base +++ /dev/null @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{61037E7C-EF94-43D7-B5DF-74F1BEB33710}</ProjectGuid> - <RootNamespace>Test</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>Application</ConfigurationType> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> - <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>C:\cpplapack\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>CPPL_DEBUG;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <MinimalRebuild>true</MinimalRebuild> - <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>EditAndContinue</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>libf2c.lib;BLAS.lib;clapack.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\cpplapack\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <IgnoreSpecificDefaultLibraries>LIBCMT;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Console</SubSystem> - <TargetMachine>MachineX86</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <Optimization>MaxSpeed</Optimization> - <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>C:\cpplapack\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <FunctionLevelLinking>true</FunctionLevelLinking> - <PrecompiledHeader> - </PrecompiledHeader> - <WarningLevel>Level3</WarningLevel> - <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - </ClCompile> - <Link> - <AdditionalDependencies>libf2c.lib;BLAS.lib;clapack.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\cpplapack\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> - <GenerateDebugInformation>true</GenerateDebugInformation> - <SubSystem>Console</SubSystem> - <OptimizeReferences>true</OptimizeReferences> - <EnableCOMDATFolding>true</EnableCOMDATFolding> - <TargetMachine>MachineX86</TargetMachine> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="main.cpp" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project> \ No newline at end of file diff --git a/cpplapack-r198/.svn/pristine/7d/7d4a867797617593aafebd85616772161c21a355.svn-base b/cpplapack-r198/.svn/pristine/7d/7d4a867797617593aafebd85616772161c21a355.svn-base deleted file mode 100644 index 614bc9b72b5eae93c3df728ab38a3a40ace774df..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7d/7d4a867797617593aafebd85616772161c21a355.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _zrovector*zhematrix operator */ -inline _zrovector operator*(const _zrovector& vec, const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/7d/7d78139c5563f7940f73c704b60510342c2194ee.svn-base b/cpplapack-r198/.svn/pristine/7d/7d78139c5563f7940f73c704b60510342c2194ee.svn-base deleted file mode 100644 index a08a3cf423f91ff0c7aebf5bd430ffa7b188f155..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7d/7d78139c5563f7940f73c704b60510342c2194ee.svn-base +++ /dev/null @@ -1,200 +0,0 @@ -<?xml version="1.0" encoding="shift_jis"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="vc_sample" - ProjectGUID="{61037E7C-EF94-43D7-B5DF-74F1BEB33710}" - RootNamespace="Test" - Keyword="Win32Proj" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="C:\cpplapack\include" - PreprocessorDefinitions="CPPL_DEBUG;WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="1" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libf2c.lib BLAS.lib clapack.lib" - LinkIncremental="2" - AdditionalLibraryDirectories="C:\cpplapack\lib" - IgnoreDefaultLibraryNames="LIBCMT" - GenerateDebugInformation="true" - SubSystem="1" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="C:\cpplapack\include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="0" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="3" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="libf2c.lib BLAS.lib clapack.lib" - LinkIncremental="1" - AdditionalLibraryDirectories="C:\cpplapack\lib" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="source files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\main.cpp" - > - </File> - </Filter> - <Filter - Name="header files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - <Filter - Name="resource files" - Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" - UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/cpplapack-r198/.svn/pristine/7d/7db6f397ea9444ad092ad5f5a0c1b1a5c9b02910.svn-base b/cpplapack-r198/.svn/pristine/7d/7db6f397ea9444ad092ad5f5a0c1b1a5c9b02910.svn-base deleted file mode 100644 index 3d661b8f8d73ca95187be7e40febfdb0d1b98774..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7d/7db6f397ea9444ad092ad5f5a0c1b1a5c9b02910.svn-base +++ /dev/null @@ -1,242 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void zgematrix::clear() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - delete [] array; - array =NULL; - delete [] darray; - darray =NULL; -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline zgematrix& zgematrix::zero() -{CPPL_VERBOSE_REPORT; - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =comple(0.,0.); - } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline zgematrix& zgematrix::identity() -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "Only square matrix can be a identity matrix." << std::endl - << "The matrix size was " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =comple(0.,0.); - } - for(CPPL_INT i=0; i<m; i++){ - operator()(i,i) =comple(1.,0.); - } - - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void zgematrix::chsign() -{CPPL_VERBOSE_REPORT; - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =-array[i]; - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void zgematrix::copy(const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - delete [] array; - array =new comple[m*n]; - delete [] darray; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } - - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - zcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void zgematrix::shallow_copy(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - delete [] array; - array =mat.array; - delete [] darray; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline void zgematrix::resize(const CPPL_INT& _m, const CPPL_INT& _n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers." << std::endl - << "Your input was (" << _m << "," << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - m =_m; - n =_n; - delete [] array; - array =new comple[m*n]; - delete [] darray; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _zrovector zgematrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector v(n); - for(CPPL_INT j=0; j<n; j++){ - v(j)=(*this)(_m,j); - } - return _(v); -} - -//============================================================================= -/*! get column of the matrix */ -inline _zcovector zgematrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector v(m); - for(CPPL_INT i=0; i<m; i++){ - v(i)=(*this)(i,_n); - } - return _(v); -} - -//============================================================================= -/*! extract the real part of the matrixr */ -inline _dgematrix zgematrix::real() const -{CPPL_VERBOSE_REPORT; - dgematrix mat(m,n); - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =array[i].real(); - } - return _(mat); -} - -//============================================================================= -/*! extract the imag part of the matrix */ -inline _dgematrix zgematrix::imag() const -{CPPL_VERBOSE_REPORT; - dgematrix mat(m,n); - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =array[i].imag(); - } - return _(mat); -} - -//============================================================================= -/*! extract the absolute of the matrix */ -inline _dgematrix zgematrix::abs() const -{CPPL_VERBOSE_REPORT; - dgematrix mat(m,n); - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =std::abs(array[i]); - } - return _(mat); -} - -//============================================================================= -/*! extract the argument of the matrix */ -inline _dgematrix zgematrix::arg() const -{CPPL_VERBOSE_REPORT; - dgematrix mat(m,n); - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - mat.array[i] =std::arg(array[i]); - } - return _(mat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(zgematrix& A, zgematrix& B) -{CPPL_VERBOSE_REPORT; - CPPL_INT A_m =A.m, A_n =A.n; - comple* A_array =A.array; - comple** A_darray =A.darray; - A.m=B.m; A.n=B.n; A.array=B.array; A.darray=B.darray; - B.m=A_m; B.n=A_n; B.array=A_array; B.darray=A_darray; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _zgematrix _(zgematrix& mat) -{CPPL_VERBOSE_REPORT; - _zgematrix newmat; - - //////// shallow copy //////// - newmat.m =mat.m; - newmat.n =mat.n; - newmat.array =mat.array; - newmat.darray =mat.darray; - - //////// nullify //////// - mat.m =0; - mat.n =0; - mat.array =NULL; - mat.darray =NULL; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/7e/7e23e1b3c83f5c16e705b41fec9996942f5e2cd9.svn-base b/cpplapack-r198/.svn/pristine/7e/7e23e1b3c83f5c16e705b41fec9996942f5e2cd9.svn-base deleted file mode 100644 index 84d137d1c389e107fb08f0dcb2e85148f5acaf91..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7e/7e23e1b3c83f5c16e705b41fec9996942f5e2cd9.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -//============================================================================= -/*! dgsmatrix constructor without arguments */ -inline dgsmatrix::dgsmatrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - data.clear(); - rows.clear(); - cols.clear(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix copy constructor */ -inline dgsmatrix::dgsmatrix(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - data.clear(); - rows.clear(); - cols.clear(); - copy(mat); -} - -//============================================================================= -/*! dgsmatrix constructor to cast _dgsmatrix */ -inline dgsmatrix::dgsmatrix(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - data.clear(); - rows.clear(); - cols.clear(); - - data.swap(mat.data); - rows.swap(mat.rows); - cols.swap(mat.cols); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix constructor with size specification */ -inline dgsmatrix::dgsmatrix(const CPPL_INT& _m, const CPPL_INT& _n, const CPPL_INT _c) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _c<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl - << "Your input was (" << _m << "," << _n << "," << _c << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - m =_m; - n =_n; - data.resize(0); - data.reserve(_c); - rows.resize(m); - cols.resize(n); -} - -//============================================================================= -/*! dgsmatrix constructor with filename */ -inline dgsmatrix::dgsmatrix(const char* filename) -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix destructor */ -inline dgsmatrix::~dgsmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/7f/7f0158e5540aa46e4a1f55cb219c096799c37d44.svn-base b/cpplapack-r198/.svn/pristine/7f/7f0158e5540aa46e4a1f55cb219c096799c37d44.svn-base deleted file mode 100644 index fd6a84ea936cd47d968f724680027fea8322bb04..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7f/7f0158e5540aa46e4a1f55cb219c096799c37d44.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! +zhsmatrix operator */ -inline const zhsmatrix& operator+(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -zhsmatrix operator */ -inline _zhsmatrix operator-(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v =-it->v; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/7f/7f5b5530fb54cb6c42640dd5d439591eb2ea7582.svn-base b/cpplapack-r198/.svn/pristine/7f/7f5b5530fb54cb6c42640dd5d439591eb2ea7582.svn-base deleted file mode 100644 index 1c3aafbf09517cfe216f1a61947abfe1c2acb0bf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7f/7f5b5530fb54cb6c42640dd5d439591eb2ea7582.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(3), CAP(4); - - CPPL::dgsmatrix A(M,N,CAP); - A.put(0,0, 1.); - A.put(3,2, 2.); - A.put(1,2, 3.); - A.put(4,1, 4.); - std::cout << "A =\n" << A << std::endl;; - - CPPL::dcovector x(N); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - std::cout << "x =\n" << x << std::endl;; - - std::cout << "A*x =\n" << A*x << std::endl;; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/7f/7fd6ce1caeeb13e375e6015a1863c255235c1ce7.svn-base b/cpplapack-r198/.svn/pristine/7f/7fd6ce1caeeb13e375e6015a1863c255235c1ce7.svn-base deleted file mode 100644 index 2e78c6868580dfeaf63d3abbf2df211a4bdb1ff3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7f/7fd6ce1caeeb13e375e6015a1863c255235c1ce7.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+dgsmatrix operator */ -inline _dgsmatrix operator+(const _dgsmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix-dgsmatrix operator */ -inline _dgsmatrix operator-(const _dgsmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix*dgsmatrix operator */ -inline _dgsmatrix operator*(const _dgsmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat( matA.m, matB.n ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::const_iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::const_iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/7f/7fdce7ac13eb29ce20c3f01ecd3c1257240cb6ff.svn-base b/cpplapack-r198/.svn/pristine/7f/7fdce7ac13eb29ce20c3f01ecd3c1257240cb6ff.svn-base deleted file mode 100644 index 47fe695644fd7c07fe2afb1a6abc716ecd0d5f47..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7f/7fdce7ac13eb29ce20c3f01ecd3c1257240cb6ff.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(6), N(5), KL(2), KU(1); - - CPPL::dgbmatrix A; - cout << "A ||" - << " m=" << A.m << ", n=" << A.n - << " kl=" << A.kl << ", ku=" << A.ku - << ", array=" << A.array << endl; - - - CPPL::dgbmatrix B(M,N,KL,KU); - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - if( !((i-j)>B.kl || (j-i)>B.ku) ){ B(i,j) =double( rand() /(RAND_MAX/10) ); } - }} - cout << "B ||" - << " m=" << B.m << ", n=" << B.n - << " kl=" << B.kl << ", ku=" << B.ku - << ", array=" << B.array << endl; - cout << "B =\n" << B << endl; - - - CPPL::dgbmatrix C(B); - cout << "C ||" - << " m=" << C.m << ", n=" << C.n - << " kl=" << C.kl << ", ku=" << C.ku - << ", array=" << C.array << endl; - cout << "C =\n" << C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/7f/7fde3ee0d068d3cd793a7d52a327fffdfde4d937.svn-base b/cpplapack-r198/.svn/pristine/7f/7fde3ee0d068d3cd793a7d52a327fffdfde4d937.svn-base deleted file mode 100644 index 79894ff54712dc67f9ff7e8074e6976cc4db13e4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7f/7fde3ee0d068d3cd793a7d52a327fffdfde4d937.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -//============================================================================= -//! Samll Complex Double-precision General Dence Matrix Class -template<CPPL_INT m, CPPL_INT n> class zgematrix_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - comple array[m*n]; - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zgematrix_small(); - inline explicit zgematrix_small(const zgematrix&); - inline ~zgematrix_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline comple& operator()(const CPPL_INT& i, const CPPL_INT& j); - inline comple operator()(const CPPL_INT& i, const CPPL_INT& j) const; - inline zgematrix_small<m,n>& set(const CPPL_INT& i, const CPPL_INT& j, const comple& v); - template<CPPL_INT _m, CPPL_INT _n> inline friend std::ostream& operator<<(std::ostream&, const zgematrix_small<_m,_n>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// calc //////// -#ifndef _MSC_VER - template<CPPL_INT _m, CPPL_INT _n> inline friend zgematrix_small<n,m> t(const zgematrix_small<m,n>&); -#endif//_MSC_VER - - //////// misc //////// - inline zgematrix_small<m,n>& zero(); - inline zgematrix_small<m,n>& identity(); - inline zcovector_small<m> col(const CPPL_INT& j) const; - inline zrovector_small<n> row(const CPPL_INT& i) const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT M, CPPL_INT N> inline zgematrix_small<M,N>& operator= (const zgematrix_small<M,N>&); - //////// += //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N>& operator+=(zgematrix_small<M,N>&, const zgematrix_small<M,N>&); - //////// -= //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N>& operator-=(zgematrix_small<M,N>&, const zgematrix_small<M,N>&); - //////// *= //////// - template<CPPL_INT M, CPPL_INT L, CPPL_INT N> inline friend zgematrix_small<M,N>& operator*=(zgematrix_small<M,L>&, const zgematrix_small<L,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N>& operator*=(zgematrix_small<M,N>&, const double&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N>& operator*=(zgematrix_small<M,N>&, const comple&); - //////// /= //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N>& operator/=(zgematrix_small<M,N>&, const double&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N>& operator/=(zgematrix_small<M,N>&, const comple&); - //////// unary //////// - template<CPPL_INT M, CPPL_INT N> inline friend const zgematrix_small<M,N>& operator+(const zgematrix_small<M,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator-(const zgematrix_small<M,N>&); - //////// + //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator+(const zgematrix_small<M,N>&, const zgematrix_small<M,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator+(const zgematrix_small<M,N>&, const zhematrix_small< N >&); - //////// - //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator-(const zgematrix_small<M,N>&, const zgematrix_small<M,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator-(const zgematrix_small<M,N>&, const zhematrix_small< N >&); - //////// * //////// - template<CPPL_INT M, CPPL_INT N> inline friend zcovector_small< M > operator*(const zgematrix_small<M,N>&, const zcovector_small< N >&); - template<CPPL_INT M, CPPL_INT L, CPPL_INT N> inline friend zgematrix_small<M,N> operator*(const zgematrix_small<M,L>&, const zgematrix_small<L,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator*(const zgematrix_small<M,N>&, const zhematrix_small< N >&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator*(const zgematrix_small<M,N>&, const double&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator*(const zgematrix_small<M,N>&, const comple&); - //////// / //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator/(const zgematrix_small<M,N>&, const double&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator/(const zgematrix_small<M,N>&, const comple&); - //////// comple //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator*(const double&, const zgematrix_small<M,N>&); - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> operator*(const comple&, const zgematrix_small<M,N>&); - //////// hadamerd //////// - template<CPPL_INT M, CPPL_INT N> inline friend zgematrix_small<M,N> hadamerd(const zgematrix_small<M,N>&, const zgematrix_small<M,N>&); - template<CPPL_INT N> inline friend zgematrix_small<N,N> hadamerd(const zgematrix_small<N,N>&, const zhematrix_small< N >&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline comple det(const zgemat2&); -inline zgemat2 inv(const zgemat2&); -inline comple det(const zgemat3&); -inline zgemat3 inv(const zgemat3&); diff --git a/cpplapack-r198/.svn/pristine/7f/7fed0f42b9bb408c6bf7297e7a6f94731ca5c60c.svn-base b/cpplapack-r198/.svn/pristine/7f/7fed0f42b9bb408c6bf7297e7a6f94731ca5c60c.svn-base deleted file mode 100644 index cd4ea3e1fa82b509e5c4cbd4d362dcf4f32f16b1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7f/7fed0f42b9bb408c6bf7297e7a6f94731ca5c60c.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! zgbmatrix+zhematrix operator */ -inline _zgematrix operator+(const zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)+=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix-zhematrix operator */ -inline _zgematrix operator-(const zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=max(0,i-matA.kl); j<min(matA.n,i+matA.ku+1); j++){ - newmat(i,j)-=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix*zhematrix operator */ -inline _zgematrix operator*(const zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=max(0,matB.indx[c]-(matA.ku+1)); - i<min(matA.m,matB.indx[c]+matA.kl); i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/7f/7ff8baa22197ed4d1119a3ee788205df0aced813.svn-base b/cpplapack-r198/.svn/pristine/7f/7ff8baa22197ed4d1119a3ee788205df0aced813.svn-base deleted file mode 100644 index 51daad8e3d38ecc9d6b95bdaa54e4b829dd5d110..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/7f/7ff8baa22197ed4d1119a3ee788205df0aced813.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -/*! _dsymatrix+dgbmatrix operator */ -inline _dgematrix operator+(const _dsymatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix-dgbmatrix operator */ -inline _dgematrix operator-(const _dsymatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgematrix*dgbmatrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) +=matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/80/80726ac45305f73787977d648b6614e86c5ed4b4.svn-base b/cpplapack-r198/.svn/pristine/80/80726ac45305f73787977d648b6614e86c5ed4b4.svn-base deleted file mode 100644 index 2a765bafbbee8644fcd17089bda8d1b86eec3180..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/80/80726ac45305f73787977d648b6614e86c5ed4b4.svn-base +++ /dev/null @@ -1,203 +0,0 @@ -//============================================================================= -/*! dgematrix=dgematrix operator */ -inline dgematrix& dgematrix::operator=(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - if(array!=mat.array){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+=dgematrix operator */ -inline dgematrix& dgematrix::operator+=(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =m*n; - for(CPPL_INT i=0; i<mn; i++){ - array[i]+=mat.array[i]; - } - return *this; -} - -//============================================================================= -/*! dgematrix operator-= */ -inline dgematrix& dgematrix::operator-=(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =m*n; - for(CPPL_INT i=0; i<mn; i++){ - array[i]-=mat.array[i]; - } - return *this; -} - -//============================================================================= -/*! dgematrix operator*= */ -inline dgematrix& dgematrix::operator*=(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( m, mat.n ); - char transa ='n'; - char transb ='n'; - double alpha =1.; - double beta =0.; - - dgemm_( &transa, &transb, &m, &mat.n, &n, &alpha, array, &m, mat.array, &mat.m, &beta, newmat.array, &m ); - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+dgematrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m,matA.n); - - const CPPL_INT mn =newmat.m*newmat.n; - for(CPPL_INT i=0; i<mn; i++){ - newmat.array[i] =matA.array[i]+matB.array[i]; - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix-dgematrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m,matA.n); - - const CPPL_INT mn =newmat.m*newmat.n; - for(CPPL_INT i=0; i<mn; i++){ - newmat.array[i] =matA.array[i]-matB.array[i]; - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix*dgematrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - double alpha =1.; - double beta =0.; - - dgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - return _(newmat); -} - -//============================================================================= -/*! dgematrix%dgematrix operator */ -inline _drovector operator%(const dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") % (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec( matA.n ); - - newvec.zero(); - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newvec(j) +=matA(i,j)*matB(i,j); - } - } - - return _(newvec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return Hadamerd product */ -inline _dgematrix hadamerd(const dgematrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( matA.m!=matB.m || matA.n!=matB.n ){ - ERROR_REPORT; - std::cerr << "These two matrices can not make Hadamerd product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") and (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m,matA.n); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =matA(i,j)*matB(i,j); - } - } - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/80/80a41a2e8dfba97afac239b3beb3da19974d4721.svn-base b/cpplapack-r198/.svn/pristine/80/80a41a2e8dfba97afac239b3beb3da19974d4721.svn-base deleted file mode 100644 index 5fa98bfa5b2568febe7783823ecf32daf796892b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/80/80a41a2e8dfba97afac239b3beb3da19974d4721.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -//============================================================================= -/*! dsymatrix+dgbmatrix operator */ -inline _dgematrix operator+(const dsymatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) += matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix-dgbmatrix operator */ -inline _dgematrix operator-(const dsymatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dsymatrix*dgbmatrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/80/80ad04972e02036e58bd926380b6afb51218f44c.svn-base b/cpplapack-r198/.svn/pristine/80/80ad04972e02036e58bd926380b6afb51218f44c.svn-base deleted file mode 100644 index 1ac1f48a07941cec1e7116017b6ef93a6d0d63a6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/80/80ad04972e02036e58bd926380b6afb51218f44c.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! dgsmatrix+_dgbmatrix operator */ -inline _dgematrix operator+(const dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix-_dgbmatrix operator */ -inline _dgematrix operator-(const dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix*_dgbmatrix operator */ -inline _dgematrix operator*(const dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/81/812dc673d2b37f978c61396c96ce7d70ba961cdb.svn-base b/cpplapack-r198/.svn/pristine/81/812dc673d2b37f978c61396c96ce7d70ba961cdb.svn-base deleted file mode 100644 index 12bef2dfed00bd93fc1a01846991d5765998c227..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/81/812dc673d2b37f978c61396c96ce7d70ba961cdb.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(5), CAP(4); - - CPPL::dgsmatrix A(M,N,CAP); - A.put(0,0, 1.); - A.put(3,2, 2.); - A.put(1,2, 3.); - A.put(4,1, 4.); - std::cout << "A =\n" << A << std::endl; - - CPPL::dsymatrix B(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - std::cout << "B =\n" << B << std::endl; - - //std::cout << "A+B =\n" << A+B << std::endl; - std::cout << "A-B =\n" << A-B << std::endl; - std::cout << "A*B =\n" << A*B << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/81/816def3d8c52dd6443238c75bd6f53129d201d63.svn-base b/cpplapack-r198/.svn/pristine/81/816def3d8c52dd6443238c75bd6f53129d201d63.svn-base deleted file mode 100644 index 1c984d1602cbf04a8fb7536a8bae3ba462d35a51..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/81/816def3d8c52dd6443238c75bd6f53129d201d63.svn-base +++ /dev/null @@ -1,141 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline comple& zgematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[i+m*j]; - return darray[j][i]; -} - -//============================================================================= -/*! operator() for const object */ -inline comple zgematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[i+m*j]; - return darray[j][i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline zgematrix& zgematrix::set(const CPPL_INT& i, const CPPL_INT& j, const comple& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //array[i+m*j] =v; - darray[j][i] =v; - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - s << " " << mat(i,j); - } - s << std::endl; - } - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void zgematrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zgematrix" << " " << m << " " << n << std::endl; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++ ){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void zgematrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zgematrix" && id != "#zgematrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zgematrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> m >> n; - resize(m, n); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++ ){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/81/81a9225d0997725798c308bdd551aa28287081dc.svn-base b/cpplapack-r198/.svn/pristine/81/81a9225d0997725798c308bdd551aa28287081dc.svn-base deleted file mode 100644 index 712297d5b21aa6bd394ce4a237b51f9442379174..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/81/81a9225d0997725798c308bdd551aa28287081dc.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+zhematrix operator */ -inline _zgematrix operator+(const _zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matB.to_zgematrix() ); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix-zhematrix operator */ -inline _zgematrix operator-(const _zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to zgematrix //// - zgematrix newmat( (-matB).to_zgematrix() ); - - //// add //// - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - //// return //// - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix*zhematrix operator */ -inline _zgematrix operator*(const _zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/81/81b2b642d9c432401036b6e7f951dd2860c45d69.svn-base b/cpplapack-r198/.svn/pristine/81/81b2b642d9c432401036b6e7f951dd2860c45d69.svn-base deleted file mode 100644 index 641be07f3c581b0100f3a61e646bfdd8b64a8891..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/81/81b2b642d9c432401036b6e7f951dd2860c45d69.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -//============================================================================= -/*! return transposed zgematrix */ -inline _zhematrix t(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - zhematrix newmat(mat.n); - - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - newmat(i,j) =mat(j,i); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _zgematrix i(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - zhematrix mat_cp(mat); - zgematrix mat_inv(mat.n,mat.n); - mat_inv.identity(); - mat_cp.zhesv(mat_inv); - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its conjugate matrix */ -inline _zhematrix conj(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - zhematrix newmat(mat.n); - - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - newmat(i,j) =std::conj(mat(i,j)); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its conjugate transposed matrix */ -inline _zhematrix conjt(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - WARNING_REPORT; - std::cerr << "This function call has no effect since the matrix is Hermitian." << std::endl; -#endif//CPPL_DEBUG - - zhematrix newmat =mat; - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/82/8251f0bc39d26c09b768c22da01bbeb1aa54f487.svn-base b/cpplapack-r198/.svn/pristine/82/8251f0bc39d26c09b768c22da01bbeb1aa54f487.svn-base deleted file mode 100644 index 8ffa6de0aff15125aa9338398c3f4fe16ed87b7f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/82/8251f0bc39d26c09b768c22da01bbeb1aa54f487.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -//============================================================================= -/*! zrovector constructor */ -inline _zrovector::_zrovector() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =0; - array =NULL; -} - -//============================================================================= -/*! _zrovector copy constructor */ -inline _zrovector::_zrovector(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - array =vec.array; - - vec.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _zrovector destructor */ -inline _zrovector::~_zrovector() -{CPPL_VERBOSE_REPORT; - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/82/826c057c870715ae81c26bbf96bc91f0e24f1edf.svn-base b/cpplapack-r198/.svn/pristine/82/826c057c870715ae81c26bbf96bc91f0e24f1edf.svn-base deleted file mode 100644 index 949de2c64ebb5337a2473b85eeebaeac8b6cb937..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/82/826c057c870715ae81c26bbf96bc91f0e24f1edf.svn-base +++ /dev/null @@ -1,140 +0,0 @@ -//============================================================================= -//! Real Double-precision General Sparse Matrix Class -class dgsmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT m; //!< matrix row size - CPPL_INT n; //!< matrix column size - std::vector<dcomponent> data; //!< matrix data - std::vector< std::vector<CPPL_INT> > rows; //!< array of vector to store the entry information of component for each row - std::vector< std::vector<CPPL_INT> > cols; //!< array of vector to store the entry information of component for each column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dgsmatrix(); - inline dgsmatrix(const dgsmatrix&); - inline dgsmatrix(const _dgsmatrix&); - inline dgsmatrix(const CPPL_INT&, const CPPL_INT&, const CPPL_INT=0); - inline dgsmatrix(const char*); - inline ~dgsmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgsmatrix to_zgsmatrix() const; - inline _dgematrix to_dgematrix() const; - inline dgrmatrix to_dgrmatrix() const; - - //////// io //////// - inline double operator()(const CPPL_INT&, const CPPL_INT&) const; - inline double& operator()(const CPPL_INT&, const CPPL_INT&); - inline dgsmatrix& put(const CPPL_INT&, const CPPL_INT&, const double&); - inline dgsmatrix& del(const CPPL_INT, const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline dgsmatrix& del(const CPPL_INT); //<-- NOT (const CPPL_INT&) - inline friend std::ostream& operator<<(std::ostream&, const dgsmatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline dgsmatrix& zero(); - inline dgsmatrix& identity(); - inline void chsign(); - inline void copy(const dgsmatrix&); - inline void shallow_copy(const _dgsmatrix&); - inline dgsmatrix& resize(const CPPL_INT&, const CPPL_INT&, const CPPL_INT=0, const CPPL_INT=0); - inline void stretch(const CPPL_INT&, const CPPL_INT&); - inline bool isListed(const CPPL_INT&, const CPPL_INT&) const; - inline CPPL_INT number(const CPPL_INT&, const CPPL_INT&); - inline void diet(const double=DBL_MIN); - inline void checkup(); - inline _drovector row(const CPPL_INT&) const; - inline _dcovector col(const CPPL_INT&) const; - inline friend void swap(dgsmatrix&, dgsmatrix&); - inline friend _dgsmatrix _(dgsmatrix&); - - //////// calc //////// - inline friend _dgsmatrix t(const dgsmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const dgsmatrix&); - inline friend double damax(const dgsmatrix&); - - //////// pardiso //////// - inline CPPL_INT pardiso(dcovector&) const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline dgsmatrix& operator=(const dgsmatrix&); - inline dgsmatrix& operator=(const _dgsmatrix&); - - //////// += //////// - inline dgsmatrix& operator+=(const dgsmatrix&); - inline dgsmatrix& operator+=(const _dgsmatrix&); - - //////// -= //////// - inline dgsmatrix& operator-=(const dgsmatrix&); - inline dgsmatrix& operator-=(const _dgsmatrix&); - - //////// *= //////// - inline dgsmatrix& operator*=(const dgsmatrix&); - inline dgsmatrix& operator*=(const _dgsmatrix&); - inline dgsmatrix& operator*=(const double&); - - //////// /= //////// - inline dgsmatrix& operator/=(const double&); - - //////// unary //////// - inline friend const dgsmatrix& operator+(const dgsmatrix&); - inline friend _dgsmatrix operator-(const dgsmatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const dgsmatrix&, const dgematrix&); - inline friend _dgematrix operator+(const dgsmatrix&, const _dgematrix&); - inline friend _dgematrix operator+(const dgsmatrix&, const dsymatrix&); - inline friend _dgematrix operator+(const dgsmatrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const dgsmatrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const dgsmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator+(const dgsmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator+(const dgsmatrix&, const _dgsmatrix&); - inline friend _dgsmatrix operator+(const dgsmatrix&, const dssmatrix&); - inline friend _dgsmatrix operator+(const dgsmatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const dgsmatrix&, const dgematrix&); - inline friend _dgematrix operator-(const dgsmatrix&, const _dgematrix&); - inline friend _dgematrix operator-(const dgsmatrix&, const dsymatrix&); - inline friend _dgematrix operator-(const dgsmatrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const dgsmatrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const dgsmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator-(const dgsmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator-(const dgsmatrix&, const _dgsmatrix&); - inline friend _dgsmatrix operator-(const dgsmatrix&, const dssmatrix&); - inline friend _dgsmatrix operator-(const dgsmatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const dgsmatrix&, const dcovector&); - inline friend _dcovector operator*(const dgsmatrix&, const _dcovector&); - inline friend _dgematrix operator*(const dgsmatrix&, const dgematrix&); - inline friend _dgematrix operator*(const dgsmatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const dgsmatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const dgsmatrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const dgsmatrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const dgsmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator*(const dgsmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator*(const dgsmatrix&, const _dgsmatrix&); - inline friend _dgsmatrix operator*(const dgsmatrix&, const dssmatrix&); - inline friend _dgsmatrix operator*(const dgsmatrix&, const _dssmatrix&); - inline friend _dgsmatrix operator*(const dgsmatrix&, const double&); - - //////// / //////// - inline friend _dgsmatrix operator/(const dgsmatrix&, const double&); - - //////// double //////// - inline friend _dgsmatrix operator*(const double&, const dgsmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/82/82ad6562b7c57cec52aea598ccaa87210c46b0b5.svn-base b/cpplapack-r198/.svn/pristine/82/82ad6562b7c57cec52aea598ccaa87210c46b0b5.svn-base deleted file mode 100644 index 011dd1fce36a0e27e7758edc54651d49b5bda0e3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/82/82ad6562b7c57cec52aea598ccaa87210c46b0b5.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! comple*zgbmatrix operator */ -inline _zgbmatrix operator*(const comple& d, const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/82/82b71dc329f63662cd778ae46647ed3ad7434113.svn-base b/cpplapack-r198/.svn/pristine/82/82b71dc329f63662cd778ae46647ed3ad7434113.svn-base deleted file mode 100644 index 48440e972a4c38fb217b41e317a8f322ff517f07..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/82/82b71dc329f63662cd778ae46647ed3ad7434113.svn-base +++ /dev/null @@ -1,3 +0,0 @@ -Now we use "alien" converter to make deb packpage. - -alien -dk cpplapack-YYYY.MM.DD-X.noarch.rpm diff --git a/cpplapack-r198/.svn/pristine/82/82d48ad036ddbf08c8bf16ed3a285d10bb2cc17b.svn-base b/cpplapack-r198/.svn/pristine/82/82d48ad036ddbf08c8bf16ed3a285d10bb2cc17b.svn-base deleted file mode 100644 index 99e940425ecdf266bfcb28fd13fbb50ddc24283f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/82/82d48ad036ddbf08c8bf16ed3a285d10bb2cc17b.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -/*! zgbmatrix+_zgematrix operator */ -inline _zgematrix operator+(const zgbmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j)+=matA(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! zgbmatrix-_zgematrix operator */ -inline _zgematrix operator-(const zgbmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matB.m*matB.n; i++){ - matB.array[i] = -matB.array[i]; - } - - //// add //// - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) +=matA(i,j); - } - } - - return matB; -} - -//============================================================================= -/*! zgbmatrix*_zgematrix operator */ -inline _zgematrix operator*(const zgbmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/82/82e344ceb61733107564a7c063411080c78eac3d.svn-base b/cpplapack-r198/.svn/pristine/82/82e344ceb61733107564a7c063411080c78eac3d.svn-base deleted file mode 100644 index 7586fd06fb5c53315d27e28a1e055b278de92e1b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/82/82e344ceb61733107564a7c063411080c78eac3d.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+_zhematrix operator */ -inline _zgematrix operator+(const _zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matB.to_zgematrix() ); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix-_zhematrix operator */ -inline _zgematrix operator-(const _zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to zgematrix //// - zgematrix newmat( (-matB).to_zgematrix() ); - - //// add //// - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - //////// - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix*_zhematrix operator */ -inline _zgematrix operator*(const _zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/83/83148350c0c587f28c221ce44f5925bb40136a22.svn-base b/cpplapack-r198/.svn/pristine/83/83148350c0c587f28c221ce44f5925bb40136a22.svn-base deleted file mode 100644 index 00fbf2db70de24ad1c55a2fcdcccad4db9845d1c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/83/83148350c0c587f28c221ce44f5925bb40136a22.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -#define drot_ DROT -#define dswap_ DSWAP -#define dscal_ DSCAL -#define dcopy_ DCOPY -#define daxpy_ DAXPY -#define ddot_ DDOT -#define dnrm2_ DNRM2 -#define dasum_ DASUM -#define idamax_ IDAMAX - -#define dgemv_ DGEMV -#define dgbmv_ DGBMV -#define dsymv_ DSYMV -#define dsbmv_ DSBMV -#define dspmv_ DSPMV -#define dtrmv_ DTRMV -#define dtbmv_ DTBMV -#define dtpmv_ DTPMV -#define dtrsv_ DTRSV -#define dtbsv_ DTBSV -#define dtpsv_ DTPSV -#define dger_ DGER -#define dsyr_ DSYR -#define dspr_ DSPR -#define dsyr2_ DSYR2 -#define dspr2_ DSPR2 - -#define dgemm_ DGEMM -#define dsymm_ DSYMM -#define dsyrk_ DSYRK -#define dsyr2k_ DSYR2K -#define dtrmm_ DTRMM -#define dtrsm_ DTRSM - -#define zdrot_ ZDROT -#define zswap_ ZSWAP -#define zdscal_ ZDSCAL -#define zscal_ ZSCAL -#define zcopy_ ZCOPY -#define zaxpy_ ZAXPY -#define zdotu_ ZDOTU -#define zdotc_ ZDOTC -#define dznrm2_ DZNRM2 -#define dzasum_ DZASUM -#define izamax_ IZAMAX - -#define zgemv_ ZGEMV -#define zgbmv_ ZGBMV -#define zhemv_ ZHEMV -#define zhbmv_ ZHBMV -#define zhpmv_ ZHPMV -#define ztrmv_ ZTRMV -#define ztbmv_ ZTBMV -#define ztpmv_ ZTPMV -#define ztrsv_ ZTRSV -#define ztbsv_ ZTBSV -#define ztpsv_ ZTPSV -#define zgeru_ ZGERU -#define zgerc_ ZGERC -#define zher_ ZHER -#define zhpr_ ZHPR -#define zher2_ ZHER2 -#define zhpr2_ ZHPR2 - -#define zgemm_ ZGEMM -#define zsymm_ ZSYMM -#define zhemm_ ZHEMM -#define zsyrk_ ZSYRK -#define zherk_ ZHERK -#define zsyr2k_ ZSYR2K -#define zher2k_ ZHER2K -#define ztrmm_ ZTRMM -#define ztrsm_ ZTRSM - -//////// mkl.h does not have legal zdotu_ and zdotc_ . Why??? //////// -inline MKL_Complex16 zdotu_( const CPPL_INT *N, MKL_Complex16 *x, const CPPL_INT *incx, const MKL_Complex16 *y, const CPPL_INT *incy ) -{ - MKL_Complex16 v; - zdotu_(&v, N, x, incx, y, incy); - return v; -} - -inline MKL_Complex16 zdotc_( const CPPL_INT *N, MKL_Complex16 *x, const CPPL_INT *incx, const MKL_Complex16 *y, const CPPL_INT *incy ) -{ - MKL_Complex16 v; - zdotc_(&v, N, x, incx, y, incy); - return v; -} diff --git a/cpplapack-r198/.svn/pristine/83/8376bcc2e771d6d06299946209f5bd834aa4d5fb.svn-base b/cpplapack-r198/.svn/pristine/83/8376bcc2e771d6d06299946209f5bd834aa4d5fb.svn-base deleted file mode 100644 index 92f3d4a8ab3ecf92a6d851e7782b1e4bed47bf42..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/83/8376bcc2e771d6d06299946209f5bd834aa4d5fb.svn-base +++ /dev/null @@ -1,113 +0,0 @@ -//============================================================================= -void dgeev_check_value() -{ - std::cout << "############ check dgeev value ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A //// - CPPL::dgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - std::vector<double> wr, wi; - - //// make A_original //// - CPPL::dgematrix A_original(A); - - //// dgeev //// - A.dgeev(wr, wi); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - for(int i=0; i<A.m; i++){ - std::cout << "#### " << i << "th eigen ####" << std::endl; - std::cout << "wr=" << wr[i] <<std::endl; - std::cout << "wi=" << wi[i] <<std::endl; - } -} - -//============================================================================= -void dgeev_check_right() -{ - std::cout << "############ check dgeev right ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A //// - CPPL::dgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vr //// - std::vector<double> wr, wi; - std::vector<CPPL::dcovector> vrr, vri; - - //// make A_original //// - CPPL::dgematrix A_original(A); - - //// dgeev //// - A.dgeev(wr, wi ,vrr, vri); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - for(int i=0; i<A.m; i++){ - std::cout << "#### " << i << "th eigen ####" << std::endl; - std::cout << "wr=" << wr[i] <<std::endl; - std::cout << "wi=" << wi[i] <<std::endl; - std::cout << "vrr=\n" << vrr[i] <<std::endl; - std::cout << "vri=\n" << vri[i] <<std::endl; - std::cout << "Real[ [A]*{x} -lambda*{x} ] = (Should be zeros)\n" - << A_original*vrr[i] -(wr[i]*vrr[i] - wi[i]*vri[i]) - << std::endl; - std::cout << "Imag[ [A]*{x} -lambda*{x} ] = (Should be zeros)\n" - << A_original*vri[i] -(wr[i]*vri[i] + wi[i]*vrr[i]) - << std::endl; - } -} - -//============================================================================= -void dgeev_check_left() -{ - std::cout << "############ check dgeev left ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A //// - CPPL::dgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make wr wi vl //// - std::vector<double> wr, wi; - std::vector<CPPL::drovector> vlr, vli; - - //// make A_original //// - CPPL::dgematrix A_original(A); - - //// dgeev //// - A.dgeev(wr, wi ,vlr, vli); - - //// print //// - std::cout << "A_original=\n" << A_original << std::endl; - for(int i=0; i<A.m; i++){ - std::cout << "#### " << i << "th eigen ####" << std::endl; - std::cout << "wr = " << wr[i] << std::endl; - std::cout << "wi = " << wi[i] << std::endl; - std::cout << "vlr = " << vlr[i]; - std::cout << "vli = " << vli[i] << std::endl; - std::cout << "Real[ {x}*[A] -{x}*lambda ] = (Should be zeros)\n" - << vlr[i]*A_original -(vlr[i]*wr[i] - vli[i]*wi[i]) - << std::endl; - std::cout << "Imag[ {x}*[A] -{x}*lambda ] = (Should be zeros)\n" - << vli[i]*A_original -(vli[i]*wr[i] + vlr[i]*wi[i]) - << std::endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/84/840399aac0b9e018aa04f1f2c50b3a1539a504ff.svn-base b/cpplapack-r198/.svn/pristine/84/840399aac0b9e018aa04f1f2c50b3a1539a504ff.svn-base deleted file mode 100644 index af6b548322b15f1c17e76c40e1f181b292cd03d5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/84/840399aac0b9e018aa04f1f2c50b3a1539a504ff.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -#undef CPPL_VERBOSE -#undef CPPL_DEBUG - -//============================================================================= -#include "cpplapack.h" -#include <cstring> -#include <ctime> - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - int size(3000); - CPPL::dgematrix A(size,size), B; - - srand(unsigned(time(NULL))); - for(int i=0; i<size; i++){ for(int j=0; j<size; j++){ - A(i,j) =double(rand())/double(RAND_MAX); - }} - - clock_t t0, t1, t2, t3; - - t0=clock();////////////////////////////////////////////////////////////////// - - B=A; - - t1=clock();////////////////////////////////////////////////////////////////// - - B.resize(size,size); - for(int i=0; i<size*size; i++){ - B.array[i] =A.array[i]; - } - - t2=clock();////////////////////////////////////////////////////////////////// - - B.resize(size,size); - memcpy(B.array, A.array, size*size*sizeof(double)); - - t3=clock();////////////////////////////////////////////////////////////////// - - std::cout << "\"B=A (dcopy)\" took "<< (1000./CLOCKS_PER_SEC)*(t1-t0) << "[ms]." << std::endl; - std::cout << "\"loop\" took "<< (1000./CLOCKS_PER_SEC)*(t2-t1) << "[ms]." << std::endl; - std::cout << "\"memcpy\" took "<< (1000./CLOCKS_PER_SEC)*(t3-t2) << "[ms]." << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/84/84152da1c19a554527ef29c973eb60130faae10a.svn-base b/cpplapack-r198/.svn/pristine/84/84152da1c19a554527ef29c973eb60130faae10a.svn-base deleted file mode 100644 index d47b3bf087a50805c74e414a710b9f792e8bed90..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/84/84152da1c19a554527ef29c973eb60130faae10a.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -/*! dsymatrix+_dgbmatrix operator */ -inline _dgematrix operator+(const dsymatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) += matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dsymatrix-_dgbmatrix operator */ -inline _dgematrix operator-(const dsymatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dsymatrix*_dgbmatrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/84/841d9de76718d437faad0d2447b17c8dd4c16284.svn-base b/cpplapack-r198/.svn/pristine/84/841d9de76718d437faad0d2447b17c8dd4c16284.svn-base deleted file mode 100644 index 775bc501dbc63ff749a4601140eb46b4ebf1b4a2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/84/841d9de76718d437faad0d2447b17c8dd4c16284.svn-base +++ /dev/null @@ -1,120 +0,0 @@ -//============================================================================= -/*! -\page pg-vector_io Example Codes of Vector IO -\section st-dco_io dcovector IO -\include dcovector-io/main.cpp -<br><br> -\section st-dro_io drovector IO -\include drovector-io/main.cpp -*/ - -//============================================================================= -/*! -\page pg-matrix_io Example Codes of Matrix IO -\section st-dge_io dgematrix IO -\include dgematrix-io/main.cpp -<br><br> -\section st-dgb_io dgbmatrix IO -\include dgbmatrix-io/main.cpp -<br><br> -\section st-dsy_io dsymatrix IO -\include dsymatrix-io/main.cpp -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//============================================================================= -/*! -\page pg-dge_lapack Example Codes of dgematrix LAPACK Functions -\include dgematrix-lapack/dgesv_check.hpp -\include dgematrix-lapack/dgels_check.hpp -\include dgematrix-lapack/dgelss_check.hpp -\include dgematrix-lapack/dgeev_check.hpp -\include dgematrix-lapack/dggev_check.hpp -\include dgematrix-lapack/dgesvd_check.hpp -\include dgematrix-lapack/main.cpp -*/ - -//============================================================================= -/*! -\page pg-dgb_lapack Example Codes of dgbmatrix LAPACK Functions -\include dgbmatrix-lapack/main.cpp -*/ - -//============================================================================= -/*! -\page pg-dsy_lapack Example Codes of dsymatrix LAPACK Functions -\include dsymatrix-lapack/dsysv_check.hpp -\include dsymatrix-lapack/dsyev_check.hpp -<!-- \include dsymatrix-lapack/dsygv_check.cpp --> -\include dsymatrix-lapack/main.cpp -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//============================================================================= -/*! -\page pg-format Read/Write File Format -\htmlinclude File_Format.html -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//============================================================================= -/*xxxxxxxxxxxxxxx! -\page pg-cygwin How to install ATLAS and LAPACK on Cygwin -\htmlinclude Install_on_Cygwin.html -*/ - -//============================================================================= -/*xxxxxxxxxxxxxxx! -\page pg-vcpp How to compile with VC++ on Windows -\htmlinclude Compile_with_VC.html -*/ - -//============================================================================= -/*! -\page pg-makefile Typical "Makefile"s for a few Platforms -\section st-base The base Makefile -\include Makefile -<br><br> -\section st-gXX Makefile for g++ + libblas + liblapack (works with the base Makefile) -\include Makefile.g++ -<br><br> -\section st-icpc Makefile for icpc + MKL on Linux (works with the base Makefile) -\include Makefile.icpc -<br><br> -\section st-icl Makefile for icl + MKL on Windows -\include Makefile-icl -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//============================================================================= -/*! -\page pg-nt Mechanism of "Smart-Temporary" System -\htmlinclude Smart-Temporary.html -*/ - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//============================================================================= -/*! -\page pg-bandmatrix Illustration of Band Matrix -\image html bandmatrix.png -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -//============================================================================= -/*//! -\page pg-sparsematrix Specifications of Sparse Matrix -\htmlinclude Sparse_Matrix.html -*/ diff --git a/cpplapack-r198/.svn/pristine/84/8467d1bd7014bfd19981d6348d3bc1f85fbcf75e.svn-base b/cpplapack-r198/.svn/pristine/84/8467d1bd7014bfd19981d6348d3bc1f85fbcf75e.svn-base deleted file mode 100644 index 3807b6be708e96c5a3347bef0b4f1ff538bcbe43..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/84/8467d1bd7014bfd19981d6348d3bc1f85fbcf75e.svn-base +++ /dev/null @@ -1,99 +0,0 @@ -//============================================================================= -/*! return transposed zgematrix */ -inline _zgematrix t(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.n,mat.m); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =mat(j,i); - } - } - - mat.destroy(); - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _zgematrix i(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix mat_cp(mat); - zgematrix mat_inv(mat_cp.m,mat_cp.n); - mat_inv.identity(); - mat_cp.zgesv(mat_inv); - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its conjugate matrix */ -inline _zgematrix conj(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - mat(i,j) =std::conj(mat(i,j)); - } - } - - return mat; -} - -//============================================================================= -/*! return its conjugate transposed matrix */ -inline _zgematrix conjt(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.n,mat.m); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =std::conj(mat(j,i)); - } - } - - mat.destroy(); - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - CPPL_INT index =izamax_(&size, mat.array, &inc) -1; - i =index%mat.m; - j =index/mat.m; - - mat.destroy(); -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - comple val =mat.array[izamax_(&size, mat.array, &inc) -1]; - - mat.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/84/84ae6e68f23ee5dcf1d25ef98ed49f57d38e4ba5.svn-base b/cpplapack-r198/.svn/pristine/84/84ae6e68f23ee5dcf1d25ef98ed49f57d38e4ba5.svn-base deleted file mode 100644 index 62a92552897e094ad026a1fa6a26092783f4061f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/84/84ae6e68f23ee5dcf1d25ef98ed49f57d38e4ba5.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _dgsmatrix::nullify() const -{CPPL_VERBOSE_REPORT; - m=0; - n=0; - data.clear(); - rows.clear(); - cols.clear(); -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _dgsmatrix::destroy() const -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/84/84dc69449959db2a2e7ef5115414c14c2a21704b.svn-base b/cpplapack-r198/.svn/pristine/84/84dc69449959db2a2e7ef5115414c14c2a21704b.svn-base deleted file mode 100644 index a2ab5d6fb0460ea3744f7b066ff70ba9da938b95..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/84/84dc69449959db2a2e7ef5115414c14c2a21704b.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! zcovector*zrovector operator */ -inline _zgematrix operator*(const zcovector& covec, const zrovector& rovec) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(covec.l, rovec.l); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/85/8534120ccbca980eaedc0fcd4787e43a46686a7a.svn-base b/cpplapack-r198/.svn/pristine/85/8534120ccbca980eaedc0fcd4787e43a46686a7a.svn-base deleted file mode 100644 index a5773b4e86f1f3e3df32b40585be8ba8c4aec078..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/85/8534120ccbca980eaedc0fcd4787e43a46686a7a.svn-base +++ /dev/null @@ -1,526 +0,0 @@ -//============================================================================= -/*! solve A*X=Y using zgesv\n - The argument is zgematrix Y. Y is overwritten and become the solution X. - A is also overwritten and become P*l*U. */ -inline CPPL_INT zgematrix::zgesv(zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1); - zgesv_(&n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, &INFO); - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve A*x=y using zgesv\n - The argument is zcovector y. y is overwritten and become the solution x. - A is also overwritten and become P*l*U. */ -inline CPPL_INT zgematrix::zgesv(zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || m!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT NRHS(1), LDA(n), *IPIV(new CPPL_INT[n]), LDB(vec.l), INFO(1); - zgesv_(&n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, &INFO); - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! solve overdetermined or underdetermined A*X=Y using zgels\n*/ -inline CPPL_INT zgematrix::zgels(zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - zgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - comple *WORK(new comple[LWORK]); - zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, mat.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - zgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<tmp.m; i++){ - for(CPPL_INT j=0; j<tmp.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve overdetermined or underdetermined A*x=y using zgels\n*/ -inline CPPL_INT zgematrix::zgels(zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - zcovector tmp(n); - for(CPPL_INT i=0; i<vec.l; i++){ - tmp(i)=vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - comple *WORK(new comple[LWORK]); - zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, vec.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - zcovector tmp(n); - for(CPPL_INT i=0; i<tmp.l; i++){ - tmp(i)=vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve overdetermined or underdetermined A*X=Y using zgels - with the sum of residual squares output\n - The residual is set as the columnwise sum of residual squares - for overdetermined problems - while it is always zero for underdetermined problems. -*/ -inline CPPL_INT zgematrix::zgels(zgematrix& mat, drovector& residual) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - residual.resize(mat.n); - residual.zero(); - - if(m<n){ //underdetermined - zgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(mat.n), LDA(m), LDB(mat.m), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - comple *WORK(new comple[LWORK]); - zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, mat.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - for(CPPL_INT i=0; i<residual.l; i++){ - for(CPPL_INT j=0; j<m-n; j++){ - residual(i) += std::norm(mat(n+j,i)); - } - } - - zgematrix tmp(n,mat.n); - for(CPPL_INT i=0; i<tmp.m; i++){ - for(CPPL_INT j=0; j<tmp.n; j++){ - tmp(i,j) =mat(i,j); - } - } - mat.clear(); - swap(mat,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve overdetermined or underdetermined A*x=y using zgels - with the sum of residual squares output\n - The residual is set as the sum of residual squares for overdetermined problems - while it is always zero for underdetermined problems. -*/ -inline CPPL_INT zgematrix::zgels(zcovector& vec, double& residual) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - residual=0.0; - - if(m<n){ //underdetermined - zcovector tmp(n); - for(CPPL_INT i=0; i<vec.l; i++){ - tmp(i)=vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - char TRANS('n'); - CPPL_INT NRHS(1), LDA(m), LDB(vec.l), LWORK(std::min(m,n)+std::max(std::min(m,n),NRHS)), INFO(1); - comple *WORK(new comple[LWORK]); - zgels_(&TRANS, &m, &n, &NRHS, array, &LDA, vec.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - - if(m>n){ //overdetermined - for(CPPL_INT i=0; i<m-n; i++){ - residual += std::norm(vec(n+i)); - } - - zcovector tmp(n); - for(CPPL_INT i=0; i<tmp.l; i++){ - tmp(i) =vec(i); - } - vec.clear(); - swap(vec,tmp); - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate the least-squares-least-norm solution - for overdetermined or underdetermined A*x=y using zgelss\n */ -inline CPPL_INT zgematrix::zgelss(zcovector& B, dcovector& S, CPPL_INT& RANK, - const double RCOND =-1. ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=B.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << B.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - zcovector tmp(n); - for(CPPL_INT i=0; i<B.l; i++){ - tmp(i)=B(i); - } - B.clear(); - swap(B,tmp); - } - - S.resize(std::min(m,n)); - - CPPL_INT NRHS(1), LDA(m), LDB(B.l), LWORK(2*std::min(m,n) +std::max(std::max(m,n),NRHS)), INFO(1); - double *RWORK(new double[5*std::min(m,n)]); - comple *WORK(new comple[LWORK]); - zgelss_(&m, &n, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, WORK, &LWORK, RWORK, &INFO); - delete [] RWORK; - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate the least-squares-least-norm solution - for overdetermined or underdetermined A*x=y using zgelss\n */ -inline CPPL_INT zgematrix::zgelss(zgematrix& B, dcovector& S, CPPL_INT& RANK, - const double RCOND =-1. ) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=B.m){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << B.m << "x" << B.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(m<n){ //underdetermined - zgematrix tmp(n,B.n); - for(CPPL_INT i=0; i<B.m; i++){ - for(CPPL_INT j=0; j<B.n; j++){ - tmp(i,j)=B(i,j); - } - } - B.clear(); - swap(B,tmp); - } - - S.resize(std::min(m,n)); - - CPPL_INT NRHS(B.n), LDA(m), LDB(B.m), LWORK(2*std::min(m,n) +std::max(std::max(m,n),NRHS)), INFO(1); - double *RWORK(new double[5*std::min(m,n)]); - comple *WORK(new comple[LWORK]); - zgelss_(&m, &n, &NRHS, array, &LDA, B.array, &LDB, S.array, &RCOND, &RANK, WORK, &LWORK, RWORK, &INFO); - delete [] RWORK; - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate eigenvalues\n - The argument need not to be initialized. - w is overwitten and become eigenvalues. - This matrix is also overwritten. */ -inline CPPL_INT zgematrix::zgeev(std::vector< comple >& w) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix cannot have eigenvalues." << std::endl - << "Your input was (" << m << "x" << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - w.resize(n); - - char JOBVL('n'), JOBVR('n'); - CPPL_INT LDA(n), LDVL(1), LDVR(1), LWORK(4*n), INFO(1); - double *RWORK(new double[2*n]); - comple *VL(NULL), *VR(NULL), *WORK(new comple[LWORK]); - zgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &w[0], VL, &LDVL, VR, &LDVR, WORK, &LWORK, RWORK, &INFO); - delete [] RWORK; - delete [] WORK; - delete [] VL; - delete [] VR; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate eigenvalues and right eigenvectors\n - 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. */ -inline CPPL_INT zgematrix::zgeev(std::vector< comple >& w, - std::vector<zcovector>& vr) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix cannot have eigenvalues." << std::endl - << "Your input was (" << m << "x" << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - w.resize(n); - vr.resize(n); - for(CPPL_INT i=0; i<n; i++){ - vr[i].resize(n); - } - - zgematrix VR(n,n); - char JOBVL('n'), JOBVR('V'); - CPPL_INT LDA(n), LDVL(1), LDVR(n), LWORK(4*n), INFO(1); - double *RWORK(new double[2*n]); - comple *VL(NULL), *WORK(new comple[LWORK]); - zgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &w[0], VL, &LDVL, VR.array, &LDVR, WORK, &LWORK, RWORK, &INFO); - delete [] RWORK; - delete [] WORK; - delete [] VL; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=0; i<n; i++){ - vr[j](i) = VR(i,j); - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate eigenvalues and left eigenvectors\n - 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. */ -inline CPPL_INT zgematrix::zgeev(std::vector< comple >& w, - std::vector<zrovector>& vl) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "This matrix cannot have eigenvalues." << std::endl - << "Your input was (" << m << "x" << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - w.resize(n); - vl.resize(n); - for(CPPL_INT i=0; i<n; i++){ - vl[i].resize(n); - } - zgematrix VL(n,n); - - char JOBVL('V'), JOBVR('n'); - CPPL_INT LDA(n), LDVL(n), LDVR(1), LWORK(4*n), INFO(1); - double *RWORK(new double[2*n]); - comple *VR(NULL), *WORK(new comple[LWORK]); - zgeev_(&JOBVL, &JOBVR, &n, array, &LDA, &w[0], VL.array, &LDVL, VR, &LDVR, WORK, &LWORK, RWORK, &INFO); - delete [] RWORK; - delete [] WORK; - delete [] VR; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=0; i<n; i++){ - vl[j](i) = std::conj(VL(i,j)); - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -//inline CPPL_INT zgematrix::zgegv() - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! compute the singular value decomposition (SVD)\n - 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. -*/ -inline CPPL_INT zgematrix::zgesvd(dcovector& S, zgematrix& U, zgematrix& VT) -{CPPL_VERBOSE_REPORT; - char JOBU('A'), JOBVT('A'); - 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); - double *RWORK(new double[5*std::min(m,n)]); - comple *WORK(new comple[LWORK]); - S.resize(std::min(m,n)); - U.resize(LDU,m); - VT.resize(LDVT,n); - - zgesvd_(&JOBU, &JOBVT, &m, &n, array, &LDA, S.array, U.array, &LDU, VT.array, &LDVT, WORK, &LWORK, RWORK, &INFO); - delete [] RWORK; - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} diff --git a/cpplapack-r198/.svn/pristine/85/85693cad404575dc6cbd0f599f299b476b9f795a.svn-base b/cpplapack-r198/.svn/pristine/85/85693cad404575dc6cbd0f599f299b476b9f795a.svn-base deleted file mode 100644 index e86328c8ebb68522e4d90fbf7e7393c86a84180a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/85/85693cad404575dc6cbd0f599f299b476b9f795a.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! dssmatrix+dsymatrix operator */ -/* -inline _dgematrix operator+(const dssmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ -//============================================================================= -/*! dssmatrix-dsymatrix operator */ -/* -inline _dgematrix operator-(const dssmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to dgematrix //// - dgematrix newmat(-matB); - - //// add //// - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ -//============================================================================= -/*! dssmatrix*dsymatrix operator */ -/* -inline _dgematrix operator*(const dssmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/85/85f7a503fb8f877637b7c0834a4e248ec6e1988d.svn-base b/cpplapack-r198/.svn/pristine/85/85f7a503fb8f877637b7c0834a4e248ec6e1988d.svn-base deleted file mode 100644 index 6ac1b2fcab88889fc5567819f66e2da4196ba835..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/85/85f7a503fb8f877637b7c0834a4e248ec6e1988d.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix zhematrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat(n,n); - - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<n; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/86/864d0582f41076133ba54a581801e5800d5524e4.svn-base b/cpplapack-r198/.svn/pristine/86/864d0582f41076133ba54a581801e5800d5524e4.svn-base deleted file mode 100644 index ffd231d578a622c2f4b0c6692c2fba99e1d8d65d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/86/864d0582f41076133ba54a581801e5800d5524e4.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::dsymatrix A(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "A*10. =\n" << A*10. << endl; - cout << "A/10. =\n" << A/10. << endl; - - cout << "#### A*=10.; ####" << endl; - A*=10.; - cout << "A =\n" << A << endl; - cout << "#### A/=10.; ####" << endl; - A/=10.; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/86/868ade341183c4e9c5a6ab50262311fdd4664297.svn-base b/cpplapack-r198/.svn/pristine/86/868ade341183c4e9c5a6ab50262311fdd4664297.svn-base deleted file mode 100644 index 14563cdb10ac39c03561d6112fd86f89ddc4f74d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/86/868ade341183c4e9c5a6ab50262311fdd4664297.svn-base +++ /dev/null @@ -1,172 +0,0 @@ -//============================================================================= -/*! calculate vector product only for 2D vector */ -inline double operator/(const dcovec2& A, const dcovec2& B) -{CPPL_VERBOSE_REPORT; - return A(0)*B(1) -A(1)*B(0); -} - -//============================================================================= -/*! convert 2D vector to theta */ -inline double v2t(const dcovec2& v) -{CPPL_VERBOSE_REPORT; - return std::atan2(v(1),v(0)); -} - -//============================================================================= -/*! rotate 2D vector by theta [rad] */ -inline dcovec2 rotate(const dcovec2& v, const double& t) -{CPPL_VERBOSE_REPORT; - dcovec2 w; - w(0) =v(0)*std::cos(t) -v(1)*std::sin(t); - w(1) =v(0)*std::sin(t) +v(1)*std::cos(t); - return w; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate vector product only for 3D vector */ -inline dcovec3 operator/(const dcovec3& A, const dcovec3& B) -{CPPL_VERBOSE_REPORT; - dcovec3 C; - C(0) =A(1)*B(2) -A(2)*B(1); - C(1) =A(2)*B(0) -A(0)*B(2); - C(2) =A(0)*B(1) -A(1)*B(0); - return C; -} - -//============================================================================= -/*! calculate vector product only for 3D vector */ -inline dcovec3 operator/=(dcovec3& A, const dcovec3& B) -{CPPL_VERBOSE_REPORT; - A =A/B; - return A; -} - -//============================================================================= -/*! make quaternion from imag vector and real value */ -inline dquater vr2q(const dcovec3& v, const double& r) -{CPPL_VERBOSE_REPORT; - return dquater(v(0),v(1),v(2),r); -} - -//============================================================================= -/*! make quaternion from directional vector and rotational angle */ -inline dquater vt2q(const dcovec3& v, const double& theta) -{CPPL_VERBOSE_REPORT; - return vr2q( v/(nrm2(v)+DBL_MIN)*std::sin(0.5*theta), std::cos(0.5*theta) ); -} - -//============================================================================= -/*! rotate 3D vector by quaternion */ -inline dcovec3 rotate(const dcovec3& v, const dquater& q) -{CPPL_VERBOSE_REPORT; - return imag( q*vr2q(v,0.)*conj(q) ); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! conjuction */ -inline dquater conj(const dquater& q) -{CPPL_VERBOSE_REPORT; - return dquater(-q(0),-q(1),-q(2), q(3)); -} - -//============================================================================= -/*! imag */ -inline dcovec3 imag(const dquater& q) -{CPPL_VERBOSE_REPORT; - return dcovec3(q(0),q(1),q(2)); -} - -//============================================================================= -/*! inverse */ -inline dquater inv(const dquater& q) -{CPPL_VERBOSE_REPORT; - return conj(q)/std::pow(nrm2(q),2); -} - -//============================================================================= -/*! dquater*dquater operator */ -inline dquater operator*(const dquater& q1, const dquater& q2) -{CPPL_VERBOSE_REPORT; - return dquater(q1(3)*q2(0) +q1(0)*q2(3) +q1(1)*q2(2) -q1(2)*q2(1), - q1(3)*q2(1) -q1(0)*q2(2) +q1(1)*q2(3) +q1(2)*q2(0), - q1(3)*q2(2) +q1(0)*q2(1) -q1(1)*q2(0) +q1(2)*q2(3), - q1(3)*q2(3) -q1(0)*q2(0) -q1(1)*q2(1) -q1(2)*q2(2) ); -} - -//============================================================================= -/*! dquater/dquater operator */ -inline dquater operator/(const dquater& q1, const dquater& q2) -{CPPL_VERBOSE_REPORT; - return q1*inv(q2); -} - -//============================================================================= -/*! dquater*=dquater operator */ -inline dquater operator*=(dquater& q1, const dquater& q2) -{CPPL_VERBOSE_REPORT; - q1 =q1*q2; - return q1; -} - -//============================================================================= -/*! dquater/=dquater operator */ -inline dquater operator/=(dquater& q1, const dquater& q2) -{CPPL_VERBOSE_REPORT; - q1 =q1/q2; - return q1; -} - -//============================================================================= -/*! return vector from quaternion (|vector|=theta) */ -inline dcovec3 q2vt(const dquater& q) -{CPPL_VERBOSE_REPORT; - double sin_theta_half; - double theta( 2.*std::acos(q(3)) ); - - if(theta<M_PI){ - sin_theta_half =std::sin(0.5*theta); - } - else{ - theta -=2.*M_PI; - sin_theta_half =-std::sin(0.5*theta); - } - - return dcovec3( theta*q(0)/sin_theta_half, - theta*q(1)/sin_theta_half, - theta*q(2)/sin_theta_half ); -} - -//============================================================================= -/*! return rotational matrix made of quaternion */ -inline dgemat3 q2m(const dquater& q) -{CPPL_VERBOSE_REPORT; - dquater cq( conj(q) ); - dquater X( dquater(+q(3),+q(2),-q(1),-q(0))*cq ); - dquater Y( dquater(-q(2),+q(3),+q(0),-q(1))*cq ); - dquater Z( dquater(+q(1),-q(0),+q(3),-q(2))*cq ); - dgemat3 mat; - mat(0,0)=X(0); mat(0,1)=Y(0); mat(0,2)=Z(0); - mat(1,0)=X(1); mat(1,1)=Y(1); mat(1,2)=Z(1); - mat(2,0)=X(2); mat(2,1)=Y(2); mat(2,2)=Z(2); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/86/86fdd747fc012d34b0a4d365776646e53e8e9a5d.svn-base b/cpplapack-r198/.svn/pristine/86/86fdd747fc012d34b0a4d365776646e53e8e9a5d.svn-base deleted file mode 100644 index 7405bbf21515f2865bc37ca3a4f9314356c0a05f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/86/86fdd747fc012d34b0a4d365776646e53e8e9a5d.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _dssmatrix+_dssmatrix operator */ -inline _dssmatrix operator+(const _dssmatrix& matA, const _dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) +=it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dssmatrix-_dssmatrix operator */ -inline _dssmatrix operator-(const _dssmatrix& matA, const _dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) -=it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dssmatrix*_dssmatrix operator */ -/* -inline _dssmatrix operator*(const _dssmatrix& matA, const _dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matA.n); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.line[k].begin(); p!=matB.line[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/87/874933fa546ce216f80f4040f88d2c06c550d90d.svn-base b/cpplapack-r198/.svn/pristine/87/874933fa546ce216f80f4040f88d2c06c550d90d.svn-base deleted file mode 100644 index 6c8b4a51fcba128c8918968d569218c98ff281ba..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/87/874933fa546ce216f80f4040f88d2c06c550d90d.svn-base +++ /dev/null @@ -1,116 +0,0 @@ -//============================================================================= -//! Real Double-precision Row Vector Class -class drovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT l; //!< vector size - CPPL_INT cap; //!< vector capacity - double* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline drovector(); - inline drovector(const drovector&); - inline drovector(const _drovector&); - inline drovector(const CPPL_INT&, const CPPL_INT=0); - inline drovector(const char*); - inline ~drovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zrovector to_zrovector() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&); - inline double operator()(const CPPL_INT&) const; - inline drovector& set(const CPPL_INT&, const double&); //const; - inline friend std::ostream& operator<<(std::ostream&, const drovector&); - inline void write(const char*) const; - inline void read(const char*); - - //////// calc //////// - inline friend _dcovector t(const drovector&); - inline friend double nrm2(const drovector&); - inline friend CPPL_INT idamax(const drovector&); - inline friend double damax(const drovector&); - - //////// misc //////// - inline void clear(); - inline drovector& zero(); - inline void chsign(); - inline void copy(const drovector&); - inline void shallow_copy(const _drovector&); - inline void alias(const drovector&); - inline void unalias(); - inline drovector& resize(const CPPL_INT&, const CPPL_INT=0); - inline void stretch(const CPPL_INT&); - inline friend void swap(drovector&, drovector&); - inline friend _drovector _(drovector&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline drovector& operator=(const drovector&); - inline drovector& operator=(const _drovector&); - - //////// += /// - inline drovector& operator+=(const drovector&); - inline drovector& operator+=(const _drovector&); - - //////// -= //////// - inline drovector& operator-=(const drovector&); - inline drovector& operator-=(const _drovector&); - - //////// *= //////// - inline drovector& operator*=(const double&); - - //////// /= //////// - inline drovector& operator/=(const double&); - - //////// unary //////// - inline friend const drovector& operator+(const drovector&); - inline friend _drovector operator-(const drovector&); - - //////// + //////// - inline friend _drovector operator+(const drovector&, const drovector&); - inline friend _drovector operator+(const drovector&, const _drovector&); - - //////// - //////// - inline friend _drovector operator-(const drovector&, const drovector&); - inline friend _drovector operator-(const drovector&, const _drovector&); - - //////// * //////// - inline friend double operator*(const drovector&, const dcovector&); - inline friend double operator*(const drovector&, const _dcovector&); - inline friend _drovector operator*(const drovector&, const dgematrix&); - inline friend _drovector operator*(const drovector&, const _dgematrix&); - inline friend _drovector operator*(const drovector&, const dsymatrix&); - inline friend _drovector operator*(const drovector&, const _dsymatrix&); - inline friend _drovector operator*(const drovector&, const dgbmatrix&); - inline friend _drovector operator*(const drovector&, const _dgbmatrix&); - inline friend _drovector operator*(const drovector&, const dgsmatrix&); - inline friend _drovector operator*(const drovector&, const _dgsmatrix&); - inline friend _drovector operator*(const drovector&, const dssmatrix&); - inline friend _drovector operator*(const drovector&, const _dssmatrix&); - inline friend _drovector operator*(const drovector&, const double&); - - //////// / //////// - inline friend _drovector operator/(const drovector&, const double&); - - //////// % //////// - inline friend double operator%(const drovector&, const drovector&); - inline friend double operator%(const drovector&, const _drovector&); - - //////// double //////// - inline friend _drovector operator*(const double&, const drovector&); - - //////// hadamard //////// - inline friend _drovector hadamard(const drovector&, const drovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/87/87ac05875dc2c2f31e54ee6cbfee4255e8bdf5a6.svn-base b/cpplapack-r198/.svn/pristine/87/87ac05875dc2c2f31e54ee6cbfee4255e8bdf5a6.svn-base deleted file mode 100644 index 37b123cae1c106e58afb0dc01323c1874bd82604..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/87/87ac05875dc2c2f31e54ee6cbfee4255e8bdf5a6.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double& _drovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _drovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ s << " " << vec.array[i]; } - s << std::endl; - - vec.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _drovector::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#drovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << " "; - } - ofs << std::endl; - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/87/87b6b83a679700ce45d5031af690725e0a861c7a.svn-base b/cpplapack-r198/.svn/pristine/87/87b6b83a679700ce45d5031af690725e0a861c7a.svn-base deleted file mode 100644 index e4fd85ed8878eb535f74667d3bc23e027b4bcc62..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/87/87b6b83a679700ce45d5031af690725e0a861c7a.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -pwd=$PWD -for i in `find * -type d | grep -v .svn`; do - echo $i - cd $i - rm -f A.OUT main.o A.dgematrix A.dsymatrix y.dcovector answer.dcovector solution.dcovector *~ - cd $pwd -done diff --git a/cpplapack-r198/.svn/pristine/88/8815b52400e50f22b97b89e0f853f4c2c5bd204a.svn-base b/cpplapack-r198/.svn/pristine/88/8815b52400e50f22b97b89e0f853f4c2c5bd204a.svn-base deleted file mode 100644 index b958a003740940c1aa9cd06520953d4c54683d8e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/88/8815b52400e50f22b97b89e0f853f4c2c5bd204a.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+dsymatrix operator */ -/* -inline _dgematrix operator+(const _dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix-dsymatrix operator */ -/* -inline _dgematrix operator-(const _dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix*dsymatrix operator */ -/* -inline _dgematrix operator*(const _dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/88/882d154aef5e7b6d4529b13821d939dda4d29ea4.svn-base b/cpplapack-r198/.svn/pristine/88/882d154aef5e7b6d4529b13821d939dda4d29ea4.svn-base deleted file mode 100644 index c0c8c98d16493a9af79a54287a3885d09b87c872..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/88/882d154aef5e7b6d4529b13821d939dda4d29ea4.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! drovector constructor */ -inline drovector::drovector() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =0; - cap =0; - array =NULL; -} - -//============================================================================= -/*! drovector copy constructor */ -inline drovector::drovector(const drovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - cap =vec.cap; - array =new double[cap]; - - //////// copy //////// - CPPL_INT inc =1; - dcopy_(&l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! drovector constructor to cast _drovector */ -inline drovector::drovector(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - cap =vec.cap; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! drovector constructor with size specification */ -inline drovector::drovector(const CPPL_INT& _l, const CPPL_INT margin) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 || margin<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers. " << std::endl - << "Your input was (" << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - l =_l; - cap =l+margin; - array =new double[cap]; -} - -//============================================================================= -/*! drovector constructor with filename */ -inline drovector::drovector(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector destructor */ -inline drovector::~drovector() -{CPPL_VERBOSE_REPORT; - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/88/888ab6a8fe6fe66e62ea829226345b9512733322.svn-base b/cpplapack-r198/.svn/pristine/88/888ab6a8fe6fe66e62ea829226345b9512733322.svn-base deleted file mode 100644 index 964f013f119c533937a9e613df12cc73e3800307..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/88/888ab6a8fe6fe66e62ea829226345b9512733322.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! _zcovector*comple operator */ -inline _zcovector operator*(const _zcovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zscal_(&vec.l, &d, vec.array, &inc); - return vec; -} - -//============================================================================= -/*! _zcovector/comple operator */ -inline _zcovector operator/(const _zcovector& vec, const comple& d) -{CPPL_VERBOSE_REPORT; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&vec.l, &dinv, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/88/888d074427a164304566f6f0a4d6a4b1d91adf6e.svn-base b/cpplapack-r198/.svn/pristine/88/888d074427a164304566f6f0a4d6a4b1d91adf6e.svn-base deleted file mode 100644 index 9ac98be00e253d249fc7ad4abf090094550136ea..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/88/888d074427a164304566f6f0a4d6a4b1d91adf6e.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -//============================================================================= -//! Component Class for Real Double-precision Sparse Matrix Classes -class dcomponent -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT i; //!< i index of the component - CPPL_INT j; //!< j index of the component - double v; //!< value of the component - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dcomponent(){ ; } - inline dcomponent(const CPPL_INT& _i, const CPPL_INT& _j, const double& _v) :i(_i), j(_j), v(_v){ ; } - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - inline friend std::ostream& operator<<(std::ostream&, const dcomponent&); - inline static bool ilt(const dcomponent&, const dcomponent&); - inline static bool jlt(const dcomponent&, const dcomponent&); -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dcomponent& c) -{CPPL_VERBOSE_REPORT; - s << "(" << c.i << ", " << c.j << ", " << c.v << ")" << std::flush; - return s; -} - -//============================================================================= -/*! lessthan function for i of dcomponent */ -inline bool dcomponent::ilt(const dcomponent& a, const dcomponent& b) -{CPPL_VERBOSE_REPORT; - return a.i < b.i; -} - -//============================================================================= -/*! lessthan function for j of dcomponent */ -inline bool dcomponent::jlt(const dcomponent& a, const dcomponent& b) -{CPPL_VERBOSE_REPORT; - return a.j < b.j; -} diff --git a/cpplapack-r198/.svn/pristine/88/8896eb9e6191a24db8fbf8a501231f8063893429.svn-base b/cpplapack-r198/.svn/pristine/88/8896eb9e6191a24db8fbf8a501231f8063893429.svn-base deleted file mode 100644 index 67d8589222465e880329f0f63b42327af83ad710..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/88/8896eb9e6191a24db8fbf8a501231f8063893429.svn-base +++ /dev/null @@ -1,160 +0,0 @@ -//============================================================================= -/*! dgsmatrix=dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator=(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - if(&data!=&mat.data){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix+=dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator+=(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) +=it->v; - } - - return *this; -} - -//============================================================================= -/*! dgsmatrix-=dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator-=(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -=it->v; - } - return *this; -} - -//============================================================================= -/*! dgsmatrix*=dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator*=(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(m, mat.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::const_iterator mat_rows_k_end =mat.rows[k].end(); - for(std::vector<CPPL_INT>::const_iterator p=mat.rows[k].begin(); p!=mat_rows_k_end; p++){ - newmat(it->i,mat.data[*p].j) +=it->v*mat.data[*p].v; - } - } - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix+dgsmatrix operator */ -inline _dgsmatrix operator+(const dgsmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix-dgsmatrix operator */ -inline _dgsmatrix operator-(const dgsmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) -=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix*dgsmatrix operator */ -inline _dgsmatrix operator*(const dgsmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat( matA.m, matB.n ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::const_iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::const_iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) +=it->v*matB.data[*p].v; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/88/88babc41a37bde24250a92845b3f4a3c9d5cfb19.svn-base b/cpplapack-r198/.svn/pristine/88/88babc41a37bde24250a92845b3f4a3c9d5cfb19.svn-base deleted file mode 100644 index f8b5aba591ea43145a2cd64c0c7c83dd35a889dd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/88/88babc41a37bde24250a92845b3f4a3c9d5cfb19.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################### -## Makefile for icl ## -############################################################################### - -TARGET = a.exe - -############################################################################### - -CXX = icl -FLAGS += /DRELEASE -####/DMKL_ILP64 -FLAGS += /QaxSSE4.2,AVX,CORE-AVX2,CORE-AVX-I /O3 /Qprec-div- /fp:fast=2 # without ipo -####FLAGS += /Qipo -FLAGS += /Qopenmp /Qmkl:parallel -CFLAGS += /Qstd=c++11 /W0 /nologo -LFLAGS += -INCLUDE_DIRS += /I. -INCLUDE_DIRS += /I../../cpplapack/include - -############################################################################### - -HEADERS:= $(wildcard */*.hpp *.hpp) -SOURCES:= $(wildcard */*.cpp *.cpp) -SOURCES:= $(sort $(SOURCES)) -#SOURCES:= $(filter-out main.cpp, $(SOURCES)) main.cpp -OBJECTS:= $(SOURCES:%.cpp=%.obj) -OBJECTS_TO_DEL := $(subst /,\,$(OBJECTS)) - -############################################################################### -############################################################################### -############################################################################### - -all: $(OBJECTS) - $(CXX) $(OBJECTS) $(FLAGS) $(LFLAGS) $(LIB_DIRS) $(LIBS) /Fe$(TARGET) - -.SUFFIXES: .cpp .obj -.cpp.obj: - $(CXX) /c $< $(FLAGS) $(CFLAGS) $(INCLUDE_DIRS) $(MACROS) /Fo$@ - -clean: - del $(OBJECTS_TO_DEL) diff --git a/cpplapack-r198/.svn/pristine/89/8960e60f107152c9e940497311c0af05af88961b.svn-base b/cpplapack-r198/.svn/pristine/89/8960e60f107152c9e940497311c0af05af88961b.svn-base deleted file mode 100644 index d82a2e7b29dba2287ecb3418fe61bbde18ac84d1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/89/8960e60f107152c9e940497311c0af05af88961b.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! drovector*dcovector operator */ -inline double operator*(const drovector& rovec, const dcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - return val; -} diff --git a/cpplapack-r198/.svn/pristine/89/899ce857a401c9d55a2adfb066b91515db2b9dfb.svn-base b/cpplapack-r198/.svn/pristine/89/899ce857a401c9d55a2adfb066b91515db2b9dfb.svn-base deleted file mode 100644 index f40587a3705aa00b9a1cb810be68196f0311eb95..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/89/899ce857a401c9d55a2adfb066b91515db2b9dfb.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -/*****************************************************************************/ -/* noname.cpp */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(2), KU(1); - CPPL::dgematrix A(M,N); - CPPL::dgbmatrix B(M,N,KL,KU); - CPPL::dsymatrix C(N); - CPPL::dcovector cv(M); - CPPL::drovector rv(M); - - for(int i=0; i<M; i++){ for(int j=0; j<N; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - for(int i=0; i<M; i++){ for(int j=0; j<N; j++){ - if( !(i-j>B.kl || j-i>B.ku) ){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - } - }} - - for(int i=0; i<N; i++){ for(int j=0; j<=i; j++){ - C(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - for(int i=0; i<M; i++){ - cv(i) =double( rand() /(RAND_MAX/10) ); - rv(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "A =\n" << A << endl; - cout << "10.*A =\n" << 10.*A << endl; - cout << "A*10. =\n" << A*10. << endl; - cout << "A/10. =\n" << A/10. << endl; - - cout << "B =\n" << B << endl; - cout << "10.*B =\n" << 10.*B << endl; - cout << "B*10. =\n" << B*10. << endl; - cout << "B/10. =\n" << B/10. << endl; - - cout << "C =\n" << C << endl; - cout << "10.*C =\n" << 10.*C << endl; - cout << "C*10. =\n" << C*10. << endl; - cout << "C/10. =\n" << C/10. << endl; - - cout << "cv =\n" << cv << endl; - cout << "10.*cv =\n" << 10.*cv << endl; - cout << "cv*10. =\n" << cv*10. << endl; - cout << "cv/10. =\n" << cv/10. << endl; - - cout << "rv =\n" << rv << endl; - cout << "10.*rv =\n" << 10.*rv << endl; - cout << "rv*10. =\n" << rv*10. << endl; - cout << "rv/10. =\n" << rv/10. << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/89/89b146f3bb5cd720a8f405fe5ef66488274acf09.svn-base b/cpplapack-r198/.svn/pristine/89/89b146f3bb5cd720a8f405fe5ef66488274acf09.svn-base deleted file mode 100644 index 4cc6bc2d1d688a1f5d5b38a0e7004e22b2dd19a3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/89/89b146f3bb5cd720a8f405fe5ef66488274acf09.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! cast to _zcovector */ -inline _zcovector _dcovector::to_zcovector() const -{CPPL_VERBOSE_REPORT; - zcovector newvec(l); - - for(CPPL_INT i=0; i<l; i++){ - newvec.array[i] =comple(array[i], 0.); - } - - destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/8b/8b32c9922291c2f3a4b4d96eb367215463f94a9b.svn-base b/cpplapack-r198/.svn/pristine/8b/8b32c9922291c2f3a4b4d96eb367215463f94a9b.svn-base deleted file mode 100644 index 7aeca8aebb35c2a49dbbe4a34ce48ef53cd5c60d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8b/8b32c9922291c2f3a4b4d96eb367215463f94a9b.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+_zgsmatrix operator */ -inline _zgsmatrix operator+(const _zgsmatrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix-_zgsmatrix operator */ -inline _zgsmatrix operator-(const _zgsmatrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix*_zgsmatrix operator */ -inline _zgsmatrix operator*(const _zgsmatrix& matA, const _zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA.m, matB.n); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/8b/8b39767093abc92df6bb324f3fe322dfe7af998d.svn-base b/cpplapack-r198/.svn/pristine/8b/8b39767093abc92df6bb324f3fe322dfe7af998d.svn-base deleted file mode 100644 index ec74a7811cadea1ccea623eb9374aec69d3f34f6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8b/8b39767093abc92df6bb324f3fe322dfe7af998d.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*dgrmatrix operator */ -inline dgrmatrix operator*(const double& d, const dgrmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgrmatrix newmat =mat; - - const size_t newmat_a_size =newmat.a.size(); - for(size_t k=0; k<newmat_a_size; k++){ - newmat.a[k] *= d; - } - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/8b/8bbf087a959178c771da9e5ea9d3cf0ad2676d89.svn-base b/cpplapack-r198/.svn/pristine/8b/8bbf087a959178c771da9e5ea9d3cf0ad2676d89.svn-base deleted file mode 100644 index b9ab2e6a1d5c54efd8dd0d0e64bb3055006984bb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8b/8bbf087a959178c771da9e5ea9d3cf0ad2676d89.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -//============================================================================= -/*! cast to _zgematrix */ -inline _zgematrix dgematrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat(m,n); - for(CPPL_INT i=0; i<m*n; i++){ - newmat.array[i] =comple(array[i],0.0); - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/8c/8cbe7365a484635448ca20ac61f97f886a6899f4.svn-base b/cpplapack-r198/.svn/pristine/8c/8cbe7365a484635448ca20ac61f97f886a6899f4.svn-base deleted file mode 100644 index 3ed32505f3238a5468fd070294d9001c85c5b051..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8c/8cbe7365a484635448ca20ac61f97f886a6899f4.svn-base +++ /dev/null @@ -1,84 +0,0 @@ -//============================================================================= -/*! calculate determinant */ -inline double det(const dsymat2& A) -{CPPL_VERBOSE_REPORT; - return A(0,0)*A(1,1) -A(1,0)*A(1,0); -} - -//============================================================================= -/*! calculate inverse */ -inline dsymat2 inv(const dsymat2& A) -{CPPL_VERBOSE_REPORT; - const double Adet( det(A) ); - dsymat2 Ainv; - Ainv(0,0)= A(1,1)/Adet; - Ainv(1,0)=-A(1,0)/Adet; Ainv(1,1)= A(0,0)/Adet; - return Ainv; -} - -//============================================================================= -/*! rotate 2D matrix by rotational angle */ -inline dsymat2 rotate(const dsymat2& m, const double& theta) -{CPPL_VERBOSE_REPORT; - double c(std::cos(theta)), s(std::sin(theta)); - double cc(c*c), cs(c*s), ss(s*s); - dsymat2 mat; - mat(0,0) =m(0,0)*cc -2.*m(1,0)*cs +m(1,1)*ss; - mat(1,0) =m(1,0)*cc +(m(0,0)-m(1,1))*cs -m(1,0)*ss; - mat(1,1) =m(1,1)*cc +2.*m(1,0)*cs +m(0,0)*ss; - return mat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate determinant */ -inline double det(const dsymat3& A) -{CPPL_VERBOSE_REPORT; - return - +A(0,0)*A(1,1)*A(2,2) -A(0,0)*A(2,1)*A(2,1) - +A(1,0)*A(2,1)*A(2,0) -A(1,0)*A(1,0)*A(2,2) - +A(2,0)*A(1,0)*A(2,1) -A(2,0)*A(1,1)*A(2,0); -} - -//============================================================================= -/*! calculate inverse */ -inline dsymat3 inv(const dsymat3& A) -{CPPL_VERBOSE_REPORT; - const double Adet( det(A) ); - dsymat3 Ainv; - Ainv(0,0) =(A(1,1)*A(2,2)-A(2,1)*A(2,1))/Adet; - Ainv(1,0) =(A(2,1)*A(2,0)-A(1,0)*A(2,2))/Adet; - Ainv(1,1) =(A(0,0)*A(2,2)-A(2,0)*A(2,0))/Adet; - Ainv(2,0) =(A(1,0)*A(2,1)-A(1,1)*A(2,0))/Adet; - Ainv(2,1) =(A(1,0)*A(2,0)-A(0,0)*A(2,1))/Adet; - Ainv(2,2) =(A(0,0)*A(1,1)-A(1,0)*A(1,0))/Adet; - return Ainv; -} - -//============================================================================= -/*! rotate 3D matrix by quaternion */ -inline dsymat3 rotate(const dsymat3& m, const dquater& q) -{CPPL_VERBOSE_REPORT; - dgemat3 R =q2m(q); - dgemat3 Rm =R*m; - - dsymat3 RmRT;//not dgemat3 - RmRT.zero(); - for(CPPL_INT i=0; i<3; i++){ - for(CPPL_INT j=0; j<=i; j++){ - for(CPPL_INT k=0; k<3; k++){ - RmRT(i,j) +=Rm(i,k)*R(j,k); - } - } - } - return RmRT; -} diff --git a/cpplapack-r198/.svn/pristine/8c/8cd5e148373a29beadf7596753aed7efb580189e.svn-base b/cpplapack-r198/.svn/pristine/8c/8cd5e148373a29beadf7596753aed7efb580189e.svn-base deleted file mode 100644 index db0a60c69109cae50f1b09fe8b764f3cf1cd24a6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8c/8cd5e148373a29beadf7596753aed7efb580189e.svn-base +++ /dev/null @@ -1,323 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double dssmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ - return data[*p].v; - } - } - - //// (i,j) component was not found //// - return 0.0; -} - -//============================================================================= -/*! operator() for const object */ -inline double& dssmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// search (i,j) component //////// - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ - return data[*p].v; - } - } - - //////// (i,j) component not found //////// - line[ii].push_back(CPPL_INT(data.size())); - if(i!=j){//off-diagonal - line[jj].push_back(CPPL_INT(data.size())); - } - data.push_back(dcomponent(ii,jj,0.)); - return data.back().v; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! put value with volume cheack without isListed check */ -inline dssmatrix& dssmatrix::put(const CPPL_INT& i, const CPPL_INT& j, const double& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } - - if( isListed(i,j) ){ - ERROR_REPORT; - std::cerr << "The required component is already listed." << std::endl - << "Your input was (" << i << "," << j << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// push //// - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - line[ii].push_back(CPPL_INT(data.size())); - if(i!=j){//off-diagonal - line[jj].push_back(CPPL_INT(data.size())); - } - data.push_back(dcomponent(ii,jj,v)); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! delete the entry of a component */ -inline dssmatrix& dssmatrix::del(const CPPL_INT i, const CPPL_INT j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - //////// search (i,j) component //////// - const std::vector<CPPL_INT>::iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){//exists - //// save position //// - CPPL_INT c =*p; - CPPL_INT C =CPPL_INT(data.size()-1); - - //// data translation //// - data[c]=data.back(); - data.pop_back(); - - //// remove from List //// - line[ii].erase(p); - if(i!=j){//off-diagonal - const std::vector<CPPL_INT>::iterator line_jj_end =line[jj].end(); - for(std::vector<CPPL_INT>::iterator pj=line[jj].begin(); pj!=line_jj_end; pj++){ - if(*pj==c){ line[jj].erase(pj); break; } - } - } - - //// modify the entry of translated component //// - CPPL_INT I(data[c].i), J(data[c].j); - const std::vector<CPPL_INT>::iterator line_I_end =line[I].end(); - for(std::vector<CPPL_INT>::iterator q=line[I].begin(); q!=line_I_end; q++){ - if(*q==C){ *q=c; break; } - } - if(I!=J){//off-diagonal - const std::vector<CPPL_INT>::iterator line_J_end =line[J].end(); - for(std::vector<CPPL_INT>::iterator q=line[J].begin(); q!=line_J_end; q++){ - if(*q==C){ *q=c; break; } - } - } - return *this; - } - } - -#ifdef CPPL_DEBUG - std::cerr << "# [NOTE]@dssmatrix::del(CPPL_INT&, CPPL_INT&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; -#endif//CPPL_DEBUG - - return *this; -} - -//============================================================================= -/*! delete the entry of an element */ -inline dssmatrix& dssmatrix::del(const CPPL_INT c) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( c<0 || c>=CPPL_INT(data.size()) ){ - ERROR_REPORT; - std::cerr << "The required element is out of the matrix volume." << std::endl - << "Your input was (" << c << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if( c==CPPL_INT(data.size()-1) ){//if c is the last element - CPPL_INT i(data[c].i), j(data[c].j); - const std::vector<CPPL_INT>::iterator line_i_end =line[i].end(); - for(std::vector<CPPL_INT>::iterator q=line[i].begin(); q!=line_i_end; q++){ - if(*q==c){ line[i].erase(q); break; } - } - if(i!=j){//off-diagonal - const std::vector<CPPL_INT>::iterator line_j_end =line[j].end(); - for(std::vector<CPPL_INT>::iterator q=line[j].begin(); q!=line_j_end; q++){ - if(*q==c){ line[j].erase(q); break; } - } - } - data.pop_back(); - } - - else{//c is NOT the last element - //// data translation //// - CPPL_INT C =CPPL_INT(data.size()-1); - CPPL_INT i(data[c].i), j(data[c].j), I(data.back().i), J(data.back().j); - data[c]=data.back(); - //std::cerr << "c=" << c << " i=" << i << " j=" << j << " C=" << vol << " I=" << I << " J=" << J << std::endl; - - //// remove entry of component //// - const std::vector<CPPL_INT>::iterator line_i_end =line[i].end(); - for(std::vector<CPPL_INT>::iterator q=line[i].begin(); q!=line_i_end; q++){ - if(*q==c){ line[i].erase(q); break; } - } - if(i!=j){//off-diagonal - const std::vector<CPPL_INT>::iterator line_j_end =line[j].end(); - for(std::vector<CPPL_INT>::iterator q=line[j].begin(); q!=line_j_end; q++){ - if(*q==c){ line[j].erase(q); break; } - } - } - - //// modify the entry of translated component //// - const std::vector<CPPL_INT>::iterator line_I_end =line[I].end(); - for(std::vector<CPPL_INT>::iterator q=line[I].begin(); q!=line_I_end; q++){ - if(*q==C){ *q=c; break; } - } - if(I!=J){//off-diagonal - const std::vector<CPPL_INT>::iterator line_J_end =line[J].end(); - for(std::vector<CPPL_INT>::iterator q=line[J].begin(); q!=line_J_end; q++){ - if(*q==C){ *q=c; break; } - } - } - - //// pop_back //// - data.pop_back(); - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i >= j ){ - CPPL_INT c =mat.number(i,j); - if(c<0){ - s << " x "; - } - else{ - s << " " << mat.data[c].v << " "; - } - } - else{//i<j - CPPL_INT c =mat.number(i,j); - if(c<0){ - s << "{x}"; - } - else{ - s << "{" << mat.data[c].v << "}"; - } - } - } - s << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void dssmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dssmatrix " << n << " " << data.size() << std::endl; - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void dssmatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - //////// id //////// - std::string id; - s >> id; - if( id != "dssmatrix" && id != "#dssmatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dssmatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - //////// n //////// - size_t size; - s >> n >> size; - resize(n); - data.reserve(size);//NOT resize. - - //////// i, j, v //////// - CPPL_INT i, j; - double v; - for(size_t k=0; k<size; k++){ - s >> i >> j >> v; - put(i,j, v); - } - - //////// check //////// - s >> i; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << " ." << std::endl - << "Most likely, there are too many data components over the context." << std::endl; - exit(1); - } - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/8d/8d44ee5134fe9b09f680adc8e26195e3b90baaed.svn-base b/cpplapack-r198/.svn/pristine/8d/8d44ee5134fe9b09f680adc8e26195e3b90baaed.svn-base deleted file mode 100644 index 7f0c7a5496bca2fc9085e348adf67565da0cbf07..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8d/8d44ee5134fe9b09f680adc8e26195e3b90baaed.svn-base +++ /dev/null @@ -1,123 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -bool minres -( - const CPPL::dsymatrix& A, - CPPL::dcovector& x, - const double& eps -) -{ - const CPPL::dcovector y(x); - CPPL::dcovector r(y); - - double beta2(nrm2(r)), beta3; - double rho0(1.0), rho1(beta2), rho2; - double rhop(0.0); - double c0(0.0), c1(-1.0), c2; - double s0(0.0), s1(0.0), s2; - double f(beta2); - - CPPL::dcovector p1(x.l), p2(r/beta2), p3; - CPPL::dcovector q0(x.l), q1(x.l), q2; - x.zero(); - p1.zero(); - q0.zero(); - q1.zero(); - - int itc(0); - const int itmax(2*x.l); - while( (fabs(f)>eps || fabs(damax(y-A*x))>eps) && itc<itmax){ - std::cout << itc << " " << fabs(damax(y-A*x)) << std::endl; - //std::cerr << "itc=" << itc << ", fabs(f)=" << fabs(f) << std::endl; - CPPL::dcovector Ap2(A*p2), z; - z =Ap2-beta2*p1; - double alpha; - alpha =Ap2%p2; - p3 =z-alpha*p2; - beta3 =nrm2(p3); - p3 /=beta3; - - double d, h; - d =(alpha-rhop*c0)*s1; - h =beta2*s0; - - rhop =-beta2*c0*s1 -alpha*c1; - rho2 =sqrt(pow(rhop,2)+pow(beta3,2)); - c2 =rhop/rho2; - s2 =beta3/rho2; - - CPPL::dcovector zp; - zp =p2 -(h/rho0)*q0; - q2 =zp -(d/rho1)*q1; - double t; - t =f*c2; - f *=s2; - - x +=(t/rho2)*q2; - beta2=beta3; - rho0=rho1; rho1=rho2; - c0=c1; c1=c2; - s0=s1; s1=s2; - swap(p1,p2); swap(p2,p3); - swap(q0,q1); swap(q1,q2); - - itc++; - } - std::cerr << "itc=" << itc << " fabs(damax(y-A*x))=" << fabs(damax(y-A*x)) << std::endl; - //std::cerr << "itc=" << itc << " fabs(f)=" << fabs(f) << std::endl; - - if(itc<itmax){ return 0; } - else{ return 1; } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - srand(time(NULL)); - - const int size(100); - CPPL::dsymatrix A(size); - - for(int i=0; i<size; i++){ - for(int j=0; j<=i; j++){ - A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; - } - A(i,i)+=10.; - } - A.write("A.dsymatrix"); - - CPPL::dcovector x(size); - for(int i=0; i<size; i++){ - x(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - x.write("answer.dcovector");//solution - std::cerr << "answer=\n" << t(x) << std::endl; - - CPPL::dcovector y(size); - y=A*x; - y.write("y.dcovector"); - - double eps(fabs(damax(y))*1e-6); - //std::cerr << "eps=" << eps << std::endl; - if( minres(A, y, eps) ){ - std::cerr << "failed." << std::endl; - exit(1); - } - y.write("solution.dcovector"); - std::cout << "solution=\n" << t(y) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/8d/8d4c8d2f17a061010f65f2f4195626ac2df73b65.svn-base b/cpplapack-r198/.svn/pristine/8d/8d4c8d2f17a061010f65f2f4195626ac2df73b65.svn-base deleted file mode 100644 index cb4ce30d394ab5a801672bdcb3bbf4cb3e909acd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8d/8d4c8d2f17a061010f65f2f4195626ac2df73b65.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zgbmatrix*zcovector operator */ -inline _zcovector operator*(const _zgbmatrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/8d/8d7f8e373ca802b619e8e839bd3081c6c37fbae2.svn-base b/cpplapack-r198/.svn/pristine/8d/8d7f8e373ca802b619e8e839bd3081c6c37fbae2.svn-base deleted file mode 100644 index c06e3555e6aad99a6e5731beac0065f1f118ee00..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8d/8d7f8e373ca802b619e8e839bd3081c6c37fbae2.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! _zgsmatrix*double operator */ -inline _zgsmatrix operator*(const _zgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *=d; - } - - return mat; -} - -//============================================================================= -/*! _zgsmatrix/double operator */ -inline _zgsmatrix operator/(const _zgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v /=d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/8e/8e024e2d9167eb1033bdccf0e5ce3f4ca8e02ba4.svn-base b/cpplapack-r198/.svn/pristine/8e/8e024e2d9167eb1033bdccf0e5ce3f4ca8e02ba4.svn-base deleted file mode 100644 index 0f59c5deaac551562a17b319445d68bc7af7d467..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8e/8e024e2d9167eb1033bdccf0e5ce3f4ca8e02ba4.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::dgematrix A(M,N), B; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "#### B.copy(A) ####" << endl; - B.copy(A); - cout << "B =\n" << B << endl; - - cout << "#### B.clear() ####" << endl; - B.clear(); - cout << "B =\n" << B << endl; - - cout << "#### B.resize(2,2) & B.zero() ####" << endl; - B.resize(2,2); - B.zero(); - cout << "B =\n" << B << endl; - - cout << "#### B.identity() ####" << endl; - B.identity(); - cout << "B =\n" << B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/8f/8f19ace7a1c9e04cf3e458fc13429b0366a5f957.svn-base b/cpplapack-r198/.svn/pristine/8f/8f19ace7a1c9e04cf3e458fc13429b0366a5f957.svn-base deleted file mode 100644 index 84d568b451a2776ac13ffc1a73fa236da1bc48a2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8f/8f19ace7a1c9e04cf3e458fc13429b0366a5f957.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! _zgematrix+zgsmatrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - matA(z.i,z.j) += z.v; - } - - return matA; -} - -//============================================================================= -/*! _zgematrix-zgsmatrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - matA(z.i,z.j) -= z.v; - } - - return matA; -} - -//============================================================================= -/*! _zgematrix*zgsmatrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,z.j) += matA(i,z.i)*z.v; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/8f/8f7b75d15f38357643af88b69e50bc7755fd5a62.svn-base b/cpplapack-r198/.svn/pristine/8f/8f7b75d15f38357643af88b69e50bc7755fd5a62.svn-base deleted file mode 100644 index 70cd550595d3f1f4de5d73f90120c1202c63efa3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8f/8f7b75d15f38357643af88b69e50bc7755fd5a62.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! +zcovector operator */ -inline const zcovector& operator+(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -zcovector operator */ -inline _zcovector operator-(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - for(CPPL_INT i=0; i<newvec.l; i++){ newvec.array[i]=-vec.array[i]; } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/8f/8f7e9230857435f70d0d2fd00688e30bd1a12574.svn-base b/cpplapack-r198/.svn/pristine/8f/8f7e9230857435f70d0d2fd00688e30bd1a12574.svn-base deleted file mode 100644 index 0501d5969970a18e4fef375a228b03d12af645f4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8f/8f7e9230857435f70d0d2fd00688e30bd1a12574.svn-base +++ /dev/null @@ -1,117 +0,0 @@ -//============================================================================= -/*! zcovector=_zcovector operator */ -inline zcovector& zcovector::operator=(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - shallow_copy(vec); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector+=_zcovector operator */ -inline zcovector& zcovector::operator+=(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] += vec.array[i]; - } - - vec.destroy(); - return *this; -} - -//============================================================================= -/*! zcovector operator-= */ -inline zcovector& zcovector::operator-=(const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] -= vec.array[i]; - } - - vec.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector+zcovector operator */ -inline _zcovector operator+(const zcovector& vecA, const _zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecB.array[i] += vecA.array[i]; - } - - return vecB; -} - -//============================================================================= -/*! zcovector-zcovector operator */ -inline _zcovector operator-(const zcovector& vecA, const _zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecB.array[i] =vecA.array[i]-vecB.array[i]; - } - - return vecB; -} - -//============================================================================= -/*! zcovector^T*zcovector operator (inner product) */ -inline comple operator%(const zcovector& vecA, const _zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/8f/8f8cc5cb77e7fb8b1327bb0e59d97e44e0a05698.svn-base b/cpplapack-r198/.svn/pristine/8f/8f8cc5cb77e7fb8b1327bb0e59d97e44e0a05698.svn-base deleted file mode 100644 index 5432bd519c5ef40e8247a9a7b53b2e3cda3e724f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8f/8f8cc5cb77e7fb8b1327bb0e59d97e44e0a05698.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -Package: cpplapack -Version: 2015.05.11-1 -Section: devel -Priority: optional -Architecture: all -Essential: no -Homepage: http://cpplapack.sourceforge.net/ -Maintainer: Yuki ONISHI <yuki.onishi@gmail.com> -Description: CPPLapack library header files - CPPLapack is a C++ matrix library designed as a class wrapper for BLAS, LAPACK and PARDISO. - Visit http://cpplapack.sourceforge.net/ to obtain the documentation, update information, and the latest version in the subversion (svn) repository. diff --git a/cpplapack-r198/.svn/pristine/8f/8fdcd8f3f57aea58b0161399d8b08ddaf36f892d.svn-base b/cpplapack-r198/.svn/pristine/8f/8fdcd8f3f57aea58b0161399d8b08ddaf36f892d.svn-base deleted file mode 100644 index 8c32cf2a1ebfad30b6d005621f3b41ae61fd69c1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/8f/8fdcd8f3f57aea58b0161399d8b08ddaf36f892d.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! +dgrmatrix operator */ -inline const dgrmatrix& operator+(const dgrmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -dgrmatrix operator */ -inline dgrmatrix operator-(const dgrmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgrmatrix newmat =mat; - - const std::vector<double>::iterator newmat_a_end =newmat.a.end(); - for(std::vector<double>::iterator it=newmat.a.begin(); it!=newmat_a_end; it++){ - (*it) =-(*it); - } - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/90/902c79a5d0641cf46d7a2a3fcb8c40e3b0714c3a.svn-base b/cpplapack-r198/.svn/pristine/90/902c79a5d0641cf46d7a2a3fcb8c40e3b0714c3a.svn-base deleted file mode 100644 index 61de753c23ab9c94841137325db7489edae620e8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/90/902c79a5d0641cf46d7a2a3fcb8c40e3b0714c3a.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -//============================================================================= -/*! _dgematrix+dsymatrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - matA(i,j)+=matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _dgematrix-dsymatrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.n; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - matA(i,j)-=matB(i,j); - } - } - - return matA; -} - -//============================================================================= -/*! _dgematrix*dsymatrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char side ='R'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/90/907409f44892a682a9365c75d3aa318ddc59778a.svn-base b/cpplapack-r198/.svn/pristine/90/907409f44892a682a9365c75d3aa318ddc59778a.svn-base deleted file mode 100644 index 2277e0649d6b31ec1fa273d6d61ef074b01e8d1a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/90/907409f44892a682a9365c75d3aa318ddc59778a.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! drovector*dsymatrix operator */ -inline _drovector operator*(const drovector& vec, const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/90/90d1da47f45bf2a701ef4fbf015faec6b0576785.svn-base b/cpplapack-r198/.svn/pristine/90/90d1da47f45bf2a701ef4fbf015faec6b0576785.svn-base deleted file mode 100644 index 4dcc709cd5366bbd1327e332bec9152fcfe0a337..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/90/90d1da47f45bf2a701ef4fbf015faec6b0576785.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _dsymatrix*double operator */ -inline _dsymatrix operator*(const _dsymatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - mat.darray[j][i] *=d; - } - } - - return mat; -} - -//============================================================================= -/*! dsymatrix/double operator */ -inline _dsymatrix operator/(const _dsymatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - mat.darray[j][i] /=d; - } - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/91/9162cba0275b35a4fd711d7dc9b3553886a11c9d.svn-base b/cpplapack-r198/.svn/pristine/91/9162cba0275b35a4fd711d7dc9b3553886a11c9d.svn-base deleted file mode 100644 index e52709a765f5150d91ea1fac04c02297490612a8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/91/9162cba0275b35a4fd711d7dc9b3553886a11c9d.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _zhsmatrix+_zgematrix operator */ -/* -inline _zgematrix operator+(const _zhsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return matB; -} -*/ -//============================================================================= -/*! _zhsmatrix-_zgematrix operator */ -/* -inline _zgematrix operator-(const _zhsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(int i=0; i<matB.m*matB.n; i++){ - matB.array[i] = -matB.array[i]; - } - - for(CPPL_INT c=0; c<matA.vol; c++){ - matB(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return matB; -} -*/ -//============================================================================= -/*! _zhsmatrix*_zgematrix operator */ -/* -inline _zgematrix operator*(const _zhsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/91/91c6d4f88ee9d62df02f188f4bbc9aed156a756a.svn-base b/cpplapack-r198/.svn/pristine/91/91c6d4f88ee9d62df02f188f4bbc9aed156a756a.svn-base deleted file mode 100644 index 92e5d7260ac6c94640603490ecfe5b7b04db01bd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/91/91c6d4f88ee9d62df02f188f4bbc9aed156a756a.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _zgematrix*comple operator */ -inline _zgematrix operator*(const _zgematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - zscal_(&size, &d, mat.array, &inc); - return mat; -} - -//============================================================================= -/*! _zgematrix/comple operator */ -inline _zgematrix operator/(const _zgematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&size, &dinv, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/92/9232e77a9b9c8d0f59b206cdea24b10d199a897a.svn-base b/cpplapack-r198/.svn/pristine/92/9232e77a9b9c8d0f59b206cdea24b10d199a897a.svn-base deleted file mode 100644 index 11e9ddbe96aa11d032d2be7ff899debb45f1cecd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/92/9232e77a9b9c8d0f59b206cdea24b10d199a897a.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _drovector*_dgematrix operator */ -inline _drovector operator*(const _drovector& vec, const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/92/92580771ded8568eec71f9c17617c8c26b535543.svn-base b/cpplapack-r198/.svn/pristine/92/92580771ded8568eec71f9c17617c8c26b535543.svn-base deleted file mode 100644 index d42f5e06471d97e3d61a1d5c9144fc49ef341cdb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/92/92580771ded8568eec71f9c17617c8c26b535543.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::dcovector x(M); - CPPL::drovector y(M); - - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - for(int i=0; i<y.l; i++){ - y(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "x =\n" << x << endl; - cout << "y =\n" << y << endl; - cout << "x*y =\n" << x*y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/92/9291ac7f2e652d84ba17af8b3b38ac4b2e0e1f70.svn-base b/cpplapack-r198/.svn/pristine/92/9291ac7f2e652d84ba17af8b3b38ac4b2e0e1f70.svn-base deleted file mode 100644 index d8651cacd08532ff4ff3ef60c75fa34e41ea6a50..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/92/9291ac7f2e652d84ba17af8b3b38ac4b2e0e1f70.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(2); - - CPPL::zcovector x(M), y(M), z; - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "x =\n" << x << endl; - cout << "y =\n" << y << endl; - - cout << "x+x =\n" << x+x << endl; - cout << "x-x =\n" << x-x << endl; - cout << "x%y =\n" << x%y << endl; - - cout << "#### z=x; ####" << endl; - z=x; - cout << "z =\n" << z << endl; - cout << "#### z=x+x-x; ####" << endl; - z=x+x-x; - cout << "z =\n" << z << endl; - cout << "#### z+=x; ####" << endl; - z+=x; - cout << "z =\n" << z << endl; - cout << "#### z-=x; ####" << endl; - z-=x; - cout << "z =\n" << z << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/93/9380e280c295bf923fab3a95b1ece20bf34cabd7.svn-base b/cpplapack-r198/.svn/pristine/93/9380e280c295bf923fab3a95b1ece20bf34cabd7.svn-base deleted file mode 100644 index 47059c186c5fd7318683fad2ed726c72ee7b5800..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/93/9380e280c295bf923fab3a95b1ece20bf34cabd7.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! zgesvd_check */ -void zgesvd_check() -{ - cout << "############ check zgesvd ############" << endl; - - srand(unsigned(time(NULL))); - int M(4), N(3); - - //// make zgematrix A //// - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make A_original //// - CPPL::zgematrix A_original(A); - - //// make S, U and VT //// - CPPL::dcovector S; - CPPL::zgematrix U, VT; - - //// SVD A //// - A.zgesvd(S,U,VT); - - //// print A, S, U, and VT //// - cout << "A=\n" << A << endl; - cout << "S=\n" << S << endl; - cout << "U=\n" << U << endl; - cout << "VT=\n" << VT << endl; - - CPPL::zgematrix S_matrix(M,N); - S_matrix.zero(); - for(int i=0; i<std::min(M,N); i++){ S_matrix(i,i) =S(i); } - cout << "S_matrix=\n" << S_matrix << endl; - cout << "A_original=\n" << A_original << endl; - cout << "U*S_matrix*VT=\n" << U*S_matrix*VT << endl; -} diff --git a/cpplapack-r198/.svn/pristine/93/93d0bfee0fb27c377991b1cc3add43d38e8a570f.svn-base b/cpplapack-r198/.svn/pristine/93/93d0bfee0fb27c377991b1cc3add43d38e8a570f.svn-base deleted file mode 100644 index 4959cbe4a9681295f6551bfca5c8da8579ba89ec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/93/93d0bfee0fb27c377991b1cc3add43d38e8a570f.svn-base +++ /dev/null @@ -1,210 +0,0 @@ -extern "C" { - // Solve Linear Equations A * x = b - /* for General Matrix */ - void zgesv_( const CPPL_INT *N, const CPPL_INT *nrhs, std::complex<double> *a, - const CPPL_INT *lda, CPPL_INT *ipiv, std::complex<double> *b, - const CPPL_INT *ldb, CPPL_INT *info ); - /* for General Band Matrix */ - void zgbsv_( const CPPL_INT *N, const CPPL_INT *KL, const CPPL_INT *KU, - const CPPL_INT *nrhs, std::complex<double> *ab, const CPPL_INT *ldab, - CPPL_INT *ipiv, std::complex<double> *b, const CPPL_INT *ldb, - CPPL_INT *info ); - /* for Tridiagonal Matrix */ - void zgtsv_( const CPPL_INT *N, const CPPL_INT *nrhs, std::complex<double> *dl, - std::complex<double> *d, std::complex<double> *du, - std::complex<double> *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for Hermitian Positive Definite Matrix */ - void zposv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *a, const CPPL_INT *lda, std::complex<double> *b, - const CPPL_INT *ldb, CPPL_INT *info ); - /* for Hermitian Positive Definite (Packed Storage) Matrix */ - void zppsv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *ap, std::complex<double> *b, const CPPL_INT *ldb, - CPPL_INT *info ); - /* for Hermitian Positive Definite Band Matrix */ - void zpbsv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *kd, - const CPPL_INT *nrhs, std::complex<double> *ab, const CPPL_INT *ldab, - std::complex<double> *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for Hermitian Positive Definite Tridiagonal Matrix */ - void zptsv_( const CPPL_INT *N, const CPPL_INT *nrhs, double *d, - std::complex<double> *e, std::complex<double> *b, const CPPL_INT *ldb, - CPPL_INT *info ); - /* for Hermitian Indefinite Matrix */ - void zhesv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *a, const CPPL_INT *lda, CPPL_INT *ipiv, - std::complex<double> *b, const CPPL_INT *ldb, std::complex<double> *work, - const CPPL_INT *lwork, CPPL_INT *info ); - /* for Symmetric Indefinite Matrix */ - void zsysv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *a, const CPPL_INT *lda, CPPL_INT *ipiv, - std::complex<double> *b, const CPPL_INT *ldb, std::complex<double> *work, - const CPPL_INT *lwork, CPPL_INT *info ); - /* for Hermitian Indefinite (Packed Storage) Matrix */ - void zhpsv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *ap, CPPL_INT *ipiv, std::complex<double> *b, - const CPPL_INT *ldb, CPPL_INT *info ); - /* for Symmetric Indefinite (Packed Storage) Matrix */ - void zspsv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *ap, CPPL_INT *ipiv, std::complex<double> *b, - const CPPL_INT *ldb, CPPL_INT *info ); - - // Linear Least Square Problems - // Solve Overdetermined or Underdetermined Linear Equations - /* Using Orthogonal Factorization, Assuming Full Rank */ - void zgels_( const char *trans, const CPPL_INT *M, const CPPL_INT *N, - const CPPL_INT *nrhs, std::complex<double> *a, const CPPL_INT *lda, - std::complex<double> *b, const CPPL_INT *ldb, - std::complex<double> *work, const CPPL_INT *lwork, CPPL_INT *info ); - /* Compute Minimum-Norm Solution using Orthogonal Factorization */ - void zgelsy_( const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *a, const CPPL_INT *lda, std::complex<double> *b, - const CPPL_INT *ldb, CPPL_INT *jpvt, const double *rcond, - CPPL_INT *rank, std::complex<double> *work, const CPPL_INT *lwork, - double *rwork, CPPL_INT *info ); - /* Compulte Minimum-Norm Solution using Singular Value Decomposition */ - void zgelss_( const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *nrhs, - std::complex<double> *a, const CPPL_INT *lda, std::complex<double> *b, - const CPPL_INT *ldb, double *s, const double *rcond, - CPPL_INT *rank, std::complex<double> *work, const CPPL_INT *lwork, - double *rwork, CPPL_INT *info ); - /* Solve Linear Equality-Constrained Least Squares (LSE) Problem */ - void zgglse_( const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *p, - std::complex<double> *a, const CPPL_INT *lda, std::complex<double> *b, - const CPPL_INT *ldb, std::complex<double> *c, std::complex<double> *d, - std::complex<double> *x, std::complex<double> *work, - const CPPL_INT *lwork, CPPL_INT *info ); - /* Solve Gauss-Markov Linear Model (GLM) Problem */ - void zggglm_( const CPPL_INT *N, const CPPL_INT *M, const CPPL_INT *p, - std::complex<double> *a, const CPPL_INT *lda, std::complex<double> *b, - const CPPL_INT *ldb, std::complex<double> *d, std::complex<double> *x, - std::complex<double> *y, std::complex<double> *work, - const CPPL_INT *lwork, CPPL_INT *info ); - - // Standard Eigenvalue and Singular Value Problems - // Divide and Conquer routines are more fast, but need more memory. - /* Eigenvalues/Eigenvectors for General Matrix */ - void zgeev_( const char *jobvl, const char *jobvr, const CPPL_INT *N, - std::complex<double> *a, const CPPL_INT *lda, std::complex<double> *w, - std::complex<double> *vl, const CPPL_INT *ldvl, std::complex<double> *vr, - const CPPL_INT *ldvr, std::complex<double> *work, const CPPL_INT *lwork, - double *rwork, CPPL_INT *info ); - /* Eigenvalues/Eigenvectors for Hermitian Matrix */ - void zheev_( const char *jobz, const char *uplo, const CPPL_INT *N, - std::complex<double> *a, const CPPL_INT *lda, double *w, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - CPPL_INT *info ); - void zheevd_( const char *jobz, const char *uplo, const CPPL_INT *N, - std::complex<double> *a, const CPPL_INT *lda, double *w, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - const CPPL_INT *lrwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Eigenvalues/Eigenvectors for Hermitian (Packed Storage) Matrix */ - void zhpev_( const char *jobz, const char *uplo, const CPPL_INT *N, - std::complex<double> *ap, double *w, std::complex<double> *z, - const CPPL_INT *ldz, std::complex<double> *work, double *rwork, - CPPL_INT *info ); - void zhpevd_( const char *jobz, const char *uplo, const CPPL_INT *N, - std::complex<double> *ap, double *w, std::complex<double> *z, - const CPPL_INT *ldz, std::complex<double> *work, const CPPL_INT *lwork, - double *rwork, const CPPL_INT *lrwork, CPPL_INT *iwork, - const CPPL_INT *liwork, CPPL_INT *info ); /* Divide and Conqure */ - /* Eigenvalues/Eigenvectors for Hermitian Band Matrix */ - void zhbev_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *kd, std::complex<double> *ab, const CPPL_INT *ldab, - double *w, std::complex<double> *z, const CPPL_INT *ldz, - std::complex<double> *work, double *rwork, CPPL_INT *info ); - void zhbevd_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *kd, std::complex<double> *ab, const CPPL_INT *ldab, - double *w, std::complex<double> *z, const CPPL_INT *ldz, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - const CPPL_INT *lrwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Schur Factorization for General Matrix */ - void zgees_( const char *jobvs, const char *sort, - bool (*select)( std::complex<double> *, std::complex<double> * ), - const CPPL_INT *N, std::complex<double> *a, const CPPL_INT *lda, - CPPL_INT *sdim, std::complex<double> *w, std::complex<double> *vs, - const CPPL_INT *ldvs, std::complex<double> *work, const CPPL_INT *lwork, - double *rwork, bool *bwork, CPPL_INT *info ); - /* Singular Value Decomposition for General Matrix */ - void zgesvd_( const char *jobu, const char *jobvt, const CPPL_INT *M, - const CPPL_INT *N, std::complex<double> *a, const CPPL_INT *lda, - double *s, std::complex<double> *u, const CPPL_INT *ldu, - std::complex<double> *vt, const CPPL_INT *ldvt, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - CPPL_INT *info ); - void zgesdd_( const char *jobz, const CPPL_INT *M, const CPPL_INT *N, - std::complex<double> *a, const CPPL_INT *lda, double *s, - std::complex<double> *u, const CPPL_INT *ldu, std::complex<double> *vt, - const CPPL_INT *ldvt, std::complex<double> *work, const CPPL_INT *lwork, - double *rwork, CPPL_INT *iwork, - CPPL_INT *info ); /* Divide and Conqure */ - - // Generalized Eigenvalue and Sigular Value Problems - /* Generalized Eigenvalues/Eigenvectors for General Matrix */ - void zggev_( const char *jobvl, const char *jobvr, const CPPL_INT *N, - std::complex<double> *a, const CPPL_INT *lda, std::complex<double> *b, - const CPPL_INT *ldb, std::complex<double> *alpha, - std::complex<double> *beta, std::complex<double> *vl, - const CPPL_INT *ldvl, std::complex<double> *vr, const CPPL_INT *ldvr, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - CPPL_INT *info ); - /* Generalized Eigenvalues/Eigenvectors - for Hermitian-definite Matrix */ - void zhegv_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, std::complex<double> *a, const CPPL_INT *lda, - std::complex<double> *b, const CPPL_INT *ldb, double *w, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - CPPL_INT *info ); - void zhegvd_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, std::complex<double> *a, const CPPL_INT *lda, - std::complex<double> *b, const CPPL_INT *ldb, double *w, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - const CPPL_INT *lrwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Generalized Eigenvalues/Eigenvectors - for Hermitian-definite (Packed Storage) Matrix */ - void zhpgv_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, std::complex<double> *ap, std::complex<double> *bp, - double *w, std::complex<double> *z, const CPPL_INT *ldz, - std::complex<double> *work, double *rwork, CPPL_INT *info ); - void zhpgvd_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, std::complex<double> *ap, std::complex<double> *bp, - double *w, std::complex<double> *z, const CPPL_INT *ldz, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - const CPPL_INT *lrwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Generalized Eigenvalues/Eigenvectors - for Hermitian-definite Band Matrix */ - void zhbgv_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *ka, const CPPL_INT *kb, std::complex<double> *ab, - const CPPL_INT *ldab, std::complex<double> *bb, const CPPL_INT *ldbb, - double *w, std::complex<double> *z, const CPPL_INT *ldz, - std::complex<double> *work, double *rwork, CPPL_INT *info ); - void zhbgvd_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *ka, const CPPL_INT *kb, std::complex<double> *ab, - const CPPL_INT *ldab, std::complex<double> *bb, const CPPL_INT *ldbb, - double *w, std::complex<double> *z, const CPPL_INT *ldz, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - const CPPL_INT *lrwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Generalized Schur Factrization for General Matrix */ - void zgges_( const char *jobvsl, const char *jobvsr, const char *sort, - bool (*delctg)( std::complex<double> *, std::complex<double> * ), - const CPPL_INT *N, std::complex<double> *a, const CPPL_INT *lda, - std::complex<double> *b, const CPPL_INT *ldb, CPPL_INT *sdim, - std::complex<double> *alpha, std::complex<double> *beta, - std::complex<double> *vsl, const CPPL_INT *ldvsl, - std::complex<double> *vsr, const CPPL_INT *ldvsr, - std::complex<double> *work, const CPPL_INT *lwork, double *rwork, - bool *bwork, CPPL_INT *info ); - /* Generailized Singular Value Decomposition for General Matrix */ - void zggsvd_( const char *jobu, const char *jobv, const char *jobq, - const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *p, CPPL_INT *k, - CPPL_INT *L, std::complex<double> *a, const CPPL_INT *lda, - std::complex<double> *b, const CPPL_INT *ldb, double *alpha, - double *beta, std::complex<double> *u, const CPPL_INT *ldu, - std::complex<double> *v, const CPPL_INT *ldv, std::complex<double> *q, - const CPPL_INT *ldq, std::complex<double> *work, double *rwork, - CPPL_INT *iwork, CPPL_INT *info ); -} diff --git a/cpplapack-r198/.svn/pristine/93/93f9588f841586cf54f1ee622b417fdf25fd3f79.svn-base b/cpplapack-r198/.svn/pristine/93/93f9588f841586cf54f1ee622b417fdf25fd3f79.svn-base deleted file mode 100644 index 841fdc1620d788568c353b4c1be47c570381c2c9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/93/93f9588f841586cf54f1ee622b417fdf25fd3f79.svn-base +++ /dev/null @@ -1,273 +0,0 @@ -//============================================================================= -/*! solve A*X=Y using dsysv\n - The argument is dmatrix Y. Y is overwritten and become the solution X. - A is also overwritten. -*/ -inline CPPL_INT dsymatrix::dsysv(dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << n << "x" << n << ") and (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - char UPLO('l'); - CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.m), LWORK(-1), INFO(1); - double *WORK( new double[1] ); - dsysv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsysv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve A*x=y using dsysv\n - The argument is dcovector y. y is overwritten and become the solution x. - A is also overwritten. -*/ -inline CPPL_INT dsymatrix::dsysv(dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << n << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - char UPLO('l'); - CPPL_INT NRHS(1), LDA(n), *IPIV(new CPPL_INT[n]), LDB(vec.l), LWORK(-1), INFO(1); - double *WORK( new double[1] ); - dsysv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsysv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, WORK, &LWORK, &INFO); - delete [] WORK; - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate eigenvalues and eigenvectors.\n - All of the arguments need not to be initialized. - w is overwitten and become eigenvalues. - This matrix is also overwritten. - if jobz=1, this matrix becomes eigenvectors. -*/ -inline CPPL_INT dsymatrix::dsyev(std::vector<double>& w, const bool& jobz=0) -{CPPL_VERBOSE_REPORT; - w.resize(n); - char JOBZ, UPLO('l'); - if(jobz==0){ JOBZ='n'; } else{ JOBZ='V'; } - CPPL_INT LDA(n), INFO(1), LWORK(-1); - double *WORK(new double[1]); - dsyev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsyev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, &INFO); - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate eigenvalues and eigenvectors.\n - All of the arguments need not to be initialized. - w and v are overwitten and become - eigenvalues and eigenvectors, respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT dsymatrix::dsyev(std::vector<double>& w, std::vector<dcovector>& v) -{CPPL_VERBOSE_REPORT; - w.resize(n); - v.resize(n); - for(CPPL_INT i=0; i<n; i++){ - v[i].resize(n); - } - - char JOBZ('V'), UPLO('l'); - CPPL_INT LDA(n), INFO(1), LWORK(-1); - double *WORK(new double[1]); - dsyev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsyev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, &INFO); - delete [] WORK; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=0; i<n; i++){ - v[j](i) = array[i+n*j]; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate eigenvalues and eigenvectors.\n - All of the arguments need not to be initialized. - w and v are overwitten and become - eigenvalues and eigenvectors, respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT dsymatrix::dsyev(std::vector<double>& w, std::vector<drovector>& v) -{CPPL_VERBOSE_REPORT; - w.resize(n); - v.resize(n); - for(CPPL_INT i=0; i<n; i++){ - v[i].resize(n); - } - - char JOBZ('V'), UPLO('l'); - CPPL_INT LDA(n), INFO(1), LWORK(-1); - double *WORK(new double[1]); - dsyev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsyev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, &INFO); - delete [] WORK; - - //// forming //// - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=0; i<n; i++){ - v[j](i) = array[i+n*j]; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate generalized eigenvalues\n - w is overwitten and become generalized eigenvalues. - This matrix and matB are also overwritten. -*/ -inline CPPL_INT dsymatrix::dsygv(dsymatrix& matB, std::vector<double>& w) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matB.n!=n){ - ERROR_REPORT; - std::cerr << "The matrix B is not a matrix having the same size as \"this\" matrix." << std::endl - << "The B matrix is (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - w.resize(n); - char JOBZ('n'), UPLO('l'); - CPPL_INT ITYPE(1), LDA(n), LDB(n), LWORK(-1), INFO(1); - double *WORK(new double[1]); - dsygv_(&ITYPE, &JOBZ, &UPLO, &n, array, &LDA, matB.array, &LDB, &w[0], WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsygv_(&ITYPE, &JOBZ, &UPLO, &n, array, &LDA, matB.array, &LDB, &w[0], WORK, &LWORK, &INFO); - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate generalized eigenvalues\n - w is overwitten and become generalized eigenvalues. - This matrix and matB are also overwritten. -*/ -inline CPPL_INT dsymatrix::dsygv(dsymatrix& matB, std::vector<double>& w, - std::vector<dcovector>& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matB.n!=n){ - ERROR_REPORT; - std::cerr << "The matrix B is not a matrix having the same size as \"this\" matrix." << std::endl - << "The B matrix is (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - w.resize(n); - v.resize(n); - char JOBZ('V'), UPLO('l'); - CPPL_INT ITYPE(1), LDA(n), LDB(n), LWORK(-1), INFO(1); - double *WORK(new double[1]); - dsygv_(&ITYPE, &JOBZ, &UPLO, &n, array, &LDA, matB.array, &LDB, &w[0], WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(WORK[0]); - delete [] WORK; - WORK = new double[LWORK]; - dsygv_(&ITYPE, &JOBZ, &UPLO, &n, array, &LDA, matB.array, &LDB, &w[0], WORK, &LWORK, &INFO); - delete [] WORK; - - //// reforming //// - for(int i=0; i<n; i++){ - v[i].resize(n); - for(int j=0; j<n; j++){ - v[i](j) =darray[i][j]; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} diff --git a/cpplapack-r198/.svn/pristine/94/941a88b22156ba5b109e0816a652e49b4967d963.svn-base b/cpplapack-r198/.svn/pristine/94/941a88b22156ba5b109e0816a652e49b4967d963.svn-base deleted file mode 100644 index 4b41653fb70ddd432cafd23d5e5ce830c48b4b9e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/94/941a88b22156ba5b109e0816a652e49b4967d963.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - const int N(3); - - CPPL::zrovector a(N), b(N); - for(int i=0; i<a.l; i++){ - a(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - b(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - CPPL::zhematrix X(N), Y(N); - for(int i=0; i<X.n; i++){ - for(int j=0; j<i; j++){ - X(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - Y(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - X(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.); - Y(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.); - } - CPPL::zhematrix Z(X+Y); - - cout << "a*Z-a*X-a*Y = (Should be zero)\n" << a*Z-a*X-a*Y << endl; - - cout << "a*Z-a*(X+Y) = (Should be zero)\n" << a*Z-a*(X+Y) << endl; - - cout << "(a+b)*X-a*X-b*X = (Should be zero)\n" << (a+b)*X-a*X-b*X << endl; - - cout << "(a-b)*(X-Y)-a*X+a*Y+b*X-b*Y = (Should be zero)\n" - << (a-b)*(X-Y)-a*X+a*Y+b*X-b*Y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/94/94764c41151f9a19fa6241552e05e6c72d93c396.svn-base b/cpplapack-r198/.svn/pristine/94/94764c41151f9a19fa6241552e05e6c72d93c396.svn-base deleted file mode 100644 index 433dc801c4f9280d55a0b7efa2ddb721a3157034..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/94/94764c41151f9a19fa6241552e05e6c72d93c396.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+_dgematrix operator */ -inline _dgematrix operator+(const _dgbmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) += matA(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _dgbmatrix-_dgematrix operator */ -inline _dgematrix operator-(const _dgbmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) = matA(i,j)-matB(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _dgbmatrix*_dgematrix operator */ -inline _dgematrix operator*(const _dgbmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/94/947b441be13ff2e54e9a1114cd070e249b538869.svn-base b/cpplapack-r198/.svn/pristine/94/947b441be13ff2e54e9a1114cd070e249b538869.svn-base deleted file mode 100644 index ae259bc64ba60f67ace547c40cf77e20caed81ef..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/94/947b441be13ff2e54e9a1114cd070e249b538869.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Complex Double-precision Row Vector Class -class _zrovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT l; //!< vector size - mutable comple* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _zrovector(); - inline _zrovector(const _zrovector&); - inline ~_zrovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - - //////// io //////// - inline comple& operator()(const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const _zrovector&); - inline void write(const char*) const; - - //////// calc //////// - inline friend _zcovector t(const _zrovector&); - inline friend _zrovector conj(const _zrovector&); - inline friend _zcovector conjt(const _zrovector&); - inline friend double nrm2(const _zrovector&); - inline friend CPPL_INT idamax(const _zrovector&); - inline friend comple damax(const _zrovector&); - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _zrovector& operator+(const _zrovector&); - inline friend _zrovector operator-(const _zrovector&); - - //////// + //////// - inline friend _zrovector operator+(const _zrovector&, const zrovector&); - inline friend _zrovector operator+(const _zrovector&, const _zrovector&); - - //////// - //////// - inline friend _zrovector operator-(const _zrovector&, const zrovector&); - inline friend _zrovector operator-(const _zrovector&, const _zrovector&); - - //////// * //////// - inline friend comple operator*(const _zrovector&, const zcovector&); - inline friend comple operator*(const _zrovector&, const _zcovector&); - inline friend _zrovector operator*(const _zrovector&, const zgematrix&); - inline friend _zrovector operator*(const _zrovector&, const _zgematrix&); - inline friend _zrovector operator*(const _zrovector&, const zhematrix&); - inline friend _zrovector operator*(const _zrovector&, const _zhematrix&); - inline friend _zrovector operator*(const _zrovector&, const zgbmatrix&); - inline friend _zrovector operator*(const _zrovector&, const _zgbmatrix&); - inline friend _zrovector operator*(const _zrovector&, const zgsmatrix&); - inline friend _zrovector operator*(const _zrovector&, const _zgsmatrix&); - inline friend _zrovector operator*(const _zrovector&, const zhsmatrix&); - inline friend _zrovector operator*(const _zrovector&, const _zhsmatrix&); - inline friend _zrovector operator*(const _zrovector&, const double&); - inline friend _zrovector operator*(const _zrovector&, const comple&); - - //////// / //////// - inline friend _zrovector operator/(const _zrovector&, const double&); - inline friend _zrovector operator/(const _zrovector&, const comple&); - - //////// % //////// - inline friend comple operator%(const _zrovector&, const zrovector&); - inline friend comple operator%(const _zrovector&, const _zrovector&); - - //////// double, complex //////// - inline friend _zrovector operator*(const double&, const _zrovector&); - inline friend _zrovector operator*(const comple&, const _zrovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/94/949e462cc62149ca2cb3aff1def0b065e8998332.svn-base b/cpplapack-r198/.svn/pristine/94/949e462cc62149ca2cb3aff1def0b065e8998332.svn-base deleted file mode 100644 index fb0d02526a2578ebb6f37e2c022f6897ed03e426..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/94/949e462cc62149ca2cb3aff1def0b065e8998332.svn-base +++ /dev/null @@ -1,45 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(3), CAP(4); - - CPPL::zgsmatrix A(M,N,CAP); - A.put(0,0, complex<double>(1.,2.) ); - A.put(3,2, complex<double>(3.,4.) ); - A.put(1,2, complex<double>(5.,6.) ); - A.put(4,1, complex<double>(7.,8.) ); - - cout << "A =\n" << A << endl; - - //A.put(1,2, 4.5); - //A.add(1,2, 0.1); - //A.sub(1,2, 0.1); - //A.mult(1,2, 10.); - //A.div(1,2, 10.); - //A.del(1,2); - A.del(2); - cout << "A (del 2) =\n" << A << endl; - - const CPPL::zgsmatrix B(A); - //// write/read //// - cout << "before write" << endl; - B.write( "tmp.txt" ); - - CPPL::zgsmatrix C; - cout << "before read" << endl; - C.read( "tmp.txt" ); - cout << "C-B =\n" << C-B << "<-Should be zero." << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/94/94a0c76ef66468ba460303a58631385e1d37e870.svn-base b/cpplapack-r198/.svn/pristine/94/94a0c76ef66468ba460303a58631385e1d37e870.svn-base deleted file mode 100644 index dff92f5ae819cc212f81fc5ea4951fa2fe82fce6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/94/94a0c76ef66468ba460303a58631385e1d37e870.svn-base +++ /dev/null @@ -1,34 +0,0 @@ -//============================================================================= -/*! cast to _zgbmatrix */ -inline _zgbmatrix _dgbmatrix::to_zgbmatrix() const -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(m,n,kl,ku); - - for(CPPL_INT i=0; i<(kl+ku+1)*n; i++){ - newmat.array[i] =comple(array[i],0.0); - } - - destroy(); - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix _dgbmatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat( dgematrix(m,n).zero() ); - - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/95/953a971ec84071a130b96d6b582ada8543803c55.svn-base b/cpplapack-r198/.svn/pristine/95/953a971ec84071a130b96d6b582ada8543803c55.svn-base deleted file mode 100644 index 9ca6c68755384c1faf8fe5d9727e72bb6c0c3668..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/95/953a971ec84071a130b96d6b582ada8543803c55.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! dcovector*_drovector operator */ -inline _dgematrix operator*(const dcovector& covec, const _drovector& rovec) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(covec.l, rovec.l); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - } - } - - rovec.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/95/9588af124f793280e72efd514a2be0a814b0280c.svn-base b/cpplapack-r198/.svn/pristine/95/9588af124f793280e72efd514a2be0a814b0280c.svn-base deleted file mode 100644 index fef1adf4e4af80db25be78037d5852fef055011f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/95/9588af124f793280e72efd514a2be0a814b0280c.svn-base +++ /dev/null @@ -1,114 +0,0 @@ -//============================================================================= -//! Complex Double-precision Column Vector Class -class zcovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT l; //!< vector size - comple* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zcovector(); - inline zcovector(const zcovector&); - inline zcovector(const _zcovector&); - inline zcovector(const CPPL_INT&); - inline zcovector(const char*); - inline ~zcovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - - //////// io //////// - inline comple& operator()(const CPPL_INT&); - inline comple operator()(const CPPL_INT&) const; - inline zcovector& set(const CPPL_INT&, const comple&); - inline friend std::ostream& operator<<(std::ostream&, const zcovector&); - inline void write(const char*) const; - inline void read(const char*); - - //////// calc //////// - inline friend _zrovector t(const zcovector&); - inline friend _zcovector conj(const zcovector&); - inline friend _zrovector conjt(const zcovector&); - inline friend double nrm2(const zcovector&); - inline friend CPPL_INT idamax(const zcovector&); - inline friend comple damax(const zcovector&); - - //////// misc //////// - inline void clear(); - inline zcovector& zero(); - inline void chsign(); - inline void copy(const zcovector&); - inline void shallow_copy(const _zcovector&); - inline void alias(const zcovector&); - inline void unalias(); - inline void resize(const CPPL_INT&); - inline _dcovector real() const; - inline _dcovector imag() const; - inline _dcovector abs() const; - inline _dcovector arg() const; - inline friend void swap(zcovector&, zcovector&); - inline friend _zcovector _(zcovector&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline zcovector& operator=(const zcovector&); - inline zcovector& operator=(const _zcovector&); - - //////// += //////// - inline zcovector& operator+=(const zcovector&); - inline zcovector& operator+=(const _zcovector&); - - //////// -= //////// - inline zcovector& operator-=(const zcovector&); - inline zcovector& operator-=(const _zcovector&); - - //////// *= //////// - inline zcovector& operator*=(const double&); - inline zcovector& operator*=(const comple&); - - //////// /= //////// - inline zcovector& operator/=(const double&); - inline zcovector& operator/=(const comple&); - - //////// unary //////// - inline friend const zcovector& operator+(const zcovector&); - inline friend _zcovector operator-(const zcovector&); - - //////// + //////// - inline friend _zcovector operator+(const zcovector&, const zcovector&); - inline friend _zcovector operator+(const zcovector&, const _zcovector&); - - //////// - //////// - inline friend _zcovector operator-(const zcovector&, const zcovector&); - inline friend _zcovector operator-(const zcovector&, const _zcovector&); - - //////// * //////// - inline friend _zgematrix operator*(const zcovector&, const zrovector&); - inline friend _zgematrix operator*(const zcovector&, const _zrovector&); - inline friend _zcovector operator*(const zcovector&, const double&); - inline friend _zcovector operator*(const zcovector&, const comple&); - - //////// / //////// - inline friend _zcovector operator/(const zcovector&, const double&); - inline friend _zcovector operator/(const zcovector&, const comple&); - - //////// % //////// - inline friend comple operator%(const zcovector&, const zcovector&); - inline friend comple operator%(const zcovector&, const _zcovector&); - - //////// double, comple //////// - inline friend _zcovector operator*(const double&, const zcovector&); - inline friend _zcovector operator*(const comple&, const zcovector&); - - //////// hadamard //////// - inline friend _zcovector hadamard(const zcovector&, const zcovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/95/95d5bce391702559cd495197a6cfbd971b1c39fa.svn-base b/cpplapack-r198/.svn/pristine/95/95d5bce391702559cd495197a6cfbd971b1c39fa.svn-base deleted file mode 100644 index c20656f6dc460dc737b16a71222b60063bbad629..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/95/95d5bce391702559cd495197a6cfbd971b1c39fa.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _dgematrix*dcovector operator */ -inline _dcovector operator*(const _dgematrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/96/96132b6b5db343e508d916768657ea110264971a.svn-base b/cpplapack-r198/.svn/pristine/96/96132b6b5db343e508d916768657ea110264971a.svn-base deleted file mode 100644 index fcb781dc89a44158a447c1c5355467b9d0454a10..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/96/96132b6b5db343e508d916768657ea110264971a.svn-base +++ /dev/null @@ -1,85 +0,0 @@ -//============================================================================= -//! Samll Real Double-precision Symmetric Matrix Class -template<CPPL_INT n> class dsymatrix_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - double array[(n*(n+1))/2]; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dsymatrix_small(); - inline explicit dsymatrix_small(const dsymatrix&); - inline ~dsymatrix_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline dgematrix_small<n,n> to_dgematrix_small() const; - inline dsymatrix to_dsymatrix() const; - - //////// io //////// - inline double& operator()(const CPPL_INT& i, const CPPL_INT& j); - inline double operator()(const CPPL_INT& i, const CPPL_INT& j) const; - inline dsymatrix_small<n>& set(const CPPL_INT&, const CPPL_INT&, const double&); - template<CPPL_INT _n> inline friend std::ostream& operator<<(std::ostream&, const dsymatrix_small<_n>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// misc //////// - inline dsymatrix_small<n>& zero(); - inline dsymatrix_small<n>& identity(); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT N> inline dsymatrix_small<N>& operator= (const dsymatrix_small<N>&); - //////// += //////// - template<CPPL_INT N> inline friend dsymatrix_small<N>& operator+=(dsymatrix_small<N>&, const dsymatrix_small<N>&); - //////// -= //////// - template<CPPL_INT N> inline friend dsymatrix_small<N>& operator-=(dsymatrix_small<N>&, const dsymatrix_small<N>&); - //////// *= //////// - template<CPPL_INT N> inline friend dsymatrix_small<N>& operator*=(dsymatrix_small<N>&, const double&); - //////// /= //////// - template<CPPL_INT N> inline friend dsymatrix_small<N>& operator/=(dsymatrix_small<N>&, const double&); - //////// unary //////// - template<CPPL_INT N> inline friend const dsymatrix_small<N>& operator+(const dsymatrix_small<N>&); - template<CPPL_INT N> inline friend dsymatrix_small< N > operator-(const dsymatrix_small<N>&); - //////// + //////// - template<CPPL_INT N> inline friend dgematrix_small<N,N> operator+(const dsymatrix_small<N>&, const dgematrix_small<N,N>&); - template<CPPL_INT N> inline friend dsymatrix_small< N > operator+(const dsymatrix_small<N>&, const dsymatrix_small< N >&); - //////// - //////// - template<CPPL_INT N> inline friend dgematrix_small<N,N> operator-(const dsymatrix_small<N>&, const dgematrix_small<N,N>&); - template<CPPL_INT N> inline friend dsymatrix_small< N > operator-(const dsymatrix_small<N>&, const dsymatrix_small< N >&); - //////// * //////// - template<CPPL_INT N> inline friend dcovector_small< N > operator*(const dsymatrix_small<N>&, const dcovector_small< N >&); - template<CPPL_INT M, CPPL_INT N> inline friend dgematrix_small<M,N> operator*(const dsymatrix_small<M>&, const dgematrix_small<M,N>&); - template<CPPL_INT N> inline friend dgematrix_small<N,N> operator*(const dsymatrix_small<N>&, const dsymatrix_small< N >&); - template<CPPL_INT N> inline friend dsymatrix_small< N > operator*(const dsymatrix_small<N>&, const double&); - //////// / //////// - template<CPPL_INT N> inline friend dsymatrix_small< N > operator/(const dsymatrix_small<N>&, const double&); - //////// double //////// - template<CPPL_INT N> inline friend dsymatrix_small< N > operator*(const double&, const dsymatrix_small< N >&); - //////// hadamerd //////// - template<CPPL_INT N> inline friend dsymatrix_small< N > hadamerd(const dsymatrix_small<N>&, const dgematrix_small<N,N>&); - template<CPPL_INT N> inline friend dsymatrix_small< N > hadamerd(const dsymatrix_small<N>&, const dsymatrix_small< N >&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline double det(const dsymat2&); -inline dsymat2 inv(const dsymat2&); -inline dsymat2 rotate(const dsymat2&, const double&); - -inline double det(const dsymat3&); -inline dsymat3 inv(const dsymat3&); -inline dsymat3 rotate(const dsymat3&, const dquater&); diff --git a/cpplapack-r198/.svn/pristine/96/9614e749d44431c0cecff7e279fb95114867e2e6.svn-base b/cpplapack-r198/.svn/pristine/96/9614e749d44431c0cecff7e279fb95114867e2e6.svn-base deleted file mode 100644 index 193894d6c058e18c81818af909b57075b13d4088..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/96/9614e749d44431c0cecff7e279fb95114867e2e6.svn-base +++ /dev/null @@ -1,10 +0,0 @@ -CONTENTS - - inlude/: CPPLapack header files - doc/: CPPLapack documentation files (see doc/html/index.html) - test/: CPPLapack test programs -benchmark/: CPPLapack benchmark programs -makefiles/: CPPLapack Makefile samples - contrib/: CPPLapack contribution programs -packaging/: files for rpm and deb packaging - README: This file diff --git a/cpplapack-r198/.svn/pristine/96/9626ce778d8af86d6e68432f4895481be5c184e4.svn-base b/cpplapack-r198/.svn/pristine/96/9626ce778d8af86d6e68432f4895481be5c184e4.svn-base deleted file mode 100644 index 0c6eb8db096c59a315c7f5fd4319d6ec59e2de90..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/96/9626ce778d8af86d6e68432f4895481be5c184e4.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _drovector*_dgsmatrix operator */ -inline _drovector operator*(const _drovector& vec, const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/96/967bf43af153b72235d6e0e65f3435a1e9932d35.svn-base b/cpplapack-r198/.svn/pristine/96/967bf43af153b72235d6e0e65f3435a1e9932d35.svn-base deleted file mode 100644 index 4a3f3eab87025099804d147a84b80f0fc9291f21..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/96/967bf43af153b72235d6e0e65f3435a1e9932d35.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================= -/*! calculate determinant */ -inline comple det(const zhemat2& A) -{CPPL_VERBOSE_REPORT; - return A(0,0)*A(1,1) -A(1,0)*A(1,0); -} - -//============================================================================= -/*! calculate inverse */ -inline zhemat2 inv(const zhemat2& A) -{CPPL_VERBOSE_REPORT; - const comple Adet( det(A) ); - zhemat2 Ainv; - Ainv(0,0)= A(1,1)/Adet; - Ainv(1,0)=-A(1,0)/Adet; Ainv(1,1)= A(0,0)/Adet; - return Ainv; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate determinant */ -inline comple det(const zhemat3& A) -{CPPL_VERBOSE_REPORT; - return - +A(0,0)*A(1,1)*A(2,2) -A(0,0)*A(2,1)*A(2,1) - +A(1,0)*A(2,1)*A(2,0) -A(1,0)*A(1,0)*A(2,2) - +A(2,0)*A(1,0)*A(2,1) -A(2,0)*A(1,1)*A(2,0); -} - -//============================================================================= -/*! calculate inverse */ -inline zhemat3 inv(const zhemat3& A) -{CPPL_VERBOSE_REPORT; - const comple Adet( det(A) ); - zhemat3 Ainv; - Ainv(0,0) =(A(1,1)*A(2,2)-A(2,1)*A(2,1))/Adet; - Ainv(1,0) =(A(2,1)*A(2,0)-A(1,0)*A(2,2))/Adet; - Ainv(1,1) =(A(0,0)*A(2,2)-A(2,0)*A(2,0))/Adet; - Ainv(2,0) =(A(1,0)*A(2,1)-A(1,1)*A(2,0))/Adet; - Ainv(2,1) =(A(1,0)*A(2,0)-A(0,0)*A(2,1))/Adet; - Ainv(2,2) =(A(0,0)*A(1,1)-A(1,0)*A(1,0))/Adet; - return Ainv; -} diff --git a/cpplapack-r198/.svn/pristine/96/96b1585090d86e4c92f97fad436facf1858e06b8.svn-base b/cpplapack-r198/.svn/pristine/96/96b1585090d86e4c92f97fad436facf1858e06b8.svn-base deleted file mode 100644 index 67de29726deed6705c1bef51af317f950f06c11a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/96/96b1585090d86e4c92f97fad436facf1858e06b8.svn-base +++ /dev/null @@ -1,75 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(2), KU(1); - //int M(10), N(4), KL(4), KU(0); - //int M(2), N(2), KL(0), KU(0); - - CPPL::dgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - std::cout << "A =\n" << A << std::endl; - - CPPL::dgbmatrix B; - std::cout << "#### B=A; ####" << std::endl; - B=A; - std::cout << "B =\n" << B << std::endl; - - std::cout << "#### B+=A; ####" << std::endl; - B+=A; - std::cout << "B =\n" << B << std::endl; - - std::cout << "#### B-=A; ####" << std::endl; - B-=A; - std::cout << "B =\n" << B << std::endl; - - std::cout << "A+B =\n" << A+B << std::endl; - std::cout << "A-B =\n" << A-B << std::endl; - - CPPL::dgematrix A2( A.to_dgematrix() ), B2( B.to_dgematrix() ); - - std::cout << "A*t(B) =\n" << A*t(B) << std::endl; - std::cout << "A2*t(B2) =\n" << A2*t(B2) << std::endl; - - CPPL::dgbmatrix P(8,10,2,3), Q(10,9,1,3), R; - for(int i=0; i<P.m; i++){ - for(int j=std::max(0,i-P.kl); j<std::min(P.n,i+P.ku+1); j++){ - P(i,j) =double( rand() /(RAND_MAX/9) +1 ); - } - } - for(int i=0; i<Q.m; i++){ - for(int j=std::max(0,i-Q.kl); j<std::min(Q.n,i+Q.ku+1); j++){ - Q(i,j) =double( rand() /(RAND_MAX/9) +1 ); - } - } - CPPL::dgematrix P2( P.to_dgematrix() ), Q2( Q.to_dgematrix() ); - std::cout << "P =\n" << P << std::endl; - std::cout << "P2 =\n" << P2 << std::endl; - std::cout << "Q =\n" << Q << std::endl; - std::cout << "Q2 =\n" << Q2 << std::endl; - std::cout << "P*Q =\n" << P*Q << std::endl; - std::cout << "P2*Q2 =\n" << P2*Q2 << std::endl; - - std::cout << "#### P*=Q; ####" << std::endl; - P*=Q; - std::cout << "P =\n" << P << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/96/96e289a6e6bd4aa499eabd6781d96574ffd84be5.svn-base b/cpplapack-r198/.svn/pristine/96/96e289a6e6bd4aa499eabd6781d96574ffd84be5.svn-base deleted file mode 100644 index c8ecf53f328ec8935856756bfd07560f2036899a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/96/96e289a6e6bd4aa499eabd6781d96574ffd84be5.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::dgematrix A; - cout << "A || m=" << A.m << " n=" << A.n << " array=" << A.array << endl; - - - CPPL::dgematrix B(M,N); - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - cout << "B || m=" << B.m << " n=" << B.n << " array=" << B.array << endl; - cout << B << endl; - - CPPL::dgematrix C(B); - cout << "C || m=" << C.m << " n=" << C.n << " array=" << C.array << endl; - cout << C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/96/96fac8993a9ad349e3a5f5cc5e61e7dc41c09338.svn-base b/cpplapack-r198/.svn/pristine/96/96fac8993a9ad349e3a5f5cc5e61e7dc41c09338.svn-base deleted file mode 100644 index 2e873bcaac67ab89c7753c387421887814340ce0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/96/96fac8993a9ad349e3a5f5cc5e61e7dc41c09338.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _zhsmatrix+zhsmatrix operator */ -inline _zhsmatrix operator+(const _zhsmatrix& matA, const zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _zhsmatrix-zhsmatrix operator */ -inline _zhsmatrix operator-(const _zhsmatrix& matA, const zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _zhsmatrix*zhsmatrix operator */ -/* -inline _zhsmatrix operator*(const _zhsmatrix& matA, const zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat( matA.m, matB.n, 0 ); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.Col[k].begin(); p!=matB.Col[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/97/970dd964ebcab2e6da0d9308d853fee78e98c8d3.svn-base b/cpplapack-r198/.svn/pristine/97/970dd964ebcab2e6da0d9308d853fee78e98c8d3.svn-base deleted file mode 100644 index 36372f55ca12b63d30537d5e2e623760fe572a55..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/97/970dd964ebcab2e6da0d9308d853fee78e98c8d3.svn-base +++ /dev/null @@ -1,147 +0,0 @@ -//============================================================================= -/*! zcovector=zcovector operator */ -inline zcovector& zcovector::operator=(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - if(array!=vec.array){ // if it is NOT self substitution - copy(vec); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector+=zcovector operator */ -inline zcovector& zcovector::operator+=(const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] += vec.array[i]; - } - - return *this; -} - -//============================================================================= -/*! zcovector operator-= */ -inline zcovector& zcovector::operator-=(const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ - array[i] -= vec.array[i]; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector+zcovector operator */ -inline _zcovector operator+(const zcovector& vecA, const zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - zcovector newvec(vecA.l); - - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]+vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! zcovector-zcovector operator */ -inline _zcovector operator-(const zcovector& vecA, const zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(vecA.l); - - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec.array[i] =vecA.array[i]-vecB.array[i]; - } - - return _(newvec); -} - -//============================================================================= -/*! zcovector^T*zcovector operator (inner product) */ -inline comple operator%(const zcovector& vecA, const zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - return val; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return Hadamerd product */ -inline _zcovector hadamerd(const zcovector& vecA, const zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( vecA.l!=vecB.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make Hadamerd product." << std::endl - << "Your input was (" << vecA.l << ") and (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(vecA.l); - - for(CPPL_INT i=0; i<newvec.l; i++){ - newvec(i) =vecA(i)*vecB(i); - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/97/97240d4d40f668db5dcfd3119d5c7f936872e263.svn-base b/cpplapack-r198/.svn/pristine/97/97240d4d40f668db5dcfd3119d5c7f936872e263.svn-base deleted file mode 100644 index 1e27863aa81ddc2b1b1743bc82c39ba7a12dd703..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/97/97240d4d40f668db5dcfd3119d5c7f936872e263.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - CPPL::dquater q( vt2q(CPPL::dcovec3(1,1,1),M_PI/3.) ); - std::cout << t(q) << std::endl; - std::cout << t(q*inv(q)) << std::endl; - - std::cout << q2m(q) << std::endl; - - //// dcovec3 //// - std::cout << t(rotate(CPPL::dcovec3(1,0,0),q)) << std::flush; - std::cout << t(rotate(CPPL::dcovec3(0,1,0),q)) << std::flush; - std::cout << t(rotate(CPPL::dcovec3(0,0,1),q)) << std::flush; - - //// dgemat3 //// - CPPL::dgemat3 gm; - gm.identity(); - std::cout << rotate(gm,q) << std::endl; - - //// dsymat3 //// - CPPL::dsymat3 sm; - sm.identity(); - std::cout << rotate(sm,q) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/97/97f2ad9731fbb44dcab9c5602cff951248456906.svn-base b/cpplapack-r198/.svn/pristine/97/97f2ad9731fbb44dcab9c5602cff951248456906.svn-base deleted file mode 100644 index 2decead6c649238a85c773ea601ee5b961134334..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/97/97f2ad9731fbb44dcab9c5602cff951248456906.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! zhsmatrix*complex operator */ -inline _zgsmatrix operator*(const zhsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat( mat.to_zgsmatrix() ); - return newmat*d; -} - -//============================================================================= -/*! zhsmatrix/complex operator */ -inline _zgsmatrix operator/(const zhsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat( mat.to_zgsmatrix() ); - return newmat/d; -} diff --git a/cpplapack-r198/.svn/pristine/97/97fee6b354d4bde6dac0c511e066ff7824c871b6.svn-base b/cpplapack-r198/.svn/pristine/97/97fee6b354d4bde6dac0c511e066ff7824c871b6.svn-base deleted file mode 100644 index e4f188a7757c871b406675129624f5b8c56c49e3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/97/97fee6b354d4bde6dac0c511e066ff7824c871b6.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class -class _dgsmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable std::vector<dcomponent> data; //!< matrix data - mutable std::vector< std::vector<CPPL_INT> > rows; //!< array of vector to store the entry information of component for each row - mutable std::vector< std::vector<CPPL_INT> > cols; //!< array of vector to store the entry information of component for each column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _dgsmatrix(); - inline _dgsmatrix(const _dgsmatrix&); - inline ~_dgsmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgsmatrix to_zgsmatrix() const; - inline _dgematrix to_dgematrix() const; - - //////// io //////// - inline double operator()(const CPPL_INT&, const CPPL_INT&) const;//not return double& - inline friend std::ostream& operator<<(std::ostream&, const _dgsmatrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _dgsmatrix t(const dgsmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const dgsmatrix&); - inline friend double damax(const dgsmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _dgsmatrix& operator+(const _dgsmatrix&); - inline friend _dgsmatrix operator-(const _dgsmatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const _dgsmatrix&, const dgematrix&); - inline friend _dgematrix operator+(const _dgsmatrix&, const _dgematrix&); - inline friend _dgematrix operator+(const _dgsmatrix&, const dsymatrix&); - inline friend _dgematrix operator+(const _dgsmatrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const _dgsmatrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const _dgsmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator+(const _dgsmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator+(const _dgsmatrix&, const _dgsmatrix&); - inline friend _dgsmatrix operator+(const _dgsmatrix&, const dssmatrix&); - inline friend _dgsmatrix operator+(const _dgsmatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const _dgsmatrix&, const dgematrix&); - inline friend _dgematrix operator-(const _dgsmatrix&, const _dgematrix&); - inline friend _dgematrix operator-(const _dgsmatrix&, const dsymatrix&); - inline friend _dgematrix operator-(const _dgsmatrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const _dgsmatrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const _dgsmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator-(const _dgsmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator-(const _dgsmatrix&, const _dgsmatrix&); - inline friend _dgsmatrix operator-(const _dgsmatrix&, const dssmatrix&); - inline friend _dgsmatrix operator-(const _dgsmatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const _dgsmatrix&, const dcovector&); - inline friend _dcovector operator*(const _dgsmatrix&, const _dcovector&); - inline friend _dgematrix operator*(const _dgsmatrix&, const dgematrix&); - inline friend _dgematrix operator*(const _dgsmatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const _dgsmatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const _dgsmatrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const _dgsmatrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const _dgsmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator*(const _dgsmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator*(const _dgsmatrix&, const _dgsmatrix&); - inline friend _dgsmatrix operator*(const _dgsmatrix&, const dssmatrix&); - inline friend _dgsmatrix operator*(const _dgsmatrix&, const _dssmatrix&); - inline friend _dgsmatrix operator*(const _dgsmatrix&, const double&); - - //////// / //////// - inline friend _dgsmatrix operator/(const _dgsmatrix&, const double&); - - //////// double //////// - inline friend _dgsmatrix operator*(const double&, const _dgsmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/98/9864a637fa63790fdb0f6ee7f76c1921bcb22e86.svn-base b/cpplapack-r198/.svn/pristine/98/9864a637fa63790fdb0f6ee7f76c1921bcb22e86.svn-base deleted file mode 100644 index adf168ff4b3ca0888fd9ecbdc9e831579bcbce9a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/98/9864a637fa63790fdb0f6ee7f76c1921bcb22e86.svn-base +++ /dev/null @@ -1,98 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class -class _zhsmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - //mutable CPPL_INT const& m; //!< matrix row size - CPPL_INT const& m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable std::vector<zcomponent> data; //!< matrix data - mutable std::vector< std::vector<CPPL_INT> > line; //!< vector of vector to store the entry information of component for each row and column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _zhsmatrix(); - inline _zhsmatrix(const _zhsmatrix&); - inline ~_zhsmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - inline _zhematrix to_zhematrix() const; - inline _zgsmatrix to_zgsmatrix() const; - - //////// io //////// - inline comple operator()(const CPPL_INT&, const CPPL_INT&) const;//not return zhecomplex - inline friend std::ostream& operator<<(std::ostream&, const _zhsmatrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _zhsmatrix t(const zhsmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const zhsmatrix&); - inline friend comple damax(const zhsmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _zhsmatrix& operator+(const _zhsmatrix&); - inline friend _zhsmatrix operator-(const _zhsmatrix&); - - //////// + //////// - inline friend _zgematrix operator+(const _zhsmatrix&, const zgematrix&); - inline friend _zgematrix operator+(const _zhsmatrix&, const _zgematrix&); - inline friend _zgematrix operator+(const _zhsmatrix&, const zhematrix&); - inline friend _zgematrix operator+(const _zhsmatrix&, const _zhematrix&); - inline friend _zgematrix operator+(const _zhsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const _zhsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator+(const _zhsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator+(const _zhsmatrix&, const _zgsmatrix&); - inline friend _zhsmatrix operator+(const _zhsmatrix&, const zhsmatrix&); - inline friend _zhsmatrix operator+(const _zhsmatrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const _zhsmatrix&, const zgematrix&); - inline friend _zgematrix operator-(const _zhsmatrix&, const _zgematrix&); - inline friend _zgematrix operator-(const _zhsmatrix&, const zhematrix&); - inline friend _zgematrix operator-(const _zhsmatrix&, const _zhematrix&); - inline friend _zgematrix operator-(const _zhsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const _zhsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator-(const _zhsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator-(const _zhsmatrix&, const _zgsmatrix&); - inline friend _zhsmatrix operator-(const _zhsmatrix&, const zhsmatrix&); - inline friend _zhsmatrix operator-(const _zhsmatrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const _zhsmatrix&, const zcovector&); - inline friend _zcovector operator*(const _zhsmatrix&, const _zcovector&); - inline friend _zgematrix operator*(const _zhsmatrix&, const zgematrix&); - inline friend _zgematrix operator*(const _zhsmatrix&, const _zgematrix&); - inline friend _zgematrix operator*(const _zhsmatrix&, const zhematrix&); - inline friend _zgematrix operator*(const _zhsmatrix&, const _zhematrix&); - inline friend _zgematrix operator*(const _zhsmatrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const _zhsmatrix&, const _zgbmatrix&); - inline friend _zgsmatrix operator*(const _zhsmatrix&, const zgsmatrix&); - inline friend _zgsmatrix operator*(const _zhsmatrix&, const _zgsmatrix&); - inline friend _zgsmatrix operator*(const _zhsmatrix&, const zhsmatrix&); - inline friend _zgsmatrix operator*(const _zhsmatrix&, const _zhsmatrix&); - inline friend _zhsmatrix operator*(const _zhsmatrix&, const double&); - inline friend _zgsmatrix operator*(const _zhsmatrix&, const comple&); - - //////// / //////// - inline friend _zhsmatrix operator/(const _zhsmatrix&, const double&); - inline friend _zgsmatrix operator/(const _zhsmatrix&, const comple&); - - //////// double, complex //////// - inline friend _zhsmatrix operator*(const double&, const _zhsmatrix&); - inline friend _zgsmatrix operator*(const comple&, const _zhsmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/99/9911b81c02552e4587b2b8c505118942d0aa503e.svn-base b/cpplapack-r198/.svn/pristine/99/9911b81c02552e4587b2b8c505118942d0aa503e.svn-base deleted file mode 100644 index a17771bc35b8f431a4b7d82941491bc66b4d8c19..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/99/9911b81c02552e4587b2b8c505118942d0aa503e.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _zgematrix+_zgbmatrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix-_zgbmatrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _zgematrix*_zgbmatrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/99/992bb12481a4cb31789713976f7afa9a17efcdcc.svn-base b/cpplapack-r198/.svn/pristine/99/992bb12481a4cb31789713976f7afa9a17efcdcc.svn-base deleted file mode 100644 index b0d04a68d18d4eb40e47a4fbd8ccab6f552cef84..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/99/992bb12481a4cb31789713976f7afa9a17efcdcc.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -//============================================================================= -/*! zgbmatrix+zhematrix operator */ -inline _zgematrix operator+(const zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB.n,matB.n); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) =matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix-zhematrix operator */ -inline _zgematrix operator-(const zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB.n,matB.n); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) =-matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix*zhematrix operator */ -inline _zgematrix operator*(const zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/99/9977bdc81d7cf9888b5b251e12bf05d96c0929dc.svn-base b/cpplapack-r198/.svn/pristine/99/9977bdc81d7cf9888b5b251e12bf05d96c0929dc.svn-base deleted file mode 100644 index f773c7adf29afe9be204667afb20832387d7bf21..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/99/9977bdc81d7cf9888b5b251e12bf05d96c0929dc.svn-base +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -rm -f std err doxygen.log diff --git a/cpplapack-r198/.svn/pristine/99/99a31026758bba22abe4674534309584489ddcce.svn-base b/cpplapack-r198/.svn/pristine/99/99a31026758bba22abe4674534309584489ddcce.svn-base deleted file mode 100644 index 1e06034a0ec6b87c63e675292acf17f2736be729..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/99/99a31026758bba22abe4674534309584489ddcce.svn-base +++ /dev/null @@ -1,163 +0,0 @@ -//============================================================================= -/*! dgsmatrix=_dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator=(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix+=_dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator+=(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) += it->v; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dgsmatrix-=_dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator-=(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -= it->v; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dgsmatrix*=_dgsmatrix operator */ -inline dgsmatrix& dgsmatrix::operator*=(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(m, mat.n); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::const_iterator mat_rows_k_end =mat.rows[k].end(); - for(std::vector<CPPL_INT>::const_iterator p=mat.rows[k].begin(); p!=mat_rows_k_end; p++){ - newmat(it->i,mat.data[*p].j) += it->v*mat.data[*p].v; - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgsmatrix+_dgsmatrix operator */ -inline _dgsmatrix operator+(const dgsmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matB); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix-_dgsmatrix operator */ -inline _dgsmatrix operator-(const dgsmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matB); - newmat.chsign(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix*_dgsmatrix operator */ -inline _dgsmatrix operator*(const dgsmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA.m, matB.n); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/9a/9a0b251036fd8d6a9dbeb4f3fb38235e853b9984.svn-base b/cpplapack-r198/.svn/pristine/9a/9a0b251036fd8d6a9dbeb4f3fb38235e853b9984.svn-base deleted file mode 100644 index fe9cfd0a7c360f8ec3e62c5db9e3d5070b4bf553..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9a/9a0b251036fd8d6a9dbeb4f3fb38235e853b9984.svn-base +++ /dev/null @@ -1 +0,0 @@ -//// N/A //// diff --git a/cpplapack-r198/.svn/pristine/9a/9a445007d2f0259a598a77a99de53b5c49f3ab4c.svn-base b/cpplapack-r198/.svn/pristine/9a/9a445007d2f0259a598a77a99de53b5c49f3ab4c.svn-base deleted file mode 100644 index 1a961c17e530ea9afa8b3d62f9f8c6814f0ef0cf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9a/9a445007d2f0259a598a77a99de53b5c49f3ab4c.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _dgbmatrix::nullify() const -{CPPL_VERBOSE_REPORT; - m=0; - n=0; - kl=0; - ku=0; - array=NULL; - darray=NULL; -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _dgbmatrix::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; - array=NULL; - darray=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/9a/9aa3fbd83dd86b3cbbd8efb1ae78c771442372eb.svn-base b/cpplapack-r198/.svn/pristine/9a/9aa3fbd83dd86b3cbbd8efb1ae78c771442372eb.svn-base deleted file mode 100644 index 84d981d1e8e3dc9f1462ff6479b45f1ee3096849..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9a/9aa3fbd83dd86b3cbbd8efb1ae78c771442372eb.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -//============================================================================= -/*! cast to _zhematrix */ -inline _zhematrix _dsymatrix::to_zhematrix() const -{CPPL_VERBOSE_REPORT; - zhematrix newmat(n); - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - newmat(i,j) =comple((*this)(i,j),0.0); - } - } - - destroy(); - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix _dsymatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat(n,n); - - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<n; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/9a/9af10718deafa736814f1609ad3ee16cee34caed.svn-base b/cpplapack-r198/.svn/pristine/9a/9af10718deafa736814f1609ad3ee16cee34caed.svn-base deleted file mode 100644 index 089bff322d7ba0d9d9cc583b548278541633851c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9a/9af10718deafa736814f1609ad3ee16cee34caed.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -//============================================================================= -/*! drovector_small constructor */ -template<CPPL_INT l> -inline drovector_small<l>::drovector_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! drovector_small constructor */ -template<CPPL_INT l> -inline drovector_small<l>::drovector_small(const drovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "Vector sizes must be the same." << std::endl - << "Your input was " << l << " and " << vec.l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<l; k++){ - array[k] =vec.array[k]; - } -} - -//============================================================================= -/*! drovector_small constructor */ -template<CPPL_INT l> -inline drovector_small<l>::drovector_small(const double& x, const double& y) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=2 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 2." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG] - - array[0] =x; - array[1] =y; -} - -//============================================================================= -/*! drovector_small constructor */ -template<CPPL_INT l> -inline drovector_small<l>::drovector_small(const double& x, const double& y, const double& z) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=3 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 3." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; - array[2] =z; -} - -//============================================================================= -/*! drovector_small constructor */ -template<CPPL_INT l> -inline drovector_small<l>::drovector_small(const double& x, const double& y, const double& z, const double& r) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=4 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 4." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; - array[2] =z; - array[3] =r; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector_small destructor */ -template<CPPL_INT l> -inline drovector_small<l>::~drovector_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/9b/9b8bcb63e39b3a89b7d1e7d1ea6a355688d3dd58.svn-base b/cpplapack-r198/.svn/pristine/9b/9b8bcb63e39b3a89b7d1e7d1ea6a355688d3dd58.svn-base deleted file mode 100644 index 0f4e1979de25011a336bd0bc521f20ce3e9cac53..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9b/9b8bcb63e39b3a89b7d1e7d1ea6a355688d3dd58.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -#include <cpplapack.h> -#include <ctime> - -//============================================================================= -inline void ended() -{ - system("@pause"); -} - -//============================================================================= -int main(int /*argc*/, char** /*argv*/) -{ - //////// to keep the command prompt open //////// - atexit(ended); - - //////// declare A and y //////// - const size_t size(3); - CPPL::dgematrix A(size,size); //3x3 matrix - CPPL::dcovector y(size); //3 column vector - - //////// set components of A and y at random //////// - srand(unsigned(time(NULL))); - for(size_t i=0; i<size; i++){ - for(size_t j=0; j<size; j++){ - A(i,j) =double(rand())/double(RAND_MAX); - } - y(i) =double(rand())/double(RAND_MAX); - } - std::cout << "A=\n" << A << std::endl; //print A - std::cout << "y=\n" << y << std::endl; //print y - - //////// solve A*x=y //////// - A.dgesv(y); //call dgesv of LAPACK (y becomes x) - std::cout << "x=\n" << y << std::endl; //print x - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/9b/9b9562c5245bfea69cab9fcabf64d64e00416911.svn-base b/cpplapack-r198/.svn/pristine/9b/9b9562c5245bfea69cab9fcabf64d64e00416911.svn-base deleted file mode 100644 index 2663d23a7d1263b6b8096f79582ac82d3bb851d1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9b/9b9562c5245bfea69cab9fcabf64d64e00416911.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+dgematrix operator */ -/* -inline _dgematrix operator+(const _dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix-dgematrix operator */ -/* -inline _dgematrix operator-(const _dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix*dgematrix operator */ -/* -inline _dgematrix operator*(const _dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/9c/9c183e65a0d5dd1bffde0ff1d8822fbea7068d7a.svn-base b/cpplapack-r198/.svn/pristine/9c/9c183e65a0d5dd1bffde0ff1d8822fbea7068d7a.svn-base deleted file mode 100644 index 695e49e608d2b028823d80ee242df10b05b18d6e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9c/9c183e65a0d5dd1bffde0ff1d8822fbea7068d7a.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -//============================================================================= -/*! _zcovector+zcovector operator */ -inline _zcovector operator+(const _zcovector& vecA, const zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] += vecB.array[i]; - } - - return vecA; -} - -//============================================================================= -/*! zcovector-zcovector operator */ -inline _zcovector operator-(const _zcovector& vecA, const zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] -= vecB.array[i]; - } - - return vecA; -} - -//============================================================================= -/*! zcovector^T*zcovector operator (inner product) */ -inline comple operator%(const _zcovector& vecA, const zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/9c/9c392daecb43ff6af77173f93774e9f0f0a369e1.svn-base b/cpplapack-r198/.svn/pristine/9c/9c392daecb43ff6af77173f93774e9f0f0a369e1.svn-base deleted file mode 100644 index c127830a7cba1657055b881e36d531b0e89202cc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9c/9c392daecb43ff6af77173f93774e9f0f0a369e1.svn-base +++ /dev/null @@ -1,32 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - cout << "+A =\n" << +A << endl; - cout << "-A =\n" << -A << endl; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/9c/9c5290eabe1af6d890eb96b59e51ad615f8467a5.svn-base b/cpplapack-r198/.svn/pristine/9c/9c5290eabe1af6d890eb96b59e51ad615f8467a5.svn-base deleted file mode 100644 index 1c0f337d82feb8e204a0a3d0fc6f56f721e223a6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9c/9c5290eabe1af6d890eb96b59e51ad615f8467a5.svn-base +++ /dev/null @@ -1,295 +0,0 @@ -//============================================================================= -/*! solve A*x=b for real and unsymmetric matrix using DFGMRES of Intel RCI ISS without preconditioning.\n - The argument is dcovector b. - b is overwritten and become the solution x. - A is not overwritten. -*/ -inline CPPL_INT dgrmatrix::dfgmres(dcovector& b, const double eps) const -{CPPL_VERBOSE_REPORT; -#ifndef __INTEL_COMPILER - ERROR_REPORT; - std::cerr << "dgrmatrix::dfgmres is only for intel c++ compiler (icpc)." << std::endl; - std::cerr << "Recompile your code with icpc to use dfgmres." << std::endl; - (void)b; - (void)eps; - exit(1); - - -#else //__INTEL_COMPILER is defined. - //#ifdef CPPL_DEBUG - if(m!=n || m!=b.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << b.l << ")." << std::endl; - exit(1); - } - //#endif//CPPL_DEBUG - - //////////////// constant //////////////// - MKL_INT itmax =1000; - MKL_INT n_res =500;//number of iteration before restart - MKL_INT N =MKL_INT(n); - const dcovector b_orig =b; - - //////////////// dfgmresinit //////////////// - dcovector x =dcovector(N).zero();//initial guess - //dcovector x =b;//initial guess - MKL_INT RCI_request; - MKL_INT ipar[128]; - double dpar[128]; - std::vector<double> tmp((2*n_res+1)*N + (n_res*(n_res+9))/2 + 1); - DFGMRES_INIT(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0]); - if(RCI_request){ - ERROR_REPORT; - std::cerr << "dfgmres_init failed. RCI_request=" << RCI_request << "." << std::endl; - exit(1); - } - - //////////////// dfgmres_check //////////////// - //////// ipar //////// - ipar[7] = 0;//if check iteration count - ipar[8] = 0;//if enable residual stopping test - ipar[9] = 1;//if enable user defined stopping test - ipar[10] = 0;//if enable preconditioner - ipar[11] = 1;//if enable check of the norm of the next generated vector automatically - ipar[14] = n_res;//number of iteration before restart - //////// dpar //////// - ////dpar[0] =1e-99;//relative tolerance - ////dpar[1] =0.;//absolute tolerance - //////// call //////// - DFGMRES_CHECK(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0]); - if(RCI_request){ - ERROR_REPORT; - std::cerr << "dfgmres_init failed. RCI_request=" << RCI_request << "." << std::endl; - exit(1); - } - - //////////////// dfgmres //////////////// - char transa ='N'; - double* A =const_cast<double*>(&a[0]); - MKL_INT* IA =const_cast<MKL_INT*>(&ia[0]); - MKL_INT* JA =const_cast<MKL_INT*>(&ja[0]); - MKL_INT itercount; - dcovector x_tmp(N); - size_t itc =0; - while(1){ - //// call //// - DFGMRES(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0]); - - //// RCI_request //// - if(RCI_request==1){//continue - MKL_DCSRGEMV(&transa, &N, A, IA, JA, &tmp[ipar[21]-1], &tmp[ipar[22]-1]);//calc A*v - itc++; - //std::cerr << "A*v" << std::endl; - } - else if(RCI_request==2){//convergence check with count check - if(itc%100==0){ - ipar[12] = 1; - DFGMRES_GET(&N, x.array, x_tmp.array, &RCI_request, ipar, dpar, &tmp[0], &itercount); - double norm_r =fabs(damax(b_orig-(*this)*x_tmp)); - std::cerr << "itc=" << itc << ": norm_r = " << norm_r << " (eps=" << eps << ")" << std::endl; - if(norm_r<eps){ - std::cerr << "converged (norm_r<eps)" << std::endl; - break; - } - if(itc>=itmax){ - std::cerr << "failed. (itc>=itmax)" << std::endl; - break; - } - } - } - else if(RCI_request==0){//converged (ipar[11]) - std::cerr << "converged (RCI_request=0)" << std::endl; - break; - } - else{//failed - WARNING_REPORT; - std::cerr << "dfgmres failed. RCI_request=" << RCI_request << "." << std::endl; - break; - } - } - //////// info //////// - CPPL_INT info =RCI_request; - - //////////////// dfgmres_get //////////////// - ipar[12] =0; - DFGMRES_GET(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0], &itercount); - - //////////////// MKL_Free_Buffers //////////////// - MKL_Free_Buffers(); - - //////////////// swap x and b //////////////// - swap(x, b); - - return info; -#endif //__INTEL_COMPILER -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! solve A*x=b for real and unsymmetric matrix using DFGMRES with ILUT precondition of Intel RCI ISS.\n - The argument is dcovector b. - b is overwritten and become the solution x. - A is not overwritten. -*/ -inline CPPL_INT dgrmatrix::ilut_dfgmres(dcovector& b, const int maxfil, const double eps) const -{CPPL_VERBOSE_REPORT; -#ifndef __INTEL_COMPILER - ERROR_REPORT; - std::cerr << "dgrmatrix::ilut_dfgmres is only for intel c++ compiler (icpc)." << std::endl; - std::cerr << "Recompile your code with icpc to use ilut_dfgmres." << std::endl; - (void)b; - (void)maxfil; - (void)eps; - exit(1); - - -#else //__INTEL_COMPILER is defined. - //#ifdef CPPL_DEBUG - if(m!=n || m!=b.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << b.l << ")." << std::endl; - exit(1); - } - //#endif//CPPL_DEBUG - - //////////////// constants //////////////// - MKL_INT itmax =500; - MKL_INT n_res =500;//number of iteration before restart - //MKL_INT n_res =150;//number of iteration before restart - MKL_INT N =MKL_INT(n); - MKL_INT MAXFIL =std::min(maxfil, N-1);//limitter for maxfil - const dcovector b_orig =b; - - //////////////// dfgmresinit //////////////// - dcovector x =dcovector(b.l).zero();//initial guess - //dcovector x =b;//initial guess - MKL_INT RCI_request; - MKL_INT ipar[128]; - double dpar[128]; - std::vector<double> tmp((2*n_res+1)*N + (n_res*(n_res+9))/2 + 1); - DFGMRES_INIT(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0]); - if(RCI_request){ - ERROR_REPORT; - std::cerr << "dfgmres_init failed. RCI_request=" << RCI_request << "." << std::endl; - exit(1); - } - - //////////////// dcsrilut //////////////// - double* A =const_cast<double*>(&a[0]); - MKL_INT* IA =const_cast<MKL_INT*>(&ia[0]); - MKL_INT* JA =const_cast<MKL_INT*>(&ja[0]); - std::vector<double> bilut((2*MAXFIL+1)*N - MAXFIL*(MAXFIL+1) + 1); - std::vector<MKL_INT> ibilut(N+1); - std::vector<MKL_INT> jbilut((2*MAXFIL+1)*N - MAXFIL*(MAXFIL+1) + 1); - double tol =1e-3;//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - //double tol =1e-4;//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - //double tol =1e-6;//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - MKL_INT ierr; - //ipar[30] =0;//dangerrous - ipar[30] =1;//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - dpar[30] =tol;//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - //dpar[30] =1e-99;//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - DCSRILUT(&N, A, IA, JA, &bilut[0], &ibilut[0], &jbilut[0], &tol, &MAXFIL, ipar, dpar, &ierr); - if(ierr){ - ERROR_REPORT; - std::cerr << "dcsrilut failed. ierr=" << ierr << "." << std::endl; - exit(1); - } - - //////////////// dfgmres_check //////////////// - //////// ipar //////// - ipar[7] = 0;//if check iteration count - ipar[8] = 0;//if enable residual stopping test - ipar[9] = 1;//if enable user defined stopping test - ipar[10] = 1;//if enable preconditioner - ipar[11] = 1;//if enable check of the norm of the next generated vector automatically - ipar[14] = n_res;//number of iteration before restart - //////// dpar //////// - ////dpar[0] =1e-1;//relative tolerance - ////dpar[1] =eps;//absolute tolerance - //////// call //////// - DFGMRES_CHECK(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0]); - if(RCI_request){ - ERROR_REPORT; - std::cerr << "dfgmres_init failed. RCI_request=" << RCI_request << "." << std::endl; - exit(1); - } - - //////////////// dfgmres //////////////// - char transa ='N'; - char uplo1 ='L'; - char transa1 ='N'; - char diag1 ='U'; - char uplo2 ='U'; - char transa2 ='N'; - char diag2 ='N'; - MKL_INT itercount; - dcovector x_tmp(N); - size_t itc =0; - while(1){ - //// call //// - DFGMRES(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0]); - - //// RCI_request //// - if(RCI_request==1){//continue - MKL_DCSRGEMV(&transa, &N, A, IA, JA, &tmp[ipar[21]-1], &tmp[ipar[22]-1]);//calc A*v - itc++; - } - else if(RCI_request==3){//precondition - MKL_DCSRTRSV(&uplo1, &transa1, &diag1, &N, &bilut[0], &ibilut[0], &jbilut[0], &tmp[ipar[21]-1], x_tmp.array); - MKL_DCSRTRSV(&uplo2, &transa2, &diag2, &N, &bilut[0], &ibilut[0], &jbilut[0], x_tmp.array, &tmp[ipar[22]-1]); - //std::cout << "preconditioned" << std::endl; - } - else if(RCI_request==2){//convergence check with count check - if(itc%100==0){ - ipar[12] = 1; - DFGMRES_GET(&N, x.array, x_tmp.array, &RCI_request, ipar, dpar, &tmp[0], &itercount); - double norm_r =fabs(damax(b_orig-(*this)*x_tmp)); - std::cerr << "itc=" << itc << ": norm_r = " << norm_r << " (eps=" << eps << ")" << std::endl; - if(norm_r<eps){ - std::cerr << "converged (norm_r<eps)" << std::endl; - break; - } - if(itc>=itmax){ - std::cerr << "failed. (itc>=itmax)" << std::endl; - break; - } - } - } - else if(RCI_request==0){//converged (ipar[11]) - std::cerr << "converged (RCI_request=0)" << std::endl; - break; - } - else{//failed - WARNING_REPORT; - std::cerr << "dfgmres failed. RCI_request=" << RCI_request << "." << std::endl; - break; - } - } - //////// info //////// - CPPL_INT info =RCI_request; - - //////////////// dfgmres_get //////////////// - ipar[12] =0; - DFGMRES_GET(&N, x.array, b.array, &RCI_request, ipar, dpar, &tmp[0], &itercount); - - //////////////// MKL_Free_Buffers //////////////// - MKL_Free_Buffers(); - - //////////////// swap x and b //////////////// - swap(x, b); - - return info; -#endif //__INTEL_COMPILER -} diff --git a/cpplapack-r198/.svn/pristine/9c/9c73100e3a6953bb50f6a9254ae37c02d1a064be.svn-base b/cpplapack-r198/.svn/pristine/9c/9c73100e3a6953bb50f6a9254ae37c02d1a064be.svn-base deleted file mode 100644 index b72f482911ab6bf4db45e1b3437e2f8aeccd8937..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9c/9c73100e3a6953bb50f6a9254ae37c02d1a064be.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -//============================================================================= -/*! zgsmatrix*=double operator */ -inline zgsmatrix& zgsmatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v *=d; - } - - return *this; -} - -//============================================================================= -/*! zgsmatrix/=double operator */ -inline zgsmatrix& zgsmatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v /=d; - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix*double operator */ -inline _zgsmatrix operator*(const zgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *=d; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix/double operator */ -inline _zgsmatrix operator/(const zgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v /=d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/9c/9c944d8e5a962ab9c0ab94691ec5af4de718650f.svn-base b/cpplapack-r198/.svn/pristine/9c/9c944d8e5a962ab9c0ab94691ec5af4de718650f.svn-base deleted file mode 100644 index 94040adfcdf8e521c68174ae0ff9c8b1d8a3d55f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9c/9c944d8e5a962ab9c0ab94691ec5af4de718650f.svn-base +++ /dev/null @@ -1,59 +0,0 @@ -//============================================================================= -/*! _dcovector+_dcovector operator */ -inline _dcovector operator+(const _dcovector& vecA, const _dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ vecA.array[i]+=vecB.array[i]; } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _dcovector-_dcovector operator */ -inline _dcovector operator-(const _dcovector& vecA, const _dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ vecA.array[i]-=vecB.array[i]; } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _dcovector^T*_dcovector operator (inner product) */ -inline double operator%(const _dcovector& vecA, const _dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - CPPL_INT inc =1; - - double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/9e/9e62e8a83c71913099aeb128b02ed14a2785fb2f.svn-base b/cpplapack-r198/.svn/pristine/9e/9e62e8a83c71913099aeb128b02ed14a2785fb2f.svn-base deleted file mode 100644 index 77dbe58486334432987f7d1811dc872da04a24f1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9e/9e62e8a83c71913099aeb128b02ed14a2785fb2f.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::dgematrix A(M,N); - CPPL::dcovector x(N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "A =\n" << A << endl; - cout << "x =\n" << x << endl; - cout << "A*x =\n" << A*x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/9e/9e99463e275477f2e2adbc055d6702c2bde4c04b.svn-base b/cpplapack-r198/.svn/pristine/9e/9e99463e275477f2e2adbc055d6702c2bde4c04b.svn-base deleted file mode 100644 index 9dbe4d26bcda947ae0fe91ee61d6c384bbc49d89..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9e/9e99463e275477f2e2adbc055d6702c2bde4c04b.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3), M(4); - - CPPL::drovector x(M), y; - CPPL::dgematrix A(M,N); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "x =\n" << x << endl; - cout << "A =\n" << A << endl; - - cout << "#### y=x*A; ####" << endl; - y=x*A; - cout << "y =\n" << y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/9e/9ebac4022aa94f87cc3559d06ac0a1195fdde7a1.svn-base b/cpplapack-r198/.svn/pristine/9e/9ebac4022aa94f87cc3559d06ac0a1195fdde7a1.svn-base deleted file mode 100644 index 5057abc3d27f79fd13d9745dfaefbba300b551e5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9e/9ebac4022aa94f87cc3559d06ac0a1195fdde7a1.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! dssmatrix*_dcovector operator */ -inline _dcovector operator*(const dssmatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(dcovector(mat.n)); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=it->v*vec(it->i); - } - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/9e/9ee3eada55f0a4563ca5b6a2125ca9e8683a26ac.svn-base b/cpplapack-r198/.svn/pristine/9e/9ee3eada55f0a4563ca5b6a2125ca9e8683a26ac.svn-base deleted file mode 100644 index 6fd457e5250857fe4ed3aebd78d1ddb1567aa5ff..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9e/9ee3eada55f0a4563ca5b6a2125ca9e8683a26ac.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::dsymatrix A(N), B(N); - CPPL::dcovector x(N), y(N); - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - y(i) =double( rand() /(RAND_MAX/10) ); - } - CPPL::dcovector z(x+y); - - cout << "A*z-A*x-A*y =\n" << A*z-A*x-A*y << "<-Should be zero." << endl; - cout << "A*z-A*(x+y) =\n" << A*z-A*(x+y) << "<-Should be zero." << endl; - cout << "(A+B)*x-A*x-B*x =\n" << (A+B)*x-A*x-B*x - << "<-Should be zero." << endl; - cout << "(A-B)*(x-y)-A*x+A*y+B*x-B*y =\n" << (A-B)*(x-y)-A*x+A*y+B*x-B*y - << "<-Should be zero." << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/9f/9f120d20a39fd78853d922fdf6c2deda0e480dfe.svn-base b/cpplapack-r198/.svn/pristine/9f/9f120d20a39fd78853d922fdf6c2deda0e480dfe.svn-base deleted file mode 100644 index 4e34d73fb8fc7803bea7afa2f17c6f1ca6fcf317..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9f/9f120d20a39fd78853d922fdf6c2deda0e480dfe.svn-base +++ /dev/null @@ -1,96 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Complex Double-precision Hermitian Matrix Class -class _zhematrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - //mutable CPPL_INT const& m;//!< matrix row and size - CPPL_INT const& m;//!< matrix row and size - mutable CPPL_INT n; //!< matrix column size - mutable comple* array; //!< 1D array to store matrix data - mutable comple** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _zhematrix(); - inline _zhematrix(const _zhematrix&); - inline ~_zhematrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgematrix to_zgematrix() const; - - //////// io //////// - inline zhecomplex operator()(const CPPL_INT&, const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const zhematrix&); - inline void write(const char*) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - inline void complete() const; - - //////// calc //////// - inline friend _zhematrix t(const _zhematrix&); - inline friend _zgematrix i(const _zhematrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _zhematrix& operator+(const _zhematrix&); - inline friend _zhematrix operator-(const _zhematrix&); - - //////// + //////// - inline friend _zgematrix operator+(const _zhematrix&, const zgematrix&); - inline friend _zgematrix operator+(const _zhematrix&, const _zgematrix&); - inline friend _zhematrix operator+(const _zhematrix&, const zhematrix&); - inline friend _zhematrix operator+(const _zhematrix&, const _zhematrix&); - inline friend _zgematrix operator+(const _zhematrix&, const zgbmatrix&); - inline friend _zgematrix operator+(const _zhematrix&, const _zgbmatrix&); - inline friend _zgematrix operator+(const _zhematrix&, const zgsmatrix&); - inline friend _zgematrix operator+(const _zhematrix&, const _zgsmatrix&); - inline friend _zhematrix operator+(const _zhematrix&, const zhsmatrix&); - inline friend _zhematrix operator+(const _zhematrix&, const _zhsmatrix&); - - //////// - //////// - inline friend _zgematrix operator-(const _zhematrix&, const zgematrix&); - inline friend _zgematrix operator-(const _zhematrix&, const _zgematrix&); - inline friend _zhematrix operator-(const _zhematrix&, const zhematrix&); - inline friend _zhematrix operator-(const _zhematrix&, const _zhematrix&); - inline friend _zgematrix operator-(const _zhematrix&, const zgbmatrix&); - inline friend _zgematrix operator-(const _zhematrix&, const _zgbmatrix&); - inline friend _zgematrix operator-(const _zhematrix&, const zgsmatrix&); - inline friend _zgematrix operator-(const _zhematrix&, const _zgsmatrix&); - inline friend _zhematrix operator-(const _zhematrix&, const zhsmatrix&); - inline friend _zhematrix operator-(const _zhematrix&, const _zhsmatrix&); - - //////// * //////// - inline friend _zcovector operator*(const _zhematrix&, const zcovector&); - inline friend _zcovector operator*(const _zhematrix&, const _zcovector&); - inline friend _zgematrix operator*(const _zhematrix&, const zgematrix&); - inline friend _zgematrix operator*(const _zhematrix&, const _zgematrix&); - inline friend _zgematrix operator*(const _zhematrix&, const zhematrix&); - inline friend _zgematrix operator*(const _zhematrix&, const _zhematrix&); - inline friend _zgematrix operator*(const _zhematrix&, const zgbmatrix&); - inline friend _zgematrix operator*(const _zhematrix&, const _zgbmatrix&); - inline friend _zgematrix operator*(const _zhematrix&, const zgsmatrix&); - inline friend _zgematrix operator*(const _zhematrix&, const _zgsmatrix&); - inline friend _zgematrix operator*(const _zhematrix&, const zhsmatrix&); - inline friend _zgematrix operator*(const _zhematrix&, const _zhsmatrix&); - inline friend _zhematrix operator*(const _zhematrix&, const double&); - inline friend _zgematrix operator*(const _zhematrix&, const comple&); - - //////// / //////// - inline friend _zhematrix operator/(const _zhematrix&, const double&); - inline friend _zgematrix operator/(const _zhematrix&, const comple&); - - //////// double, complex //////// - inline friend _zhematrix operator*(const double&, const _zhematrix&); - inline friend _zgematrix operator*(const comple&, const _zhematrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/9f/9f53fb1ab4d5d1824efdfca0603ea076f8de4cd3.svn-base b/cpplapack-r198/.svn/pristine/9f/9f53fb1ab4d5d1824efdfca0603ea076f8de4cd3.svn-base deleted file mode 100644 index c6cacb9c521663affd2bd23d84257a0eb6424cf3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9f/9f53fb1ab4d5d1824efdfca0603ea076f8de4cd3.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -//============================================================================= -/*! return a transposed column vector */ -inline _zcovector t(const _zrovector& rovec) -{CPPL_VERBOSE_REPORT; - _zcovector covec; - covec.l =rovec.l; - delete [] covec.array; - covec.array =rovec.array; - - return covec; -} - -//============================================================================= -/*! return its conjugated vector */ -inline _zrovector conj(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ - vec(i) =std::conj(vec(i)); - } - return vec; -} - -//============================================================================= -/*! return a conjugate transposed column vector */ -inline _zcovector conjt(const _zrovector& rovec) -{CPPL_VERBOSE_REPORT; - zcovector covec(rovec.l); - for(CPPL_INT i=0; i<rovec.l; i++){ - covec(i) =std::conj(rovec(i)); - } - - rovec.destroy(); - return _(covec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double val =dznrm2_(&vec.l, vec.array, &inc); - vec.destroy(); - return val; -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - CPPL_INT i =izamax_(&vec.l, vec.array, &inc) -1; - vec.destroy(); - return i; -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - comple val =vec.array[izamax_(&vec.l, vec.array, &inc) -1]; - vec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/9f/9fe333424401b9d028d8deb3c213d703af54cb93.svn-base b/cpplapack-r198/.svn/pristine/9f/9fe333424401b9d028d8deb3c213d703af54cb93.svn-base deleted file mode 100644 index f7620ad48f58b8ab61fb727efd2ab254af0e5936..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/9f/9fe333424401b9d028d8deb3c213d703af54cb93.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(3), CAP(4); - - CPPL::zgsmatrix A(M,N,CAP); - A.put(0,0, complex<double>(1.,2.) ); - A.put(3,2, complex<double>(3.,4.) ); - A.put(1,2, complex<double>(5.,6.) ); - A.put(4,1, complex<double>(7.,8.) ); - cout << "A =\n" << A << endl; - - CPPL::zcovector x(N); - x(0)=complex<double>(1,1); - x(1)=complex<double>(2,2); - x(2)=complex<double>(3,3); - cout << "x =\n" << x << endl; - - cout << "A*x =\n" << A*x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/a0/a05135aa9e12cf42f1f7e1467d20c2b111b080b8.svn-base b/cpplapack-r198/.svn/pristine/a0/a05135aa9e12cf42f1f7e1467d20c2b111b080b8.svn-base deleted file mode 100644 index b414e8fe75f638329901e87b5930a6ba9d5f3a8c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a0/a05135aa9e12cf42f1f7e1467d20c2b111b080b8.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -#include "zhesv_check.hpp" -#include "zheev_check.hpp" -//#include "zhegv_check.hpp" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - zhesv_check_vector(); - zhesv_check_matrix(); - - zheev_check_value(); - zheev_check_right(); - zheev_check_left(); - - //zhegv_check_value(); - //zhegv_check_right(); - //zhegv_check_left(); - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/a0/a0f373803fc14115d477ca08cab9ea4730e81d01.svn-base b/cpplapack-r198/.svn/pristine/a0/a0f373803fc14115d477ca08cab9ea4730e81d01.svn-base deleted file mode 100644 index 1fadb42eb11925b0ad66aa8755cfecd2e41dc143..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a0/a0f373803fc14115d477ca08cab9ea4730e81d01.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+_dgbmatrix operator */ -inline _dgematrix operator+(const _dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix-_dgbmatrix operator */ -inline _dgematrix operator-(const _dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix*_dgbmatrix operator */ -inline _dgematrix operator*(const _dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a1/a1e90765fb4015b47e04f58596e22f829e915726.svn-base b/cpplapack-r198/.svn/pristine/a1/a1e90765fb4015b47e04f58596e22f829e915726.svn-base deleted file mode 100644 index 76b6d93f01d2be5cc8f5a71d5d757a2bd75d8550..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a1/a1e90765fb4015b47e04f58596e22f829e915726.svn-base +++ /dev/null @@ -1,106 +0,0 @@ -//============================================================================= -/*! zgels_check */ -void zgels_check_vector() -{ - cout << "############ check zgels vector ############" << endl; - - srand(unsigned(time(NULL))); - int M(3), N(2); - - //// make zgematrix A //// - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make zcovector y //// - CPPL::zcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - //// make originals //// - CPPL::zgematrix A_original(A); - CPPL::zcovector y_original(y); - - //// zgels //// - A.zgels(y); - - //// print //// - cout << "######## zgels(vec) ########" << endl; - cout << "A_original=\n" << A_original << endl; - cout << "y_original=\n" << y_original << endl; - cout << "A=\n" << A << endl; - cout << "y=\n" << y << endl; - cout << "A_original*y=\n" << A_original*y << endl; - - //// reset //// - A =A_original; - y =y_original; - double r; //residual square - - //// zgels //// - A.zgels(y,r); - - //// print //// - cout << "######## zgels(vec, residual) ########" << endl; - cout << "A_original=\n" << A_original << endl; - cout << "y_original=\n" << y_original << endl; - cout << "A=\n" << A << endl; - cout << "y=\n" << y << endl; - cout << "residual=" << r << endl; - cout << "A_original*y=\n" << A_original*y << endl; -} - -//============================================================================== -void zgels_check_matrix() -{ - cout << "############ check zgels matrix ############" << endl; - - srand(unsigned(time(NULL))); - int M(3), N(2); - - //// make zgematrix A //// - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make zgematrix Y //// - CPPL::zgematrix Y(M,M); - for(int i=0; i<Y.m; i++){ for(int j=0; j<Y.n; j++){ - Y(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make originals //// - CPPL::zgematrix A_original(A); - CPPL::zgematrix Y_original(Y); - - //// zgels //// - A.zgels(Y); - - //// print //// - cout << "######## zgels(mat) ########" << endl; - cout << "A_original=\n" << A_original << endl; - cout << "Y_original=\n" << Y_original << endl; - cout << "A=\n" << A << endl; - cout << "Y=\n" << Y << endl; - cout << "A_original*Y=\n" << A_original*Y << endl; - - //// reset //// - A =A_original; - Y =Y_original; - CPPL::drovector R; //residual square - - //// zgels //// - A.zgels(Y,R); - - //// print //// - cout << "######## zgels(mat, residual) ########" << endl; - cout << "A_original=\n" << A_original << endl; - cout << "Y_original=\n" << Y_original << endl; - cout << "A=\n" << A << endl; - cout << "Y=\n" << Y << endl; - cout << "residual=" << R << endl; - cout << "A_original*Y=\n" << A_original*Y << endl; -} diff --git a/cpplapack-r198/.svn/pristine/a2/a250ce3d33d671866e1ffbe7837c9d9af151e4af.svn-base b/cpplapack-r198/.svn/pristine/a2/a250ce3d33d671866e1ffbe7837c9d9af151e4af.svn-base deleted file mode 100644 index c2295cc6ed9a9e56727020b42ecc8f2550a19ff0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a2/a250ce3d33d671866e1ffbe7837c9d9af151e4af.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - //// make zcovector x //// - CPPL::zcovector x(L); - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - //// print x in two ways //// - cout << "x =\n" << x << endl; - for(int i=0; i<x.l; i++){ - cout << "x(" << i << ") =" << x(i) << endl; - } - - //// make zcovector y //// - CPPL::zcovector y(x); - - //// print y in two ways //// - cout << "y =\n" << y << endl; - for(int i=0; i<y.l; i++){ - cout << "y(" << i << ") =" << y(i) << endl; - } - - //// print x+y //// - cout << "x+y=\n" << x+y << endl; - - //// write/read //// - x.write( "tmp.txt" ); - CPPL::zcovector z; - z.read( "tmp.txt" ); - cout << "z-x =\n" << z-x << "<-Should be zero." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/a2/a2de093a81d273df1b9b25d1260cf2d30310880c.svn-base b/cpplapack-r198/.svn/pristine/a2/a2de093a81d273df1b9b25d1260cf2d30310880c.svn-base deleted file mode 100644 index 2c7f5c069b3703c7ec7218327254b887376c8427..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a2/a2de093a81d273df1b9b25d1260cf2d30310880c.svn-base +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -rm -f std err doxygen.log -rm -rf html diff --git a/cpplapack-r198/.svn/pristine/a3/a3618a61babb8929a13941ca942a28a94439c137.svn-base b/cpplapack-r198/.svn/pristine/a3/a3618a61babb8929a13941ca942a28a94439c137.svn-base deleted file mode 100644 index 35ec1c0b4c25a95b1c848ac79652775364059a4f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a3/a3618a61babb8929a13941ca942a28a94439c137.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! +zgsmatrix operator */ -inline const zgsmatrix& operator+(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -zgsmatrix operator */ -inline _zgsmatrix operator-(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v =-it->v; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a3/a37bb7a8b63f1dcdf3e43a2bf9e2b2d7792468cb.svn-base b/cpplapack-r198/.svn/pristine/a3/a37bb7a8b63f1dcdf3e43a2bf9e2b2d7792468cb.svn-base deleted file mode 100644 index ef8c594956511e4050a9f27c49f2a1b0af0f7c26..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a3/a37bb7a8b63f1dcdf3e43a2bf9e2b2d7792468cb.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _dsymatrix*_dcovector operator */ -inline _dcovector operator*(const _dsymatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/a4/a459e40eda30cb7a21ed1802afb12c64d1bc6943.svn-base b/cpplapack-r198/.svn/pristine/a4/a459e40eda30cb7a21ed1802afb12c64d1bc6943.svn-base deleted file mode 100644 index e70e78e64bc1651c7cd3691432896805bed7b29d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a4/a459e40eda30cb7a21ed1802afb12c64d1bc6943.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! nullify all the vector data */ -inline void _drovector::nullify() const -{CPPL_VERBOSE_REPORT; - l=0; - cap=0; - array=NULL; -} - -//============================================================================= -/*! destroy all the vector data */ -inline void _drovector::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - array=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/a4/a45ca659f1a287ce1b8f2199247cbd101a80997d.svn-base b/cpplapack-r198/.svn/pristine/a4/a45ca659f1a287ce1b8f2199247cbd101a80997d.svn-base deleted file mode 100644 index 9d2638a004060ab389dbf993c884a5b3953dee4d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a4/a45ca659f1a287ce1b8f2199247cbd101a80997d.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! _zrovector*_zgbmatrix operator */ -inline _zrovector operator*(const _zrovector& vec, const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/a4/a47948470a332439f2cd30d33f589f37833f2815.svn-base b/cpplapack-r198/.svn/pristine/a4/a47948470a332439f2cd30d33f589f37833f2815.svn-base deleted file mode 100644 index 797e89ec11762806c9363416150a598e5d610b4b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a4/a47948470a332439f2cd30d33f589f37833f2815.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zgbmatrix*zcovector operator */ -inline _zcovector operator*(const zgbmatrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/a4/a47eb88ae8beb915da4802d257f2f7fb6304fbb9.svn-base b/cpplapack-r198/.svn/pristine/a4/a47eb88ae8beb915da4802d257f2f7fb6304fbb9.svn-base deleted file mode 100644 index 712b30277dff5a00b4fb7b71fb4292ee5035f42d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a4/a47eb88ae8beb915da4802d257f2f7fb6304fbb9.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix zhsmatrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat( zgematrix(m,n).zero() ); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - newmat(it->j, it->i) =std::conj(it->v); - } - - return _(newmat); -} - -//============================================================================= -/*! convert to _zhematrix */ -inline _zhematrix zhsmatrix::to_zhematrix() const -{CPPL_VERBOSE_REPORT; - zhematrix newmat(n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! convert to _zgsmatrix */ -inline _zgsmatrix zhsmatrix::to_zgsmatrix() const -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(m,n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, it->v); - if(it->i!=it->j){ - newmat.put(it->j, it->i, std::conj(it->v)); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a4/a4adfd17d01830b0ce2f85d691da3b2cbfaa953c.svn-base b/cpplapack-r198/.svn/pristine/a4/a4adfd17d01830b0ce2f85d691da3b2cbfaa953c.svn-base deleted file mode 100644 index 9c130e5c2b446c5f435c0b92729e57692ab4257b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a4/a4adfd17d01830b0ce2f85d691da3b2cbfaa953c.svn-base +++ /dev/null @@ -1,116 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+zgbmatrix operator */ -inline _zgbmatrix operator+(const _zgbmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>=matB.kl && matA.ku>=matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) += matB(i,j); - } - } - - return matA; - } - - else{ - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) += matB(i,j); - } - } - - matA.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! _zgbmatrix-zgbmatrix operator */ -inline _zgbmatrix operator-(const _zgbmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matA.kl>=matB.kl && matA.ku>=matB.ku){ - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) -= matB(i,j); - } - } - - return matA; - } - - else{ - zgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); - } -} - -//============================================================================= -/*! _zgbmatrix*zgbmatrix operator */ -inline _zgbmatrix operator*(const _zgbmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a5/a52916efcae4b9fb51b82872aa84a7519a3477ee.svn-base b/cpplapack-r198/.svn/pristine/a5/a52916efcae4b9fb51b82872aa84a7519a3477ee.svn-base deleted file mode 100644 index 1352be7fb3a7bcb765563b55042e1966d4caad0a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a5/a52916efcae4b9fb51b82872aa84a7519a3477ee.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! _zhsmatrix*double operator */ -inline _zhsmatrix operator*(const _zhsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *=d; - } - - return mat; -} - -//============================================================================= -/*! _zhsmatrix/double operator */ -inline _zhsmatrix operator/(const _zhsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v /=d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/a5/a5331b1ac4d7d7160ed1a11b601a3f6a3a63818b.svn-base b/cpplapack-r198/.svn/pristine/a5/a5331b1ac4d7d7160ed1a11b601a3f6a3a63818b.svn-base deleted file mode 100644 index 9db421222f53de34276c9b9f2aadde095e358e5c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a5/a5331b1ac4d7d7160ed1a11b601a3f6a3a63818b.svn-base +++ /dev/null @@ -1,202 +0,0 @@ -//============================================================================= -/*! solve A*X=Y using zhesv\n - The argument is dmatrix Y. Y is overwritten and become the solution X. - A is also overwritten. -*/ -inline CPPL_INT zhematrix::zhesv(zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrices cannot be solved." << std::endl - << "Your input was (" << n << "x" << n << ") and (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - char UPLO('l'); - CPPL_INT NRHS(mat.n), LDA(n), *IPIV(new CPPL_INT[n]), LDB(mat.n), LWORK(-1), INFO(1); - comple *WORK(new comple[1]); - zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(std::real(WORK[0])); - delete [] WORK; - WORK =new comple[LWORK]; - zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, mat.array, &LDB, WORK, &LWORK, &INFO); - - delete [] WORK; - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve A*x=y using zhesv\n - The argument is zcovector y. y is overwritten and become the solution x. - A is also overwritten. -*/ -inline CPPL_INT zhematrix::zhesv(zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << n << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - char UPLO('l'); - CPPL_INT NRHS(1), LDA(n), *IPIV(new CPPL_INT[n]), LDB(vec.l), LWORK(-1), INFO(1); - comple *WORK( new comple[1] ); - zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, WORK, &LWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(std::real(WORK[0])); - delete [] WORK; - WORK = new comple[LWORK]; - zhesv_(&UPLO, &n, &NRHS, array, &LDA, IPIV, vec.array, &LDB, WORK, &LWORK, &INFO); - - delete [] WORK; - delete [] IPIV; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate eigenvalues and eigenvectors.\n - All of the arguments need not to be initialized. - w is overwitten and become eigenvalues. - This matrix is also overwritten. - if jobz=1, this matrix becomes eigenvectors. -*/ -inline CPPL_INT zhematrix::zheev(std::vector<double>& w, - const bool& jobz=0) -{CPPL_VERBOSE_REPORT; - w.resize(n); - - char JOBZ, UPLO('l'); - if(jobz==0){ JOBZ='n'; } else{ JOBZ='V'; } - CPPL_INT LDA(n), INFO(1), LWORK(-1); - double *RWORK(new double[std::max(CPPL_INT(1), 3*n-2)]); - comple *WORK(new comple[1]); - zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(std::real(WORK[0])); - delete [] WORK; - WORK = new comple[LWORK]; - zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO); - - delete [] RWORK; - delete [] WORK; - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate eigenvalues and eigenvectors.\n - All of the arguments need not to be initialized. - w and v are overwitten and become - eigenvalues and eigenvectors, respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT zhematrix::zheev(std::vector<double>& w, - std::vector<zcovector>& v) -{CPPL_VERBOSE_REPORT; - w.resize(n); - v.resize(n); - for(CPPL_INT i=0; i<n; i++){ - v[i].resize(n); - } - - char JOBZ('V'), UPLO('l'); - CPPL_INT LDA(n), INFO(1), LWORK(-1); - double *RWORK(new double[std::max(CPPL_INT(1), 3*n-2)]); - comple *WORK(new comple[1]); - zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(std::real(WORK[0])); - delete [] WORK; - WORK = new comple[LWORK]; - zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO); - - delete [] RWORK; - delete [] WORK; - - //// forming //// - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<n; j++){ - v[j](i) = array[i+n*j]; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! calculate eigenvalues and eigenvectors.\n - All of the arguments need not to be initialized. - w and v are overwitten and become - eigenvalues and eigenvectors, respectively. - This matrix is also overwritten. -*/ -inline CPPL_INT zhematrix::zheev(std::vector<double>& w, - std::vector<zrovector>& v) -{CPPL_VERBOSE_REPORT; - w.resize(n); - v.resize(n); - for(CPPL_INT i=0; i<n; i++){ - v[i].resize(n); - } - - char JOBZ('V'), UPLO('l'); - CPPL_INT LDA(n), INFO(1), LWORK(-1); - double *RWORK(new double[std::max(CPPL_INT(1), 3*n-2)]); - comple *WORK(new comple[1]); - zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO); - - INFO=1; - LWORK = CPPL_INT(std::real(WORK[0])); - delete [] WORK; - WORK = new comple[LWORK]; - zheev_(&JOBZ, &UPLO, &n, array, &LDA, &w[0], WORK, &LWORK, RWORK, &INFO); - - delete [] RWORK; - delete [] WORK; - - //// forming //// - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<n; j++){ - v[j](i) = array[i+n*j]; - } - } - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} diff --git a/cpplapack-r198/.svn/pristine/a5/a5420738c2999fd6a18f6e744fa22ceb42ef7162.svn-base b/cpplapack-r198/.svn/pristine/a5/a5420738c2999fd6a18f6e744fa22ceb42ef7162.svn-base deleted file mode 100644 index f10e20a92c7ced3ad6046c6598269aaddc31dbc9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a5/a5420738c2999fd6a18f6e744fa22ceb42ef7162.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+_zhematrix operator */ -inline _zgematrix operator+(const _zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB.n, matB.n); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) = matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix-_zhematrix operator */ -inline _zgematrix operator-(const _zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB.n, matB.n); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) = -matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix*_zhematrix operator */ -inline _zgematrix operator*(const _zgbmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a5/a553ce577d16f62b797b56868b5fcf052626abdc.svn-base b/cpplapack-r198/.svn/pristine/a5/a553ce577d16f62b797b56868b5fcf052626abdc.svn-base deleted file mode 100644 index 9b854cde7afef6a64d2df079131a0ac415d0d8c7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a5/a553ce577d16f62b797b56868b5fcf052626abdc.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _dgematrix::nullify() const -{CPPL_VERBOSE_REPORT; - m=0; - n=0; - array=NULL; - darray=NULL; -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _dgematrix::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; - array=NULL; - darray=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/a5/a56dd9fc36ae66c856e22e24d8827efe68ba057b.svn-base b/cpplapack-r198/.svn/pristine/a5/a56dd9fc36ae66c856e22e24d8827efe68ba057b.svn-base deleted file mode 100644 index 48cb8d2fc9aa0827d74b223cdd0fb809625c50a0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a5/a56dd9fc36ae66c856e22e24d8827efe68ba057b.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision Column Vector Class -class _dcovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT l; //!< vector size - mutable CPPL_INT cap; //!< vector capacity - mutable double* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _dcovector(); - inline _dcovector(const _dcovector&); - inline ~_dcovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zcovector to_zcovector() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const _dcovector&); - inline void write(const char*) const; - - //////// calc //////// - inline friend _drovector t(const dcovector&); - inline friend double nrm2(const dcovector&); - inline friend CPPL_INT idamax(const dcovector&); - inline friend double damax(const dcovector&); - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _dcovector& operator+(const _dcovector&); - inline friend _dcovector operator-(const _dcovector&); - - //////// + //////// - inline friend _dcovector operator+(const _dcovector&, const dcovector&); - inline friend _dcovector operator+(const _dcovector&, const _dcovector&); - - //////// - //////// - inline friend _dcovector operator-(const _dcovector&, const dcovector&); - inline friend _dcovector operator-(const _dcovector&, const _dcovector&); - - //////// * //////// - inline friend _dgematrix operator*(const _dcovector&, const drovector&); - inline friend _dgematrix operator*(const _dcovector&, const _drovector&); - inline friend _dcovector operator*(const _dcovector&, const double&); - - //////// / //////// - inline friend _dcovector operator/(const _dcovector&, const double&); - - //////// % //////// - inline friend double operator%(const _dcovector&, const dcovector&); - inline friend double operator%(const _dcovector&, const _dcovector&); - - //////// double //////// - inline friend _dcovector operator*(const double&, const _dcovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/a5/a5862a064be8b62b02c9ef27b3cdcee02e59824f.svn-base b/cpplapack-r198/.svn/pristine/a5/a5862a064be8b62b02c9ef27b3cdcee02e59824f.svn-base deleted file mode 100644 index d10dad324e8aa1b37a34031aef6e1e531c02de9c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a5/a5862a064be8b62b02c9ef27b3cdcee02e59824f.svn-base +++ /dev/null @@ -1,53 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), K(2); - - CPPL::zgematrix A(M,K), B(K,N), C; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - - cout << "A+A =\n" << A+A << endl; - cout << "A-A =\n" << A-A << endl; - cout << "A*B =\n" << A*B << endl; - - cout << "#### C=A; ####" << endl; - C=A; - cout << "C =\n" << C << endl; - cout << "#### C+=A; ####" << endl; - C+=A; - cout << "C =\n" << C << endl; - cout << "#### C-=A; ####" << endl; - C-=A; - cout << "C =\n" << C << endl; - cout << "#### C*=B; ####" << endl; - C*=B; - cout << "C =\n" << C << endl; - cout << "#### C=A+A; ####" << endl; - C=A+A; - cout << "C =\n" << C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/a5/a5deb86b5f169638c1f5bae3bfb2c437d3bd38d8.svn-base b/cpplapack-r198/.svn/pristine/a5/a5deb86b5f169638c1f5bae3bfb2c437d3bd38d8.svn-base deleted file mode 100644 index 2442f06db0b913df9318bac5eb39510ca57b02ad..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a5/a5deb86b5f169638c1f5bae3bfb2c437d3bd38d8.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! comple*zcovector operator */ -inline _zcovector operator*(const comple& d, const zcovector& vec) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =d*vec.array[i]; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/a6/a645ede2a0c9bf5353d2a934185736d0190e0e78.svn-base b/cpplapack-r198/.svn/pristine/a6/a645ede2a0c9bf5353d2a934185736d0190e0e78.svn-base deleted file mode 100644 index e989462df7bc53f53c96684883f9930356cc1e2a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a6/a645ede2a0c9bf5353d2a934185736d0190e0e78.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*zhematrix operator */ -inline _zhematrix operator*(const double& d, const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - zhematrix newmat(mat.n); - - const CPPL_INT size =mat.n*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a7/a7489c14a962dd3fce8431d4f8e18d2b0cc5090c.svn-base b/cpplapack-r198/.svn/pristine/a7/a7489c14a962dd3fce8431d4f8e18d2b0cc5090c.svn-base deleted file mode 100644 index db4a42d59c03d36c6403001f3618ce41c4e7b58a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a7/a7489c14a962dd3fce8431d4f8e18d2b0cc5090c.svn-base +++ /dev/null @@ -1,145 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline double& dgbmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << " with kl=" << kl << ", ku=" << ku << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[ku+i+(kl+ku)*j]; - return darray[j][ku-j+i]; -} - -//============================================================================= -/*! operator() for const object */ -inline double dgbmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << " with kl=" << kl << ", ku=" << ku << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[ku+i+(kl+ku)*j]; - return darray[j][ku-j+i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline dgbmatrix& dgbmatrix::set(const CPPL_INT& i, const CPPL_INT& j, const double& v) //const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << " with kl=" << kl << ", ku=" << ku << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //array[ku+i+(kl+ku)*j] =v; - darray[j][ku-j+i] =v; - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i-j>mat.kl || j-i>mat.ku ){ s << " x"; } - else{ s << " " << mat(i,j); } - } - s << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void dgbmatrix::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dgbmatrix" << " " << m << " " << n << " " << kl << " " << ku << std::endl; - - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void dgbmatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dgbmatrix" && id != "#dgbmatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dgbmatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> m >> n >> kl >> ku; - resize(m, n, kl, ku); - - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/a7/a7816cf51d012ef4ded62d30059cee1e39815e9f.svn-base b/cpplapack-r198/.svn/pristine/a7/a7816cf51d012ef4ded62d30059cee1e39815e9f.svn-base deleted file mode 100644 index 3d0e3a1d780f49ca6f3288a891604b9cb31b409b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a7/a7816cf51d012ef4ded62d30059cee1e39815e9f.svn-base +++ /dev/null @@ -1,144 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline comple& zgbmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << " with kl=" << kl << ", ku=" << ku << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[ku+i+(kl+ku)*j]; - return darray[j][ku-j+i]; -} - -//============================================================================= -/*! operator() for const object */ -inline comple zgbmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << " with kl=" << kl << ", ku=" << ku << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[ku+i+(kl+ku)*j]; - return darray[j][ku-j+i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline zgbmatrix& zgbmatrix::set(const CPPL_INT& i, const CPPL_INT& j, const comple& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << " with kl=" << kl << ", ku=" << ku << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //array[ku+i+(kl+ku)*j] =v; - darray[j][ku-j+i] =v; - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i-j>mat.kl || j-i>mat.ku ){ s << " x"; } - else{ s << " " << mat(i,j); } - } - s << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void zgbmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zgbmatrix" << " " << m << " " << n << " " << kl << " " << ku << std::endl; - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void zgbmatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zgbmatrix" && id != "#zgbmatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zgbmatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> m >> n >> kl >> ku; - resize(m, n, kl, ku); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/a7/a785542beb976966aa9e20c7f4078a695288bf55.svn-base b/cpplapack-r198/.svn/pristine/a7/a785542beb976966aa9e20c7f4078a695288bf55.svn-base deleted file mode 100644 index 5ef737516107de157bd0157a44ddc04f9c0359b0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a7/a785542beb976966aa9e20c7f4078a695288bf55.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -//============================================================================= -/*! double*_zhsmatrix operator */ -inline _zhsmatrix operator*(const double& d, const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *=d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/a7/a7bbccd54d8366d6e73ae37572e7666bf78c4c8e.svn-base b/cpplapack-r198/.svn/pristine/a7/a7bbccd54d8366d6e73ae37572e7666bf78c4c8e.svn-base deleted file mode 100644 index 89c765789d59dca7d972db17dde0becaed0d5582..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a7/a7bbccd54d8366d6e73ae37572e7666bf78c4c8e.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _dsymatrix::nullify() const -{CPPL_VERBOSE_REPORT; - n=0; - array=NULL; - darray=NULL; -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _dsymatrix::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; - array=NULL; - darray=NULL; -} - -//============================================================================= -/*! complete the upper-right components */ -inline void _dsymatrix::complete() const -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - darray[i][j] =darray[j][i]; - } - } -} diff --git a/cpplapack-r198/.svn/pristine/a8/a83009609996f5a2451e02311cc0908ac7f154a6.svn-base b/cpplapack-r198/.svn/pristine/a8/a83009609996f5a2451e02311cc0908ac7f154a6.svn-base deleted file mode 100644 index b004c8baba42f17db865349662178b70de9b045c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a8/a83009609996f5a2451e02311cc0908ac7f154a6.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! _dcovector*_drovector operator */ -inline _dgematrix operator*(const _dcovector& covec, const _drovector& rovec) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(covec.l, rovec.l); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - } - } - - covec.destroy(); - rovec.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a8/a8ced4e9c9f66c89db11b65455bfe929f2b3dbdc.svn-base b/cpplapack-r198/.svn/pristine/a8/a8ced4e9c9f66c89db11b65455bfe929f2b3dbdc.svn-base deleted file mode 100644 index 538fe8e6369dde02a7affa012ad78f14c42878ea..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a8/a8ced4e9c9f66c89db11b65455bfe929f2b3dbdc.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*dgsmatrix operator */ -inline _dgsmatrix operator*(const double& d, const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgsmatrix newmat =mat; - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *= d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/a9/a97deb2b04a59b9901bd33283b92dd33f55ecbd5.svn-base b/cpplapack-r198/.svn/pristine/a9/a97deb2b04a59b9901bd33283b92dd33f55ecbd5.svn-base deleted file mode 100644 index a05d6b2b5114759805d7505b940e3918a7530835..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a9/a97deb2b04a59b9901bd33283b92dd33f55ecbd5.svn-base +++ /dev/null @@ -1,57 +0,0 @@ -//============================================================================= -/*! return transposed _zgsmatrix */ -inline _zgsmatrix t(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - std::swap(it->i,it->j); - } - - std::swap(mat.rows,mat.cols); - - return mat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - i=itx->i; - j=itx->j; - - mat.destroy(); -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - mat.destroy(); - return itx->v; -} diff --git a/cpplapack-r198/.svn/pristine/a9/a9a429ab03b5ecb328caa8bedbec04fd6f8f87ca.svn-base b/cpplapack-r198/.svn/pristine/a9/a9a429ab03b5ecb328caa8bedbec04fd6f8f87ca.svn-base deleted file mode 100644 index 2c74415fa1d60fc3490e2939e52df71fbfb2cc77..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a9/a9a429ab03b5ecb328caa8bedbec04fd6f8f87ca.svn-base +++ /dev/null @@ -1,141 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline double& dgematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[i+m*j]; - return darray[j][i]; -} - -//============================================================================= -/*! operator() for const object */ -inline double dgematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[i+m*j]; - return darray[j][i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline dgematrix& dgematrix::set(const CPPL_INT& i, const CPPL_INT& j, const double& v) //const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //array[i+m*j] =v; - darray[j][i] =v; - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - s << " " << mat(i,j); - } - s << std::endl; - } - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void dgematrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dgematrix" << " " << m << " " << n << std::endl; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++ ){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void dgematrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "dgematrix" && id != "#dgematrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dgematrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> m >> n; - resize(m, n); - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++ ){ - s >> operator()(i,j); - } - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is a lack of data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/a9/a9addb498e230700b636c09839a04edebee4e651.svn-base b/cpplapack-r198/.svn/pristine/a9/a9addb498e230700b636c09839a04edebee4e651.svn-base deleted file mode 100644 index 8c9ba9aa85c88d99dfd1b844920a87984b0e89bc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/a9/a9addb498e230700b636c09839a04edebee4e651.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _zrovector*zgematrix operator */ -inline _zrovector operator*(const _zrovector& vec, const zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/aa/aa9401d7724830512a56fccc17a9755f97f04443.svn-base b/cpplapack-r198/.svn/pristine/aa/aa9401d7724830512a56fccc17a9755f97f04443.svn-base deleted file mode 100644 index e7d357e8637cc7c89187dc9faa88cb62adba53bd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/aa/aa9401d7724830512a56fccc17a9755f97f04443.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -dssmatrix 6 100000 -0 0 8.653846e+08 -1 0 4.807692e+08 -1 1 8.653846e+08 -2 2 6.730769e+08 -3 3 1.923077e+08 -4 4 1.923077e+08 -5 5 6.730769e+08 -2 0 -6.730769e+08 -2 1 -2.884615e+08 -3 0 -1.923077e+08 -3 1 -1.923077e+08 -4 0 -1.923077e+08 -4 1 -1.923077e+08 -5 0 -2.884615e+08 -5 1 -6.730769e+08 -4 3 1.923077e+08 -5 2 2.884615e+08 diff --git a/cpplapack-r198/.svn/pristine/aa/aaf2d33bca9e3e84bdcb8cc425056122852ba5df.svn-base b/cpplapack-r198/.svn/pristine/aa/aaf2d33bca9e3e84bdcb8cc425056122852ba5df.svn-base deleted file mode 100644 index ce8f100cd32f2fa57157b7bfaa618bf5e602c000..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/aa/aaf2d33bca9e3e84bdcb8cc425056122852ba5df.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! dgbmatrix+dgsmatrix operator */ -inline _dgematrix operator+(const dgbmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix-dgsmatrix operator */ -inline _dgematrix operator-(const dgbmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( -matB.to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)-=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix*dgsmatrix operator */ -inline _dgematrix operator*(const dgbmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - const CPPL_INT imax =std::min(matA.m,it->i+matA.kl); - for(CPPL_INT i=std::max(CPPL_INT(0),it->i-(matA.ku+1)); i<imax; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ab/ab4e51cec1d385b7f62dcd8878fea92909ec24e7.svn-base b/cpplapack-r198/.svn/pristine/ab/ab4e51cec1d385b7f62dcd8878fea92909ec24e7.svn-base deleted file mode 100644 index c4bc998a598b9e2d845e207c6bf431a9716e3144..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ab/ab4e51cec1d385b7f62dcd8878fea92909ec24e7.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -#define dgesv_ DGESV -#define dgbsv_ DGBSV -#define dgtsv_ DGTSV -#define dposv_ DPOSV -#define dppsv_ DPPSV -#define dpbsv_ DPBSV -#define dptsv_ DPTSV -#define dsysv_ DSYSV -#define dspsv_ DSPSV -#define dgels_ DGELS -#define dgelsy_ DGELSY -#define dgelss_ DGELSS -#define dgelsd_ DGELSD -#define dgglse_ DGGLSE -#define dggglm_ DGGGLM -#define dgeev_ DGEEV -#define dsyev_ DSYEV -#define dsyevd_ DSYEVD -#define dspev_ DSPEV -#define dspevd_ DSPEVD -#define dsbev_ DSBEV -#define dsbevd_ DSBEVD -#define dstev_ DSTEV -#define dstevd_ DSTEVD -#define dgees_ DGEES -#define dgesvd_ DGESVD -#define dgesdd_ DGESDD -#define dggev_ DGGEV -#define dsygv_ DSYGV -#define dsygvd_ DSYGVD -#define dspgv_ DSPGV -#define dspgvd_ DSPGVD -#define dsbgv_ DSBGV -#define dsbgvd_ DSBGVD -#define dgges_ DGGES -#define dggsvd_ DGGSVD - -#define zgesv_ ZGESV -#define zgbsv_ ZGBSV -#define zgtsv_ ZGTSV -#define zposv_ ZPOSV -#define zppsv_ ZPPSV -#define zpbsv_ ZPBSV -#define zptsv_ ZPTSV -#define zhesv_ ZHESV -#define zsysv_ ZSYSV -#define zhpsv_ ZHPSV -#define zspsv_ ZSPSV -#define zgels_ ZGELS -#define zgelsy_ ZGELSY -#define zgelss_ ZGELSS -#define zgglse_ ZGGLSE -#define zggglm_ ZGGGLM -#define zgeev_ ZGEEV -#define zheev_ ZHEEV -#define zheevd_ ZHEEVD -#define zhpev_ ZHPEV -#define zhpevd_ ZHPEVD -#define zhbev_ ZHBEV -#define zhbevd_ ZHBEVD -#define zgees_ ZGEES -#define zgesvd_ ZGESVD -#define zgesdd_ ZGESDD -#define zggev_ ZGGEV -#define zhegv_ ZHEGV -#define zhegvd_ ZHEGVD -#define zhpgv_ ZHPGV -#define zhpgvd_ ZHPGVD -#define zhbgv_ ZHBGV -#define zhbgvd_ ZHBGVD -#define zgges_ ZGGES -#define zggsvd_ ZGGSVD diff --git a/cpplapack-r198/.svn/pristine/ab/ab94e8ce5fe6e7d57fbfef87f17c993a685dd4c4.svn-base b/cpplapack-r198/.svn/pristine/ab/ab94e8ce5fe6e7d57fbfef87f17c993a685dd4c4.svn-base deleted file mode 100644 index 4d4b6efb9d25cb65b9b11df4e50282a863a356ec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ab/ab94e8ce5fe6e7d57fbfef87f17c993a685dd4c4.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -//============================================================================= -//! Samll Complex Double-precision Symmetric Matrix Class -template<CPPL_INT n> class zhematrix_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - comple array[(n*(n+1))/2]; - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zhematrix_small(); - inline explicit zhematrix_small(const zhematrix&); - inline ~zhematrix_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline zgematrix_small<n,n> to_zgematrix_small() const; - inline zhematrix to_zhematrix() const; - - //////// io //////// - inline comple& operator()(const CPPL_INT& i, const CPPL_INT& j); - inline comple operator()(const CPPL_INT& i, const CPPL_INT& j) const; - inline zhematrix_small<n>& set(const CPPL_INT&, const CPPL_INT&, const comple&); - template<CPPL_INT _n> inline friend std::ostream& operator<<(std::ostream&, const zhematrix_small<_n>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// misc //////// - inline zhematrix_small<n>& zero(); - inline zhematrix_small<n>& identity(); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT N> inline zhematrix_small<N>& operator= (const zhematrix_small<N>&); - //////// += //////// - template<CPPL_INT N> inline friend zhematrix_small<N>& operator+=(zhematrix_small<N>&, const zhematrix_small<N>&); - //////// -= //////// - template<CPPL_INT N> inline friend zhematrix_small<N>& operator-=(zhematrix_small<N>&, const zhematrix_small<N>&); - //////// *= //////// - template<CPPL_INT N> inline friend zhematrix_small<N>& operator*=(zhematrix_small<N>&, const zhematrix_small<N>&); - template<CPPL_INT N> inline friend zhematrix_small<N>& operator*=(zhematrix_small<N>&, const double&); - template<CPPL_INT N> inline friend zhematrix_small<N>& operator*=(zhematrix_small<N>&, const comple&); - //////// /= //////// - template<CPPL_INT N> inline friend zhematrix_small<N>& operator/=(zhematrix_small<N>&, const double&); - template<CPPL_INT N> inline friend zhematrix_small<N>& operator/=(zhematrix_small<N>&, const comple&); - //////// unary //////// - template<CPPL_INT N> inline friend const zhematrix_small<N>& operator+(const zhematrix_small<N>&); - template<CPPL_INT N> inline friend zhematrix_small< N > operator-(const zhematrix_small<N>&); - //////// + //////// - template<CPPL_INT N> inline friend zgematrix_small<N,N> operator+(const zhematrix_small<N>&, const zgematrix_small<N,N>&); - template<CPPL_INT N> inline friend zhematrix_small< N > operator+(const zhematrix_small<N>&, const zhematrix_small< N >&); - //////// - //////// - template<CPPL_INT N> inline friend zgematrix_small<N,N> operator-(const zhematrix_small<N>&, const zgematrix_small<N,N>&); - template<CPPL_INT N> inline friend zhematrix_small< N > operator-(const zhematrix_small<N>&, const zhematrix_small< N >&); - //////// * //////// - template<CPPL_INT N> inline friend zcovector_small< N > operator*(const zhematrix_small<N>&, const zcovector_small< N >&); - template<CPPL_INT N> inline friend zgematrix_small<N,N> operator*(const zhematrix_small<N>&, const zgematrix_small<N,N>&); - template<CPPL_INT N> inline friend zgematrix_small<N,N> operator*(const zhematrix_small<N>&, const zhematrix_small< N >&); - template<CPPL_INT N> inline friend zhematrix_small< N > operator*(const zhematrix_small<N>&, const double&); - template<CPPL_INT N> inline friend zhematrix_small< N > operator*(const zhematrix_small<N>&, const comple&); - //////// / //////// - template<CPPL_INT N> inline friend zhematrix_small< N > operator/(const zhematrix_small<N>&, const double&); - template<CPPL_INT N> inline friend zhematrix_small< N > operator/(const zhematrix_small<N>&, const comple&); - //////// comple //////// - template<CPPL_INT N> inline friend zhematrix_small< N > operator*(const double&, const zhematrix_small< N >&); - template<CPPL_INT N> inline friend zhematrix_small< N > operator*(const comple&, const zhematrix_small< N >&); - //////// hadamerd //////// - template<CPPL_INT N> inline friend zgematrix_small<N,N> hadamerd(const zhematrix_small<N>&, const zgematrix_small<N,N>&); - template<CPPL_INT N> inline friend zhematrix_small< N > hadamerd(const zhematrix_small<N>&, const zhematrix_small< N >&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline comple det(const zhemat2&); -inline zhemat2 inv(const zhemat2&); -inline comple det(const zhemat3&); -inline zhemat3 inv(const zhemat3&); diff --git a/cpplapack-r198/.svn/pristine/ab/abb81ecd86d59357fd94a65c5f477a1f063c2ed2.svn-base b/cpplapack-r198/.svn/pristine/ab/abb81ecd86d59357fd94a65c5f477a1f063c2ed2.svn-base deleted file mode 100644 index 0fbc347d5089c9942d5a83cf2d39e184ede9846c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ab/abb81ecd86d59357fd94a65c5f477a1f063c2ed2.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix _zgbmatrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat( zgematrix(m,n).zero() ); - - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ac/ac67701d5e5891541e2ec7568e693d86f7ae63f7.svn-base b/cpplapack-r198/.svn/pristine/ac/ac67701d5e5891541e2ec7568e693d86f7ae63f7.svn-base deleted file mode 100644 index 24cd204e914c2f2be5e8319d6e49eae0e990790b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ac/ac67701d5e5891541e2ec7568e693d86f7ae63f7.svn-base +++ /dev/null @@ -1,68 +0,0 @@ -//============================================================================= -/*! return transposed dgematrix */ -inline _dgematrix t(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(mat.n,mat.m); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =mat(j,i); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _dgematrix i(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix mat_cp(mat), mat_inv(mat.m,mat.n); - mat_inv.identity(); - mat_cp.dgesv(mat_inv); - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT N =mat.m*mat.n; - CPPL_INT INCX =1; - return dnrm2_(&N, mat.array, &INCX); -} - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =mat.m*mat.n; - CPPL_INT inc =1; - CPPL_INT index =idamax_(&mn, mat.array, &inc) -1; - i =index%mat.m; - j =index/mat.m; -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =mat.m*mat.n; - CPPL_INT inc =1; - return mat.array[idamax_(&mn, mat.array, &inc) -1]; -} diff --git a/cpplapack-r198/.svn/pristine/ac/ac68a4acaaf5cb43d7d698d7e47b56d9f31ffa7a.svn-base b/cpplapack-r198/.svn/pristine/ac/ac68a4acaaf5cb43d7d698d7e47b56d9f31ffa7a.svn-base deleted file mode 100644 index a2c1412e0a46e99df052afa2816089ecf4149d32..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ac/ac68a4acaaf5cb43d7d698d7e47b56d9f31ffa7a.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================= -/*! _zgematrix+zgematrix operator */ -inline _zgematrix operator+(const _zgematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - matA.array[i] += matB.array[i]; - } - - return matA; -} - -//============================================================================= -/*! _zgematrix-zgematrix operator */ -inline _zgematrix operator-(const _zgematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - matA.array[i] -= matB.array[i]; - } - - return matA; -} - -//============================================================================= -/*! _zgematrix*zgematrix operator */ -inline _zgematrix operator*(const _zgematrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ac/aca22b99ef452886fba14f9a93e65ae415bdbd29.svn-base b/cpplapack-r198/.svn/pristine/ac/aca22b99ef452886fba14f9a93e65ae415bdbd29.svn-base deleted file mode 100644 index 4aa90609310b8c6615044098e63c44b895f866c4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ac/aca22b99ef452886fba14f9a93e65ae415bdbd29.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! double*dcovector operator */ -inline _dcovector operator*(const double& d, const dcovector& vec) -{CPPL_VERBOSE_REPORT; - dcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =d*vec.array[i]; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/ac/acd651d14e32ab582f14052990bb70d05b857714.svn-base b/cpplapack-r198/.svn/pristine/ac/acd651d14e32ab582f14052990bb70d05b857714.svn-base deleted file mode 100644 index 88a187eb7ee1e8159d13135881093b6bff0d9f8c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ac/acd651d14e32ab582f14052990bb70d05b857714.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! zgbmatrix*=double operator */ -inline zgbmatrix& zgbmatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(kl+ku+1)*n; - CPPL_INT inc =1; - zdscal_(&size, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zgbmatrix/=double operator */ -inline zgbmatrix& zgbmatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(kl+ku+1)*n; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&size, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix*double operator */ -inline _zgbmatrix operator*(const zgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! zgbmatrix/double operator */ -inline _zgbmatrix operator/(const zgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ac/ace7ce112ce6757a1e9f8851bc28e49e6c84d4fb.svn-base b/cpplapack-r198/.svn/pristine/ac/ace7ce112ce6757a1e9f8851bc28e49e6c84d4fb.svn-base deleted file mode 100644 index be38af2600fbe540764b5339b32e07b3eacca9ab..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ac/ace7ce112ce6757a1e9f8851bc28e49e6c84d4fb.svn-base +++ /dev/null @@ -1,240 +0,0 @@ -//============================================================================= -/*! dgbmatrix=_dgbmatrix operator */ -inline dgbmatrix& dgbmatrix::operator=(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgbmatrix+=_dgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline dgbmatrix& dgbmatrix::operator+=(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) += mat(i,j); - } - } - - mat.destroy(); - return *this; - } - else{ - dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j)+=operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j)+=mat(i,j); - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; - } -} - -//============================================================================= -/*! dgbmatrix-=_dgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline dgbmatrix& dgbmatrix::operator-=(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - mat.destroy(); - return *this; - } - else{ - dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j)+=operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j)-=mat(i,j); - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; - } -} - -//============================================================================= -/*! dgbmatrix*=_dgbmatrix operator */ -inline dgbmatrix& dgbmatrix::operator*=(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-kl), std::max(CPPL_INT(0),j-mat.ku) ); k<kmax; k++){ - newmat(i,j)+= operator()(i,k)*mat(k,j); - } - } - } - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgbmatrix+_dgbmatrix operator */ -inline _dgbmatrix operator+(const dgbmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(matB.kl>matA.kl && matB.ku>matA.ku){ - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j)+=matA(i,j); - } - } - - return matB; - } - else{ - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j)+=matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); - } -} - -//============================================================================= -/*! dgbmatrix-_dgbmatrix operator */ -inline _dgbmatrix operator-(const dgbmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j)+=matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix*_dgbmatrix operator */ -inline _dgbmatrix operator*(const dgbmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j)+= matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ad/add0f5b569d55a25398ff18342bacd387a6feee5.svn-base b/cpplapack-r198/.svn/pristine/ad/add0f5b569d55a25398ff18342bacd387a6feee5.svn-base deleted file mode 100644 index 035f26729ca543a3951a0d7f4e45342e14b9447d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ad/add0f5b569d55a25398ff18342bacd387a6feee5.svn-base +++ /dev/null @@ -1,50 +0,0 @@ -//============================================================================= -/*! cast to _zhematrix */ -inline _zhematrix dsymatrix::to_zhematrix() const -{CPPL_VERBOSE_REPORT; - zhematrix newmat(n); - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - newmat(i,j) =comple((*this)(i,j),0.0); - } - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix dsymatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat(n,n); - - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<n; j++){ - newmat(i,j) =(*this)(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! convert to _dssmatrix */ -inline _dssmatrix dsymatrix::to_dssmatrix(const double eps) const -{CPPL_VERBOSE_REPORT; - dssmatrix newmat(n); - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - if( fabs((*this)(i,j))>eps ){ - newmat(i,j) =(*this)(i,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ad/add3351bfe76333057c06198a88674c6a28cdbd9.svn-base b/cpplapack-r198/.svn/pristine/ad/add3351bfe76333057c06198a88674c6a28cdbd9.svn-base deleted file mode 100644 index 85a4f85257ec5a10c4a9dba77d84ec729f52c910..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ad/add3351bfe76333057c06198a88674c6a28cdbd9.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! dgsmatrix+dgbmatrix operator */ -inline _dgematrix operator+(const dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix-dgbmatrix operator */ -inline _dgematrix operator-(const dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix*dgbmatrix operator */ -inline _dgematrix operator*(const dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ad/addc96a7f2207b14e81f247c3724a98be9379975.svn-base b/cpplapack-r198/.svn/pristine/ad/addc96a7f2207b14e81f247c3724a98be9379975.svn-base deleted file mode 100644 index 69e06b13a1f393c2c72cece8cd026beec3213463..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ad/addc96a7f2207b14e81f247c3724a98be9379975.svn-base +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -######## base ######## -version=`grep Version ./control | awk '{print $2}'` -name=cpplapack_"$version"_all -dir=/tmp/$name -rm -rf $dir -mkdir $dir - -######## DEBIAN ######## -mkdir $dir/DEBIAN -cp ./control $dir/DEBIAN - -######## include/cpplapack ######## -mkdir $dir/usr/ -mkdir $dir/usr/include -mkdir $dir/usr/include/cpplapack -cp -r ../../include/* $dir/usr/include/cpplapack -cat $dir/usr/include/cpplapack/cpplapack.h | sed -e 's/\#include\ \"/\#include\ \"cpplapack\//g'\ > $dir/usr/include/cpplapack.h -rm $dir/usr/include/cpplapack/cpplapack.h -rm -rf `find $dir -type d -name .svn` -sudo chown -R root:root $dir - -######## dpkg-deb ######## -cd /tmp -rm -f $name.deb -dpkg -b $name -sudo rm -rf $dir -echo "/tmp/$name.deb was successfully created." - -## sudo dpkg -i cpplapack -## sudo dpkg -r cpplapack diff --git a/cpplapack-r198/.svn/pristine/ad/adfd04b92056852b9faf5839edf31f9fac50d7d4.svn-base b/cpplapack-r198/.svn/pristine/ad/adfd04b92056852b9faf5839edf31f9fac50d7d4.svn-base deleted file mode 100644 index 252759256cbb031943f50658135b548735ad38fb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ad/adfd04b92056852b9faf5839edf31f9fac50d7d4.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -//============================================================================= -/*! double*_zgbmatrix operator */ -inline _zgbmatrix operator*(const double& d, const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - zdscal_(&size, &d, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/ae/aee4d3c164f0ad22ec57d5120bcfdca304b24e83.svn-base b/cpplapack-r198/.svn/pristine/ae/aee4d3c164f0ad22ec57d5120bcfdca304b24e83.svn-base deleted file mode 100644 index 25ad1235f2f4cf582793515a37e0b6041f85faa1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ae/aee4d3c164f0ad22ec57d5120bcfdca304b24e83.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! dgrmatrix constructor without arguments */ -inline dgrmatrix::dgrmatrix() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgrmatrix copy constructor */ -inline dgrmatrix::dgrmatrix(const dgrmatrix& mat) -{CPPL_VERBOSE_REPORT; - copy(mat); -} - -//============================================================================= -/*! dgrmatrix constructor with filename */ -inline dgrmatrix::dgrmatrix(const char* filename) -{CPPL_VERBOSE_REPORT; - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgrmatrix destructor */ -inline dgrmatrix::~dgrmatrix() -{CPPL_VERBOSE_REPORT; - a.clear(); - ia.clear(); - ja.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/af/af36aa0aee3818cc07f79211140be8cf8e9a1183.svn-base b/cpplapack-r198/.svn/pristine/af/af36aa0aee3818cc07f79211140be8cf8e9a1183.svn-base deleted file mode 100644 index 9f4b2075b428a6b74d80d0593a7fae10de23d508..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/af/af36aa0aee3818cc07f79211140be8cf8e9a1183.svn-base +++ /dev/null @@ -1,11 +0,0 @@ -//============================================================================= -/*! complex*_zgsmatrix operator */ -inline _zgsmatrix operator*(const comple& d, const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *= d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/af/af650cfc58edaabff409603d1e06039eaab69aeb.svn-base b/cpplapack-r198/.svn/pristine/af/af650cfc58edaabff409603d1e06039eaab69aeb.svn-base deleted file mode 100644 index 49968e8717ec8ad722da97b4437ed4bbd1c95588..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/af/af650cfc58edaabff409603d1e06039eaab69aeb.svn-base +++ /dev/null @@ -1,97 +0,0 @@ -############################################################################### -## Makefile ## -############################################################################### - -TARGET = A.OUT - -############################################################################### - -ifeq ($(COMPILER), icpc) - include $(HOME)/local/cpplapack/makefiles/Makefile.icpc -else - include $(HOME)/local/cpplapack/makefiles/Makefile.g++ -endif - -############################################################################### - -THIS_FILE:= $(firstword $(MAKEFILE_LIST)) -OPTIONS:= $(MAKEFLAGS) - -HEADERS:= $(shell find ./ -iname '*.hpp') -SOURCES:= $(shell find ./ -iname '*.cpp') -SOURCES:= $(sort $(SOURCES)) - -OBJECTS:= $(SOURCES:%.cpp=%.o) - -ifeq ($(OMP_NUM_THREADS),) - OMP_NUM_THREADS:= $(shell cat /proc/cpuinfo | grep processor | wc -l) -endif - -############################################################################### -############################################################################### -############################################################################### - -debug: depend - @echo -e "################################" - @echo -e "#### building in debug mode ####" - @echo -e "################################\n" - @$(MAKE) -j $(OMP_NUM_THREADS) -f $(THIS_FILE) --no-print-directory _build DEBUG=1 - @echo -e "#############################" - @echo -e "#### built in debug mode ####" - @echo -e "#############################\n" - -release: depend - @echo -e "##################################" - @echo -e "#### building in release mode ####" - @echo -e "##################################\n" - @$(MAKE) -j $(OMP_NUM_THREADS) -f $(THIS_FILE) --no-print-directory _build RELEASE=1 - @echo -e "###############################" - @echo -e "#### built in release mode ####" - @echo -e "###############################\n" - -profile: depend - @echo -e "##################################" - @echo -e "#### building in profile mode ####" - @echo -e "##################################\n" - @$(MAKE) -j $(OMP_NUM_THREADS) -f $(THIS_FILE) --no-print-directory _build PROFILE=1 - @echo -e "###############################" - @echo -e "#### built in profile mode ####" - @echo -e "###############################\n" - -verbose: depend - @echo -e "##################################" - @echo -e "#### building in verbose mode ####" - @echo -e "##################################\n" - @$(MAKE) -j $(OMP_NUM_THREADS) -f $(THIS_FILE) --no-print-directory _build DEBUG=1 VERBOSE=1 - @echo -e "###############################" - @echo -e "#### built in verbose mode ####" - @echo -e "###############################\n" - -############################################################################### - -.SUFFIXES: .cpp .o -.cpp.o: - $(CXX) -c $< $(FLAGS) $(CFLAGS) $(INCLUDE_DIRS) $(MACROS) -o $@ - @echo - -_build: $(OBJECTS) - $(CXX) $(OBJECTS) $(LIBS) $(FLAGS) $(LFLAGS) $(LIB_DIRS) -o $(TARGET) - @echo - -############################################################################### - -depend: - makedepend -f- -Y $(SOURCES) > Makefile.depend 2> /dev/null -# gccmakedep -- -I./ -MM -- $(SOURCES) -# $(CXX) -MM -I./ $(SOURCES) > Makefile.depend -# $(CXX) -MM $(INCLUDE_DIRS) $(SOURCES) > Makefile.depend - @echo - -clean: - rm -f $(OBJECTS) - -fullclean: - rm -f $(shell find -name '*.o') Makefile.depend std err *~ $(TARGET) - -############################################################################### --include Makefile.depend diff --git a/cpplapack-r198/.svn/pristine/af/af8a980d0e6a170afaef99e3b7d562d709b52804.svn-base b/cpplapack-r198/.svn/pristine/af/af8a980d0e6a170afaef99e3b7d562d709b52804.svn-base deleted file mode 100644 index e56f2eee349a9e8fd49191166edbc1e9e8d6d69f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/af/af8a980d0e6a170afaef99e3b7d562d709b52804.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(3), N(4); - - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - cout << "A =\n" << A << endl; - - cout << "#### t(A) ####" << endl; - cout << "t(A) =\n" << CPPL::t(A) << endl; - - cout << "#### i(A) ####" << endl; - A.resize(M); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - CPPL::zgematrix A_inv; - - A_inv = CPPL::i(A); - //A_inv =i(A); // g++ cannot compile this line - - cout << "A =\n" << A << endl; - cout << "A_inv =\n" << A_inv << endl; - cout << "A*A_inv =\n" << A*A_inv << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/af/afc9a304a0cc903d7664497576f0c58c2207a52f.svn-base b/cpplapack-r198/.svn/pristine/af/afc9a304a0cc903d7664497576f0c58c2207a52f.svn-base deleted file mode 100644 index ed291fbf67f52029e1171368dcd89975b44bd0e9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/af/afc9a304a0cc903d7664497576f0c58c2207a52f.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(5), CAP(4); - - CPPL::dssmatrix A(N,CAP); - A.put(0,0, 1.); - A.put(3,2, 2.); - A.put(1,2, 3.); - A.put(4,1, 4.); - cout << "A =\n" << A << endl; - A.checkup(); - - CPPL::drovector x(N); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - cout << "x =\n" << x << endl; - - cout << "x*A =\n" << x*A << endl; - - CPPL::dsymatrix B( A.to_dsymatrix() ); - cout << "B =\n" << B << endl; - cout << "x*B =\n" << x*B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/b0/b00c47a9a4d6c3abb380e471d397c522ba7f7ac2.svn-base b/cpplapack-r198/.svn/pristine/b0/b00c47a9a4d6c3abb380e471d397c522ba7f7ac2.svn-base deleted file mode 100644 index 7b7ef4761dbd2348643b9584a7b5673f7a858c6c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b0/b00c47a9a4d6c3abb380e471d397c522ba7f7ac2.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! cast to _zhsmatrix */ -inline _zhsmatrix _dssmatrix::to_zhsmatrix() const -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat(n,CPPL_INT(data.size())); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, comple(it->v,0.0)); - } - - destroy(); - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix _dssmatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat(m,n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - newmat(it->j, it->i) =it->v; - } - - destroy(); - return _(newmat); -} - -//============================================================================= -/*! convert to _dsymatrix */ -inline _dsymatrix _dssmatrix::to_dsymatrix() const -{CPPL_VERBOSE_REPORT; - dsymatrix newmat(n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - } - - destroy(); - return _(newmat); -} - -//============================================================================= -/*! convert to _dgsmatrix */ -inline _dgsmatrix _dssmatrix::to_dgsmatrix() const -{CPPL_VERBOSE_REPORT; - dgsmatrix newmat(m,n,CPPL_INT(data.size()*2)); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, it->v); - if(it->i!=it->j){ - newmat.put(it->j, it->i, it->v); - } - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b0/b01fa84fe02382cda2e2b418bb0feef00429ab08.svn-base b/cpplapack-r198/.svn/pristine/b0/b01fa84fe02382cda2e2b418bb0feef00429ab08.svn-base deleted file mode 100644 index 3d4d727919d999468cd696245c9756fb006b1db5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b0/b01fa84fe02382cda2e2b418bb0feef00429ab08.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -/*! _zhematrix+zgbmatrix operator */ -inline _zgematrix operator+(const _zhematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) += matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix-zgbmatrix operator */ -inline _zgematrix operator-(const _zhematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgematrix*zgbmatrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b0/b0e1b1267a1ea4877937f4aef09cef04018da578.svn-base b/cpplapack-r198/.svn/pristine/b0/b0e1b1267a1ea4877937f4aef09cef04018da578.svn-base deleted file mode 100644 index 2b02b6b6a6c7924dd406358a0f0271bc81fb4d67..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b0/b0e1b1267a1ea4877937f4aef09cef04018da578.svn-base +++ /dev/null @@ -1,62 +0,0 @@ -//============================================================================= -/*! _zcovector+_zcovector operator */ -inline _zcovector operator+(const _zcovector& vecA, const _zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] += vecB.array[i]; - } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _zcovector-_zcovector operator */ -inline _zcovector operator-(const _zcovector& vecA, const _zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i] -= vecB.array[i]; - } - - vecB.destroy(); - return vecA; -} - -//============================================================================= -/*! _zcovector^T*_zcovector operator (inner product) */ -inline comple operator%(const _zcovector& vecA, const _zcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - comple val =zdotu_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/b0/b0f6fbb1eb4bb7048f8154e320ae4b25d0566d50.svn-base b/cpplapack-r198/.svn/pristine/b0/b0f6fbb1eb4bb7048f8154e320ae4b25d0566d50.svn-base deleted file mode 100644 index f9c57d8a5f259d693d016de8f286a2b084fbae71..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b0/b0f6fbb1eb4bb7048f8154e320ae4b25d0566d50.svn-base +++ /dev/null @@ -1,277 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double dgsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const std::vector<CPPL_INT>::const_iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::const_iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){ return data[*p].v; } - } - - //// (i,j) component was not found //// - return 0.0; -} - -//============================================================================= -/*! operator() for const object */ -inline double& dgsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// search (i,j) component //////// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){ return data[*p].v; } - } - - //////// (i,j) component not found //////// - rows[i].push_back(CPPL_INT(data.size())); - cols[j].push_back(CPPL_INT(data.size())); - data.push_back(dcomponent(i,j,0.)); - return data.back().v; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! put value with volume cheack without isListed check */ -inline dgsmatrix& dgsmatrix::put(const CPPL_INT& i, const CPPL_INT& j, const double& v) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - if( it->i==i && it->j==j ){ - ERROR_REPORT; - std::cerr << "The required component is already listed." << std::endl - << "Your input was (" << i << "," << j << "," << v << ")." << std::endl; - exit(1); - } - } -#endif//CPPL_DEBUG - - //// push //// - rows[i].push_back(CPPL_INT(data.size())); - cols[j].push_back(CPPL_INT(data.size())); - data.push_back(dcomponent(i,j,v)); - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! delete the entry of a component */ -inline dgsmatrix& dgsmatrix::del(const CPPL_INT i, const CPPL_INT j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){//exists - //// save position //// - CPPL_INT c =*p; - CPPL_INT C =CPPL_INT(data.size()-1); - - //// data translation //// - data[c]=data.back(); - data.pop_back(); - - //// remove from List //// - rows[i].erase(p); - const std::vector<CPPL_INT>::iterator cols_j_end =cols[j].end(); - for(std::vector<CPPL_INT>::iterator q=cols[j].begin(); q!=cols_j_end; q++){ - if(*q==c){ cols[j].erase(q); break; } - } - - //// modify the entry of translated component //// - CPPL_INT I(data[c].i), J(data[c].j); - const std::vector<CPPL_INT>::iterator rows_I_end =rows[I].end(); - for(std::vector<CPPL_INT>::iterator q=rows[I].begin(); q!=rows_I_end; q++){ - if(*q==C){ *q=c; break; } - } - const std::vector<CPPL_INT>::iterator cols_J_end =cols[J].end(); - for(std::vector<CPPL_INT>::iterator q=cols[J].begin(); q!=cols_J_end; q++){ - if(*q==C){ *q=c; break; } - } - return *this; - } - } - -#ifdef CPPL_DEBUG - std::cerr << "# [NOTE]@dgsmatrix::del(CPPL_INT&, CPPL_INT&): The required component was not listed. Your input was (" << i << "," << j << ")." << std::endl; -#endif//CPPL_DEBUG - - return *this; -} - -//============================================================================= -/*! delete the entry of an element */ -inline dgsmatrix& dgsmatrix::del(const CPPL_INT c) -{CPPL_VERBOSE_REPORT; - if( c==CPPL_INT(data.size()-1) ){//if c is the last element - CPPL_INT i(data[c].i), j(data[c].j); - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator q=rows[i].begin(); q!=rows_i_end; q++){ - if(*q==c){ rows[i].erase(q); break; } - } - const std::vector<CPPL_INT>::iterator cols_j_end =cols[j].end(); - for(std::vector<CPPL_INT>::iterator q=cols[j].begin(); q!=cols_j_end; q++){ - if(*q==c){ cols[j].erase(q); break; } - } - data.pop_back(); - } - - else{//if c is NOT the last element - //// data translation //// - CPPL_INT C =CPPL_INT(data.size()-1); - CPPL_INT i(data[c].i), j(data[c].j), I(data.back().i), J(data.back().j); - data[c]=data.back(); - //// remove entry of component //// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator q=rows[i].begin(); q!=rows_i_end; q++){ - if(*q==c){ rows[i].erase(q); break; } - } - const std::vector<CPPL_INT>::iterator cols_j_end =cols[j].end(); - for(std::vector<CPPL_INT>::iterator q=cols[j].begin(); q!=cols_j_end; q++){ - if(*q==c){ cols[j].erase(q); break; } - } - //// modify the entry of translated component //// - const std::vector<CPPL_INT>::iterator rows_I_end =rows[I].end(); - for(std::vector<CPPL_INT>::iterator q=rows[I].begin(); q!=rows_I_end; q++){ - if(*q==C){ *q=c; break; } - } - const std::vector<CPPL_INT>::iterator cols_J_end =cols[J].end(); - for(std::vector<CPPL_INT>::iterator q=cols[J].begin(); q!=cols_J_end; q++){ - if(*q==C){ *q=c; break; } - } - //// pop_back //// - data.pop_back(); - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - const std::vector<CPPL_INT>::const_iterator mat_rows_i_end =mat.rows[i].end(); - for(CPPL_INT j=0; j<mat.n; j++){ - std::vector<CPPL_INT>::const_iterator q; - for(q=mat.rows[i].begin(); q!=mat_rows_i_end; q++){ - if(mat.data[*q].j==j){ break; } - } - if(q!=mat_rows_i_end){ s << " " << mat.data[*q].v; } - else{ s << " x"; } - } - s << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void dgsmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dgsmatrix " << m << " " << n << " " << data.size() << std::endl; - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void dgsmatrix::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - //////// id //////// - std::string id; - s >> id; - if( id != "dgsmatrix" && id != "#dgsmatrix" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not dgsmatrix." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - //////// m, n, size //////// - size_t size; - s >> m >> n >> size; - resize(m, n); - data.reserve(size);//NOT resize. - - //////// i, j, v //////// - CPPL_INT i, j; - double v; - for(size_t k=0; k<size; k++){ - s >> i >> j >> v; - put(i,j, v); - } - - //////// check //////// - s >> i; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << " ." << std::endl - << "Most likely, there are too many data components over the context." << std::endl; - exit(1); - } - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/b1/b1d21598d54d56badc64ca0188dfb786641e44dc.svn-base b/cpplapack-r198/.svn/pristine/b1/b1d21598d54d56badc64ca0188dfb786641e44dc.svn-base deleted file mode 100644 index 896739fe21e0f50d23dee288991f0e3f6eaaa37b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b1/b1d21598d54d56badc64ca0188dfb786641e44dc.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _dgematrix+_dgsmatrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - matA(it->i,it->j) += it->v; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix-_dgsmatrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matA.m*matA.n; i++){ - matA.array[i]=-matA.array[i]; - } - - //// add //// - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - matA(it->i,it->j) += it->v; - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix*_dgsmatrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b1/b1fafc3bc849a27c1c6c06de7fa37426b6c40c48.svn-base b/cpplapack-r198/.svn/pristine/b1/b1fafc3bc849a27c1c6c06de7fa37426b6c40c48.svn-base deleted file mode 100644 index 81188ed38bd4397708b700f2fdfe47901a497953..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b1/b1fafc3bc849a27c1c6c06de7fa37426b6c40c48.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _zgsmatrix::nullify() const -{CPPL_VERBOSE_REPORT; - m=0; - n=0; - data.clear(); - rows.clear(); - cols.clear(); -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _zgsmatrix::destroy() const -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/b2/b23ab873b060685e19bdeaa505772daba2ab9974.svn-base b/cpplapack-r198/.svn/pristine/b2/b23ab873b060685e19bdeaa505772daba2ab9974.svn-base deleted file mode 100644 index ca0732bd5ac9534a5351ef54be00c8b70020eeb1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b2/b23ab873b060685e19bdeaa505772daba2ab9974.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -//============================================================================= -/*! operator complex*zcovector_small */ -template<CPPL_INT l> -inline zcovector_small<l> operator*(const comple& v, const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - zcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =v*A(i); - } - return X; -} - -//============================================================================= -/*! operator complex*zrovector_small */ -template<CPPL_INT l> -inline zrovector_small<l> operator*(const comple& v, const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =v*A(i); - } - return X; -} - -//============================================================================= -/*! operator complex*zgematrix_small */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const comple& v, const zgematrix_small<m,n>& A) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> C; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - C(i,j) =v*A(i,j); - } - } - return C; -} - -//============================================================================= -/*! operator complex*zhematrix_small */ -template<CPPL_INT n> -inline zhematrix_small<n> operator*(const comple& v, const zhematrix_small<n>& A) -{CPPL_VERBOSE_REPORT; - zhematrix_small<n> X; - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ - X.array[k] =v*A.array[k]; - } - return X; -} diff --git a/cpplapack-r198/.svn/pristine/b2/b2af91ccba84cb79f10acfaf0f33212649a0a337.svn-base b/cpplapack-r198/.svn/pristine/b2/b2af91ccba84cb79f10acfaf0f33212649a0a337.svn-base deleted file mode 100644 index 0427ab885051333e806444bb503199d52d9766dc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b2/b2af91ccba84cb79f10acfaf0f33212649a0a337.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -//============================================================================= -/*! zrovector*=double operator */ -inline zrovector& zrovector::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zdscal_(&l, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zrovector/=double operator */ -inline zrovector& zrovector::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&l, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector*double operator */ -inline _zrovector operator*(const zrovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]*d; - } - - return _(newvec); -} - -//============================================================================= -/*! zrovector/double operator */ -inline _zrovector operator/(const zrovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =vec.array[i]/d; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/b2/b2c7ef243ba7cd406ef7a53584826021d8c7d0cb.svn-base b/cpplapack-r198/.svn/pristine/b2/b2c7ef243ba7cd406ef7a53584826021d8c7d0cb.svn-base deleted file mode 100644 index 05b17e4027b4f337b9f380a52fcf029f44c80872..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b2/b2c7ef243ba7cd406ef7a53584826021d8c7d0cb.svn-base +++ /dev/null @@ -1,58 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - //// make dgematrix A //// - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - //// print A in two ways //// - cout << "A =\n" << A << endl; - for(int i=0; i<A.n; i++){ for(int j=0; j<=i; j++){ - cout << "A(" << i << "," << j << ") =" << A(i,j) << endl; - }} - - for(int i=0; i<A.n; i++){ - for(int j=0; j<A.n; j++){ - cout << A.array[i+A.n*j] << ' '; - } - cout << endl; - } - - //// make A 10 times //// - cout << "#### A*=10.; ####" << endl; - A*=10.; - - //// make zgematrix B //// - CPPL::zhematrix B(A); - cout << "B =\n" << B << endl; - for(int i=0; i<B.n; i++){ for(int j=0; j<=i; j++){ - cout << "B(" << i << "," << j << ") =" << B(i,j) << endl; - }} - - //// print A+B //// - cout << "A+B=\n" << A+B << endl; - - //// write/read //// - B.write( "tmp.txt" ); - CPPL::zhematrix C; - C.read( "tmp.txt" ); - cout << "C-B =\n" << C-B << "<-Should be zero." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/b2/b2e0b9660a6a3be26b9e2e6302c80a893fa12f1e.svn-base b/cpplapack-r198/.svn/pristine/b2/b2e0b9660a6a3be26b9e2e6302c80a893fa12f1e.svn-base deleted file mode 100644 index fcc7dff288b0357e2de546868f593a0930c01934..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b2/b2e0b9660a6a3be26b9e2e6302c80a893fa12f1e.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! dgematrix+_dgsmatrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgematrix-_dgsmatrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgematrix*_dgsmatrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b2/b2f0948d36ffef90aa4b25ac353ae6533c6e19e5.svn-base b/cpplapack-r198/.svn/pristine/b2/b2f0948d36ffef90aa4b25ac353ae6533c6e19e5.svn-base deleted file mode 100644 index c2a9bb44244e035b49c6e8d4c834cc1f5f4fbba2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b2/b2f0948d36ffef90aa4b25ac353ae6533c6e19e5.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+_dgbmatrix operator */ -/* -inline _dgematrix operator+(const _dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix-_dgbmatrix operator */ -/* -inline _dgematrix operator-(const _dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix*_dgbmatrix operator */ -/* -inline _dgematrix operator*(const _dgsmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT k=max(0,matA.jndx[c]-matB.ku); - k<min(matB.m,matA.jndx[c]+matB.kl+1); k++){ - newmat(matA.indx[c],k) += matA.array[c]*matB(matA.jndx[c],k); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/b3/b30ca5a4e6bd56d1357b54d00164375864146fb3.svn-base b/cpplapack-r198/.svn/pristine/b3/b30ca5a4e6bd56d1357b54d00164375864146fb3.svn-base deleted file mode 100644 index e3ce861d9548e3081199a1c00854a4f7b10e0105..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b3/b30ca5a4e6bd56d1357b54d00164375864146fb3.svn-base +++ /dev/null @@ -1,75 +0,0 @@ -//============================================================================= -//! Real Double-precision General Compressed Sparse Row (CSR) Matrix Class -class dgrmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT m; //!< matrix row size - CPPL_INT n; //!< matrix column size - std::vector<double> a; //!< matrix component values - std::vector<CPPL_INT> ia; //!< rowIndex (NOT zero-based BUT one-based indexing) - std::vector<CPPL_INT> ja; //!< columns (NOT zero-based BUT one-based indexing) - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dgrmatrix(); - inline dgrmatrix(const CPPL_INT&, const CPPL_INT&); - inline dgrmatrix(const dgrmatrix&); - inline dgrmatrix(const char*); - inline ~dgrmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - //inline _zgsmatrix to_zgsmatrix() const; - inline _dgematrix to_dgematrix() const; - - //////// io //////// - inline double operator()(const CPPL_INT&, const CPPL_INT&) const; - inline double& operator()(const CPPL_INT&, const CPPL_INT&); - inline friend std::ostream& operator<<(std::ostream&, const dgrmatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline dgrmatrix& zero(); - inline void copy(const dgrmatrix&); - inline bool isListed(const CPPL_INT&, const CPPL_INT&) const; - inline void checkup(); - //inline _drovector row(const CPPL_INT&) const; - //inline _dcovector col(const CPPL_INT&) const; - inline friend void swap(dgrmatrix&, dgrmatrix&); - - //////// calc //////// - //inline friend void idamax(CPPL_INT&, CPPL_INT&, const dgrmatrix&); - inline friend double damax(const dgrmatrix&); - - //////// MKL //////// - inline CPPL_INT pardiso(dcovector&) const; - inline CPPL_INT dfgmres(dcovector&, const double) const; - inline CPPL_INT ilut_dfgmres(dcovector&, const int, const double) const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline dgrmatrix& operator=(const dgrmatrix&); - - //////// ?= //////// - inline dgrmatrix& operator*=(const double&); - inline dgrmatrix& operator/=(const double&); - - //////// * //////// - inline friend dgrmatrix operator*(const dgrmatrix&, const double&); - inline friend dgrmatrix operator*(const double&, const dgrmatrix&); - inline friend _dcovector operator*(const dgrmatrix&, const dcovector&); - inline friend _dcovector operator*(const dgrmatrix&, const _dcovector&); - - //////// / //////// - inline friend dgrmatrix operator/(const dgrmatrix&, const double&); -}; diff --git a/cpplapack-r198/.svn/pristine/b3/b3428206837ad63eb020086926ca24fa930b650a.svn-base b/cpplapack-r198/.svn/pristine/b3/b3428206837ad63eb020086926ca24fa930b650a.svn-base deleted file mode 100644 index 1ce30d822088527140657cbf58128ca03f9876ec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b3/b3428206837ad63eb020086926ca24fa930b650a.svn-base +++ /dev/null @@ -1,81 +0,0 @@ -//============================================================================= -/*! dssmatrix+_dgbmatrix operator */ -/* -inline _dgematrix operator+(const dssmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! dssmatrix-_dgbmatrix operator */ -/* -inline _dgematrix operator-(const dssmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ - -//============================================================================= -/*! dssmatrix*_dgbmatrix operator */ -/* -inline _dgematrix operator*(const dssmatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT j=max(0,matA.jndx[c]-matB.kl); - j<min(matB.n,matA.jndx[c]+matB.ku+1); j++){ - newmat(matA.indx[c],j) += matA.array[c]*matB(matA.jndx[c],j); - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/b3/b3c37fee1f1684102a34700f334f2d12fd7bf9a4.svn-base b/cpplapack-r198/.svn/pristine/b3/b3c37fee1f1684102a34700f334f2d12fd7bf9a4.svn-base deleted file mode 100644 index c6bd9abc60780defddfd3e4ef532b99c7e6712e3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b3/b3c37fee1f1684102a34700f334f2d12fd7bf9a4.svn-base +++ /dev/null @@ -1,130 +0,0 @@ -//============================================================================= -/*! dsymatrix constructor without arguments */ -inline dsymatrix::dsymatrix() - : m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n = 0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! dsymatrix copy constructor */ -inline dsymatrix::dsymatrix(const dsymatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =mat.n; - array =new double[n*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } - - //////// copy //////// - CPPL_INT size =n*n; - CPPL_INT inc =1; - dcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! dsymatrix constructor to cast _dsymatrix */ -inline dsymatrix::dsymatrix(const _dsymatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! dsymatrix copy constructor to cast dssmatrix */ -/* -inline dsymatrix::dsymatrix(const dssmatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =mat.n; - array =new double[n*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ darray[i] =&array[i*n]; } - - //////// copy //////// - zero(); - for(int c=0; c<mat.vol; c++){ - (*this)(mat.indx[c],mat.jndx[c]) =mat.array[c]; - } -} -*/ - -//============================================================================= -/*! dsymatrix constructor to cast _dssmatrix */ -/* -inline dsymatrix::dsymatrix(const _dssmatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - n =mat.n; - array =new double[n*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ darray[i] =&array[i*n]; } - - //////// copy //////// - zero(); - for(int c=0; c<mat.vol; c++){ - (*this)(mat.indx[c],mat.jndx[c]) =mat.array[c]; - } - - mat.nullify(); -} -*/ - - -//============================================================================= -/*! dsymatrix constructor with size specification */ -inline dsymatrix::dsymatrix(const CPPL_INT& _n) - : m(n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers. " << std::endl - << "Your input was (" << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - n =_n; - array =new double[n*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } -} - -//============================================================================= -/*! dsymatrix constructor with filename */ -inline dsymatrix::dsymatrix(const char* filename) - : m(n) -{CPPL_VERBOSE_REPORT; - array =NULL; - darray =NULL; - - //// copy //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dsymatrix destructor */ -inline dsymatrix::~dsymatrix() -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/b4/b43ecd04adcd9383bfc29e65ff2499574f913f6d.svn-base b/cpplapack-r198/.svn/pristine/b4/b43ecd04adcd9383bfc29e65ff2499574f913f6d.svn-base deleted file mode 100644 index 21b5d5e00d287e8352eb5bda6dbbb931c2e0c33a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b4/b43ecd04adcd9383bfc29e65ff2499574f913f6d.svn-base +++ /dev/null @@ -1,59 +0,0 @@ -//============================================================================= -/*! operator() for object */ -inline comple& _zgematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is (" << m << "," << n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[i+m*j]; - return darray[j][i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - s << " " << mat(i,j); - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _zgematrix::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zgematrix" << " " << m << " " << n << std::endl; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/b5/b50adaff4bea05dcc383a7e928d8bd0ceea18883.svn-base b/cpplapack-r198/.svn/pristine/b5/b50adaff4bea05dcc383a7e928d8bd0ceea18883.svn-base deleted file mode 100644 index b9795ae0bf1583a4d1bef9a26c0c9ac9f6ef8295..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b5/b50adaff4bea05dcc383a7e928d8bd0ceea18883.svn-base +++ /dev/null @@ -1,154 +0,0 @@ -//============================================================================= -/*! zgematrix+=zgbmatrix operator */ -inline zgematrix& zgematrix::operator+=(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) += mat(i,j); - } - } - - return *this; -} - -//============================================================================= -/*! zgematrix-=zgbmatrix operator */ -inline zgematrix& zgematrix::operator-=(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - return *this; -} -//============================================================================= -/*! zgematrix*=zgbmatrix operator */ -inline zgematrix& zgematrix::operator*=(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - zgematrix newmat(m,mat.n); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(mat.m,j+mat.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-mat.ku); k<kmax; k++){ - newmat(i,j) += operator()(i,k)*mat(k,j); - } - } - } - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+zgbmatrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) += matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix-zgbmatrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix*zgbmatrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b5/b53016b6c694a0d78b48042c77f42cd124e5e87b.svn-base b/cpplapack-r198/.svn/pristine/b5/b53016b6c694a0d78b48042c77f42cd124e5e87b.svn-base deleted file mode 100644 index bf2a4e417b6844429bd3d30073b1080a28b1893a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b5/b53016b6c694a0d78b48042c77f42cd124e5e87b.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! convert to _zgematrix */ -inline _zgematrix zgsmatrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat( zgematrix(m,n).zero() ); - - const size_t data_size =data.size(); - for(size_t c=0; c<data_size; c++){ - const zcomponent& z =data[c]; - newmat(z.i,z.j) =z.v; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b6/b6451f6ccc308d0d0fc331749d770c5cf94c6d01.svn-base b/cpplapack-r198/.svn/pristine/b6/b6451f6ccc308d0d0fc331749d770c5cf94c6d01.svn-base deleted file mode 100644 index daf064c28a5d12a3e16b0c3aeda69e319c9edd27..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b6/b6451f6ccc308d0d0fc331749d770c5cf94c6d01.svn-base +++ /dev/null @@ -1,111 +0,0 @@ -//============================================================================= -void zheev_check_value() -{ - cout << "############ check zheev value ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make zhematrix A //// - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - //// make w //// - vector<double> w; - - //// make A_original //// - CPPL::zhematrix A_original(A); - - //// zheev //// - A.zheev(w); - //A.zheev(w,1); - - //// print //// - cout << "A=\n" << A << endl; - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<N; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - } -} - -//============================================================================= -void zheev_check_right() -{ - cout << "############ check zheev right ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make zhematrix A //// - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - //// make wr wi vr //// - vector<double> w; - vector<CPPL::zcovector> v; - - //// make A_original //// - CPPL::zhematrix A_original(A); - - //// zheev //// - A.zheev(w,v); - - //// print //// - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<A.n; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w=" << w[i] <<endl; - cout << "v=\n" << v[i] <<endl; - cout << "[A]*{x} -lambda*{x} = (Should be zeros)\n" - << A_original*v[i] -w[i]*v[i] << endl; - } -} - -//============================================================================= -void zheev_check_left() -{ - cout << "############ check zheev left ############" << endl; - - srand(unsigned(time(NULL))); - int N(3); - - //// make zhematrix A //// - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - //// make wr wi vl //// - vector<double> w; - vector<CPPL::zrovector> v; - - //// make A_original //// - CPPL::zhematrix A_original(A); - - //// zheev //// - A.zheev(w, v); - - //// print //// - cout << "A_original=\n" << A_original << endl; - for(int i=0; i<A.n; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "w = " << w[i] << endl; - cout << "v = " << v[i] << endl; - cout << "{x}*[A] -{x}*lambda = (Should be zeros)\n" - << v[i]*A_original -v[i]*w[i] << endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/b6/b6f7a6bc1cdccda82dfa65a4f1e3f89e5fc62b2a.svn-base b/cpplapack-r198/.svn/pristine/b6/b6f7a6bc1cdccda82dfa65a4f1e3f89e5fc62b2a.svn-base deleted file mode 100644 index 24b69a3b1916e0076df592ff659940d217935fa6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b6/b6f7a6bc1cdccda82dfa65a4f1e3f89e5fc62b2a.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! _zgsmatrix constructor without arguments */ -inline _zgsmatrix::_zgsmatrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - data.clear(); - rows.clear(); - cols.clear(); -} - -//============================================================================= -/*! _zgsmatrix copy constructor */ -inline _zgsmatrix::_zgsmatrix(const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =mat.m; - n =mat.n; - data.swap(mat.data); - rows.swap(mat.rows); - cols.swap(mat.cols); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _zgsmatrix destructor */ -inline _zgsmatrix::~_zgsmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/b7/b72576b8ec244eb1a8f9edd59b4b458275810316.svn-base b/cpplapack-r198/.svn/pristine/b7/b72576b8ec244eb1a8f9edd59b4b458275810316.svn-base deleted file mode 100644 index 5e82bb4397a3c977e39fc8bde44d92f0bd706f3c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b7/b72576b8ec244eb1a8f9edd59b4b458275810316.svn-base +++ /dev/null @@ -1,59 +0,0 @@ -//============================================================================= -/*! operator() for object */ -inline double& _dgematrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //double val(array[i+m*j]); - return darray[j][i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - s << " " << mat(i,j); - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _dgematrix::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dgematrix" << " " << m << " " << n << std::endl; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++ ){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/b7/b737cf379e1a32026ce444a97403ee6552ece677.svn-base b/cpplapack-r198/.svn/pristine/b7/b737cf379e1a32026ce444a97403ee6552ece677.svn-base deleted file mode 100644 index 400b132532ab556fea5e49b07023541ec9646058..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b7/b737cf379e1a32026ce444a97403ee6552ece677.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! dgematrix_small constructor */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>::dgematrix_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! dgematrix_small constructor */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>::dgematrix_small(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( m!=mat.m || n!=mat.n ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be the same." << std::endl - << "Your input was " << m << "x" << n << " and " << mat.m << "x" << mat.n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<m*n; k++){ - array[k] =mat.array[k]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix_small destructor */ -template<CPPL_INT m, CPPL_INT n> -inline dgematrix_small<m,n>::~dgematrix_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/b7/b73ea7d94fa60e35ba86b576f07c01358657789a.svn-base b/cpplapack-r198/.svn/pristine/b7/b73ea7d94fa60e35ba86b576f07c01358657789a.svn-base deleted file mode 100644 index cfdef2c2657810ee256b63dfbd61dba324e1f50b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b7/b73ea7d94fa60e35ba86b576f07c01358657789a.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! double*dsymatrix operator */ -inline _dsymatrix operator*(const double& d, const dsymatrix& mat) -{CPPL_VERBOSE_REPORT; - dsymatrix newmat(mat.n); - - for(CPPL_INT j=0; j<mat.n; j++){ - for(CPPL_INT i=j; i<mat.n; i++){ - newmat.darray[j][i] =d*mat.darray[j][i]; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b7/b79cf0dcc5af9e54b7567b8929935b8765b89f40.svn-base b/cpplapack-r198/.svn/pristine/b7/b79cf0dcc5af9e54b7567b8929935b8765b89f40.svn-base deleted file mode 100644 index 8863095c11212357a86dfa68f4140d796a484e27..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b7/b79cf0dcc5af9e54b7567b8929935b8765b89f40.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! _drovector*_dgbmatrix operator */ -inline _drovector operator*(const _drovector& vec, const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/b7/b7a5cca42710b9b541bf6a91baf48694ef729abc.svn-base b/cpplapack-r198/.svn/pristine/b7/b7a5cca42710b9b541bf6a91baf48694ef729abc.svn-base deleted file mode 100644 index ee127494062cda128eff7477d98364b41c950eb1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b7/b7a5cca42710b9b541bf6a91baf48694ef729abc.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! _zcovector*_zrovector operator */ -inline _zgematrix operator*(const _zcovector& covec, const _zrovector& rovec) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(covec.l, rovec.l); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - } - } - - covec.destroy(); - rovec.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b8/b8e758bd222b770dac6740c80d7ce374f82c0f79.svn-base b/cpplapack-r198/.svn/pristine/b8/b8e758bd222b770dac6740c80d7ce374f82c0f79.svn-base deleted file mode 100644 index 2ae75e0616b579789a299ed91f1c111341d677a9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b8/b8e758bd222b770dac6740c80d7ce374f82c0f79.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _zgematrix*zcovector operator */ -inline _zcovector operator*(const _zgematrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/b8/b8fc0131c15785bdd788231c2b330f91757a9caa.svn-base b/cpplapack-r198/.svn/pristine/b8/b8fc0131c15785bdd788231c2b330f91757a9caa.svn-base deleted file mode 100644 index 6833faaf9a73be671e33793348f14b57d6f3c025..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b8/b8fc0131c15785bdd788231c2b330f91757a9caa.svn-base +++ /dev/null @@ -1,47 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(4), KL(2), KU(1); - - CPPL::zgbmatrix A(M,N,KL,KU), B; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - if(!( i-j>A.kl || j-i>A.ku )){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - }} - - cout << "A =\n" << A << endl; - cout << "#### B.copy(A) ####" << endl; - B.copy(A); - cout << "B =\n" << B << endl; - - cout << "#### B.clear() ####" << endl; - B.clear(); - cout << "B =\n" << B << endl; - - cout << "#### B.resize(4,4,1,2) & B.zero() ####" << endl; - B.resize(4,4,1,2); - B.zero(); - cout << "B =\n" << B << endl; - - cout << "#### B.identity() ####" << endl; - B.identity(); - cout << "B =\n" << B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/b9/b90ca4222c7b834a7f0e371328c7e791989d5b49.svn-base b/cpplapack-r198/.svn/pristine/b9/b90ca4222c7b834a7f0e371328c7e791989d5b49.svn-base deleted file mode 100644 index c9f4b4dde14a4b1d61e1060f80793771ac2299ae..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b9/b90ca4222c7b834a7f0e371328c7e791989d5b49.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! zrovector*zcovector operator */ -inline comple operator*(const zrovector& rovec, const zcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - - comple val =zdotu_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - return val; -} diff --git a/cpplapack-r198/.svn/pristine/b9/b9194e75c927b98edd7ed22882110ef366894d2b.svn-base b/cpplapack-r198/.svn/pristine/b9/b9194e75c927b98edd7ed22882110ef366894d2b.svn-base deleted file mode 100644 index 6773cd92d10806538dfcdbb84e080c75d4a55f75..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b9/b9194e75c927b98edd7ed22882110ef366894d2b.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+_dgematrix operator */ -inline _dgematrix operator+(const _dgsmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _dgsmatrix-_dgematrix operator */ -inline _dgematrix operator-(const _dgsmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(int i=0; i<matB.m*matB.n; i++){ - matB.array[i] = -matB.array[i]; - } - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _dgsmatrix*_dgematrix operator */ -inline _dgematrix operator*(const _dgsmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v *matB(it->j,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b9/b97662ceb815705a4734e0f0100b0393d951a56a.svn-base b/cpplapack-r198/.svn/pristine/b9/b97662ceb815705a4734e0f0100b0393d951a56a.svn-base deleted file mode 100644 index 0818b1de588664fc854861f5ae2d4b9c09adf74c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b9/b97662ceb815705a4734e0f0100b0393d951a56a.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! dgsmatrix+_dgematrix operator */ -inline _dgematrix operator+(const dgsmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - return matB; -} - -//============================================================================= -/*! dgsmatrix-_dgematrix operator */ -inline _dgematrix operator-(const dgsmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matB.m*matB.n; i++){ - matB.array[i]=-matB.array[i]; - } - - //// add //// - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - return matB; -} - -//============================================================================= -/*! dgsmatrix*_dgematrix operator */ -inline _dgematrix operator*(const dgsmatrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v *matB(it->j,j); - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/b9/b9940976dcb0c857945adbc488b901a82cf0db99.svn-base b/cpplapack-r198/.svn/pristine/b9/b9940976dcb0c857945adbc488b901a82cf0db99.svn-base deleted file mode 100644 index 912f6e9f305e3e8f3addc6b370c905fd1ae2ce1a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/b9/b9940976dcb0c857945adbc488b901a82cf0db99.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! _drovector*double operator */ -inline _drovector operator*(const _drovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - dscal_(&vec.l, &d, vec.array, &inc); - return vec; -} - -//============================================================================= -/*! _drovector/double operator */ -inline _drovector operator/(const _drovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - double dinv =1./d; - CPPL_INT inc =1; - dscal_(&vec.l, &dinv, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/ba/ba02b9316f36636681682a581ef8cae6fdc44be2.svn-base b/cpplapack-r198/.svn/pristine/ba/ba02b9316f36636681682a581ef8cae6fdc44be2.svn-base deleted file mode 100644 index c1987fe2145ff527e7eb7884043c459d62b6ffa6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ba/ba02b9316f36636681682a581ef8cae6fdc44be2.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _zhematrix*double operator */ -inline _zhematrix operator*(const _zhematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.n*mat.n; - CPPL_INT inc =1; - zdscal_(&size, &d, mat.array, &inc); - return mat; -} - -//============================================================================= -/*! _zhematrix/double operator */ -inline _zhematrix operator/(const _zhematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.n*mat.n; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&size, &dinv, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/ba/ba3a7fd79484776b67b9c816c78560987803da0b.svn-base b/cpplapack-r198/.svn/pristine/ba/ba3a7fd79484776b67b9c816c78560987803da0b.svn-base deleted file mode 100644 index fcf8becbc5bd156127ff43dc3324a59b8c226b87..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ba/ba3a7fd79484776b67b9c816c78560987803da0b.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+dgbmatrix operator */ -inline _dgematrix operator+(const _dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix-dgbmatrix operator */ -inline _dgematrix operator-(const _dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix*dgbmatrix operator */ -inline _dgematrix operator*(const _dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ba/ba6a00c0a1272bc2aa6e0dcdb182f9a348e4b70e.svn-base b/cpplapack-r198/.svn/pristine/ba/ba6a00c0a1272bc2aa6e0dcdb182f9a348e4b70e.svn-base deleted file mode 100644 index a7b2137cc3418c0d011129b6c1e09f8644062021..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ba/ba6a00c0a1272bc2aa6e0dcdb182f9a348e4b70e.svn-base +++ /dev/null @@ -1,54 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), K(2); - - CPPL::dgematrix A(M,K), B(K,N), C; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - B(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - - cout << "A+A =\n" << A+A << endl; - cout << "A-A =\n" << A-A << endl; - cout << "A*B =\n" << A*B << endl; - - cout << "#### C=A; ####" << endl; - C=A; - cout << "C =\n" << C << endl; - cout << "#### C+=A; ####" << endl; - C+=A; - cout << "C =\n" << C << endl; - cout << "#### C-=A; ####" << endl; - C-=A; - cout << "C =\n" << C << endl; - cout << "#### C*=B; ####" << endl; - C*=B; - cout << "C =\n" << C << endl; - cout << "#### C=A+A; ####" << endl; - C=A+A; - cout << "C =\n" << C << endl; - - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/ba/baff396424fc3154242cef41d84ccdad6f7f63ab.svn-base b/cpplapack-r198/.svn/pristine/ba/baff396424fc3154242cef41d84ccdad6f7f63ab.svn-base deleted file mode 100644 index 038531f30c9618f7433d192a4580621a2985a293..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ba/baff396424fc3154242cef41d84ccdad6f7f63ab.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(5); - - CPPL::dssmatrix A(N); - A(0,0)=1; - A(2,3)=2; - A(1,2)=3; - A(4,1)=4; - //A(3,2)+=0.1; - - std::cout << "A =\n" << A << std::endl; - std::cout << "A(1,1)=" << A(1,1) << std::endl; - for(std::vector<CPPL::dcomponent>::const_iterator it=A.data.begin(); it!=A.data.end(); it++){ - std::cout << "A(" << it->i << "," << it->j << ") =" << it->v << std::endl; - } - A.checkup(); - - A.put(3,4, 3.4); - A.del(1,4); - A.del(0); - std::cout << "A =\n" << A << std::endl; - - const CPPL::dssmatrix B(A); - //// write/read //// - B.write( "tmp.txt" ); - - CPPL::dssmatrix C; - C.read( "tmp.txt" ); - std::cout << "C-B =\n" << C-B << "<-Should be zero." << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/bc/bcd19fab479731e8b9adab8369818f8aa10075e6.svn-base b/cpplapack-r198/.svn/pristine/bc/bcd19fab479731e8b9adab8369818f8aa10075e6.svn-base deleted file mode 100644 index 8c5b9f281645e2aced18b44a48d4e47d86449853..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bc/bcd19fab479731e8b9adab8369818f8aa10075e6.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*dssmatrix operator */ -inline _dssmatrix operator*(const double& d, const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - dssmatrix newmat =mat; - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *=d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/bd/bd2518e98964e210354944a2e6abd7c775139c9f.svn-base b/cpplapack-r198/.svn/pristine/bd/bd2518e98964e210354944a2e6abd7c775139c9f.svn-base deleted file mode 100644 index aa5f85e5e7c41972cc079430a2f6122b58979b9c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bd/bd2518e98964e210354944a2e6abd7c775139c9f.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _dsymatrix*dcovector operator */ -inline _dcovector operator*(const _dsymatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/bd/bd4184a9f385cf061685eeabeb38a375875eb3a2.svn-base b/cpplapack-r198/.svn/pristine/bd/bd4184a9f385cf061685eeabeb38a375875eb3a2.svn-base deleted file mode 100644 index 9238078aebe7712dcd3193eecbd3def9aa1d1031..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bd/bd4184a9f385cf061685eeabeb38a375875eb3a2.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! drovector*_dcovector operator */ -inline double operator*(const drovector& rovec, const _dcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - covec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/bd/bd4bc55815e8d68b8ad7cdbe632a9fcc6384a923.svn-base b/cpplapack-r198/.svn/pristine/bd/bd4bc55815e8d68b8ad7cdbe632a9fcc6384a923.svn-base deleted file mode 100644 index af2eaf5ee9bf06e8a7dab225d2b8985c0d74b76d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bd/bd4bc55815e8d68b8ad7cdbe632a9fcc6384a923.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+zhematrix operator */ -inline _zgematrix operator+(const _zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matB.to_zgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix-zgematrix operator */ -inline _zgematrix operator-(const _zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( (-matB).to_zgematrix() ); - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgbmatrix*zgematrix operator */ -inline _zgematrix operator*(const _zgbmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/bd/bd667d3adcccbbd5a66993cca36a2297b6badfe2.svn-base b/cpplapack-r198/.svn/pristine/bd/bd667d3adcccbbd5a66993cca36a2297b6badfe2.svn-base deleted file mode 100644 index f46edeadc59f2741a6b3846b0899b8dd968c467e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bd/bd667d3adcccbbd5a66993cca36a2297b6badfe2.svn-base +++ /dev/null @@ -1,60 +0,0 @@ -//============================================================================= -/*! _drovector+drovector operator */ -inline _drovector operator+(const _drovector& vecA, const drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i]+=vecB.array[i]; - } - - return vecA; -} - -//============================================================================= -/*! drovector-drovector operator */ -inline _drovector operator-(const _drovector& vecA, const drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecA.array[i]-=vecB.array[i]; - } - - return vecA; -} - -//============================================================================= -/*! drovector^T*drovector operator (inner product) */ -inline double operator%(const _drovector& vecA, const drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/bd/bd8f1cf3c1646d5b528660afaefff53c4d10d41e.svn-base b/cpplapack-r198/.svn/pristine/bd/bd8f1cf3c1646d5b528660afaefff53c4d10d41e.svn-base deleted file mode 100644 index ddbd259efaf84abdf2cb3810d2ad9a9e00d091dd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bd/bd8f1cf3c1646d5b528660afaefff53c4d10d41e.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - CPPL::zcovector x(L), y; - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "x =\n" << x << endl; - cout << "#### y.copy(x) ####" << endl; - y.copy(x); - cout << "y =\n" << y << endl; - - cout << "#### y.clear() ####" << endl; - y.clear(); - cout << "y =\n" << y << endl; - - cout << "#### y.resize(2) & y.zero() ####" << endl; - y.resize(2); - y.zero(); - cout << "y =\n" << y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/bd/bdade9897b41384b8b4822b3c269914a7e2fcdb4.svn-base b/cpplapack-r198/.svn/pristine/bd/bdade9897b41384b8b4822b3c269914a7e2fcdb4.svn-base deleted file mode 100644 index a09f423f80784ffb7eb47a3c29c53cd387fd64b5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bd/bdade9897b41384b8b4822b3c269914a7e2fcdb4.svn-base +++ /dev/null @@ -1,152 +0,0 @@ -//============================================================================= -/*! clear vector */ -inline void drovector::clear() -{CPPL_VERBOSE_REPORT; - l =0; - cap =0; - delete [] array; - array =NULL; -} - -//============================================================================= -/*! make vector into zero vector */ -inline drovector& drovector::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ array[i] =0.0; } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the vector */ -inline void drovector::chsign() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ array[i] =-array[i]; } -} - -//============================================================================= -/*! make a deep copy of the drovector */ -inline void drovector::copy(const drovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - delete [] array; - array =new double[vec.cap]; - CPPL_INT inc =1; - dcopy_(&vec.l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the vector\n - This function is not desinged to be used in project codes. */ -inline void drovector::shallow_copy(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - delete [] array; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! make an alias of the vector\n - Be carefull to use this function not to cause double free. */ -inline void drovector::alias(const drovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - delete [] array; - array =vec.array; -} - -//============================================================================= -/*! unalias the vector */ -inline void drovector::unalias() -{CPPL_VERBOSE_REPORT; - l =0; - cap =0; - array =NULL; -} - -//============================================================================= -/*! resize vector */ -inline drovector& drovector::resize(const CPPL_INT& _l, const CPPL_INT margin) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 || margin<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers." << std::endl - << "Your input was (" << _l << ", " << margin << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - l =_l; - cap =l+margin; - delete [] array; - array =new double[cap]; - - return *this; -} - -//============================================================================= -/*! stretch or shrink vector */ -inline void drovector::stretch(const CPPL_INT& dl) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l+dl<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers." << std::endl - << "Your input was (" << dl << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// zero //////// - if(dl==0){ return; } - - //////// non-zero //////// - l +=dl; - - if(l>cap){ - while(l>cap){ - cap++; - cap*=2; - } - CPPL_INT newl =l-dl; - CPPL_INT inc =1; - double* newArray(new double[cap]); - dcopy_(&newl, array, &inc, newArray, &inc); - delete [] array; - array =newArray; - } -} - -//============================================================================= -/*! swap two vectors */ -inline void swap(drovector& u, drovector& v) -{CPPL_VERBOSE_REPORT; - CPPL_INT u_cap(u.cap), u_l(u.l); - double* u_array(u.array); - u.l=v.l; u.cap=v.cap; u.array=v.array; - v.l=u_l; v.cap=u_cap; v.array=u_array; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _drovector _(drovector& vec) -{CPPL_VERBOSE_REPORT; - _drovector newvec; - - //////// shallow copy //////// - newvec.l =vec.l; - newvec.cap =vec.cap; - newvec.array =vec.array; - - //////// nullify //////// - vec.l =0; - vec.cap =0; - vec.array =NULL; - - return newvec; -} diff --git a/cpplapack-r198/.svn/pristine/be/be5fc4c32c82ac945aa39ebddc58ec29b3db62bd.svn-base b/cpplapack-r198/.svn/pristine/be/be5fc4c32c82ac945aa39ebddc58ec29b3db62bd.svn-base deleted file mode 100644 index 4433867a33ece12abf93f7b71743cb09ae157bdd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/be/be5fc4c32c82ac945aa39ebddc58ec29b3db62bd.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+zgematrix operator */ -inline _zgematrix operator+(const _zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix-zgematrix operator */ -inline _zgematrix operator-(const _zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zgsmatrix*zgematrix operator */ -inline _zgematrix operator*(const _zgsmatrix& matA, const zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/be/bef73c8c5cb547f36777941e08521b9b5c2e6eb4.svn-base b/cpplapack-r198/.svn/pristine/be/bef73c8c5cb547f36777941e08521b9b5c2e6eb4.svn-base deleted file mode 100644 index 39fac0cb7b88d6e1251800ef2c75da6218146d2a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/be/bef73c8c5cb547f36777941e08521b9b5c2e6eb4.svn-base +++ /dev/null @@ -1,21 +0,0 @@ -//============================================================================= -/*! _zrovector*_zcovector operator */ -inline comple operator*(const _zrovector& rovec, const _zcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - - comple val =zdotu_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - rovec.destroy(); - covec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/bf/bf2bd2444e18436454a06afe639b1abd8a8f66cf.svn-base b/cpplapack-r198/.svn/pristine/bf/bf2bd2444e18436454a06afe639b1abd8a8f66cf.svn-base deleted file mode 100644 index bc5bced5e5b7662a0750387ea2e25be3f789834a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bf/bf2bd2444e18436454a06afe639b1abd8a8f66cf.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline comple _zgsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// search (i,j) component //////// - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if( data[*p].j==j ){ return data[*p].v; } - } - - //////// (i,j) component was not found //////// - return comple(0.0,0.0); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - std::vector<CPPL_INT>::iterator q; - const std::vector<CPPL_INT>::iterator mat_rows_i_end =mat.rows[i].end(); - for(q=mat.rows[i].begin(); q!=mat_rows_i_end; q++){ - if( mat.data[*q].j==j ){ break; } - } - if(q!=mat_rows_i_end){ s << " " << mat.data[*q].v; } - else{ s << " x"; } - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _zgsmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zgsmatrix " << m << " " << n << " " << data.size() << std::endl; - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/bf/bf903e03ff8ead8f22d598f493d35a30e1669536.svn-base b/cpplapack-r198/.svn/pristine/bf/bf903e03ff8ead8f22d598f493d35a30e1669536.svn-base deleted file mode 100644 index 95c91c482682f370b90f1feb557ab3d492d87764..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/bf/bf903e03ff8ead8f22d598f493d35a30e1669536.svn-base +++ /dev/null @@ -1,1036 +0,0 @@ -%!PS-Adobe-3.0 EPSF-3.0 -%%BoundingBox: 23 438 399 520 -%%Title: dssmatrix-del -%%CreationDate: Thu Nov 4 02:04:21 2004 -%%Creator: Tgif-4.1.43-QPL written by William Chia-Wei Cheng (bill.cheng@acm.org) -%%ProducedBy: (unknown) -%%Pages: 1 -%%DocumentFonts: (atend) -%%EndComments -%%BeginProlog - -/tgifdict 88 dict def -tgifdict begin - -/tgifellipsedict 6 dict def -tgifellipsedict /mtrx matrix put - -/TGEL % tgifellipse - { tgifellipsedict begin - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y translate - xrad yrad scale - 0 0 1 0 360 arc - savematrix setmatrix - end - } def - -/tgifarrowtipdict 8 dict def -tgifarrowtipdict /mtrx matrix put - -/TGAT % tgifarrowtip - { tgifarrowtipdict begin - /dy exch def - /dx exch def - /h exch def - /w exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y translate - dy dx atan rotate - 0 0 moveto - w neg h lineto - w neg h neg lineto - savematrix setmatrix - end - } def - -/tgifpatdict 10 dict def - -/tgifpatbyte - { currentdict /retstr get exch - pat i cellsz mod get put - } def - -/tgifpatproc - { 0 1 widthlim {tgifpatbyte} for retstr - /i i 1 add def - } def - -/TGPF % tgifpatfill - { tgifpatdict begin - /h exch def - /w exch def - /lty exch def - /ltx exch def - /cellsz exch def - /pat exch def - - /widthlim w cellsz div cvi 1 sub def - /retstr widthlim 1 add string def - /i 0 def - - tgiforigctm setmatrix - ltx lty translate - w h true [1 0 0 1 0 0] {tgifpatproc} imagemask - ltx neg lty neg translate - end - } def - -/pat3 <8000000008000000> def -/pat4 <8800000022000000> def -/pat5 <8800220088002200> def -/pat6 <8822882288228822> def -/pat7 <aa55aa55aa55aa55> def -/pat8 <77dd77dd77dd77dd> def -/pat9 <77ffddff77ffddff> def -/pat10 <77ffffff77ffffff> def -/pat11 <7fffffff7fffffff> def -/pat12 <8040200002040800> def -/pat13 <40a00000040a0000> def -/pat14 <ff888888ff888888> def -/pat15 <ff808080ff080808> def -/pat16 <f87422478f172271> def -/pat17 <038448300c020101> def -/pat18 <081c22c180010204> def -/pat19 <8080413e080814e3> def -/pat20 <8040201008040201> def -/pat21 <8844221188442211> def -/pat22 <77bbddee77bbddee> def -/pat23 <c1e070381c0e0783> def -/pat24 <7fbfdfeff7fbfdfe> def -/pat25 <3e1f8fc7e3f1f87c> def -/pat26 <0102040810204080> def -/pat27 <1122448811224488> def -/pat28 <eeddbb77eeddbb77> def -/pat29 <83070e1c3870e0c1> def -/pat30 <fefdfbf7efdfbf7f> def -/pat31 <7cf8f1e3c78f1f3e> def - -/TGMAX - { exch dup 3 1 roll exch dup 3 1 roll gt { pop } { exch pop } ifelse - } def -/TGMIN - { exch dup 3 1 roll exch dup 3 1 roll lt { pop } { exch pop } ifelse - } def -/TGSW { stringwidth pop } def - -/bd { bind def } bind def - -/GS { gsave } bd -/GR { grestore } bd -/NP { newpath } bd -/CP { closepath } bd -/CHP { charpath } bd -/CT { curveto } bd -/L { lineto } bd -/RL { rlineto } bd -/M { moveto } bd -/RM { rmoveto } bd -/S { stroke } bd -/F { fill } bd -/TR { translate } bd -/RO { rotate } bd -/SC { scale } bd -/MU { mul } bd -/DI { div } bd -/DU { dup } bd -/NE { neg } bd -/AD { add } bd -/SU { sub } bd -/PO { pop } bd -/EX { exch } bd -/CO { concat } bd -/CL { clip } bd -/EC { eoclip } bd -/EF { eofill } bd -/IM { image } bd -/IMM { imagemask } bd -/ARY { array } bd -/SG { setgray } bd -/RG { setrgbcolor } bd -/SD { setdash } bd -/W { setlinewidth } bd -/SM { setmiterlimit } bd -/SLC { setlinecap } bd -/SLJ { setlinejoin } bd -/SH { show } bd -/FF { findfont } bd -/MS { makefont setfont } bd -/AR { arcto 4 {pop} repeat } bd -/CURP { currentpoint } bd -/FLAT { flattenpath strokepath clip newpath } bd -/TGSM { tgiforigctm setmatrix } def -/TGRM { savematrix setmatrix } def - -end - -%%EndProlog -%%Page: 1 1 - -%%PageBoundingBox: 23 438 399 520 -tgifdict begin -/tgifsavedpage save def - -1 SM -1 W - -0 SG - -72 0 MU 72 8.203 MU TR -72 128 DI 100.000 MU 100 DI DU NE SC - -GS - -/tgiforigctm matrix currentmatrix def - -% BOX -0 SG -GS - 10 SM - GS - NP 652 128 M 708 128 L 708 164 L 652 164 L CP - S - GR -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 552 128 M 608 128 L 608 164 L 552 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 496 128 M 552 128 L 552 164 L 496 164 L CP EC NP - pat5 8 488 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 496 128 M 552 128 L 552 164 L 496 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 440 128 M 496 128 L 496 164 L 440 164 L CP EC NP - pat5 8 432 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 440 128 M 496 128 L 496 164 L 440 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 340 128 M 396 128 L 396 164 L 340 164 L CP EC NP - pat5 8 336 120 64 48 TGPF -GR -GS - 10 SM - GS - NP 340 128 M 396 128 L 396 164 L 340 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 240 128 M 296 128 L 296 164 L 240 164 L CP EC NP - pat5 8 232 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 240 128 M 296 128 L 296 164 L 240 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 184 128 M 240 128 L 240 164 L 184 164 L CP EC NP - pat5 8 176 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 184 128 M 240 128 L 240 164 L 184 164 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 128 128 M 184 128 L 184 164 L 128 164 L CP EC NP - pat5 8 120 120 72 48 TGPF -GR -GS - 10 SM - GS - NP 128 128 M 184 128 L 184 164 L 128 164 L CP - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 156 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (0) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (0) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 212 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 268 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 368 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (c) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (c) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 468 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 680 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) SH - GR - GR - -% OVAL -0 SG -NP 306 146 2 2 TGEL F -GS - GS - NP 306 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 318 146 2 2 TGEL F -GS - GS - NP 318 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 330 146 2 2 TGEL F -GS - GS - NP 330 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 406 146 2 2 TGEL F -GS - GS - NP 406 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 418 146 2 2 TGEL F -GS - GS - NP 418 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 430 146 2 2 TGEL F -GS - GS - NP 430 146 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 524 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 580 152 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) SH - GR - GR - -% OVAL -0 SG -NP 618 146 2 2 TGEL F -GS - GS - NP 618 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 630 146 2 2 TGEL F -GS - GS - NP 630 146 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 642 146 2 2 TGEL F -GS - GS - NP 642 146 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 80 200 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (del\(i,j\);) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (del\(i,j\);) SH - GR - GR - -% BOX -0 SG -GS - 10 SM - GS - NP 652 232 M 708 232 L 708 268 L 652 268 L CP - S - GR -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 552 232 M 608 232 L 608 268 L 552 268 L CP - S - GR -GR - -% BOX -0 SG -GS - 10 SM - GS - NP 496 232 M 552 232 L 552 268 L 496 268 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 440 232 M 496 232 L 496 268 L 440 268 L CP EC NP - pat5 8 432 224 72 48 TGPF -GR -GS - 10 SM - GS - NP 440 232 M 496 232 L 496 268 L 440 268 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 340 232 M 396 232 L 396 268 L 340 268 L CP EC NP - pat5 8 336 224 64 48 TGPF -GR -GS - 10 SM - GS - NP 340 232 M 396 232 L 396 268 L 340 268 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 240 232 M 296 232 L 296 268 L 240 268 L CP EC NP - pat5 8 232 224 72 48 TGPF -GR -GS - 10 SM - GS - NP 240 232 M 296 232 L 296 268 L 240 268 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 184 232 M 240 232 L 240 268 L 184 268 L CP EC NP - pat5 8 176 224 72 48 TGPF -GR -GS - 10 SM - GS - NP 184 232 M 240 232 L 240 268 L 184 268 L CP - S - GR -GR - -% BOX -0 SG -GS - NP 128 232 M 184 232 L 184 268 L 128 268 L CP EC NP - pat5 8 120 224 72 48 TGPF -GR -GS - 10 SM - GS - NP 128 232 M 184 232 L 184 268 L 128 268 L CP - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 156 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (0) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (0) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 212 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 268 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (2) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (2) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 368 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (c) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (c) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 468 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol-1) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 680 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (cap-1) SH - GR - GR - -% OVAL -0 SG -NP 306 250 2 2 TGEL F -GS - GS - NP 306 250 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 318 250 2 2 TGEL F -GS - GS - NP 318 250 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 330 250 2 2 TGEL F -GS - GS - NP 330 250 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 406 250 2 2 TGEL F -GS - GS - NP 406 250 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 418 250 2 2 TGEL F -GS - GS - NP 418 250 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 430 250 2 2 TGEL F -GS - GS - NP 430 250 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 524 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 580 256 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (vol+1) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (vol+1) SH - GR - GR - -% OVAL -0 SG -NP 618 250 2 2 TGEL F -GS - GS - NP 618 250 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 630 250 2 2 TGEL F -GS - GS - NP 630 250 2 2 TGEL - 3 W - S - GR -GR - -% OVAL -0 SG -NP 642 250 2 2 TGEL F -GS - GS - NP 642 250 2 2 TGEL - 3 W - S - GR -GR - -% TEXT -NP -0 SG - GS - 1 W - 260 200 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (automatically "vol--;") TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (automatically "vol--;") SH - GR - GR - -% POLY/OPEN-SPLINE -0 SG -GS - NP - 524 232 M - 480 208 L - 368 208 L - 24 0 atan DU cos 10.000 MU 368 exch SU - exch sin 10.000 MU 232 exch SU L - TGSM - 2 W - S - 1 W -GR -GS - TGSM - NP - 368 232 10.000 4.000 0 24 TGAT - CP F -GR - -% TEXT -NP -0 SG - GS - 1 W - 548 208 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (assign value) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (assign value) SH - GR - 0 22 RM - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (at here) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (at here) SH - GR - GR - -% TEXT -NP -0 SG - GS - 1 W - 132 224 M - GS - GS - 0 - /Helvetica FF [18 0 0 -18 0 0] MS - (\(if \(i,j\) means array[c]\)) TGSW - AD - GR - 2 DI NE 0 RM - 0 SG - /Helvetica FF [18 0 0 -18 0 0] MS - (\(if \(i,j\) means array[c]\)) SH - GR - GR - -GR -tgifsavedpage restore -end -showpage - -%%Trailer -%MatchingCreationDate: Thu Nov 4 02:04:21 2004 -%%DocumentFonts: Helvetica -%%EOF diff --git a/cpplapack-r198/.svn/pristine/c0/c015b79e18332c96395f704ade236a14acba2dd3.svn-base b/cpplapack-r198/.svn/pristine/c0/c015b79e18332c96395f704ade236a14acba2dd3.svn-base deleted file mode 100644 index ce06fc849549779bb2cc1bf0ab474b18ab5059bf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c0/c015b79e18332c96395f704ade236a14acba2dd3.svn-base +++ /dev/null @@ -1,99 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -bool bicg -( - const CPPL::dgematrix& A, - //const CPPL::dgsmatrix& A, - CPPL::dcovector& x, - const double& eps -) -{ - double alpha, beta(0.0); - CPPL::dcovector p_0(x.l), p_1, P_0(x.l), P_1, q, Q; - CPPL::dcovector r_1(x), r_2, R_1(r_1), R_2; - double rho_0(r_1%R_1), rho_1; - x.zero(); - p_0.zero(); - P_0.zero(); - - int itc(0); - const int itmax(2*x.l); - while(fabs(damax(r_1))>eps && ++itc<itmax){ - std::cout << itc << " " << fabs(damax(r_1)) << std::endl; - - rho_1 =r_1%R_1; - beta =rho_1/rho_0; - p_1 =r_1 +beta*p_0; - P_1 =R_1 +beta*P_0; - q =A*p_1; - Q =t(t(P_1)*A); - alpha =rho_1/(P_1%q); - x +=alpha*p_1; - r_2 =r_1 -alpha*q; - R_2 =R_1 -alpha*Q; - - rho_0 =rho_1; - swap(p_0, p_1); - swap(P_0, P_1); - swap(r_1, r_2); - swap(R_1, R_2); - } - std::cerr << "itc=" << itc << " fabs(damax(r_1))=" << fabs(damax(r_1)) << std::endl; - - if(itc<itmax){ return 0; } - else{ return 1; } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - srand(time(NULL)); - - const int size(100); - CPPL::dgematrix A(size,size); - //CPPL::dgsmatrix A(size,size); - - for(int i=0; i<size; i++){ - for(int j=0; j<size; j++){ - if(rand()%2){ A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; } - } - A(i,i)+=10.; - } - A.write("A.dgematrix"); - - CPPL::dcovector x(size); - for(int i=0; i<size; i++){ - x(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - x.write("answer.dcovector");//solution - std::cerr << "answer=\n" << t(x) << std::endl; - - CPPL::dcovector y(A*x); - y.write("y.dcovector"); - //std::cerr << "y=\n" << t(y) << std::endl; - - double eps(fabs(damax(y))*1e-6); - //std::cerr << "eps=" << eps << std::endl; - if( bicg(A, y, eps) ){ - std::cerr << "failed." << std::endl; - exit(1); - } - y.write("solution.dcovector"); - std::cout << "solution=\n" << t(y) << std::endl; - //std::cerr << "A*x=\n" << t(A*y) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/c0/c073b519542807681e45e5796d49295a76e5a6f9.svn-base b/cpplapack-r198/.svn/pristine/c0/c073b519542807681e45e5796d49295a76e5a6f9.svn-base deleted file mode 100644 index e728ab226316a9414038ceef50d37617c2ec60d9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c0/c073b519542807681e45e5796d49295a76e5a6f9.svn-base +++ /dev/null @@ -1,28 +0,0 @@ -//============================================================================= -/*! _drovector*_dssmatrix operator */ -inline _drovector operator*(const _drovector& vec, const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) +=vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) +=vec(it->j)*it->v; - } - } - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/c0/c081944b143238d14207d5b697d665bcdbba7bd6.svn-base b/cpplapack-r198/.svn/pristine/c0/c081944b143238d14207d5b697d665bcdbba7bd6.svn-base deleted file mode 100644 index b9f89b7e30ea4b0475c9b4c7440a3b2b4b3fcd61..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c0/c081944b143238d14207d5b697d665bcdbba7bd6.svn-base +++ /dev/null @@ -1,90 +0,0 @@ -//============================================================================= -/*! return transposed zgsmatrix */ -inline _zgsmatrix t(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat =mat; - - std::swap(newmat.m,newmat.n); - std::swap(newmat.rows,newmat.cols); - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - std::swap(it->i,it->j); - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its conjugate matrix */ -inline _zgsmatrix conj(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v =std::conj(it->v); - } - - return _(newmat); -} - -//============================================================================= -/*! return its conjugate transposed matrix */ -inline _zgsmatrix conjt(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(mat); - std::swap(newmat.rows,newmat.cols); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - std::swap(it->i,it->j); - it->v =std::conj(it->v); - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - i=itx->i; - j=itx->j; -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - return itx->v; -} diff --git a/cpplapack-r198/.svn/pristine/c0/c0f8ce29713f2f44f460bda2a90e7ca3edaffc88.svn-base b/cpplapack-r198/.svn/pristine/c0/c0f8ce29713f2f44f460bda2a90e7ca3edaffc88.svn-base deleted file mode 100644 index 170fe37e89745c7d0e80161fd215c0174468756d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c0/c0f8ce29713f2f44f460bda2a90e7ca3edaffc88.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*dgematrix operator */ -inline _dgematrix operator*(const double& d, const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(mat.m, mat.n); - - const CPPL_INT size =mat.m*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c1/c1cdf020f7593ea92029d258a6a9f8eaea81bbde.svn-base b/cpplapack-r198/.svn/pristine/c1/c1cdf020f7593ea92029d258a6a9f8eaea81bbde.svn-base deleted file mode 100644 index 53c7895cc18c291a118bd2f54f3a4eae5b244ef4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c1/c1cdf020f7593ea92029d258a6a9f8eaea81bbde.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -//============================================================================= -/*! double*_zgematrix operator */ -inline _zgematrix operator*(const double& d, const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - zdscal_(&size, &d, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/c1/c1f37db5423aa6eb4f0d8d705c77485818d741ea.svn-base b/cpplapack-r198/.svn/pristine/c1/c1f37db5423aa6eb4f0d8d705c77485818d741ea.svn-base deleted file mode 100644 index d1770c4730eee3376aa6d83fac69b1de3d18e90a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c1/c1f37db5423aa6eb4f0d8d705c77485818d741ea.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _drovector*dgsmatrix operator */ -inline _drovector operator*(const _drovector& vec, const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/c3/c3aa3ecb374bcde9164d6456e65beb8cb0e6d843.svn-base b/cpplapack-r198/.svn/pristine/c3/c3aa3ecb374bcde9164d6456e65beb8cb0e6d843.svn-base deleted file mode 100644 index a7c6902db93062ae24974582a396ee97a56596b2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c3/c3aa3ecb374bcde9164d6456e65beb8cb0e6d843.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+_zgematrix operator */ -inline _zgematrix operator+(const _zgsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _zgsmatrix-_zgematrix operator */ -inline _zgematrix operator-(const _zgsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(int i=0; i<matB.m*matB.n; i++){ - matB.array[i] = -matB.array[i]; - } - - //// add //// - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _zgsmatrix*_zgematrix operator */ -inline _zgematrix operator*(const _zgsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v *matB(it->j,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c3/c3b61418408e355791c8c092c1e9a523d0aebf11.svn-base b/cpplapack-r198/.svn/pristine/c3/c3b61418408e355791c8c092c1e9a523d0aebf11.svn-base deleted file mode 100644 index 357443e17ba4e8fc4cdc06b219857129f6f8d906..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c3/c3b61418408e355791c8c092c1e9a523d0aebf11.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! zhsmatrix+zhematrix operator */ -/* -inline _zgematrix operator+(const zhsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ -//============================================================================= -/*! zhsmatrix-zhematrix operator */ -/* -inline _zgematrix operator-(const zhsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to zgematrix //// - zgematrix newmat(-matB); - - //// add //// - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - return _(newmat); -} -*/ -//============================================================================= -/*! zhsmatrix*zhematrix operator */ -/* -inline _zgematrix operator*(const zhsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/c4/c4efb26d291f5eeda4d9aed4cfaab254aa659921.svn-base b/cpplapack-r198/.svn/pristine/c4/c4efb26d291f5eeda4d9aed4cfaab254aa659921.svn-base deleted file mode 100644 index 86ebd02e1b3723b851bc86d05a595b4dc8ac770e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c4/c4efb26d291f5eeda4d9aed4cfaab254aa659921.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -dgematrix 8 8 -5.000000e-01 -1.148386e-01 -1.148386e-01 -2.703227e-01 1.915613e-01 7.688979e-02 7.688979e-02 1.616523e-01 --1.148386e-01 5.000000e-01 -1.148386e-01 -2.703227e-01 7.688979e-02 1.915613e-01 7.688979e-02 1.616523e-01 --1.148386e-01 -1.148386e-01 5.000000e-01 -2.703227e-01 7.688979e-02 7.688979e-02 1.915613e-01 1.616523e-01 --1.666667e-01 -1.666667e-01 -1.666667e-01 5.000000e-01 8.958975e-02 8.958975e-02 8.958975e-02 2.567070e-01 -1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 -0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 -0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 0.000000e+00 -0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00 0.000000e+00 diff --git a/cpplapack-r198/.svn/pristine/c5/c5260f4ee34b16fa0d35d91099d45b9f898cda68.svn-base b/cpplapack-r198/.svn/pristine/c5/c5260f4ee34b16fa0d35d91099d45b9f898cda68.svn-base deleted file mode 100644 index 3b720ca2831a1c865a1b0f9ffbc57617c8ca7c50..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c5260f4ee34b16fa0d35d91099d45b9f898cda68.svn-base +++ /dev/null @@ -1,65 +0,0 @@ -%define prefix /usr -%define version 2015.05.11 -%define sourcedir /home/yuki/local/cpplapack - -############################################################################### -Summary: CPPLapack library header files -Name: cpplapack -Version: %{version} -Release: 1 -Vendor: Yuki ONISHI -URL: http://sourceforge.net/projects/cpplapack/ -Source: http://sourceforge.net/projects/cpplapack/files/ -#Patch: -License: GPL -Group: Applications/Engineering -#Packager: -BuildArch: noarch -Buildroot: %{_tmppath}/%{name}-root - -#%package doc -#Summary: Documentation of CPPLapack -#Group: Applications/Engineering - -%description -CPPLapack is a C++ matrix library designed as a class wrapper for BLAS, LAPACK and PARDISO. -Visit http://cpplapack.sourceforge.net/ to obtain the documentation, update information, and the latest version in the subversion (svn) repository. - -#%description doc -#This package contains the html documentation, sample Makefies, -#test programs, and benchmark programs of CPPLapack. -#Please visit http://cpplapack.sourceforge.net/ to check update -#information and to obtain the latest version. - -############################################################################### -%prep -echo "prep" -rm -rf $RPM_BUILD_ROOT - -%build -echo "build" -echo Nothing to make since CPPLapack is a set of header files. - -%install -echo "install" -mkdir -p $RPM_BUILD_ROOT/%{prefix}/include/cpplapack -cd $RPM_BUILD_ROOT/%{prefix}/include -cp -r %{sourcedir}/include/* cpplapack/ -rm -rf `find -type d -name .svn` -cat cpplapack/cpplapack.h\ - | sed -e 's/\#include\ \"/\#include\ \"cpplapack\//g'\ - > ./cpplapack.h -rm cpplapack/cpplapack.h - -%clean -echo "%clean" -#rm -rf $RPM_BUILD_ROOT - -############################################################################### -%files -%defattr(-,root,root) -/usr/include/cpplapack -/usr/include/cpplapack.h - -#%files doc -#%doc benchmark doc makefiles test diff --git a/cpplapack-r198/.svn/pristine/c5/c53448dec08b0a3f675dc3621b3deadd6c8c53c9.svn-base b/cpplapack-r198/.svn/pristine/c5/c53448dec08b0a3f675dc3621b3deadd6c8c53c9.svn-base deleted file mode 100644 index 7cdaffcaa8313575738b407e917ad33fca2f2fbd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c53448dec08b0a3f675dc3621b3deadd6c8c53c9.svn-base +++ /dev/null @@ -1,32 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "+A =\n" << +A << endl; - cout << "-A =\n" << -A << endl; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/c5/c5439591b8991cb69d0d113b28fa666d1ad4d1fa.svn-base b/cpplapack-r198/.svn/pristine/c5/c5439591b8991cb69d0d113b28fa666d1ad4d1fa.svn-base deleted file mode 100644 index 6e5f1f0892d9d2bb438f13cd22f1838b08848233..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c5439591b8991cb69d0d113b28fa666d1ad4d1fa.svn-base +++ /dev/null @@ -1,43 +0,0 @@ -//============================================================================= -/*! cast to _zgrmatrix */ -/* -inline _zgrmatrix dgrmatrix::to_zgrmatrix() const -{CPPL_VERBOSE_REPORT; - zgrmatrix newmat; - newmat.m =m; - newmat.n =n; - newmat.ia =ia; - newmat.ja =ja; - - newmat.a.resize(a.size()); - const size_t a_size =a.size(); - for(size_t k=0; k<a_size; k++){ - newmat.a[k] =comple(a[k],0.); - } - - return _(newmat); -} -*/ - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix dgrmatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat(m,n); - newmat.zero(); - - for(CPPL_INT i=0; i<m; i++){ - int k_beg =ia[i]-1; - int k_end =ia[i+1]-1; - for(int k=k_beg; k<k_end; k++){ - int j =ja[k]-1; - newmat(i,j) =a[k]; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c5/c565e88516e0bf490cd86e4663f6632f33f75a5c.svn-base b/cpplapack-r198/.svn/pristine/c5/c565e88516e0bf490cd86e4663f6632f33f75a5c.svn-base deleted file mode 100644 index 5ff920529345978465064b6e3844b3ebb45e6c06..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c565e88516e0bf490cd86e4663f6632f33f75a5c.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -//============================================================================= -/*! comple*_zgbmatrix operator */ -inline _zgbmatrix operator*(const comple& d, const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - zscal_(&size, &d, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/c5/c5ad99e83281a00b03948daf3950746f1c5780f2.svn-base b/cpplapack-r198/.svn/pristine/c5/c5ad99e83281a00b03948daf3950746f1c5780f2.svn-base deleted file mode 100644 index 60c95dd925196e3c85ea8261578a388d3a23d621..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c5ad99e83281a00b03948daf3950746f1c5780f2.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision Row Vector Class -class _drovector -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - mutable CPPL_INT l; //!< vector size - mutable CPPL_INT cap; //!< vector capacity - mutable double* array; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _drovector(); - inline _drovector(const _drovector&); - inline ~_drovector(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zrovector to_zrovector() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&) const; - inline friend std::ostream& operator<<(std::ostream&, const _drovector&); - inline void write(const char*) const; - - //////// calc //////// - inline friend _dcovector t(const drovector&); - inline friend double nrm2(const drovector&); - inline friend CPPL_INT idamax(const drovector&); - inline friend double damax(const drovector&); - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _drovector& operator+(const _drovector&); - inline friend _drovector operator-(const _drovector&); - - //////// + //////// - inline friend _drovector operator+(const _drovector&, const drovector&); - inline friend _drovector operator+(const _drovector&, const _drovector&); - - //////// - //////// - inline friend _drovector operator-(const _drovector&, const drovector&); - inline friend _drovector operator-(const _drovector&, const _drovector&); - - //////// * //////// - inline friend double operator*(const _drovector&, const dcovector&); - inline friend double operator*(const _drovector&, const _dcovector&); - inline friend _drovector operator*(const _drovector&, const dgematrix&); - inline friend _drovector operator*(const _drovector&, const _dgematrix&); - inline friend _drovector operator*(const _drovector&, const dsymatrix&); - inline friend _drovector operator*(const _drovector&, const _dsymatrix&); - inline friend _drovector operator*(const _drovector&, const dgbmatrix&); - inline friend _drovector operator*(const _drovector&, const _dgbmatrix&); - inline friend _drovector operator*(const _drovector&, const dgsmatrix&); - inline friend _drovector operator*(const _drovector&, const _dgsmatrix&); - inline friend _drovector operator*(const _drovector&, const dssmatrix&); - inline friend _drovector operator*(const _drovector&, const _dssmatrix&); - inline friend _drovector operator*(const _drovector&, const double&); - - //////// / //////// - inline friend _drovector operator/(const _drovector&, const double&); - - //////// % //////// - inline friend double operator%(const _drovector&, const drovector&); - inline friend double operator%(const _drovector&, const _drovector&); - - //////// double //////// - inline friend _drovector operator*(const double&, const _drovector&); -}; diff --git a/cpplapack-r198/.svn/pristine/c5/c5b0b0c7e34eb817f135b4f3f17a277767a219f5.svn-base b/cpplapack-r198/.svn/pristine/c5/c5b0b0c7e34eb817f135b4f3f17a277767a219f5.svn-base deleted file mode 100644 index 7edc18b1654af12f3558b63bc61f56d6388f4eb1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c5b0b0c7e34eb817f135b4f3f17a277767a219f5.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! zgematrix+zgsmatrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - newmat(z.i,z.j) += z.v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix-zgsmatrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - newmat(z.i,z.j) -= z.v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix*zgsmatrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const size_t matB_data_size =matB.data.size(); - for(size_t c=0; c<matB_data_size; c++){ - const zcomponent& z =matB.data[c]; - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,z.j) += matA(i,z.i)*z.v; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c5/c5d57abaa2bcb4652c3a61edfca4dc57b96c01bb.svn-base b/cpplapack-r198/.svn/pristine/c5/c5d57abaa2bcb4652c3a61edfca4dc57b96c01bb.svn-base deleted file mode 100644 index e241abcc8517a8044199b358d93b5c74005b1825..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c5d57abaa2bcb4652c3a61edfca4dc57b96c01bb.svn-base +++ /dev/null @@ -1,133 +0,0 @@ -//============================================================================= -/*! zhsmatrix=zhsmatrix operator */ -inline zhsmatrix& zhsmatrix::operator=(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - if(&data!=&mat.data){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix+=zhsmatrix operator */ -inline zhsmatrix& zhsmatrix::operator+=(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) +=it->v; - } - - return *this; -} - -//============================================================================= -/*! zhsmatrix-=zhsmatrix operator */ -inline zhsmatrix& zhsmatrix::operator-=(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -=it->v; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix+zhsmatrix operator */ -inline _zhsmatrix operator+(const zhsmatrix& matA, const zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zhsmatrix-zhsmatrix operator */ -inline _zhsmatrix operator-(const zhsmatrix& matA, const zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zhsmatrix*zhsmatrix operator */ -/* -inline _zgsmatrix operator*(const zhsmatrix& matA, const zhsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zhsmatrix newmat( matA.n, 0 ); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.Col[k].begin(); p!=matB.Col[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/c5/c5e109434040b0de660213fc0c4916332248e602.svn-base b/cpplapack-r198/.svn/pristine/c5/c5e109434040b0de660213fc0c4916332248e602.svn-base deleted file mode 100644 index 6f5f5209a2b96274f3d97b436157ff4226fa6a1b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c5/c5e109434040b0de660213fc0c4916332248e602.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _dssmatrix+dssmatrix operator */ -inline _dssmatrix operator+(const _dssmatrix& matA, const dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _dssmatrix-dssmatrix operator */ -inline _dssmatrix operator-(const _dssmatrix& matA, const dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! _dssmatrix*dssmatrix operator */ -/* -inline _dssmatrix operator*(const _dssmatrix& matA, const dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat( matA.m, matB.n, 0 ); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.Col[k].begin(); p!=matB.Col[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/c6/c61162d55a3c2d238119d09905cc792062c2608f.svn-base b/cpplapack-r198/.svn/pristine/c6/c61162d55a3c2d238119d09905cc792062c2608f.svn-base deleted file mode 100644 index e90d5dd31c216216d8a246ff840f1457a3f2ca15..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c6/c61162d55a3c2d238119d09905cc792062c2608f.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! comple*zgematrix operator */ -inline _zgematrix operator*(const comple& d, const zgematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat(mat.m, mat.n); - - const CPPL_INT size =mat.m*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c6/c6610e37a996f5a6c025df07c22dac7b93ef3115.svn-base b/cpplapack-r198/.svn/pristine/c6/c6610e37a996f5a6c025df07c22dac7b93ef3115.svn-base deleted file mode 100644 index 3421690311b066a8273f382f02b098297060f4e5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c6/c6610e37a996f5a6c025df07c22dac7b93ef3115.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! dgesv_check */ -void dgesv_check_vector() -{ - std::cout << "############ check dgesv vector ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make dgematrix A //// - CPPL::dgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make dcovector y //// - CPPL::dcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =double( rand() /(RAND_MAX/10) ); - } - - //// make A_original and y_original //// - CPPL::dgematrix A_original(A); - CPPL::dcovector y_original(y); - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "y_original=\n" << y_original << std::endl; - - //// solve Ax=y //// - A.dgesv(y); - - //// print A, y and A_original*y //// - std::cout << "A=\n" << A << std::endl; - std::cout << "y=\n" << y << std::endl; - std::cout << "A_original*y=\n" << A_original*y << std::endl; -} - -void dgesv_check_matrix() -{ - std::cout << "############ check dgesv matrix ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3); - - - //// make dgematrix A //// - CPPL::dgematrix A(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make dgematrix Y //// - CPPL::dgematrix Y(M,M); - for(int i=0; i<Y.m; i++){ for(int j=0; j<Y.n; j++){ - Y(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make A_original and Y_original //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix Y_original(Y); - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "Y_original=\n" << Y_original << std::endl; - - //// solve AY=B //// - A.dgesv(Y); - - //// print A, Y and A_original*Y //// - std::cout << "A=\n" << A << std::endl; - std::cout << "Y=\n" << Y << std::endl; - std::cout << "A_original*Y=\n" << A_original*Y << std::endl; -} diff --git a/cpplapack-r198/.svn/pristine/c6/c6ee09c2356bb4a9f81620db30d6c4e6aa559570.svn-base b/cpplapack-r198/.svn/pristine/c6/c6ee09c2356bb4a9f81620db30d6c4e6aa559570.svn-base deleted file mode 100644 index 5adf27f5b2b7d69c1e75ec9fd11a34a68b085211..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c6/c6ee09c2356bb4a9f81620db30d6c4e6aa559570.svn-base +++ /dev/null @@ -1,69 +0,0 @@ -//============================================================================= -/*! zhematrix+zssmatrix operator */ -inline _zgematrix operator+(const zhematrix& matA, const zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" - << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix-zssmatrix operator */ -inline _zgematrix operator-(const zhematrix& matA, const zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c]; - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix*zssmatrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c7/c74a7985c45aec4e05b441c04a7e5220b83bf0bb.svn-base b/cpplapack-r198/.svn/pristine/c7/c74a7985c45aec4e05b441c04a7e5220b83bf0bb.svn-base deleted file mode 100644 index 913280553773ccb11d28ba986dba0bdea47dba39..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c7/c74a7985c45aec4e05b441c04a7e5220b83bf0bb.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(6), N(5), KL(2), KU(1); - - CPPL::zgbmatrix A; - cout << "A ||" - << " m=" << A.m << ", n=" << A.n - << " kl=" << A.kl << ", ku=" << A.ku - << ", array=" << A.array << endl; - - - CPPL::zgbmatrix B(M,N,KL,KU); - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - if( !((i-j)>B.kl || (j-i)>B.ku) ){ - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - }} - cout << "B ||" - << " m=" << B.m << ", n=" << B.n - << " kl=" << B.kl << ", ku=" << B.ku - << ", array=" << B.array << endl; - cout << "B =\n" << B << endl; - - - CPPL::zgbmatrix C(B); - cout << "C ||" - << " m=" << C.m << ", n=" << C.n - << " kl=" << C.kl << ", ku=" << C.ku - << ", array=" << C.array << endl; - cout << "C =\n" << C << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/c7/c7ca1c8d75ef0b16be9435240cbd7af802fc83ff.svn-base b/cpplapack-r198/.svn/pristine/c7/c7ca1c8d75ef0b16be9435240cbd7af802fc83ff.svn-base deleted file mode 100644 index ba026e45e277a4eee0a7528994d54ab33a8cce6a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c7/c7ca1c8d75ef0b16be9435240cbd7af802fc83ff.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _zgbmatrix*double operator */ -inline _zgbmatrix operator*(const _zgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - zdscal_(&size, &d, mat.array, &inc); - return mat; -} - -//============================================================================= -/*! _zgbmatrix/double operator */ -inline _zgbmatrix operator/(const _zgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&size, &dinv, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/c8/c80a2a07f7220740e01a97cb9f3b62dbaeabf9ae.svn-base b/cpplapack-r198/.svn/pristine/c8/c80a2a07f7220740e01a97cb9f3b62dbaeabf9ae.svn-base deleted file mode 100644 index 61d4d15b5f4aa1ab248c379efaa0508642ce82f9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c8/c80a2a07f7220740e01a97cb9f3b62dbaeabf9ae.svn-base +++ /dev/null @@ -1,88 +0,0 @@ -//============================================================================= -/*! zhsmatrix constructor without arguments */ -inline zhsmatrix::zhsmatrix() - : m(n) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - n =0; - data.clear(); - line.clear(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix copy constructor */ -inline zhsmatrix::zhsmatrix(const zhsmatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); - copy(mat); -} - -//============================================================================= -/*! zhsmatrix constructor to cast _zhsmatrix */ -inline zhsmatrix::zhsmatrix(const _zhsmatrix& mat) - : m(n) -{CPPL_VERBOSE_REPORT; - n =mat.n; - data.clear(); - line.clear(); - - data.swap(mat.data); - line.swap(mat.line); - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix constructor with size specification */ -inline zhsmatrix::zhsmatrix(const CPPL_INT& _n, const CPPL_INT _c) - : m(n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _c<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl - << "Your input was (" << _n << "," << _c << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - n =_n; - data.resize(0); - data.reserve(_c); - line.resize(n); -} - -//============================================================================= -/*! zhsmatrix constructor with filename */ -inline zhsmatrix::zhsmatrix(const char* filename) - : m(n) -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix destructor */ -inline zhsmatrix::~zhsmatrix() -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/c8/c8359f4f7c3fb37ad216d46a4884342eb4da77db.svn-base b/cpplapack-r198/.svn/pristine/c8/c8359f4f7c3fb37ad216d46a4884342eb4da77db.svn-base deleted file mode 100644 index fdb055479305b66154b7f04b9e1155a4641b5d8a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c8/c8359f4f7c3fb37ad216d46a4884342eb4da77db.svn-base +++ /dev/null @@ -1,105 +0,0 @@ -//============================================================================= -/*! zgbmatrix constructor */ -inline zgbmatrix::zgbmatrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - kl =0; - ku =0; - array =NULL; - darray =NULL; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix copy constructor */ -inline zgbmatrix::zgbmatrix(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - array =new comple[(kl+ku+1)*n]; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*(kl+ku+1)]; - } - - //////// copy //////// - CPPL_INT size =(kl+ku+1)*n; - CPPL_INT inc =1; - zcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! zgbmatrix constructor to cast _zgbmatrix */ -inline zgbmatrix::zgbmatrix(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix constructor with size specification */ -inline zgbmatrix::zgbmatrix(const CPPL_INT& _m, const CPPL_INT& _n, - const CPPL_INT& _kl, const CPPL_INT& _ku) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){ - ERROR_REPORT; - std::cerr << "It is impossible to make a matrix you ordered. " << std::endl - << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - m =_m; - n =_n; - kl =_kl; - ku =_ku; - array =new comple[(kl+ku+1)*n]; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*(kl+ku+1)]; - } -} - -//============================================================================= -/*! zgbmatrix constructor with filename */ -inline zgbmatrix::zgbmatrix(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - darray =NULL; - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgbmatrix destructor */ -inline zgbmatrix::~zgbmatrix() -{CPPL_VERBOSE_REPORT; - //////// delete array //////// - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/c8/c874d0e14048010efd381af4dc9f9680d128dfc6.svn-base b/cpplapack-r198/.svn/pristine/c8/c874d0e14048010efd381af4dc9f9680d128dfc6.svn-base deleted file mode 100644 index 8bb82c46e53674b21fc050c45f35ccd8920cdc9d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c8/c874d0e14048010efd381af4dc9f9680d128dfc6.svn-base +++ /dev/null @@ -1,100 +0,0 @@ -//============================================================================= -/*! solve A*x=b for real and unsymmetric matrix using Intel PARDISO.\n - The argument is dcovector b. - b is overwritten and become the solution x. - A is not overwritten. -*/ -inline CPPL_INT dgsmatrix::pardiso(dcovector& b) const -{CPPL_VERBOSE_REPORT; -#ifndef __INTEL_COMPILER - ERROR_REPORT; - std::cerr << "dgsmatrix::pardiso is only for intel c++ compiler (icpc)." << std::endl; - std::cerr << "Recompile your code with icpc to use pardiso." << std::endl; - (void)b; - exit(1); -#else //__INTEL_COMPILER - - - //#ifdef CPPL_DEBUG - if(m!=n || m!=b.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << b.l << ")." << std::endl; - exit(1); - } - //#endif//CPPL_DEBUG - - //////// convert matrix storage into compressed sparse row format //////// - //std::cerr << "converting" << std::endl; - std::vector<double> a(data.size()); - std::vector<MKL_INT> ja(data.size()); - std::vector<MKL_INT> ia(m+1); - ia[0] =0; - MKL_INT k=0; - for(CPPL_INT i=0; i<m; i++){ - //// make map //// - const std::vector<CPPL_INT>::const_iterator rows_i_end =rows[i].end(); - std::map<CPPL_INT,CPPL_INT> jc; - for(std::vector<CPPL_INT>::const_iterator rit=rows[i].begin(); rit!=rows_i_end; rit++){ - jc.insert( std::make_pair(data[*rit].j, *rit) ); - } - //// assign //// - const std::map<CPPL_INT,CPPL_INT>::const_iterator jc_end =jc.end(); - for(std::map<CPPL_INT,CPPL_INT>::const_iterator jcit=jc.begin(); jcit!=jc_end; jcit++){ - a[k] =data[(*jcit).second].v; - ja[k] =MKL_INT((*jcit).first);//zero-base - k++; - } - ia[i+1] =k;//zero-base - } - - //////// pardisoinit //////// - //std::cerr << "initializing" << std::endl; - //_MKL_DSS_HANDLE_t pt[64]; - void* pt[64]; - MKL_INT mtype =11;//real unsymmetric - MKL_INT iparm[64]; - PARDISOINIT(pt, &mtype, iparm); - iparm[0] =1;//user modified iparm - //iparm[1] =3;//parallel fill-in reducing ordering [BUGGY on MKL 11.3]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - iparm[1] =0;//serial fill-in reducing ordering [STABLE] - iparm[23] =1;//use two-level scheduling factorization algorithm - //iparm[26] =1;//enable matrix checker - iparm[26] =0;//disable matrix checker - ////////iparm[34] =0;//use Fortran style (one-base) array index - iparm[34] =9999;//use C style (zero-base) array index - - //////// pardiso //////// - //std::cerr << "solving" << std::endl; - MKL_INT maxfct =1; - MKL_INT mnum =1; - MKL_INT phase =13; - MKL_INT MKL_INT_n =MKL_INT(n); - std::vector<MKL_INT> perm(n); - MKL_INT nrhs =1; -#ifdef DEBUG - MKL_INT msglvl =1; -#else //DEBUG - MKL_INT msglvl =0; -#endif//DEBUG - dcovector x(b.l); - MKL_INT error =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, &a[0], &ia[0], &ja[0], &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error); - swap(b,x);//set b as x - - if(error!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. error = " << error << "." << std::endl; - for(int i=0; i<64; i++){ - std::cerr << "iparm[" << i << "] = " << iparm[i] << std::endl; - } - } - - //////// release memory //////// - phase =-1; - MKL_INT error2 =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, &a[0], &ia[0], &ja[0], &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error2); - - return error; -#endif //__INTEL_COMPILER -} diff --git a/cpplapack-r198/.svn/pristine/c8/c8841c66a6e17b0f59bb8a04e4899d9cd5946196.svn-base b/cpplapack-r198/.svn/pristine/c8/c8841c66a6e17b0f59bb8a04e4899d9cd5946196.svn-base deleted file mode 100644 index 681782157f2ab1d9fe886042ab944d4ee5cce537..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c8/c8841c66a6e17b0f59bb8a04e4899d9cd5946196.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _zgbmatrix+_zgematrix operator */ -inline _zgematrix operator+(const _zgbmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j)+=matA(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _zgbmatrix-_zgematrix operator */ -inline _zgematrix operator-(const _zgbmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - matB(i,j) =matA(i,j)-matB(i,j); - } - } - - matA.destroy(); - return matB; -} - -//============================================================================= -/*! _zgbmatrix*_zgematrix operator */ -inline _zgematrix operator*(const _zgbmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c8/c8be23493ae3cba3e88e895397d9839491598ce1.svn-base b/cpplapack-r198/.svn/pristine/c8/c8be23493ae3cba3e88e895397d9839491598ce1.svn-base deleted file mode 100644 index 2abacd190e4aced420f554e2e5d022db8bf6cf42..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c8/c8be23493ae3cba3e88e895397d9839491598ce1.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -//============================================================================= -/*! double*_zcovector operator */ -inline _zcovector operator*(const double& d, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zdscal_(&vec.l, &d, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/c8/c8cb445c39c4231850a031529c511d7d6ab4639c.svn-base b/cpplapack-r198/.svn/pristine/c8/c8cb445c39c4231850a031529c511d7d6ab4639c.svn-base deleted file mode 100644 index 9d81933b816c6975f967f023047f0633bd118c41..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c8/c8cb445c39c4231850a031529c511d7d6ab4639c.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! _dgsmatrix*double operator */ -inline _dgsmatrix operator*(const _dgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *= d; - } - - return mat; -} - -//============================================================================= -/*! _dgsmatrix/double operator */ -inline _dgsmatrix operator/(const _dgsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v /= d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/c8/c8d033bce0c9081cfc366c169af73ab3097b67a4.svn-base b/cpplapack-r198/.svn/pristine/c8/c8d033bce0c9081cfc366c169af73ab3097b67a4.svn-base deleted file mode 100644 index 77d3269b863187b8ead8f39a12b2e0ccab8a7808..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c8/c8d033bce0c9081cfc366c169af73ab3097b67a4.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! zgsmatrix+_zhematrix operator */ -inline _zgematrix operator+(const zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matB.to_zgematrix() ); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix-_zhematrix operator */ -inline _zgematrix operator-(const zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( (-matB).to_zgematrix() ); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix*_zhematrix operator */ -inline _zgematrix operator*(const zgsmatrix& matA, const _zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c9/c961c05101c265f07b47e1bc3657f6c1f148545b.svn-base b/cpplapack-r198/.svn/pristine/c9/c961c05101c265f07b47e1bc3657f6c1f148545b.svn-base deleted file mode 100644 index 184390ec2f9508b645552f082ded7dd813b53f9b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c9/c961c05101c265f07b47e1bc3657f6c1f148545b.svn-base +++ /dev/null @@ -1,17 +0,0 @@ -//============================================================================= -/*! +_dgbmatrix operator */ -inline const _dgbmatrix& operator+(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_dgbmatrix operator */ -inline _dgbmatrix operator-(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<(mat.kl+mat.ku+1)*mat.n; i++){ - mat.array[i]=-mat.array[i]; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/c9/c96667597674c8688b42ab0eaf11ea92920f1290.svn-base b/cpplapack-r198/.svn/pristine/c9/c96667597674c8688b42ab0eaf11ea92920f1290.svn-base deleted file mode 100644 index f43eac80c15346199a04dde41e178891e87514d4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c9/c96667597674c8688b42ab0eaf11ea92920f1290.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::zhematrix A(N), B(N); - CPPL::zgematrix X(N,N), Y(N,N), Z(N,N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - B(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - for(int i=0; i<A.n; i++){ for(int j=0; j<A.n; j++){ - if(i>=j){ - X(i,j) = -A(i,j); - Y(i,j) = A(i,j); - } - else{ - X(i,j) = conj(-A(j,i)); - Y(i,j) = conj(A(j,i)); - } - }} - - for(int i=0; i<A.n; i++){ for(int j=0; j<A.n; j++){ - Z(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - cout << "X =\n" << X << endl; - cout << "Y =\n" << Y << endl; - cout << "Z =\n" << Z << endl; - - cout << "X+A = (Should be zero)\n" << X+A << endl; - cout << "Y-A = (Should be zero)\n" << Y-A << endl; - cout << "Z*A-Z*Y = (Should be zero)\n" << Z*A-Z*Y << endl; - - CPPL::zgematrix W; - cout << "W=-A;" << endl; - W=-A.to_zgematrix(); - cout << "W =\n" << W << endl; - cout << "W+=A;" << endl; - W+=A; - cout << "W = (Should be zero)\n" << W << endl; - cout << "W=A;" << endl; - W=A.to_zgematrix(); - cout << "W-=A;" << endl; - W-=A; - cout << "W = (Should be zero)\n" << W << endl; - cout << "W.identity();" << endl; - W.identity(); - cout << "W*=A;" << endl; - W*=A; - cout << "W =\n" << W << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/c9/c982b02e548abc635f9fc55a72604ff7a79a5fe8.svn-base b/cpplapack-r198/.svn/pristine/c9/c982b02e548abc635f9fc55a72604ff7a79a5fe8.svn-base deleted file mode 100644 index f50d0fa803c1ea75c4f61a347c43086a9b5a686c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c9/c982b02e548abc635f9fc55a72604ff7a79a5fe8.svn-base +++ /dev/null @@ -1,152 +0,0 @@ -//============================================================================= -/*! zgematrix=_zgematrix operator */ -inline zgematrix& zgematrix::operator=(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+=_zgematrix operator */ -inline zgematrix& zgematrix::operator+=(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] += mat.array[i]; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zgematrix-=_zgematrix operator */ -inline zgematrix& zgematrix::operator-=(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =m*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] -= mat.array[i]; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! zgematrix*=_zgematrix operator */ -inline zgematrix& zgematrix::operator*=(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( m, mat.n ); - char transa ='n'; - char transb ='n'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zgemm_( &transa, &transb, &m, &mat.n, &n, &alpha, array, &m, mat.array, &mat.m, &beta, newmat.array, &m ); - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+_zgematrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - matB.array[i] +=matA.array[i]; - } - - return matB; -} - -//============================================================================= -/*! zgematrix-_zgematrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =matA.m*matA.n; - for(CPPL_INT i=0; i<size; i++){ - matB.array[i] =matA.array[i]-matB.array[i]; - } - - return matB; -} - -//============================================================================= -/*! zgematrix*_zgematrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c9/c98cf8215dff9f8bf69fd53dc77b9337bb0c527d.svn-base b/cpplapack-r198/.svn/pristine/c9/c98cf8215dff9f8bf69fd53dc77b9337bb0c527d.svn-base deleted file mode 100644 index ef39f223bfb6c2e8d1234620646a479b6e82c8b7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c9/c98cf8215dff9f8bf69fd53dc77b9337bb0c527d.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! comple*_zhematrix operator */ -inline _zgematrix operator*(const comple& d, const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - zgematrix newmat =mat.to_zgematrix(); - - CPPL_INT size =mat.n*mat.n; - CPPL_INT inc =1; - zscal_(&size, &d, newmat.array, &inc); - - mat.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c9/c9e7af626f88c46694b9b611ed12e5533d38a1c7.svn-base b/cpplapack-r198/.svn/pristine/c9/c9e7af626f88c46694b9b611ed12e5533d38a1c7.svn-base deleted file mode 100644 index dfed23693af269b21d7ad0b12a09199af8c211cf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c9/c9e7af626f88c46694b9b611ed12e5533d38a1c7.svn-base +++ /dev/null @@ -1,144 +0,0 @@ -//============================================================================= -/*! zgematrix+=zhematrix operator */ -inline zgematrix& zgematrix::operator+=(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m; i++){ - for( CPPL_INT j=0; j<n; j++){ - operator()(i,j) += mat(i,j); - } - } - - return *this; -} - -//============================================================================= -/*! zgematrix-=zhematrix operator */ -inline zgematrix& zgematrix::operator-=(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - operator()(i,j) -= mat(i,j); - } - } - - return *this; -} - -//============================================================================= -/*! zgematrix*=zhematrix operator */ -inline zgematrix& zgematrix::operator*=(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( m, mat.n ); - char side ='R'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &mat.n, &n, &alpha, mat.array, &mat.n, array, &m, &beta, newmat.array, &newmat.m ); - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgematrix+zhematrix operator */ -inline _zgematrix operator+(const zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) += matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix-zhematrix operator */ -inline _zgematrix operator-(const zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zgematrix*zhematrix operator */ -inline _zgematrix operator*(const zgematrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matA.n ); - char side ='R'; - char uplo ='l'; - comple alpha =comple(1.,0.); - comple beta =comple(0.,0.); - - zhemm_( &side, &uplo, &newmat.m, &newmat.n, &alpha, matB.array, &matB.n, matA.array, &matA.m, &beta, newmat.array, &newmat.m ); - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/c9/c9fdc12ce7ac8768c688754bb78978226b430106.svn-base b/cpplapack-r198/.svn/pristine/c9/c9fdc12ce7ac8768c688754bb78978226b430106.svn-base deleted file mode 100644 index 19a8fe0d83c505572ef55da4aa7e6d8b1e19d831..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/c9/c9fdc12ce7ac8768c688754bb78978226b430106.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! nullify all the vector data */ -inline void _zcovector::nullify() const -{CPPL_VERBOSE_REPORT; - l=0; - array=NULL; -} - -//============================================================================= -/*! destroy all the vector data */ -inline void _zcovector::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - array=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/ca/caa603f45cf8d14f6b053919dc06ccbcd33e95dd.svn-base b/cpplapack-r198/.svn/pristine/ca/caa603f45cf8d14f6b053919dc06ccbcd33e95dd.svn-base deleted file mode 100644 index 4600375e4a56c042223d5ff94b3541e14ac13cdf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ca/caa603f45cf8d14f6b053919dc06ccbcd33e95dd.svn-base +++ /dev/null @@ -1,375 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void dgsmatrix::clear() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - data.clear(); - rows.clear(); - cols.clear(); -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline dgsmatrix& dgsmatrix::zero() -{CPPL_VERBOSE_REPORT; - data.resize(0); - for(CPPL_INT i=0; i<m; i++){ rows[i].resize(0); } - for(CPPL_INT j=0; j<n; j++){ cols[j].resize(0); } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline dgsmatrix& dgsmatrix::identity() -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "Only square matrix can be a identity matrix." << std::endl - << "The matrix size was " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zero(); - for(CPPL_INT i=0; i<m; i++){ - put(i,i,1.); - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void dgsmatrix::chsign() -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v =-it->v; - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void dgsmatrix::copy(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - data =mat.data; - rows =mat.rows; - cols =mat.cols; -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void dgsmatrix::shallow_copy(const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - data.clear(); - rows.clear(); - cols.clear(); - - m =mat.m; - n =mat.n; - data.swap(mat.data); - rows.swap(mat.rows); - cols.swap(mat.cols); - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline dgsmatrix& dgsmatrix::resize(const CPPL_INT& _m, const CPPL_INT& _n, const CPPL_INT _c, const CPPL_INT _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _c<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes and the length of arrays must be positive integers. " << std::endl - << "Your input was (" << _m << "," << _n << "," << _c << "," << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - m =_m; - n =_n; - data.resize(0); - data.reserve(_c); - rows.resize(m); - for(CPPL_INT i=0; i<m; i++){ - rows[i].resize(0); - rows[i].reserve(_l); - } - cols.resize(n); - for(CPPL_INT i=0; i<n; i++){ - cols[i].resize(0); - cols[i].reserve(_l); - } - - return *this; -} - -//============================================================================= -/*! stretch the matrix size */ -inline void dgsmatrix::stretch(const CPPL_INT& dm, const CPPL_INT& dn) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( m+dm<0 || n+dn<0 ){ - ERROR_REPORT; - std::cerr << "The new matrix size must be larger than zero. " << std::endl - << "Your input was (" << dm << ", " << dn << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// zero //////// - if(dm==0 && dn==0){ return; } - - //////// non-zero //////// - m +=dm; - n +=dn; - - //// for rows //// - if(dm<0){ - //// delete components over the new size //// - const std::vector<dcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( it->i>=m ){ del( CPPL_INT(data_rend-it-1) ); } - } - //// shrink rows //// - for(CPPL_INT i=0; i<-dm; i++){ - rows.pop_back(); - } - } - else{//dm>0 - //// expand rows //// - for(CPPL_INT i=0; i<dm; i++){ - rows.push_back( std::vector<CPPL_INT>(0) ); - } - } - - //// for cols //// - if(dn<0){ - //// delete components over the new size //// - const std::vector<dcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( it->j>=n ){ del( CPPL_INT(data_rend-it-1) ); } - } - for(CPPL_INT j=0; j<-dn; j++){ - cols.pop_back(); - } - } - else{//dn>0 - //// expand cols //// - for(CPPL_INT j=0; j<dn; j++){ - cols.push_back( std::vector<CPPL_INT>(0) ); - } - } -} - -//============================================================================= -/*! check if the component is listed */ -inline bool dgsmatrix::isListed(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - const std::vector<CPPL_INT>::const_iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::const_iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){ return 1; } - } - - return 0; -} - - -//============================================================================= -/*! return the element number of the component */ -inline CPPL_INT dgsmatrix::number(const CPPL_INT& i, const CPPL_INT& j) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - const std::vector<CPPL_INT>::iterator rows_i_end =rows[i].end(); - for(std::vector<CPPL_INT>::iterator p=rows[i].begin(); p!=rows_i_end; p++){ - if(data[*p].j==j){ return *p; } - } - - return -1; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _drovector dgsmatrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector vec(n); - vec.zero(); - - const std::vector<CPPL_INT>::const_iterator rows__m_end =rows[_m].end(); - for(std::vector<CPPL_INT>::const_iterator p=rows[_m].begin(); p!=rows__m_end; p++){ - vec(data[*p].j) =data[*p].v; - } - - return _(vec); -} - -//============================================================================= -/*! get column of the matrix */ -inline _dcovector dgsmatrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector vec(m); - vec.zero(); - - const std::vector<CPPL_INT>::const_iterator cols__n_end =cols[_n].end(); - for(std::vector<CPPL_INT>::const_iterator p=cols[_n].begin(); p!=cols__n_end; p++){ - vec(data[*p].i) =data[*p].v; - } - - return _(vec); -} - -//============================================================================= -/*! erase components less than DBL_MIN */ -inline void dgsmatrix::diet(const double eps) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( fabs(it->v)<eps ){ del( CPPL_INT(data_rend-it-1) ); } - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! health checkup */ -inline void dgsmatrix::checkup() -{CPPL_VERBOSE_REPORT; - //////// write //////// - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - std::cerr << "array[" << it-data.begin() << "] = (" << it->i << "," << it->j << ") = " << it->v << std::endl; - } - std::cerr << std::endl; - - for(CPPL_INT i=0; i<m; i++){ - std::cerr << "rows[" << i << "] =" << std::flush; - const size_t rows_i_size =rows[i].size(); - for(size_t k=0; k<rows_i_size; k++){ - std::cerr << " " << rows[i][k] << std::flush; - } - std::cerr << std::endl; - } - std::cerr << std::endl; - - for(CPPL_INT j=0; j<n; j++){ - std::cerr << "cols[" << j << "] =" << std::flush; - const size_t cols_j_size =cols[j].size(); - for(size_t k=0; k<cols_j_size; k++){ - std::cerr << " " << cols[j][k] << std::flush; - } - std::cerr << std::endl; - } - - //////// Elements //////// - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - //// m bound //// - if(it->i>=m){ - ERROR_REPORT; - std::cerr << "The indx of the " << it-data.begin() << "th element is out of the matrix size." << std::endl - << "Its i index was " << it->i << "." << std::endl; - exit(1); - } - - //// n bound //// - if(it->j>=n){ - ERROR_REPORT; - std::cerr << "The indx of the " << it-data.begin() << "th element is out of the matrix size." << std::endl - << "Its j index was " << it->j << "." << std::endl; - exit(1); - } - - //// double-listed //// - for(std::vector<dcomponent>::const_iterator IT=it+1; IT!=data_end; IT++){ - if( it->i==IT->i && it->j==IT->j ){ - ERROR_REPORT; - std::cerr << "The (" << it->i << ", " << it->j << ") component is double-listed at the " << it-data.begin() << "th and the" << IT-data.begin() << "the elements."<< std::endl; - exit(1); - } - } - } - - //////// ijc consistence //////// - - - //////// NOTE //////// - std::cerr << "# [NOTE]@dgsmatrix::checkup(): This sparse matrix is fine." << std::endl; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(dgsmatrix& A, dgsmatrix& B) -{CPPL_VERBOSE_REPORT; - std::swap(A.n,B.n); - std::swap(A.m,B.m); - std::swap(A.data,B.data); - std::swap(A.rows,B.rows); - std::swap(A.cols,B.cols); -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _dgsmatrix _(dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - _dgsmatrix newmat; - - //////// shallow copy //////// - newmat.n =mat.n; - newmat.m =mat.m; - std::swap(newmat.data,mat.data); - std::swap(newmat.rows,mat.rows); - std::swap(newmat.cols,mat.cols); - - //////// nullify //////// - mat.m =0; - mat.n =0; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/ca/cae3f13873da92e4a8378e45895678271297db8b.svn-base b/cpplapack-r198/.svn/pristine/ca/cae3f13873da92e4a8378e45895678271297db8b.svn-base deleted file mode 100644 index 451b36542c8d5a04cf0f16f8090d1629076b7ab3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ca/cae3f13873da92e4a8378e45895678271297db8b.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! zgematrix*zcovector operator */ -inline _zcovector operator*(const zgematrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/ca/caf097571a2538bb84399b2db3340fed0b083cc4.svn-base b/cpplapack-r198/.svn/pristine/ca/caf097571a2538bb84399b2db3340fed0b083cc4.svn-base deleted file mode 100644 index ce5b26227579cb5b12a73bed31914e0375108c49..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ca/caf097571a2538bb84399b2db3340fed0b083cc4.svn-base +++ /dev/null @@ -1,432 +0,0 @@ -//============================================================================= -/*! convert zcovector_small to zcovector */ -template<CPPL_INT l> -inline _zcovector zcovector_small<l>::to_zcovector() const -{CPPL_VERBOSE_REPORT; - zcovector vec(l); - for(CPPL_INT k=0; k<l; k++){ - vec(k) =(*this)(k); - } - return _(vec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT l> -inline comple& zcovector_small<l>::operator()(const CPPL_INT& k) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT l> -inline comple zcovector_small<l>::operator()(const CPPL_INT& k) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! set */ -template<CPPL_INT l> -inline zcovector_small<l>& zcovector_small<l>::set(const CPPL_INT& k, const comple& v) -{CPPL_VERBOSE_REPORT; - (*this)(k) =v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT l> -inline std::ostream& operator<<(std::ostream& s, const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<l; i++){ - s << A(i) << std::endl; - } - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT l> -inline void zcovector_small<l>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zcovector" << " " << l << std::endl; - for(CPPL_INT k=0; k<l; k++){ - ofs << (*this)(k) << std::endl; - } - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT l> -inline void zcovector_small<l>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zcovector" && id != "#zcovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zcovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _l; - s >> _l; - if(l!=_l){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - for(CPPL_INT k=0; k<l; k++){ - s >> (*this)(k); - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id;//tmp - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return transposed zrovector_small */ -template<CPPL_INT l> -inline zrovector_small<l> t(const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i); - } - return X; -} - -//============================================================================= -/*! return its 2-norm */ -template<CPPL_INT l> -inline comple nrm2(const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - comple v(0); - for(CPPL_INT i=0; i<l; i++){ - v+=A(i)*A(i); - } - return std::sqrt(v); -} - -//============================================================================= -/*! return index of the maximum component */ -template<CPPL_INT l> -inline void idamax(CPPL_INT& K, const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - comple max(-1.); - for(int k=0; k<l; k++){ - if( max<fabs(A(k)) ){ - K=k; - max =fabs(A(k)); - } - } - return; -} - -//============================================================================= -/*! return the maximum component */ -template<CPPL_INT l> -inline comple damax(const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - CPPL_INT k(0); - idamax(k,A); - return A(k); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zero */ -template<CPPL_INT l> -inline zcovector_small<l>& zcovector_small<l>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<l; k++){ - array[k] =0.; - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector_small+=zcovector_small operator */ -template<CPPL_INT l> -inline zcovector_small<l>& operator+=(zcovector_small<l>& A, const zcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) +=B(i); - } - return A; -} - -//============================================================================= -/*! zcovector_small-=zcovector_small operator */ -template<CPPL_INT l> -inline zcovector_small<l>& operator-=(zcovector_small<l>& A, const zcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) -=B(i); - } - return A; -} - -//============================================================================= -/*! zcovector_small*=double operator */ -template<CPPL_INT l> -inline zcovector_small<l>& operator*=(zcovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) *=v; - } - return A; -} - -//============================================================================= -/*! zcovector_small*=comple operator */ -template<CPPL_INT l> -inline zcovector_small<l>& operator*=(zcovector_small<l>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) *=v; - } - return A; -} - -//============================================================================= -/*! zcovector_small/=double operator */ -template<CPPL_INT l> -inline zcovector_small<l>& operator/=(zcovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) /=v; - } - return A; -} - -//============================================================================= -/*! zcovector_small/=comple operator */ -template<CPPL_INT l> -inline zcovector_small<l>& operator/=(zcovector_small<l>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) /=v; - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary + operator */ -template<CPPL_INT l> -inline const zcovector_small<l>& operator+(const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary - operator */ -template<CPPL_INT l> -inline zcovector_small<l> operator-(const zcovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - zcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =-A(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector_small+zcovector_small operator */ -template<CPPL_INT l> -inline zcovector_small<l> operator+(const zcovector_small<l>& A, const zcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - zcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)+B(i); - } - return X; -} - -//============================================================================= -/*! zcovector_small-zcovector_small operator */ -template<CPPL_INT l> -inline zcovector_small<l> operator-(const zcovector_small<l>& A, const zcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - zcovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)-B(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector_small*double operator */ -template<CPPL_INT n> -inline zcovector_small<n> operator*(const zcovector_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zcovector_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - C(i) =A(i)*v; - } - return C; -} - -//============================================================================= -/*! zcovector_small*comple operator */ -template<CPPL_INT n> -inline zcovector_small<n> operator*(const zcovector_small<n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zcovector_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - C(i) =A(i)*v; - } - return C; -} - -//============================================================================= -/*! zcovector_small*zrovector_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zgematrix_small<m,n> operator*(const zcovector_small<m>& A, const zrovector_small<n>& B) -{CPPL_VERBOSE_REPORT; - zgematrix_small<m,n> mat; - for(CPPL_INT i=0; i<m; i++){ - for(CPPL_INT j=0; j<n; j++){ - mat(i,j) =A(i)*B(j); - } - } - return mat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector_small/double operator */ -template<CPPL_INT n> -inline zcovector_small<n> operator/(const zcovector_small<n>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zcovector_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - C(i) =A(i)/v; - } - return C; -} - -//============================================================================= -/*! zcovector_small/comple operator */ -template<CPPL_INT n> -inline zcovector_small<n> operator/(const zcovector_small<n>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zcovector_small<n> C; - for(CPPL_INT i=0; i<n; i++){ - C(i) =A(i)/v; - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector_small%zcovector_small (inner product) operator */ -template<CPPL_INT l> -inline comple operator%(const zcovector_small<l>& A, const zcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - comple v(0.); - for(CPPL_INT i=0; i<l; i++){ - v +=A(i)*B(i); - } - return v; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT l> -inline zcovector_small<l> hadamard(const zcovector_small<l>& A, const zcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - zcovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)*B(i); - } - return C; -} diff --git a/cpplapack-r198/.svn/pristine/cb/cb577b1cd1dab796d1e62adffc57bd2a6fbf95be.svn-base b/cpplapack-r198/.svn/pristine/cb/cb577b1cd1dab796d1e62adffc57bd2a6fbf95be.svn-base deleted file mode 100644 index 16d1616d63bbe4aa3817b47d8175e249bf9c1391..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cb/cb577b1cd1dab796d1e62adffc57bd2a6fbf95be.svn-base +++ /dev/null @@ -1,112 +0,0 @@ -//============================================================================= -/*! drovector=_drovector operator */ -inline drovector& drovector::operator=(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - shallow_copy(vec); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector+=_drovector operator */ -inline drovector& drovector::operator+=(const _drovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << l << ") += (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]+=vec.array[i]; } - - vec.destroy(); - return *this; -} - -//============================================================================= -/*! drovector operator-= */ -inline drovector& drovector::operator-=(const _drovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << l << ") -= (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<l; i++){ array[i]-=vec.array[i]; } - - vec.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! drovector+drovector operator */ -inline _drovector operator+(const drovector& vecA, const _drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ vecB.array[i]+=vecA.array[i]; } - - return vecB; -} - -//============================================================================= -/*! drovector-drovector operator */ -inline _drovector operator-(const drovector& vecA, const _drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ - vecB.array[i] =vecA.array[i]-vecB.array[i]; - } - - return vecB; -} - -//============================================================================= -/*! drovector^T*drovector operator (inner product) */ -inline double operator%(const drovector& vecA, const _drovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecB.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/cb/cba2f00bd146c404af122fa83d227f1554141d47.svn-base b/cpplapack-r198/.svn/pristine/cb/cba2f00bd146c404af122fa83d227f1554141d47.svn-base deleted file mode 100644 index 7ead1aa0667ecbcf062e2afde1984a72f55d6f30..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cb/cba2f00bd146c404af122fa83d227f1554141d47.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! _drovector*dssmatrix operator */ -inline _drovector operator*(const _drovector& vec, const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) +=vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) +=vec(it->j)*it->v; - } - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/cc/cc078d61a70bda17c8aec63c241d577619ccbe10.svn-base b/cpplapack-r198/.svn/pristine/cc/cc078d61a70bda17c8aec63c241d577619ccbe10.svn-base deleted file mode 100644 index 9412e58da2f94dec1417596c08d0df6cf9df3e5e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cc/cc078d61a70bda17c8aec63c241d577619ccbe10.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -//============================================================================= -/*! _drovector*dcovector operator */ -inline double operator*(const _drovector& rovec, const dcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - double val =ddot_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - rovec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/cc/cc0dcad9d9fc2cb35b536e8f316adc466fe8f2a8.svn-base b/cpplapack-r198/.svn/pristine/cc/cc0dcad9d9fc2cb35b536e8f316adc466fe8f2a8.svn-base deleted file mode 100644 index 3259c26cdc0eb06d60ef2a944d11ab1400b9f4c5..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cc/cc0dcad9d9fc2cb35b536e8f316adc466fe8f2a8.svn-base +++ /dev/null @@ -1,454 +0,0 @@ -//============================================================================= -/*! convert zrovector_small to zrovector */ -template<CPPL_INT l> -inline _zrovector zrovector_small<l>::to_zrovector() const -{CPPL_VERBOSE_REPORT; - zrovector vec(l); - for(CPPL_INT k=0; k<l; k++){ - vec(k) =(*this)(k); - } - return _(vec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! operator() */ -template<CPPL_INT l> -inline comple& zrovector_small<l>::operator()(const CPPL_INT& k) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! operator() for const */ -template<CPPL_INT l> -inline comple zrovector_small<l>::operator()(const CPPL_INT& k) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( k<0 || l<=k ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << k << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[k]; -} - -//============================================================================= -/*! set */ -template<CPPL_INT l> -inline zrovector_small<l>& zrovector_small<l>::set(const CPPL_INT& k, const comple& v) -{CPPL_VERBOSE_REPORT; - (*this)(k) =v; - return *this; -} - -//============================================================================= -/*! operator<< */ -template<CPPL_INT l> -inline std::ostream& operator<<(std::ostream& s, const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - s << std::setiosflags(std::ios::showpos); - for(CPPL_INT i=0; i<l; i++){ - s << " " << A(i) << std::flush; - } - s << std::endl; - return s; -} - -//============================================================================= -/*! write to file */ -template<CPPL_INT l> -inline void zrovector_small<l>::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zrovector" << " " << l << std::endl; - for(CPPL_INT k=0; k<l; k++){ - ofs << (*this)(k) << std::endl; - } - ofs.close(); -} - -//============================================================================= -/*! read from file */ -template<CPPL_INT l> -inline void zrovector_small<l>::read(const char* filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s( filename ); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zrovector" && id != "#zrovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zrovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - CPPL_INT _l; - s >> _l; - if(l!=_l){ - ERROR_REPORT; - std::cerr << "Matrix size is invalid." << std::endl; - exit(1); - } - for(CPPL_INT k=0; k<l; k++){ - s >> (*this)(k); - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id;//tmp - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return transposed zrovector_small */ -template<CPPL_INT n> -inline zcovector_small<n> t(const zrovector_small<n>& A) -{CPPL_VERBOSE_REPORT; - zcovector_small<n> X; - for(CPPL_INT i=0; i<n; i++){ - X(i)=A(i); - } - return X; -} - -//============================================================================= -/*! return its 2-norm */ -template<CPPL_INT l> -inline double nrm2(const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - double v(0.); - for(CPPL_INT i=0; i<l; i++){ - v+=A(i)*A(i); - } - return std::sqrt(v); -} - -//============================================================================= -/*! find index of the maximum component */ -template<CPPL_INT l> -inline void idamax(CPPL_INT& K, const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - double max(-1.); - for(int k=0; k<l; k++){ - if( max<fabs(A(k)) ){ - K=k; - max =fabs(A(k)); - } - } - return; -} - -//============================================================================= -/*! return the maximum component */ -template<CPPL_INT l> -inline comple damax(const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - CPPL_INT k(0); - idamax(k,A); - return A(k); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zero */ -template<CPPL_INT l> -inline zrovector_small<l>& zrovector_small<l>::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT k=0; k<l; k++){ - array[k] =0.; - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector_small+=zrovector_small operator */ -template<CPPL_INT l> -inline zrovector_small<l>& operator+=(zrovector_small<l>& A, const zrovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) +=B(i); - } - return A; -} - -//============================================================================= -/*! zrovector_small-=zrovector_small operator */ -template<CPPL_INT l> -inline zrovector_small<l>& operator-=(zrovector_small<l>& A, const zrovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) -=B(i); - } - return A; -} - -//============================================================================= -/*! zrovector_small*=double operator */ -template<CPPL_INT l> -inline zrovector_small<l>& operator*=(zrovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) *=v; - } - return A; -} - -//============================================================================= -/*! zrovector_small*=comple operator */ -template<CPPL_INT l> -inline zrovector_small<l>& operator*=(zrovector_small<l>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) *=v; - } - return A; -} - -//============================================================================= -/*! zrovector_small/=double operator */ -template<CPPL_INT l> -inline zrovector_small<l>& operator/=(zrovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) /=v; - } - return A; -} - -//============================================================================= -/*! zrovector_small/=comple operator */ -template<CPPL_INT l> -inline zrovector_small<l>& operator/=(zrovector_small<l>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ - A(i) /=v; - } - return A; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! unary + operator */ -template<CPPL_INT l> -inline const zrovector_small<l>& operator+(const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - return A; -} - -//============================================================================= -/*! unary - operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator-(const zrovector_small<l>& A) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =-A(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector_small+zrovector_small operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator+(const zrovector_small<l>& A, const zrovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)+B(i); - } - return X; -} - -//============================================================================= -/*! zrovector_small-zrovector_small operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator-(const zrovector_small<l>& A, const zrovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> X; - for(CPPL_INT i=0; i<l; i++){ - X(i) =A(i)-B(i); - } - return X; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector_small*zcovector_small operator */ -template<CPPL_INT l> -inline comple operator*(const zrovector_small<l>& A, const zcovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - comple x =0.; - for(CPPL_INT i=0; i<l; i++){ - x +=A(i)*B(i); - } - return x; -} - -//============================================================================= -/*! zrovector_small*zgematrix_small operator */ -template<CPPL_INT m, CPPL_INT n> -inline zrovector_small<n> operator*(const zrovector_small<m>& A, const zgematrix_small<m,n>& B) -{CPPL_VERBOSE_REPORT; - zrovector_small<n> C; - C.zero(); - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=0; i<m; i++){ - C(j) +=A(i)*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! zrovector_small*zhematrix_small operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator*(const zrovector_small<l>& A, const zhematrix_small<l>& B) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> C; - C.zero(); - for(CPPL_INT j=0; j<l; j++){ - for(CPPL_INT i=0; i<j; i++){ - C(j) +=A(i)*B(j,i); - } - for(CPPL_INT i=j; i<l; i++){ - C(j) +=A(i)*B(i,j); - } - } - return C; -} - -//============================================================================= -/*! zrovector_small*double operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator*(const zrovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)*v; - } - return C; -} - -//============================================================================= -/*! zrovector_small*comple operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator*(const zrovector_small<l>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)*v; - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector_small/double operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator/(const zrovector_small<l>& A, const double& v) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)/v; - } - return C; -} - -//============================================================================= -/*! zrovector_small/comple operator */ -template<CPPL_INT l> -inline zrovector_small<l> operator/(const zrovector_small<l>& A, const comple& v) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)/v; - } - return C; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! Hadamard product */ -template<CPPL_INT l> -inline zrovector_small<l> hadamard(const zrovector_small<l>& A, const zrovector_small<l>& B) -{CPPL_VERBOSE_REPORT; - zrovector_small<l> C; - for(CPPL_INT i=0; i<l; i++){ - C(i) =A(i)*B(i); - } - return C; -} diff --git a/cpplapack-r198/.svn/pristine/cc/cc3c9419f65e69e9a57333d364ea054e03f3daa2.svn-base b/cpplapack-r198/.svn/pristine/cc/cc3c9419f65e69e9a57333d364ea054e03f3daa2.svn-base deleted file mode 100644 index d45143b460ce51cdffc567793a2998461722bdc9..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cc/cc3c9419f65e69e9a57333d364ea054e03f3daa2.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _dgematrix+dgsmatrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - matA(it->i,it->j) += it->v; - } - - return matA; -} - -//============================================================================= -/*! _dgematrix-dgsmatrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matA.m*matA.n; i++){ - matA.array[i]=-matA.array[i]; - } - - //// add //// - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - matA(it->i,it->j) += it->v; - } - - return matA; -} - -//============================================================================= -/*! _dgematrix*dgsmatrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.m; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/cc/cc7081597ffbea7661c2b8ea3f5255dde5fff3ef.svn-base b/cpplapack-r198/.svn/pristine/cc/cc7081597ffbea7661c2b8ea3f5255dde5fff3ef.svn-base deleted file mode 100644 index f5730d173960554855db4c69176b10baef281817..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cc/cc7081597ffbea7661c2b8ea3f5255dde5fff3ef.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zrovector*_zhematrix operator */ -inline _zrovector operator*(const _zrovector& vec, const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/cd/cd41c7a834678b657004388345396143c1850cce.svn-base b/cpplapack-r198/.svn/pristine/cd/cd41c7a834678b657004388345396143c1850cce.svn-base deleted file mode 100644 index a60832c73518d31061f3e7cca8406d132e210e11..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cd/cd41c7a834678b657004388345396143c1850cce.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -//============================================================================= -/*! zgsmatrix*=comple operator */ -inline zgsmatrix& zgsmatrix::operator*=(const comple& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v *=d; - } - - return *this; -} - -//============================================================================= -/*! zgsmatrix/=comple operator */ -inline zgsmatrix& zgsmatrix::operator/=(const comple& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v /=d; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix*comple operator */ -inline _zgsmatrix operator*(const zgsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *=d; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix/comple operator */ -inline _zgsmatrix operator/(const zgsmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v /=d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/cd/cd6231b1bfcf201110bdca4c35780db90616afed.svn-base b/cpplapack-r198/.svn/pristine/cd/cd6231b1bfcf201110bdca4c35780db90616afed.svn-base deleted file mode 100644 index 87fb517de39fb52c7ca2e9c9c3f92e9e193c3324..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cd/cd6231b1bfcf201110bdca4c35780db90616afed.svn-base +++ /dev/null @@ -1,151 +0,0 @@ -//============================================================================= -/*! clear vector */ -inline void dcovector::clear() -{CPPL_VERBOSE_REPORT; - l =0; - cap =0; - delete [] array; - array =NULL; -} - -//============================================================================= -/*! make vector into zero vector */ -inline dcovector& dcovector::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ array[i] =0.0; } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the vector */ -inline void dcovector::chsign() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<l; i++){ array[i] =-array[i]; } -} - -//============================================================================= -/*! make a deep copy of the dcovector */ -inline void dcovector::copy(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - delete [] array; - array =new double[cap]; - CPPL_INT inc =1; - dcopy_(&vec.l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the vector\n - This function is not desinged to be used in project codes. */ -inline void dcovector::shallow_copy(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - delete [] array; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! make an alias of the vector\n - Be carefull to use this function not to cause double free. */ -inline void dcovector::alias(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - delete [] array; - array =vec.array; -} - -//============================================================================= -/*! unalias the vector */ -inline void dcovector::unalias() -{CPPL_VERBOSE_REPORT; - l =0; - cap =0; - array =NULL; -} - -//============================================================================= -/*! resize vector */ -inline dcovector& dcovector::resize(const CPPL_INT& _l, const CPPL_INT margin) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers." << std::endl - << "Your input was (" << _l << ", " << margin << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - l =_l; - cap =l+margin; - delete [] array; - array =new double[cap]; - - return *this; -} - -//============================================================================= -/*! stretch or shrink vector */ -inline void dcovector::stretch(const CPPL_INT& dl) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l+dl<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers." << std::endl - << "Your input was (" << dl << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// zero //////// - if(dl==0){ return; } - - //////// non-zero //////// - l +=dl; - if(l>cap){ - while(l>cap){ - cap++; - cap*=2; - } - CPPL_INT newl =l-dl; - CPPL_INT inc =1; - double* newArray(new double[cap]); - dcopy_(&newl, array, &inc, newArray, &inc); - delete [] array; - array =newArray; - } -} - -//============================================================================= -/*! swap two vectors */ -inline void swap(dcovector& u, dcovector& v) -{CPPL_VERBOSE_REPORT; - CPPL_INT u_cap(u.cap), u_l(u.l); - double* u_array(u.array); - u.l=v.l; u.cap=v.cap; u.array=v.array; - v.l=u_l; v.cap=u_cap; v.array=u_array; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _dcovector _(dcovector& vec) -{CPPL_VERBOSE_REPORT; - _dcovector newvec; - - //////// shallow copy //////// - newvec.l =vec.l; - newvec.cap =vec.cap; - newvec.array =vec.array; - - //////// nullify //////// - vec.l =0; - vec.cap =0; - vec.array =NULL; - - return newvec; -} diff --git a/cpplapack-r198/.svn/pristine/cd/cdc5ad74fb17735812e263c3c237b86bece109f3.svn-base b/cpplapack-r198/.svn/pristine/cd/cdc5ad74fb17735812e263c3c237b86bece109f3.svn-base deleted file mode 100644 index 513d38d34ef927b76442e16f10f682f4e7ebd7db..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cd/cdc5ad74fb17735812e263c3c237b86bece109f3.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! +_drovector operator */ -inline const _drovector& operator+(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -_drovector operator */ -inline _drovector operator-(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ - vec.array[i] =-vec.array[i]; - } - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/cd/cde335bcc7750a33390fed8ae3684c21972735da.svn-base b/cpplapack-r198/.svn/pristine/cd/cde335bcc7750a33390fed8ae3684c21972735da.svn-base deleted file mode 100644 index 11069d6324e6d6404b12c23da53952de8000744d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cd/cde335bcc7750a33390fed8ae3684c21972735da.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - CPPL::dcovector x(L); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "x =\n" << x << endl; - cout << "x*10. =\n" << x*10. << endl; - cout << "x/10. =\n" << x/10. << endl; - - cout << "#### x*=10.; ####" << endl; - x*=10.; - cout << "x =\n" << x << endl; - cout << "#### x/=10.; ####" << endl; - x/=10.; - cout << "x =\n" << x << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/ce/ce7ca9f2c94c802e346ec1fce1097bf4d11bf592.svn-base b/cpplapack-r198/.svn/pristine/ce/ce7ca9f2c94c802e346ec1fce1097bf4d11bf592.svn-base deleted file mode 100644 index d65bf9cb617ceb469021625829bf12d95b10c70a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ce/ce7ca9f2c94c802e346ec1fce1097bf4d11bf592.svn-base +++ /dev/null @@ -1,94 +0,0 @@ -//============================================================================= -//! (DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class -class _dssmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - //mutable CPPL_INT const& m; //!< matrix row size - CPPL_INT const& m; //!< matrix row size - mutable CPPL_INT n; //!< matrix column size - mutable std::vector<dcomponent> data; //!< matrix data - mutable std::vector< std::vector<CPPL_INT> > line; //!< vector of vector to store the entry information of component for each row and column - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline _dssmatrix(); - inline _dssmatrix(const _dssmatrix&); - inline ~_dssmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zhsmatrix to_zhsmatrix() const; - inline _dgematrix to_dgematrix() const; - inline _dsymatrix to_dsymatrix() const; - inline _dgsmatrix to_dgsmatrix() const; - - //////// io //////// - inline double operator()(const CPPL_INT&, const CPPL_INT&) const;//not return double& - inline friend std::ostream& operator<<(std::ostream&, const _dssmatrix&); - inline void write(const char *) const; - - //////// misc //////// - inline void nullify() const; - inline void destroy() const; - - //////// calc //////// - inline friend _dssmatrix t(const dssmatrix&); - inline friend void idamax(CPPL_INT&, CPPL_INT&, const dssmatrix&); - inline friend double damax(const dssmatrix&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// unary //////// - inline friend const _dssmatrix& operator+(const _dssmatrix&); - inline friend _dssmatrix operator-(const _dssmatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const _dssmatrix&, const dgematrix&); - inline friend _dgematrix operator+(const _dssmatrix&, const _dgematrix&); - inline friend _dgematrix operator+(const _dssmatrix&, const dsymatrix&); - inline friend _dgematrix operator+(const _dssmatrix&, const _dsymatrix&); - inline friend _dgematrix operator+(const _dssmatrix&, const dgbmatrix&); - inline friend _dgematrix operator+(const _dssmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator+(const _dssmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator+(const _dssmatrix&, const _dgsmatrix&); - inline friend _dssmatrix operator+(const _dssmatrix&, const dssmatrix&); - inline friend _dssmatrix operator+(const _dssmatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const _dssmatrix&, const dgematrix&); - inline friend _dgematrix operator-(const _dssmatrix&, const _dgematrix&); - inline friend _dgematrix operator-(const _dssmatrix&, const dsymatrix&); - inline friend _dgematrix operator-(const _dssmatrix&, const _dsymatrix&); - inline friend _dgematrix operator-(const _dssmatrix&, const dgbmatrix&); - inline friend _dgematrix operator-(const _dssmatrix&, const _dgbmatrix&); - inline friend _dgsmatrix operator-(const _dssmatrix&, const dgsmatrix&); - inline friend _dgsmatrix operator-(const _dssmatrix&, const _dgsmatrix&); - inline friend _dssmatrix operator-(const _dssmatrix&, const dssmatrix&); - inline friend _dssmatrix operator-(const _dssmatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dgematrix operator*(const _dssmatrix&, const dgematrix&); - inline friend _dgematrix operator*(const _dssmatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const _dssmatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const _dssmatrix&, const _dsymatrix&); - inline friend _dgematrix operator*(const _dssmatrix&, const dgbmatrix&); - inline friend _dgematrix operator*(const _dssmatrix&, const _dgbmatrix&); - inline friend _dgematrix operator*(const _dssmatrix&, const dgsmatrix&); - inline friend _dgematrix operator*(const _dssmatrix&, const _dgsmatrix&); - inline friend _dssmatrix operator*(const _dssmatrix&, const dssmatrix&); - inline friend _dssmatrix operator*(const _dssmatrix&, const _dssmatrix&); - inline friend _dssmatrix operator*(const _dssmatrix&, const double&); - - //////// / //////// - inline friend _dssmatrix operator/(const _dssmatrix&, const double&); - - //////// double //////// - inline friend _dssmatrix operator*(const double&, const _dssmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/ce/ce9955e40aa5b85dc1a03c1f5c64e818b91d53f0.svn-base b/cpplapack-r198/.svn/pristine/ce/ce9955e40aa5b85dc1a03c1f5c64e818b91d53f0.svn-base deleted file mode 100644 index 859462eafa819ba4c34b1eeee6e3b2193509dbac..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ce/ce9955e40aa5b85dc1a03c1f5c64e818b91d53f0.svn-base +++ /dev/null @@ -1,155 +0,0 @@ -//============================================================================= -/*! dgematrix+=dgbmatrix operator */ -inline dgematrix& dgematrix::operator+=(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) += mat(i,j); - } - } - - return *this; -} - -//============================================================================= -/*! dgematrix-=dgbmatrix operator */ -inline dgematrix& dgematrix::operator-=(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - return *this; -} - -//============================================================================= -/*! dgematrix*=dgbmatrix operator */ -inline dgematrix& dgematrix::operator*=(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - dgematrix newmat(m,mat.n); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(mat.m,j+mat.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-mat.ku); k<kmax; k++){ - newmat(i,j) += operator()(i,k)*mat(k,j); - } - } - } - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+dgbmatrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) += matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix-dgbmatrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgematrix*dgbmatrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ce/cea1ac740b3741f011edf45964354888e8a74747.svn-base b/cpplapack-r198/.svn/pristine/ce/cea1ac740b3741f011edf45964354888e8a74747.svn-base deleted file mode 100644 index 639af42cccea200e6ab1425b822edf654f6c3170..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ce/cea1ac740b3741f011edf45964354888e8a74747.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! drovector*_dgbmatrix operator */ -inline _drovector operator*(const drovector& vec, const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/cf/cf2bcc178238259a2318c0fbcc71ebae48da7ff1.svn-base b/cpplapack-r198/.svn/pristine/cf/cf2bcc178238259a2318c0fbcc71ebae48da7ff1.svn-base deleted file mode 100644 index 2f0814443efce7401c69db65e434ab27a5b91249..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/cf/cf2bcc178238259a2318c0fbcc71ebae48da7ff1.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! _zgbmatrix constructor */ -inline _zgbmatrix::_zgbmatrix() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - kl =0; - ku =0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! _zgbmatrix copy constructor */ -inline _zgbmatrix::_zgbmatrix(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _zgbmatrix destructor */ -inline _zgbmatrix::~_zgbmatrix() -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/d0/d0627cb6640ff2c9d6a6aeacf1d64e1071bd8f7a.svn-base b/cpplapack-r198/.svn/pristine/d0/d0627cb6640ff2c9d6a6aeacf1d64e1071bd8f7a.svn-base deleted file mode 100644 index f9ed13bda5183838aa7b6fc00eaf2ae0ad69466e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d0/d0627cb6640ff2c9d6a6aeacf1d64e1071bd8f7a.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _zhsmatrix::nullify() const -{CPPL_VERBOSE_REPORT; - n=0; - data.clear(); - line.clear(); -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _zhsmatrix::destroy() const -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); -} diff --git a/cpplapack-r198/.svn/pristine/d0/d07977870e780f499a79fe0ac9029aefe2bb10e4.svn-base b/cpplapack-r198/.svn/pristine/d0/d07977870e780f499a79fe0ac9029aefe2bb10e4.svn-base deleted file mode 100644 index bd412488bca0b10f01b6190f194c72286a33961a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d0/d07977870e780f499a79fe0ac9029aefe2bb10e4.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! _dssmatrix*dcovector operator */ -inline _dcovector operator*(const _dssmatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=it->v*vec(it->i); - } - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/d0/d079bce838d53ab4b409f361e49ccdcdf04ef6b6.svn-base b/cpplapack-r198/.svn/pristine/d0/d079bce838d53ab4b409f361e49ccdcdf04ef6b6.svn-base deleted file mode 100644 index 15e53bee327b7665d0822b411bfd3ff592e9e090..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d0/d079bce838d53ab4b409f361e49ccdcdf04ef6b6.svn-base +++ /dev/null @@ -1,40 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(2), KU(1); - - CPPL::drovector x(M), y; - CPPL::dgbmatrix A(M,N,KL,KU); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - cout << "x =\n" << x << endl; - cout << "A =\n" << A << endl; - - cout << "#### y=x*A; ####" << endl; - y=x*A; - cout << "y =\n" << y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/d0/d0eb247cf9813a1613f87a0bfc4e0ee0b62c93d0.svn-base b/cpplapack-r198/.svn/pristine/d0/d0eb247cf9813a1613f87a0bfc4e0ee0b62c93d0.svn-base deleted file mode 100644 index 80da670256e95dafd45e17e83bf01bac228978ed..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d0/d0eb247cf9813a1613f87a0bfc4e0ee0b62c93d0.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! zhematrix*=double operator */ -inline zhematrix& zhematrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =n*n; - CPPL_INT inc =1; - zdscal_(&size, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! zhematrix/=double operator */ -inline zhematrix& zhematrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =n*n; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&size, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix*double operator */ -inline _zhematrix operator*(const zhematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zhematrix newmat(mat.n); - - const CPPL_INT size =mat.n*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix/double operator */ -inline _zhematrix operator/(const zhematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zhematrix newmat(mat.n); - - const CPPL_INT size =mat.n*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d1/d105207769a793051389ed8cfcfee84b90aadd0a.svn-base b/cpplapack-r198/.svn/pristine/d1/d105207769a793051389ed8cfcfee84b90aadd0a.svn-base deleted file mode 100644 index fd87e0cace3e18e79163c7da4714647815543cdf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d1/d105207769a793051389ed8cfcfee84b90aadd0a.svn-base +++ /dev/null @@ -1,97 +0,0 @@ -//============================================================================= -/*! dgbmatrix constructor */ -inline dgbmatrix::dgbmatrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - kl=0; - ku=0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! dgbmatrix copy constructor */ -inline dgbmatrix::dgbmatrix(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =mat.m; - n =mat.n; - kl=mat.kl; - ku=mat.ku; - array =new double[(kl+ku+1)*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*(kl+ku+1)]; - } - - //////// copy //////// - CPPL_INT size =(kl+ku+1)*n; - CPPL_INT inc =1; - dcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! dgbmatrix constructor to cast _dgbmatrix */ -inline dgbmatrix::dgbmatrix(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! dgbmatrix constructor with size specification */ -inline dgbmatrix::dgbmatrix(const CPPL_INT& _m, const CPPL_INT& _n, - const CPPL_INT& _kl, const CPPL_INT& _ku) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){ - ERROR_REPORT; - std::cerr << "It is impossible to make a matrix you ordered. " << std::endl - << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - m =_m; - n =_n; - kl =_kl; - ku =_ku; - array =new double[(kl+ku+1)*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*(kl+ku+1)]; - } -} - -//============================================================================= -/*! dgbmatrix constructor with filename */ -inline dgbmatrix::dgbmatrix(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - darray =NULL; - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgbmatrix destructor */ -inline dgbmatrix::~dgbmatrix() -{CPPL_VERBOSE_REPORT; - //////// delete array //////// - delete [] array; - delete [] darray; -} diff --git a/cpplapack-r198/.svn/pristine/d1/d164643526650cfa9600962753f18ffa5b56317a.svn-base b/cpplapack-r198/.svn/pristine/d1/d164643526650cfa9600962753f18ffa5b56317a.svn-base deleted file mode 100644 index 926cae22797fa6447f812c39d38acad0ddd3a7ba..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d1/d164643526650cfa9600962753f18ffa5b56317a.svn-base +++ /dev/null @@ -1,106 +0,0 @@ -//============================================================================= -/*! dgels_check */ -void dgels_check_vector() -{ - std::cout << "############ check dgels vector ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3), N(2); - - //// make dgematrix A //// - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make dcovector y //// - CPPL::dcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =double( rand() /(RAND_MAX/10) ); - } - - //// make originals //// - CPPL::dgematrix A_original(A); - CPPL::dcovector y_original(y); - - //// dgels //// - A.dgels(y); - - //// print //// - std::cout << "######## dgels(vec) ########" << std::endl; - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "y_original=\n" << y_original << std::endl; - std::cout << "A=\n" << A << std::endl; - std::cout << "y=\n" << y << std::endl; - std::cout << "A_original*y=\n" << A_original*y << std::endl; - - //// reset //// - A =A_original; - y =y_original; - double r; //residual square - - //// dgels //// - A.dgels(y,r); - - //// print //// - std::cout << "######## dgels(vec, residual) ########" << std::endl; - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "y_original=\n" << y_original << std::endl; - std::cout << "A=\n" << A << std::endl; - std::cout << "y=\n" << y << std::endl; - std::cout << "residual=" << r << std::endl; - std::cout << "A_original*y=\n" << A_original*y << std::endl; -} - -//============================================================================== -void dgels_check_matrix() -{ - std::cout << "############ check dgels matrix ############" << std::endl; - - srand(unsigned(time(NULL))); - int M(3), N(2); - - //// make dgematrix A //// - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make dgematrix Y //// - CPPL::dgematrix Y(M,M); - for(int i=0; i<Y.m; i++){ for(int j=0; j<Y.n; j++){ - Y(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - //// make originals //// - CPPL::dgematrix A_original(A); - CPPL::dgematrix Y_original(Y); - - //// dgels //// - A.dgels(Y); - - //// print //// - std::cout << "######## dgels(mat) ########" << std::endl; - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "Y_original=\n" << Y_original << std::endl; - std::cout << "A=\n" << A << std::endl; - std::cout << "Y=\n" << Y << std::endl; - std::cout << "A_original*Y=\n" << A_original*Y << std::endl; - - //// reset //// - A =A_original; - Y =Y_original; - CPPL::drovector R; //residual square - - //// dgels //// - A.dgels(Y,R); - - //// print //// - std::cout << "######## dgels(mat, residual) ########" << std::endl; - std::cout << "A_original=\n" << A_original << std::endl; - std::cout << "Y_original=\n" << Y_original << std::endl; - std::cout << "A=\n" << A << std::endl; - std::cout << "Y=\n" << Y << std::endl; - std::cout << "residual=" << R << std::endl; - std::cout << "A_original*Y=\n" << A_original*Y << std::endl; -} diff --git a/cpplapack-r198/.svn/pristine/d1/d17e901947f17713e881b0b59ba2a091474614a4.svn-base b/cpplapack-r198/.svn/pristine/d1/d17e901947f17713e881b0b59ba2a091474614a4.svn-base deleted file mode 100644 index 0e8e26d41aa2e8193484f377823e2165d4cd4997..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d1/d17e901947f17713e881b0b59ba2a091474614a4.svn-base +++ /dev/null @@ -1,29 +0,0 @@ -//============================================================================= -/*! zhematrix*comple operator */ -inline _zgematrix operator*(const zhematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - mat.complete(); - zgematrix newmat(mat.n, mat.n); - - const CPPL_INT size =mat.n*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix/comple operator */ -inline _zgematrix operator/(const zhematrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - mat.complete(); - zgematrix newmat(mat.n, mat.n); - - const CPPL_INT size =mat.n*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d1/d1ce10b657ca2d6798adccebe0fa79d8376e176f.svn-base b/cpplapack-r198/.svn/pristine/d1/d1ce10b657ca2d6798adccebe0fa79d8376e176f.svn-base deleted file mode 100644 index b72cf9fb61d37a9d2011ae7347250cec491557f6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d1/d1ce10b657ca2d6798adccebe0fa79d8376e176f.svn-base +++ /dev/null @@ -1,78 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+dgematrix operator */ -inline _dgematrix operator+(const _dgbmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix-dgematrix operator */ -inline _dgematrix operator-(const _dgbmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix*dgematrix operator */ -inline _dgematrix operator*(const _dgbmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d1/d1d452577be10fb96799bca8e3f043fe24969e68.svn-base b/cpplapack-r198/.svn/pristine/d1/d1d452577be10fb96799bca8e3f043fe24969e68.svn-base deleted file mode 100644 index e5af88d4b7eb4e94e512d73bfcd139d285650753..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d1/d1d452577be10fb96799bca8e3f043fe24969e68.svn-base +++ /dev/null @@ -1,44 +0,0 @@ -//============================================================================= -/*! return a transposed row vector */ -inline drovector t(const _dcovector& covec) -{CPPL_VERBOSE_REPORT; - _drovector rovec; - rovec.l =covec.l; - rovec.cap =covec.cap; - delete [] rovec.array; - rovec.array =covec.array; - - covec.nullify(); - return rovec; -} - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double val =dnrm2_(&vec.l, vec.array, &inc); - vec.destroy(); - return val; -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - CPPL_INT i =idamax_(&vec.l, vec.array, &inc) -1 ; - vec.destroy(); - return i; -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double val =vec.array[idamax_(&vec.l, vec.array, &inc) -1]; - vec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/d2/d206cb976fd8dae16ba1407e696a1b66cdcf435d.svn-base b/cpplapack-r198/.svn/pristine/d2/d206cb976fd8dae16ba1407e696a1b66cdcf435d.svn-base deleted file mode 100644 index 425ba85cff15c52b9aa74deca895729cc88dcbeb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d2/d206cb976fd8dae16ba1407e696a1b66cdcf435d.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! zgsmatrix+_zgematrix operator */ -inline _zgematrix operator+(const zgsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - return matB; -} - -//============================================================================= -/*! zgsmatrix-_zgematrix operator */ -inline _zgematrix operator-(const zgsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// change sign //// - for(CPPL_INT i=0; i<matB.m*matB.n; i++){ - matB.array[i]=-matB.array[i]; - } - - //// add //// - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - matB(it->i,it->j) += it->v; - } - - return matB; -} - -//============================================================================= -/*! zgsmatrix*_zgematrix operator */ -inline _zgematrix operator*(const zgsmatrix& matA, const _zgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v *matB(it->j,j); - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d2/d2155cd3f780cf967e5f0e851f6bb03ad61fe9a9.svn-base b/cpplapack-r198/.svn/pristine/d2/d2155cd3f780cf967e5f0e851f6bb03ad61fe9a9.svn-base deleted file mode 100644 index 6df364a0c80c11b8a3010b45b3ac3fe4ad951074..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d2/d2155cd3f780cf967e5f0e851f6bb03ad61fe9a9.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! dgbmatrix*=double operator */ -inline dgbmatrix& dgbmatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(kl+ku+1)*n; - CPPL_INT inc =1; - dscal_(&size, &d, array, &inc); - return *this; -} - -//============================================================================= -/*! dgbmatrix/=double operator */ -inline dgbmatrix& dgbmatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(kl+ku+1)*n; - double dinv =1./d; - CPPL_INT inc =1; - dscal_(&size, &dinv, array, &inc); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgbmatrix*double operator */ -inline _dgbmatrix operator*(const dgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]*d; - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix/double operator */ -inline _dgbmatrix operator/(const dgbmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(newmat.kl+newmat.ku+1)*newmat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =mat.array[i]/d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d2/d23b51dd7e71b4270476805f8699ab736ec8a5a7.svn-base b/cpplapack-r198/.svn/pristine/d2/d23b51dd7e71b4270476805f8699ab736ec8a5a7.svn-base deleted file mode 100644 index 3d2bbc2a7594a989c3ec07cdc83dde25430aaa87..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d2/d23b51dd7e71b4270476805f8699ab736ec8a5a7.svn-base +++ /dev/null @@ -1,95 +0,0 @@ -//============================================================================= -/*! dgematrix constructor without arguments */ -inline dgematrix::dgematrix() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =0; - n =0; - array =NULL; - darray =NULL; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix copy constructor */ -inline dgematrix::dgematrix(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - m =mat.m; - n =mat.n; - array =new double[m*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } - - //////// copy //////// - CPPL_INT mn =m*n; - CPPL_INT inc =1; - dcopy_(&mn, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! dgematrix constructor to cast _dgematrix */ -inline dgematrix::dgematrix(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix constructor with size specification */ -inline dgematrix::dgematrix(const CPPL_INT& _m, const CPPL_INT& _n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers. " << std::endl - << "Your input was (" << _m << "," << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - m =_m; - n =_n; - array =new double[m*n]; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } -} - -//============================================================================= -/*! dgematrix constructor with filename */ -inline dgematrix::dgematrix(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - darray =NULL; - - //// read //// - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix destructor */ -inline dgematrix::~dgematrix() -{CPPL_VERBOSE_REPORT; - delete [] darray; - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/d2/d2eaa839e49f36cb62b1caa6987bb0c88d19afb0.svn-base b/cpplapack-r198/.svn/pristine/d2/d2eaa839e49f36cb62b1caa6987bb0c88d19afb0.svn-base deleted file mode 100644 index cfe7eb62b7e5ff3e29dd72394f021a43dbea0556..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d2/d2eaa839e49f36cb62b1caa6987bb0c88d19afb0.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! zrovector*_zcovector operator */ -inline comple operator*(const zrovector& rovec, const _zcovector& covec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(rovec.l!=covec.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a product." << std::endl - << "Your input was (" << rovec.l << ") * (" << covec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - CPPL_INT inc =1; - - comple val =zdotu_( &rovec.l, rovec.array, &inc, covec.array, &inc ); - - covec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/d3/d341740e1c6450813255faaf52526173dbf65bb6.svn-base b/cpplapack-r198/.svn/pristine/d3/d341740e1c6450813255faaf52526173dbf65bb6.svn-base deleted file mode 100644 index 69d416267099462e1b31523dc3043561888aea08..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d3/d341740e1c6450813255faaf52526173dbf65bb6.svn-base +++ /dev/null @@ -1,46 +0,0 @@ -############################################################################### -## Makefile ## -############################################################################### - -A.OUT = dge2vtk - -############################################################################### - -#include Makefile.compiler -include Makefile.g++ -#include Makefile.icpc - -############################################################################### - -HEADERS:= $(shell find -iname '*.hpp') -SOURCES:= $(shell find -iname '*.cpp') -OBJECTS:= $(SOURCES:%.cpp=%.o) - -############################################################################### - -all: depend $(OBJECTS) - $(CXX) $(OBJECTS) $(LFLAGS) $(LIB_DIRS) $(LIBS) -o $(A.OUT) - @echo - -.SUFFIXES: .cpp .o -.cpp.o: - $(CXX) -c $< $(CFLAGS) $(INCLUDE_DIRS) $(MACROS) -o $@ - @echo - -depend: -# touch main.cpp - makedepend -f- -Y $(SOURCES) > Makefile.depend 2> /dev/null -# gccmakedep -- -I./ -MM -- $(SOURCES) -# $(CXX) -MM -I./ $(SOURCES) > Makefile.depend - @echo - -clean: - rm -f $(OBJECTS) - -fullclean: - rm -f $(shell find -name '*.o') std err Makefile.depend $(A.OUT) - -remake: clean all - -############################################################################### --include Makefile.depend diff --git a/cpplapack-r198/.svn/pristine/d3/d3820eeedfb002a3e797adbce2c65fa63a9bc02a.svn-base b/cpplapack-r198/.svn/pristine/d3/d3820eeedfb002a3e797adbce2c65fa63a9bc02a.svn-base deleted file mode 100644 index 7258c97b4c26974bf933c1cbb1442f9f23447deb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d3/d3820eeedfb002a3e797adbce2c65fa63a9bc02a.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zrovector*zgbmatrix operator */ -inline _zrovector operator*(const _zrovector& vec, const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char trans ='T'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/d3/d3dfa8e8a051659157dcf494ce557998397fe6d5.svn-base b/cpplapack-r198/.svn/pristine/d3/d3dfa8e8a051659157dcf494ce557998397fe6d5.svn-base deleted file mode 100644 index 0d358fc50be8db2967dd3024c6ed8492e88c4b5c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d3/d3dfa8e8a051659157dcf494ce557998397fe6d5.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*zgsmatrix operator */ -inline _zgsmatrix operator*(const double& d, const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgsmatrix newmat =mat; - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *= d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d3/d3e20912cb9dfad7ebcafef65507ead23e6b7638.svn-base b/cpplapack-r198/.svn/pristine/d3/d3e20912cb9dfad7ebcafef65507ead23e6b7638.svn-base deleted file mode 100644 index bba0da0acc17f91369cd355475dd5a5f2cc6444e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d3/d3e20912cb9dfad7ebcafef65507ead23e6b7638.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _dsymatrix+dgematrix operator */ -inline _dgematrix operator+(const _dsymatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =matB; - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++ ){ - newmat(i,j)+=matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix-dgematrix operator */ -inline _dgematrix operator-(const _dsymatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat =-matB; - - for(CPPL_INT i=0; i<matA.n; i++){ - for(CPPL_INT j=0; j<matA.n; j++ ){ - newmat(i,j)+=matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix*dgematrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d4/d4899fd7a1211f478511d3ece98a39f0ea427639.svn-base b/cpplapack-r198/.svn/pristine/d4/d4899fd7a1211f478511d3ece98a39f0ea427639.svn-base deleted file mode 100644 index 0b5b2898e957fbc9e80f684c6cacc45d91748a55..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d4/d4899fd7a1211f478511d3ece98a39f0ea427639.svn-base +++ /dev/null @@ -1,65 +0,0 @@ -//============================================================================= -/*! return a transposed row vector */ -inline _zrovector t(const zcovector& covec) -{CPPL_VERBOSE_REPORT; - zrovector rovec(covec.l); - - CPPL_INT inc =1; - zcopy_(&covec.l, covec.array, &inc, rovec.array, &inc); - - return _(rovec); -} -//============================================================================= -/*! return its conjugated vector */ -inline _zcovector conj(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - zcovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec(i) =std::conj(vec(i)); - } - - return _(newvec); -} - -//============================================================================= -/*! return a conjugate transposed row vector */ -inline _zrovector conjt(const zcovector& covec) -{CPPL_VERBOSE_REPORT; - zrovector rovec(covec.l); - - for(CPPL_INT i=0; i<covec.l; i++){ - rovec(i) =std::conj(covec(i)); - } - - return _(rovec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return dznrm2_(&vec.l, vec.array, &inc); -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return izamax_(&vec.l, vec.array, &inc) -1; -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const zcovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - return vec.array[izamax_(&vec.l, vec.array, &inc) -1]; -} diff --git a/cpplapack-r198/.svn/pristine/d4/d4a6a8a33f0599c4f46f7d60fed70e3f3dcdc396.svn-base b/cpplapack-r198/.svn/pristine/d4/d4a6a8a33f0599c4f46f7d60fed70e3f3dcdc396.svn-base deleted file mode 100644 index f5f42e6c9149c8c884bb350d7b3342f07761e99b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d4/d4a6a8a33f0599c4f46f7d60fed70e3f3dcdc396.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! zgsmatrix+_zgbmatrix operator */ -inline _zgematrix operator+(const zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) +=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix-_zgbmatrix operator */ -inline _zgematrix operator-(const zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.to_zgematrix() ); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -=matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix*_zgbmatrix operator */ -inline _zgematrix operator*(const zgsmatrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - const CPPL_INT jmax =std::min(matB.n,it->j+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),it->j-matB.kl); j<jmax; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d4/d4da3458a836bafcd5779b993dcc5adde36c21e0.svn-base b/cpplapack-r198/.svn/pristine/d4/d4da3458a836bafcd5779b993dcc5adde36c21e0.svn-base deleted file mode 100644 index 4a44b118d0235d8f75f9d55bb9fddbe22a39f35b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d4/d4da3458a836bafcd5779b993dcc5adde36c21e0.svn-base +++ /dev/null @@ -1,212 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void dgbmatrix::clear() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - kl =0; - ku =0; - delete [] array; - array=NULL; - delete [] darray; - darray=NULL; -} - - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline dgbmatrix& dgbmatrix::zero() -{CPPL_VERBOSE_REPORT; - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =0.0; - } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline dgbmatrix& dgbmatrix::identity() -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "Only square matrix can be a identity matrix." << std::endl - << "The matrix size was " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =0.0; - } - for(CPPL_INT i=0; i<m; i++){ - operator()(i,i) =1.0; - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void dgbmatrix::chsign() -{CPPL_VERBOSE_REPORT; - const CPPL_INT size =(kl+ku+1)*n; - for(CPPL_INT i=0; i<size; i++){ - array[i] =-array[i]; - } -} -//============================================================================= -/*! make a deep copy of the matrix */ -inline void dgbmatrix::copy(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - delete [] array; - array =new double[(mat.kl+mat.ku+1)*mat.n]; - delete [] darray; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*(kl+ku+1)]; - } - - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - dcopy_(&size, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void dgbmatrix::shallow_copy(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - kl =mat.kl; - ku =mat.ku; - delete [] array; - array =mat.array; - delete [] darray; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline dgbmatrix& dgbmatrix::resize(const CPPL_INT& _m, const CPPL_INT& _n, - const CPPL_INT& _kl, const CPPL_INT& _ku) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){ - ERROR_REPORT; - std::cerr << "It is impossible to make a matrix you ordered. " << std::endl - << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - m =_m; - n =_n; - kl =_kl; - ku =_ku; - delete [] array; - array =new double[(kl+ku+1)*n]; - delete [] darray; - darray =new double*[n]; - for(int i=0; i<n; i++){ darray[i] =&array[i*(kl+ku+1)]; } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _drovector dgbmatrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector v( drovector(n).zero() ); - - const CPPL_INT jmax =std::min(n,_m+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),_m-kl); j<jmax; j++){ - v(j)=(*this)(_m,j); - } - - return _(v); -} - -//============================================================================= -/*! get column of the matrix */ -inline _dcovector dgbmatrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector v( dcovector(m).zero() ); - - const CPPL_INT imax =std::min(m,_n+kl+1); - for(CPPL_INT i=std::max(CPPL_INT(0),_n-ku); i<imax; i++){ - v(i)=(*this)(i,_n); - } - - return _(v); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(dgbmatrix& A, dgbmatrix& B) -{CPPL_VERBOSE_REPORT; - CPPL_INT A_m =A.m, A_n =A.n, A_kl =A.kl, A_ku =A.ku; - double* A_array =A.array; - double** A_darray=A.darray; - A.m=B.m; A.n=B.n; A.kl=B.kl; A.ku=B.ku; A.array=B.array; A.darray=B.darray; - B.m=A_m; B.n=A_n; B.kl=A_kl; B.ku=A_ku; B.array=A_array; B.darray=A_darray; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _dgbmatrix _(dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - _dgbmatrix newmat; - - //////// shallow copy //////// - newmat.m =mat.m; - newmat.n =mat.n; - newmat.kl =mat.kl; - newmat.ku =mat.ku; - newmat.array =mat.array; - newmat.darray =mat.darray; - - //////// nullify //////// - mat.m =0; - mat.n =0; - mat.kl =0; - mat.ku =0; - mat.array =NULL; - mat.darray =NULL; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/d4/d4e1dd542a1ae4b7858ba69d989403e9d1be4133.svn-base b/cpplapack-r198/.svn/pristine/d4/d4e1dd542a1ae4b7858ba69d989403e9d1be4133.svn-base deleted file mode 100644 index 77751e9641fd529ae13e9cd4cbf2a600bcd33cd0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d4/d4e1dd542a1ae4b7858ba69d989403e9d1be4133.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! _zcovector*double operator */ -inline _zcovector operator*(const _zcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zdscal_(&vec.l, &d, vec.array, &inc); - return vec; -} - -//============================================================================= -/*! _zcovector/double operator */ -inline _zcovector operator/(const _zcovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&vec.l, &dinv, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/d5/d52e59149d20daf3ef105f177d63dca56162943a.svn-base b/cpplapack-r198/.svn/pristine/d5/d52e59149d20daf3ef105f177d63dca56162943a.svn-base deleted file mode 100644 index bed376545e04bb5123cc31e9cb3ebd68c9d4c7a0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d5/d52e59149d20daf3ef105f177d63dca56162943a.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! double*zrovector operator */ -inline _zrovector operator*(const double& d, const zrovector& vec) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =d*vec.array[i]; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/d5/d5a6fb7b7023c72eabd74f8e47bcb2222604fa49.svn-base b/cpplapack-r198/.svn/pristine/d5/d5a6fb7b7023c72eabd74f8e47bcb2222604fa49.svn-base deleted file mode 100644 index c5674ad783f82e30224c2fa059f9be586f6e7b37..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d5/d5a6fb7b7023c72eabd74f8e47bcb2222604fa49.svn-base +++ /dev/null @@ -1,87 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+_dsymatrix operator */ -inline _dgematrix operator+(const _dgbmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB.n, matB.n); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) = matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix-_dsymatrix operator */ -inline _dgematrix operator-(const _dgbmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB.n, matB.n); - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) = -matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix*_dsymatrix operator */ -inline _dgematrix operator*(const _dgbmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d6/d6098062a05b606fee3c49378e1470d3814a7f04.svn-base b/cpplapack-r198/.svn/pristine/d6/d6098062a05b606fee3c49378e1470d3814a7f04.svn-base deleted file mode 100644 index d620786a4e8a81fe32702814fa3195cc3d93c082..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d6/d6098062a05b606fee3c49378e1470d3814a7f04.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::zcovector x(M); - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "x =\n" << x << endl; - cout << "t(x) =\n" << CPPL::t(x) << endl; - cout << "conj(x) =\n" << CPPL::conj(x) << endl; - cout << "conjt(x) =\n" << CPPL::conjt(x) << endl; - cout << "hadamerd(x,x) =\n" << hadamerd(x,x) << endl; - cout << "nrm2(x) =\n" << CPPL::nrm2(x) << endl; - cout << "idamax(x)=\n" << CPPL::idamax(x) << endl; - cout << "damax(x)=\n" << CPPL::damax(x) << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/d6/d650cd1ac6b52534fa64e42285749b3633848eaf.svn-base b/cpplapack-r198/.svn/pristine/d6/d650cd1ac6b52534fa64e42285749b3633848eaf.svn-base deleted file mode 100644 index 60a54e9a07803bdd18b36ca27b0a7b2e22abdb21..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d6/d650cd1ac6b52534fa64e42285749b3633848eaf.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! _zrovector*double operator */ -inline _zrovector operator*(const _zrovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zdscal_(&vec.l, &d, vec.array, &inc); - return vec; -} - -//============================================================================= -/*! _zrovector/double operator */ -inline _zrovector operator/(const _zrovector& vec, const double& d) -{CPPL_VERBOSE_REPORT; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&vec.l, &dinv, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/d6/d652a916952a1984f4a7ca525c981aec8a66f7a4.svn-base b/cpplapack-r198/.svn/pristine/d6/d652a916952a1984f4a7ca525c981aec8a66f7a4.svn-base deleted file mode 100644 index 1497e3674148bce59b18ce36176007ec37fbdaba..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d6/d652a916952a1984f4a7ca525c981aec8a66f7a4.svn-base +++ /dev/null @@ -1,281 +0,0 @@ -%TGIF 4.1.43-QPL -state(0,37,100.000,0,0,0,4,1,9,1,1,1,0,1,0,1,1,'Helvetica',0,103680,0,0,0,10,0,0,1,1,0,16,0,0,1,1,1,1,1485,1050,0,0,2880,1). -% -% @(#)$Header$ -% %W% -% -unit("1 pixel/pixel"). -color_info(30,65535,0,[ - "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, - "red", 65535, 0, 0, 65535, 0, 0, 1, - "green", 0, 65535, 0, 0, 65535, 0, 1, - "blue", 0, 0, 65535, 0, 0, 65535, 1, - "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, - "pink", 65535, 49344, 52171, 65535, 49344, 52171, 1, - "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, - "CadetBlue", 24415, 40606, 41120, 24415, 40606, 41120, 1, - "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, - "black", 0, 0, 0, 0, 0, 0, 1, - "#ff4d4d", 65535, 19789, 19789, 65280, 19712, 19712, 1, - "#ff9c4d", 65535, 40092, 19789, 65280, 39936, 19712, 1, - "#ffec4d", 65535, 60652, 19789, 65280, 60416, 19712, 1, - "#c4ff4d", 50372, 65535, 19789, 50176, 65280, 19712, 1, - "#75ff4d", 30069, 65535, 19789, 29952, 65280, 19712, 1, - "#4dff75", 19789, 65535, 30069, 19712, 65280, 29952, 1, - "#4dffc4", 19789, 65535, 50372, 19712, 65280, 50176, 1, - "#4decff", 19789, 60652, 65535, 19712, 60416, 65280, 1, - "#4d9cff", 19789, 40092, 65535, 19712, 39936, 65280, 1, - "#4d4dff", 19789, 19789, 65535, 19712, 19712, 65280, 1, - "#fffffe", 65535, 65535, 65278, 65280, 65280, 65024, 1, - "#e0e0e0", 57568, 57568, 57568, 57344, 57344, 57344, 1, - "#d0d0d0", 53456, 53456, 53456, 53248, 53248, 53248, 1, - "#c0c0c0", 49344, 49344, 49344, 49152, 49152, 49152, 1, - "#b0b0b0", 45232, 45232, 45232, 45056, 45056, 45056, 1, - "#a0a0a0", 41120, 41120, 41120, 40960, 40960, 40960, 1, - "#808080", 32896, 32896, 32896, 32768, 32768, 32768, 1, - "#404040", 16448, 16448, 16448, 16384, 16384, 16384, 1, - "#101010", 4112, 4112, 4112, 4096, 4096, 4096, 1, - "#000001", 0, 0, 257, 0, 0, 256, 1 -]). -script_frac("0.6"). -fg_bg_colors('black','white'). -dont_reencode("FFDingbests:ZapfDingbats"). -page(1,"",1,''). -box('black','',652,128,708,164,0,1,1,80,0,0,0,0,0,'1',0,[ -]). -box('black','',552,128,608,164,0,1,1,170,0,0,0,0,0,'1',0,[ -]). -box('black','',496,128,552,164,5,1,1,168,0,0,0,0,0,'1',1,[ -]). -box('black','',440,128,496,164,5,1,1,164,0,0,0,0,0,'1',1,[ -]). -box('black','',340,128,396,164,5,1,1,154,0,0,0,0,0,'1',1,[ -]). -box('black','',240,128,296,164,5,1,1,127,0,0,0,0,0,'1',1,[ -]). -box('black','',184,128,240,164,5,1,1,126,0,0,0,0,0,'1',1,[ -]). -box('black','',128,128,184,164,5,1,1,122,0,0,0,0,0,'1',1,[ -]). -text('black',156,134,1,1,1,10,22,36,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "0")]) -]) -])]). -text('black',212,134,1,1,1,10,22,38,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-3,0,0,0,0,0, - "1")]) -]) -])]). -text('black',268,134,1,1,1,10,22,45,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "2")]) -]) -])]). -text('black',368,134,1,1,1,10,22,50,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "c")]) -]) -])]). -text('black',468,134,1,1,1,42,22,87,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,152,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-1,0,0,0,0,0, - "vol-2")]) -]) -])]). -text('black',680,134,1,1,1,47,22,96,18,4,0,0,0,0,2,47,22,0,0,"",0,0,0,0,152,'',[ -minilines(47,22,0,0,1,0,0,[ -mini_line(47,18,4,0,0,0,[ -str_block(0,47,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,47,18,4,0,-3,0,0,0,0,0, - "cap-1")]) -]) -])]). -oval('black','',304,144,308,148,1,3,1,135,0,0,0,0,0,'3',0,[ -]). -oval('black','',316,144,320,148,1,3,1,148,0,0,0,0,0,'3',0,[ -]). -oval('black','',328,144,332,148,1,3,1,149,0,0,0,0,0,'3',0,[ -]). -oval('black','',404,144,408,148,1,3,1,160,0,0,0,0,0,'3',0,[ -]). -oval('black','',416,144,420,148,1,3,1,161,0,0,0,0,0,'3',0,[ -]). -oval('black','',428,144,432,148,1,3,1,162,0,0,0,0,0,'3',0,[ -]). -text('black',524,134,1,1,1,42,22,167,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,152,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-3,0,0,0,0,0, - "vol-1")]) -]) -])]). -text('black',580,134,1,1,1,25,22,169,18,4,0,0,0,0,2,25,22,0,0,"",0,0,0,0,152,'',[ -minilines(25,22,0,0,1,0,0,[ -mini_line(25,18,4,0,0,0,[ -str_block(0,25,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,25,18,4,0,-1,0,0,0,0,0, - "vol")]) -]) -])]). -oval('black','',616,144,620,148,1,3,1,181,0,0,0,0,0,'3',0,[ -]). -oval('black','',628,144,632,148,1,3,1,182,0,0,0,0,0,'3',0,[ -]). -oval('black','',640,144,644,148,1,3,1,183,0,0,0,0,0,'3',0,[ -]). -text('black',80,182,1,1,1,55,22,421,18,4,0,0,0,0,2,55,22,0,0,"",0,0,0,1,200,'',[ -minilines(55,22,0,0,1,0,0,[ -mini_line(55,18,4,0,0,0,[ -str_block(0,55,18,4,0,-2,0,0,0,[ -str_seg('black','Helvetica',0,103680,55,18,4,0,-2,0,0,0,0,0, - "del(i,j);")]) -]) -])]). -box('black','',652,232,708,268,0,1,1,453,0,0,0,0,0,'1',0,[ -]). -box('black','',552,232,608,268,0,1,1,454,0,0,0,0,0,'1',0,[ -]). -box('black','',496,232,552,268,0,1,1,455,0,0,0,0,0,'1',1,[ -]). -box('black','',440,232,496,268,5,1,1,456,0,0,0,0,0,'1',1,[ -]). -box('black','',340,232,396,268,5,1,1,457,0,0,0,0,0,'1',1,[ -]). -box('black','',240,232,296,268,5,1,1,458,0,0,0,0,0,'1',1,[ -]). -box('black','',184,232,240,268,5,1,1,459,0,0,0,0,0,'1',1,[ -]). -box('black','',128,232,184,268,5,1,1,460,0,0,0,0,0,'1',1,[ -]). -text('black',156,238,1,1,1,10,22,461,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,256,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "0")]) -]) -])]). -text('black',212,238,1,1,1,10,22,462,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,256,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-3,0,0,0,0,0, - "1")]) -]) -])]). -text('black',268,238,1,1,1,10,22,463,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,256,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "2")]) -]) -])]). -text('black',368,238,1,1,1,10,22,464,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,256,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "c")]) -]) -])]). -text('black',468,238,1,1,1,42,22,465,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,256,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-3,0,0,0,0,0, - "vol-1")]) -]) -])]). -text('black',680,238,1,1,1,47,22,466,18,4,0,0,0,0,2,47,22,0,0,"",0,0,0,0,256,'',[ -minilines(47,22,0,0,1,0,0,[ -mini_line(47,18,4,0,0,0,[ -str_block(0,47,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,47,18,4,0,-3,0,0,0,0,0, - "cap-1")]) -]) -])]). -oval('black','',304,248,308,252,1,3,1,467,0,0,0,0,0,'3',0,[ -]). -oval('black','',316,248,320,252,1,3,1,468,0,0,0,0,0,'3',0,[ -]). -oval('black','',328,248,332,252,1,3,1,469,0,0,0,0,0,'3',0,[ -]). -oval('black','',404,248,408,252,1,3,1,470,0,0,0,0,0,'3',0,[ -]). -oval('black','',416,248,420,252,1,3,1,471,0,0,0,0,0,'3',0,[ -]). -oval('black','',428,248,432,252,1,3,1,472,0,0,0,0,0,'3',0,[ -]). -text('black',524,238,1,1,1,25,22,473,18,4,0,0,0,0,2,25,22,0,0,"",0,0,0,0,256,'',[ -minilines(25,22,0,0,1,0,0,[ -mini_line(25,18,4,0,0,0,[ -str_block(0,25,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,25,18,4,0,-1,0,0,0,0,0, - "vol")]) -]) -])]). -text('black',580,238,1,1,1,45,22,474,18,4,0,0,0,0,2,45,22,0,0,"",0,0,0,0,256,'',[ -minilines(45,22,0,0,1,0,0,[ -mini_line(45,18,4,0,0,0,[ -str_block(0,45,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,45,18,4,0,-3,0,0,0,0,0, - "vol+1")]) -]) -])]). -oval('black','',616,248,620,252,1,3,1,475,0,0,0,0,0,'3',0,[ -]). -oval('black','',628,248,632,252,1,3,1,476,0,0,0,0,0,'3',0,[ -]). -oval('black','',640,248,644,252,1,3,1,477,0,0,0,0,0,'3',0,[ -]). -text('black',260,182,1,1,1,165,22,479,18,4,0,0,0,0,2,165,22,0,0,"",0,0,0,1,200,'',[ -minilines(165,22,0,0,1,0,0,[ -mini_line(165,18,4,0,0,0,[ -str_block(0,165,18,4,0,0,0,0,0,[ -str_seg('black','Helvetica',0,103680,165,18,4,0,0,0,0,0,0,0, - "automatically \"vol--;\"")]) -]) -])]). -poly('black','',4,[ - 524,232,480,208,368,208,368,232],1,2,1,492,0,0,0,0,0,0,0,'2',1,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). -text('black',548,190,2,1,1,100,44,494,18,4,0,0,0,0,2,100,44,0,0,"",0,0,0,1,208,'',[ -minilines(100,44,0,0,1,0,0,[ -mini_line(100,18,4,0,0,0,[ -str_block(0,100,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,100,18,4,0,-1,0,0,0,0,0, - "assign value")]) -]), -mini_line(56,18,4,0,0,0,[ -str_block(0,56,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,56,18,4,0,-1,0,0,0,0,0, - "at here")]) -]) -])]). -text('black',132,206,1,1,1,174,22,545,18,4,0,0,0,0,2,174,22,0,0,"",0,0,0,1,224,'',[ -minilines(174,22,0,0,1,0,0,[ -mini_line(174,18,4,0,0,0,[ -str_block(0,174,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,174,18,4,0,-1,0,0,0,0,0, - "(if (i,j) means array[c])")]) -]) -])]). diff --git a/cpplapack-r198/.svn/pristine/d6/d6b25a095d47fd3251e36e7eb17c129f0fa9eea5.svn-base b/cpplapack-r198/.svn/pristine/d6/d6b25a095d47fd3251e36e7eb17c129f0fa9eea5.svn-base deleted file mode 100644 index 2b9ebd2d470178d88377a6034f388d15968b11bf..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d6/d6b25a095d47fd3251e36e7eb17c129f0fa9eea5.svn-base +++ /dev/null @@ -1,161 +0,0 @@ -//============================================================================= -/*! dgematrix+=_dgbmatrix operator */ -inline dgematrix& dgematrix::operator+=(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) += mat(i,j); - } - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dgematrix-=_dgbmatrix operator */ -inline dgematrix& dgematrix::operator-=(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - mat.destroy(); - return *this; -} -//============================================================================= -/*! dgematrix*=_dgbmatrix operator */ -inline dgematrix& dgematrix::operator*=(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(m,mat.n); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(mat.m,j+mat.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-mat.ku); k<kmax; k++){ - newmat(i,j) += operator()(i,k)*mat(k,j); - } - } - } - - swap(*this, newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+_dgbmatrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) += matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgematrix-_dgbmatrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgematrix*_dgbmatrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d7/d71259569e9b913155b32b3add962e1afa7121e1.svn-base b/cpplapack-r198/.svn/pristine/d7/d71259569e9b913155b32b3add962e1afa7121e1.svn-base deleted file mode 100644 index fbd4471635edc1ffb7b8a852bde453055ec6380c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d7/d71259569e9b913155b32b3add962e1afa7121e1.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline comple _zhsmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// search (i,j) component //// - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].j==jj){ - if( i>j ){ return data[*p].v; }//ii=i - else{ return std::conj(data[*p].v); }//ii=j - } - } - - //// (i,j) component was not found //// - return comple(0.0,0.0); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.n; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i >= j ){ - std::vector<CPPL_INT>::iterator q; - const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.line[i].end(); - for(q=mat.line[i].begin(); q!=mat_line_i_end; q++){ - if( mat.data[*q].j==j ){ break; } - } - if(q!=mat_line_i_end){ s << " " << mat.data[*q].v << " "; } - else{ s << " x "; } - } - else{//i<j - std::vector<CPPL_INT>::iterator q; - const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.line[i].end(); - for(q=mat.line[i].begin(); q!=mat_line_i_end; q++){ - if( mat.data[*q].j==j ){ break; } - } - if(q!=mat_line_i_end){ s << "{" << mat.data[*q].v << "}"; } - else{ s << "{x}"; } - } - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _zhsmatrix::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zhsmatrix " << n << " " << data.size() << std::endl; - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - ofs << it->i << " " << it->j << " " << it->v << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/d7/d78ca33b8cdfd3a8ca7a85e15ef027aebbfa2eab.svn-base b/cpplapack-r198/.svn/pristine/d7/d78ca33b8cdfd3a8ca7a85e15ef027aebbfa2eab.svn-base deleted file mode 100644 index 9f797892178f5e7ae68a212f025e230ce049506a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d7/d78ca33b8cdfd3a8ca7a85e15ef027aebbfa2eab.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################### -## Makefile.g++ ## -############################################################################### - -CXX = g++ - -######## FLAGS ######## -FLAGS += -O2 -funroll-loops -ffast-math #-mfpmath=sse -FLAGS += -fomit-frame-pointer #-ftree-vectorizer-verbose=5 -#FLAGS = -march=core2 -msse4.1 -#FLAGS += -std=c++0x # -std=c++98 # -##FLAGS += -fprefetch-loop-arrays -fforce-addr -march=pentium4 -ftree-vectorize -funsafe-loop-optimizations -Wunsafe-loop-optimizations -##FLAGS += -malign-double -#FLAGS += -fopenmp - -######## LFLAGS ######## -LFLAGS = $(FLAGS) -#LFLAGS += -static - -######## CFLAGS ######## -CFLAGS = $(FLAGS) -##CFLAGS += --param large-function-growth=99999 --param max-inline-insns-single=99999 --param inline-unit-growth=99999 -Winline -####CFLAGS += -fimplement-inlines -finline-limit=0 --param large-function-growth=0 --param max-inline-insns-single=0 --param inline-unit-growth=0 -CFLAGS += -Wall -Wno-unknown-pragmas -Wextra -ftree-vectorizer-verbose=0 - -######## others ######## -INCLUDE_DIRS = -I./ -I$(HOME)/local/cpplapack/include -#LIB_DIRS = -L/usr/lib -LIB_DIRS = -#LIBS = /usr/lib/sse2/liblapack.a /usr/lib/sse2/libblas.a -lm -lgfortran -LIBS = -llapack -lblas -lgfortran -lm -LIBS += -lboost_filesystem -MACROS = -DCPPL_SECTOR_SIZE=1000000 - -############################# -######### profiling ######### -############################# -#CFLAGS += -pg #-g -#LFLAGS += -pg #-g -#LIBS = $(HOME)/opt/lapack-3.1.1/lapack_gprof.a $(HOME)/opt/lapack-3.1.1/blas_gprof.a -lm -lgfortran -#LIBS = $(HOME)/opt/lapack-3.1.1/lapack_gprof.a $(HOME)/opt/lapack-3.1.1/blas_gprof.a $(HOME)/opt/STLport-5.1.3/lib/libstlport_gprof.a -lm -lgfortran - -############################# -######### debugging ######### -############################# -ifdef DEBUG -FLAGS = -g -O0 -CFLAGS = $(FLAGS) -Wall -Wno-unknown-pragmas -Wextra -fstack-protector-all -fbounds-check -LFLAGS = $(FLAGS) -##LIBS += -lefence -MACROS = #-DCPPL_DEBUG ####-DCPPL_VERBOSE -endif diff --git a/cpplapack-r198/.svn/pristine/d7/d7cd71d16fb3429777518f44a352c98f3e04e8e1.svn-base b/cpplapack-r198/.svn/pristine/d7/d7cd71d16fb3429777518f44a352c98f3e04e8e1.svn-base deleted file mode 100644 index bbc8d0daa8cfa5c5fa41205eb3980773f775d74d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d7/d7cd71d16fb3429777518f44a352c98f3e04e8e1.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - //// make zgematrix A //// - CPPL::zgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// print A in two ways //// - cout << "A =\n" << A << endl; - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - cout << "A(" << i << "," << j << ") =" << A(i,j) << endl; - }} - - //// make A 10 times //// - cout << "#### A*=10.; ####" << endl; - A*=10.; - - //// make zgematrix B //// - CPPL::zgematrix B(A); - cout << "B =\n" << B << endl; - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - cout << "B(" << i << "," << j << ") =" << B(i,j) << endl; - }} - - //// print A+B //// - cout << "A+B=\n" << A+B << endl; - - //// write/read //// - B.write( "tmp.txt" ); - CPPL::zgematrix C; - C.read( "tmp.txt" ); - cout << "C-B =\n" << C-B << "<-Should be zero." << endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/d8/d82472bedcbbc9e97dd5e8887c6ff72c05fd9227.svn-base b/cpplapack-r198/.svn/pristine/d8/d82472bedcbbc9e97dd5e8887c6ff72c05fd9227.svn-base deleted file mode 100644 index f8b39968faa142a79e00c8854850bdfb796dae89..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d8/d82472bedcbbc9e97dd5e8887c6ff72c05fd9227.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*zhsmatrix operator */ -inline _zhsmatrix operator*(const double& d, const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat =mat; - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *=d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/d8/d8360ad672e2cef191a70818441297a72b775739.svn-base b/cpplapack-r198/.svn/pristine/d8/d8360ad672e2cef191a70818441297a72b775739.svn-base deleted file mode 100644 index b241eb704e47c29ba3ea5e4eddab9571d3818b0a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d8/d8360ad672e2cef191a70818441297a72b775739.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -#include "dsysv_check.hpp" -#include "dsyev_check.hpp" -#include "dsygv_check.hpp" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - //////// dsysv //////// - dsysv_check_vector(); - dsysv_check_matrix(); - - //////// dsyev //////// - dsyev_check_value(); - dsyev_check_right(); - dsyev_check_left(); - - //////// dsygv //////// - dsygv_check_value(); - dsygv_check_both(); - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/d8/d849f69e82aab219b3659b1dfdb2ae3ddf315ddc.svn-base b/cpplapack-r198/.svn/pristine/d8/d849f69e82aab219b3659b1dfdb2ae3ddf315ddc.svn-base deleted file mode 100644 index c04d705d6dc554cfe8c42fb7959fe5009dda7f96..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d8/d849f69e82aab219b3659b1dfdb2ae3ddf315ddc.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(4), KL(2), KU(1); - //int M(2), N(2), KL(0), KU(0); - - CPPL::zgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(int(0),i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - std::cout << "A =\n" << A << std::endl; - - CPPL::zgbmatrix B; - std::cout << "#### B=A; ####" << std::endl; - B=A; - std::cout << "B =\n" << B << std::endl; - - std::cout << "#### B+=A; ####" << std::endl; - B+=A; - std::cout << "B =\n" << B << std::endl; - - std::cout << "#### B-=A; ####" << std::endl; - B-=A; - std::cout << "B =\n" << B << std::endl; - - std::cout << "A+B =\n" << A+B << std::endl; - std::cout << "A-B =\n" << A-B << std::endl; - std::cout << "A*B =\n" << A*B << std::endl; - - CPPL::zgbmatrix P(8,10,2,3), Q(10,9,1,3), R; - for(int i=0; i<P.m; i++){ - for(int j=std::max(int(0),i-P.kl); j<std::min(P.n,i+P.ku+1); j++){ - P(i,j) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - for(int i=0; i<Q.m; i++){ - for(int j=std::max(int(0),i-Q.kl); j<std::min(Q.n,i+Q.ku+1); j++){ - Q(i,j) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - } - CPPL::zgematrix P2( P.to_zgematrix() ), Q2( Q.to_zgematrix() ); - std::cout << "P =\n" << P << std::endl; - std::cout << "P2 =\n" << P2 << std::endl; - std::cout << "Q =\n" << Q << std::endl; - std::cout << "Q2 =\n" << Q2 << std::endl; - std::cout << "P*Q =\n" << P*Q << std::endl; - std::cout << "P2*Q2 =\n" << P2*Q2 << std::endl; - std::cout << "P*Q - P2*Q2 =\n" << P*Q-P2*Q2 << std::endl; - - std::cout << "#### P*=Q; ####" << std::endl; - P*=Q; - std::cout << "P =\n" << P << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/d8/d8534f65186e929e6d9c326a084422512456d6c8.svn-base b/cpplapack-r198/.svn/pristine/d8/d8534f65186e929e6d9c326a084422512456d6c8.svn-base deleted file mode 100644 index 117867d4f5d3a85856125c21ed3537918b777523..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d8/d8534f65186e929e6d9c326a084422512456d6c8.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(3), CAP(4); - - CPPL::dgsmatrix A(M,N,CAP); - A.put(0,0, 1.); - A.put(3,2, 2.); - A.put(1,2, 3.); - A.put(4,1, 4.); - - std::cout << "A =\n" << A << std::endl; - for(std::vector<CPPL::dcomponent>::const_iterator it=A.data.begin(); it!=A.data.end(); it++){ - std::cout << "A(" << it->i << "," << it->j << ") = " << it->v << std::endl; - } - - - //A.put(1,2, 4.5); - //A.add(1,2, 0.1); - //A.sub(1,2, 0.1); - //A.mult(1,2, 10.); - //A.div(1,2, 10.); - //A.del(1,2); - A.del(2); - std::cout << "A =\n" << A << std::endl; - std::cout << "t(A)=\n" << t(A) << std::endl; - - const CPPL::dgsmatrix B =A; - //// write/read //// - B.write( "tmp.txt" ); - - CPPL::dgsmatrix C; - C.read( "tmp.txt" ); - std::cout << "C-B =\n" << C-B << "<-Should be zero." << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/d8/d8c4c10be46bb8bd132c239ba44c716b0c13ffaf.svn-base b/cpplapack-r198/.svn/pristine/d8/d8c4c10be46bb8bd132c239ba44c716b0c13ffaf.svn-base deleted file mode 100644 index 12e39d8088b5024fa3253c62bdbda8667ee95085..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d8/d8c4c10be46bb8bd132c239ba44c716b0c13ffaf.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! cast to _zrovector */ -inline _zrovector drovector::to_zrovector() const -{CPPL_VERBOSE_REPORT; - zrovector newvec(l); - - for(CPPL_INT i=0; i<l; i++){ - newvec.array[i] =comple(array[i], 0.); - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/d9/d933572afdba32c10612454d4b178f3538bb0368.svn-base b/cpplapack-r198/.svn/pristine/d9/d933572afdba32c10612454d4b178f3538bb0368.svn-base deleted file mode 100644 index ed71f1e865d4bb752c13af0c8985ca7812bd2dba..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d9/d933572afdba32c10612454d4b178f3538bb0368.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! _zhematrix*zcovector operator */ -inline _zcovector operator*(const _zhematrix& mat, const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/d9/d94bc41bcc033f8c41f10c01defeeba6e8cbe529.svn-base b/cpplapack-r198/.svn/pristine/d9/d94bc41bcc033f8c41f10c01defeeba6e8cbe529.svn-base deleted file mode 100644 index 07703da8560586abcb67ce19b1aae6e7b2dc18b4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d9/d94bc41bcc033f8c41f10c01defeeba6e8cbe529.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -//! Samll Real Double-precision Row Vector Class -template<CPPL_INT l> class drovector_small -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - double array[l]; //!< 1D array to store vector data - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline drovector_small(); - inline explicit drovector_small(const drovector&); - inline drovector_small(const double&, const double&); - inline drovector_small(const double&, const double&, const double&); - inline drovector_small(const double&, const double&, const double&, const double&); - inline ~drovector_small(); - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _drovector to_drovector() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&); - inline double operator()(const CPPL_INT&) const; - inline drovector_small<l>& set(const CPPL_INT&, const double&); - template<CPPL_INT _l> inline friend std::ostream& operator<<(std::ostream&, const drovector_small<_l>&); - inline void read(const char* filename); - inline void write(const char* filename) const; - - //////// calc //////// -#ifndef _MSC_VER - template<CPPL_INT _l> inline friend dcovector_small<_l> t(const drovector_small<_l>&); - template<CPPL_INT _l> inline friend double nrm2(const drovector_small<_l>&); - template<CPPL_INT _l> inline friend CPPL_INT idamax(const drovector_small<_l>&); - template<CPPL_INT _l> inline friend double damax(const drovector_small<_l>&); -#endif//_MSC_VER - - //////// misc //////// - inline drovector_small<l>& zero(); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// -#ifndef _MSC_VER - //////// = //////// - template<CPPL_INT L> inline drovector_small<L>& operator= (const drovector_small<L>&); - //////// += //////// - template<CPPL_INT L> inline friend drovector_small<L>& operator+=(drovector_small<L>&, const drovector_small<L>&); - //////// -= //////// - template<CPPL_INT L> inline friend drovector_small<L>& operator-=(drovector_small<L>&, const drovector_small<L>&); - //////// *= //////// - template<CPPL_INT L> inline friend drovector_small<L>& operator*=(drovector_small<L>&, const double&); - //////// /= //////// - template<CPPL_INT L> inline friend drovector_small<L>& operator/=(drovector_small<L>&, const double&); - //////// unary //////// - template<CPPL_INT L> inline friend const drovector_small<L>& operator+(const drovector_small<L>&); - template<CPPL_INT L> inline friend drovector_small<L> operator-(const drovector_small<L>&); - //////// + //////// - template<CPPL_INT L> inline friend drovector_small<L> operator+(const drovector_small<L>&, const drovector_small<L>&); - //////// - //////// - template<CPPL_INT L> inline friend drovector_small<L> operator-(const drovector_small<L>&, const drovector_small<L>&); - //////// * //////// - template<CPPL_INT L> inline friend double operator*(const drovector_small<L>&, const dcovector_small<L>&); - template<CPPL_INT M, CPPL_INT N> inline friend drovector_small<N> operator*(const drovector_small<M>&, const dgematrix_small<M,N>&); - template<CPPL_INT L> inline friend drovector_small<L> operator*(const drovector_small<L>&, const dsymatrix_small<L>&); - template<CPPL_INT L> inline friend drovector_small<L> operator*(const drovector_small<L>&, const double&); - //////// / //////// - template<CPPL_INT L> inline friend drovector_small<L> operator/(const drovector_small<L>&, const double&); - //////// double //////// - template<CPPL_INT L> inline friend drovector_small<L> operator*(const double&, const drovector_small<L>&); - //////// hadamerd //////// - template<CPPL_INT L> inline friend drovector_small<L> hadamerd(const drovector_small<L>&, const drovector_small<L>&); -#endif//_MSC_VER -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline double operator/(const drovec2&, const drovec2&); -inline drovec3 operator/(const drovec3&, const drovec3&); diff --git a/cpplapack-r198/.svn/pristine/d9/d9850d81ed80f6d56563b9e39faf01562521bbf7.svn-base b/cpplapack-r198/.svn/pristine/d9/d9850d81ed80f6d56563b9e39faf01562521bbf7.svn-base deleted file mode 100644 index ae80bfe28a2495d33c30fda2a2e57d0c57863e81..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d9/d9850d81ed80f6d56563b9e39faf01562521bbf7.svn-base +++ /dev/null @@ -1,147 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -bool symmlq -( - const CPPL::dsymatrix& A, - CPPL::dcovector& x, - const double& eps_r -) -{ - const CPPL::dcovector y(x); - const double eps(1e-16); - const double shift(0.); - - double g_bar, alpha, b_old, beta, beta1, z, z_bar, s, t, rhs1, rhs2, d_bar, bstep, snprod; - x.zero(); - CPPL::dcovector w(x), v(x), X(x), Y1(y), Y2(y), Y(y); - - beta1 =nrm2(y); - s =1./beta1; - v =s*y; - - Y =A*v -shift*v; - alpha =v%Y; - Y -=(alpha/beta1)*Y1; - //std::cerr << "Y=" << CPPL::t(Y) << std::endl; - - z =v%Y; - s =v%v; - Y -=(z/s)*v; - //std::cerr << "Y=" << CPPL::t(Y) << std::endl; - - Y2 =Y; - b_old =beta1; - beta =sqrt(Y2%Y); - - double denom; - denom =sqrt(s)*nrm2(Y2) +eps; - s =z/denom; - t =(v%Y2)/denom; - - rhs1 =beta1; - rhs2 =0.; - g_bar =alpha; - d_bar =beta; - bstep =0.; - snprod =1.; - - int itc(0); - const int itmax(2*x.l); - while( fabs(damax(y-A*x))>eps_r && itc<itmax ){ - std::cout << "# "<< itc << " " << fabs(damax(y-A*x)) << std::endl; - z_bar =rhs1/g_bar; - z =(snprod*z_bar+bstep)/beta1; - - s =1./beta; - v =s*Y; - Y =A*v -(beta/b_old)*Y1 -shift*v; - alpha =v%Y; - Y -=(alpha/beta)*Y2; - Y1 =Y2; - Y2 =Y; - - b_old =beta; - beta =sqrt(Y2%Y); - - double gamma, cs, sn, delta, epsilon; - gamma =sqrt(pow(g_bar,2)+pow(b_old,2)); - cs =g_bar/gamma; - sn =b_old/gamma; - delta =cs*d_bar +sn*alpha; - g_bar =sn*d_bar -cs*alpha; - epsilon =sn*beta; - d_bar =-cs*beta; - - z =rhs1/gamma; - s =z*cs; - t =z*sn; - X +=s*w +t*v; - w =sn*w -cs*v; - - bstep +=snprod*cs*z; - snprod *=sn; - rhs1 =rhs2 -delta*z; - rhs2 =-epsilon*z; - - x =X +(bstep/beta1)*y; - //std::cout << "x=" << CPPL::t(x) << std::endl; - itc++; - } - std::cerr << "itc=" << itc << " fabs(damax(y-A*x))=" << fabs(damax(y-A*x)) << std::endl; - //std::cerr << "itc=" << itc << " fabs(f)=" << fabs(f) << std::endl; - - if(itc<itmax){ return 0; } - else{ return 1; } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - srand(time(NULL)); - - const int size(100); - CPPL::dsymatrix A(size); - - for(int i=0; i<size; i++){ - for(int j=0; j<=i; j++){ - A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; - } - A(i,i)+=10.; - } - A.write("A.dsymatrix"); - - CPPL::dcovector x(size); - for(int i=0; i<size; i++){ - x(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - x.write("answer.dcovector");//solution - std::cerr << "answer=\n" << t(x) << std::endl; - - CPPL::dcovector y(size); - y=A*x; - y.write("y.dcovector"); - - double eps(fabs(damax(y))*1e-6); - //std::cerr << "eps=" << eps << std::endl; - if( symmlq(A, y, eps) ){ - std::cerr << "failed." << std::endl; - exit(1); - } - y.write("solution.dcovector"); - std::cout << "solution=\n" << t(y) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/d9/d99fc5a2a30637dafc2d5c5fca997e659b6c469e.svn-base b/cpplapack-r198/.svn/pristine/d9/d99fc5a2a30637dafc2d5c5fca997e659b6c469e.svn-base deleted file mode 100644 index 500b81f162990675b66d917fb88738b6b1cc9b09..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d9/d99fc5a2a30637dafc2d5c5fca997e659b6c469e.svn-base +++ /dev/null @@ -1,192 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void dgematrix::clear() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - delete [] array; - delete [] darray; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline dgematrix& dgematrix::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<m*n; i++){ - array[i] =0.0; - } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline dgematrix& dgematrix::identity() -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n){ - ERROR_REPORT; - std::cerr << "Only square matrix can be a identity matrix." << std::endl - << "The matrix size was " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<m*n; i++){ - array[i] =0.0; - } - for(CPPL_INT i=0; i<m; i++){ - operator()(i,i) =1.0; - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void dgematrix::chsign() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<m*n; i++){ - array[i] =-array[i]; - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void dgematrix::copy(const dgematrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - delete [] array; - array =new double[mat.m*mat.n]; - delete [] darray; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } - - CPPL_INT mn =mat.m*mat.n; - CPPL_INT inc =1; - dcopy_(&mn, mat.array, &inc, array, &inc); -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void dgematrix::shallow_copy(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - delete [] array; - array =mat.array; - delete [] darray; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline dgematrix& dgematrix::resize(const CPPL_INT& _m, const CPPL_INT& _n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers." << std::endl - << "Your input was (" << _m << "," << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - m =_m; - n =_n; - delete [] array; - array =new double[m*n]; - delete [] darray; - darray =new double*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*m]; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _drovector dgematrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector v(n); - for(CPPL_INT j=0; j<n; j++){ - v(j)=(*this)(_m,j); - } - return _(v); -} - -//============================================================================= -/*! get column of the matrix */ -inline _dcovector dgematrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector v(m); - for(CPPL_INT i=0; i<m; i++){ - v(i)=(*this)(i,_n); - } - return _(v); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(dgematrix& A, dgematrix& B) -{CPPL_VERBOSE_REPORT; - CPPL_INT A_m =A.m, A_n =A.n; - double* A_array =A.array; - double** A_darray=A.darray; - A.m=B.m; A.n=B.n; A.array=B.array; A.darray=B.darray; - B.m=A_m; B.n=A_n; B.array=A_array; B.darray=A_darray; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _dgematrix _(dgematrix& mat) -{CPPL_VERBOSE_REPORT; - _dgematrix newmat; - - //////// shallow copy //////// - newmat.m =mat.m; - newmat.n =mat.n; - newmat.array =mat.array; - newmat.darray =mat.darray; - - //////// nullify //////// - mat.m =0; - mat.n =0; - mat.array =NULL; - mat.darray =NULL; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/d9/d9b30187181d42b42804af6c1a02d4a14f239ad5.svn-base b/cpplapack-r198/.svn/pristine/d9/d9b30187181d42b42804af6c1a02d4a14f239ad5.svn-base deleted file mode 100644 index bf274b2b2be4e7b92c7233bddfbf512af0638d68..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/d9/d9b30187181d42b42804af6c1a02d4a14f239ad5.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _dgematrix*double operator */ -inline _dgematrix operator*(const _dgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =mat.m*mat.n; - CPPL_INT inc =1; - dscal_(&mn, &d, mat.array, &inc); - return mat; -} - -//============================================================================= -/*! _dgematrix/double operator */ -inline _dgematrix operator/(const _dgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT mn =mat.m*mat.n; - double dinv =1./d; - CPPL_INT inc =1; - dscal_(&mn, &dinv, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/da/da164c54c44397cdca8b394aab874e44e8d067ea.svn-base b/cpplapack-r198/.svn/pristine/da/da164c54c44397cdca8b394aab874e44e8d067ea.svn-base deleted file mode 100644 index bfee7affd8f67c061f54b6013b850d92368212cb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/da/da164c54c44397cdca8b394aab874e44e8d067ea.svn-base +++ /dev/null @@ -1,173 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! solve */ -int32_t sor -( - const CPPL::dgsmatrix& A, - const CPPL::dcovector& b, - CPPL::dcovector& x, - const double& eps - ) -{ - /////////////////////////////////////////////// - ///////////////// mid values ////////////////// - /////////////////////////////////////////////// - CPPL::dcovector r(b-A*x); - CPPL::dcovector y(x.l); - const double omega(1.);//Gauss-Siedel - - //////// norm //////// - double norm_r, norm_r_min(DBL_MAX); - const double norm_r_ini(fabs(damax(r))); - std::cerr << "[NOTE]@sor: norm_r_ini=" << norm_r_ini << ", eps=" << eps<< std::endl; - if( norm_r_ini<DBL_MIN ){ - std::cerr << "[NOTE]@sor: already converged. v(^^)" << std::endl; - return 0; - } - - /////////////////////////////////////////////// - //////////////////// loop ///////////////////// - /////////////////////////////////////////////// - int itc(1); - int itmax(int(5.1*x.l)); - //int itmax(int(2.1*x.l)); - //int itmax(int(1.1*x.l)); - //int itmax(int(0.6*x.l)); - do{ - std::cerr << "** itc=" << itc << " ********************************************" << std::endl; - for(long i=0; i<x.l; i++){ - //std::cerr << "++++ i=" << i << " ++++" << std::endl; - double sigma =0.; - for(std::vector< std::pair<long,long> >::const_iterator p=A.rows[i].begin(); p!=A.rows[i].end(); p++){ - if(p->first<i){ - sigma +=A.data[p->second].v*y(p->first); - } - else if(p->first>i){ - sigma +=A.data[p->second].v*x(p->first); - } - } - double z =(b(i)-sigma)/A(i,i); - y(i) =x(i) +omega*(z-x(i)); - } - //////// update //////// - x =y; - //std::cerr << "x = " << t(x) << std::endl; - - //////// residual //////// - r =b-A*x; - //std::cerr << "r = " << t(r) << std::endl; - - //////// convergence check //////// - norm_r =fabs(damax(r)); - std::cerr << "norm_r = " << norm_r << std::endl; - if( isnan(norm_r) ){ break; }//failed - if( !std::isnormal(norm_r) ){ break; }//failed - if( !std::isfinite(norm_r) ){ break; }//failed - if( norm_r>1e3*norm_r_ini ){ break; }//failed (getting so worse) - if( norm_r<=eps ){//r satistied - std::cerr << "[NOTE]@sor: converged. v(^^) itc=" << itc << "/" << itmax << ", norm=" << norm_r << std::endl; - return 0; - } - }while(++itc<itmax); - - //////// failed //////// - std::cerr << "[NOTE]@sor: itc=" << itc << ", norm=" << norm_r << ", r_satisfied=" << (norm_r<=eps) << std::endl; - std::cerr << "[NOTE]@sor: failed to converge. orz" << std::endl; - return 1; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - /////////////////////////////////////////////// - //////////////// set precision //////////////// - /////////////////////////////////////////////// - std::cout.precision(9); - std::cout.setf(std::ios::scientific, std::ios::floatfield); - std::cout.setf(std::ios::showpos); - std::cerr.precision(3); - std::cerr.setf(std::ios::scientific, std::ios::floatfield); - std::cerr.setf(std::ios::showpos); - - /////////////////////////////////////////////// - //////////////////// A,b ////////////////////// - /////////////////////////////////////////////// - CPPL::dgsmatrix A; - CPPL::dcovector b; - bool file =false; - /////////////////////////// - ////////// read /////////// - /////////////////////////// - if(file){ - //A.read("A10.dge"); b.read("b10.dco"); - } - - /////////////////////////// - ///////// random ////////// - /////////////////////////// - else{//file==false - std::cerr << "# making random matrix" << std::endl; - const int size(1000); - A.resize(size,size); - b.resize(size); - srand(time(NULL)); - for(int i=0; i<size; i++){ - for(int j=0; j<size; j++){ - if( rand()%5==0 ){ - A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; - } - } - A(i,i) +=1e-2*double(size);//generalize - b(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - A.write("A.dge"); - b.write("b.dco"); - } - - /////////////////////////////////////////////// - ////////////////// direct ///////////////////// - /////////////////////////////////////////////// - std::cerr << "# making solution with dgesv" << std::endl; - CPPL::dgematrix A2(A.to_dgematrix()); - CPPL::dcovector b2(b); - A2.dgesv(b2); - b2.write("ans.dco"); - - /////////////////////////////////////////////// - ///////////////// iterative /////////////////// - /////////////////////////////////////////////// - //////// initial x //////// - CPPL::dcovector x(b.l); - //x.read("x_ini8.dco"); - x.zero(); - //////// eps //////// - double eps(fabs(damax(b))*1e-6); - std::cerr << "eps=" << eps << std::endl; - //////// solve //////// - if( sor(A, b, x, eps) ){ - std::cerr << "failed." << std::endl; - x.write("x.dco"); - exit(1); - } - x.write("x.dco"); - std::cerr << "fabs(damax(err))=" << fabs(damax(b2-x)) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base b/cpplapack-r198/.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/cpplapack-r198/.svn/pristine/db/dba4f8439c23f77b7db5be0e2640e7ea7e3b61c7.svn-base b/cpplapack-r198/.svn/pristine/db/dba4f8439c23f77b7db5be0e2640e7ea7e3b61c7.svn-base deleted file mode 100644 index 5f6598f15ff2dbdbddb23e467eaf0f32a42de358..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/db/dba4f8439c23f77b7db5be0e2640e7ea7e3b61c7.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+_dgsmatrix operator */ -inline _dgsmatrix operator+(const _dgsmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix-_dgsmatrix operator */ -inline _dgsmatrix operator-(const _dgsmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix*_dgsmatrix operator */ -inline _dgsmatrix operator*(const _dgsmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgsmatrix newmat(matA.m, matB.n); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) += it->v*matB.data[*p].v; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/db/dbe465283e4848413b822c117144dff2298a2026.svn-base b/cpplapack-r198/.svn/pristine/db/dbe465283e4848413b822c117144dff2298a2026.svn-base deleted file mode 100644 index 448083cd3a910d2f3f79adb57fc90b55ecf8d707..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/db/dbe465283e4848413b822c117144dff2298a2026.svn-base +++ /dev/null @@ -1,412 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void dssmatrix::clear() -{CPPL_VERBOSE_REPORT; - n =0; - data.clear(); - line.clear(); -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline dssmatrix& dssmatrix::zero() -{CPPL_VERBOSE_REPORT; - data.resize(0); - for(CPPL_INT i=0; i<n; i++){ line[i].resize(0); } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline dssmatrix& dssmatrix::identity() -{CPPL_VERBOSE_REPORT; - zero(); - for(CPPL_INT i=0; i<n; i++){ - put(i,i,1.); - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void dssmatrix::chsign() -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v =-it->v; - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void dssmatrix::copy(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - n =mat.n; - data =mat.data; - line =mat.line; -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void dssmatrix::shallow_copy(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - data.clear(); - line.clear(); - - n =mat.n; - data.swap(mat.data); - line.swap(mat.line); - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline dssmatrix& dssmatrix::resize(const CPPL_INT& _n, const CPPL_INT _c, const CPPL_INT _l) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _c<0 || _l<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes, the length of arrays, and line size must be positive integers. " << std::endl - << "Your input was (" << _n << "," << _c << "," << _l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - n =_n; - data.resize(0); - data.reserve(_c); - line.resize(n); - for(CPPL_INT i=0; i<n; i++){ - line[i].resize(0); - line[i].reserve(_l); - } - - return *this; -} - -//============================================================================= -/*! stretch the matrix size */ -inline void dssmatrix::stretch(const CPPL_INT& dn) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( n+dn<0 ){ - ERROR_REPORT; - std::cerr << "The new matrix size must be larger than zero." << std::endl - << "Your input was (" << dn << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// zero //////// - if(dn==0){ return; } - - //////// non-zero //////// - n +=dn; - - if(dn<0){ - //// delete components over the new size //// - const std::vector<dcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( it->i>=n ){ del( CPPL_INT(data_rend-it-1) ); } - } - //// shrink line //// - for(CPPL_INT i=0; i<-dn; i++){ - line.pop_back(); - } - } - else{//dn>0 - //// expand line //// - for(CPPL_INT i=0; i<dn; i++){ - line.push_back( std::vector<CPPL_INT>(0) ); - } - } -} - -//============================================================================= -/*! check if the component is listed */ -inline bool dssmatrix::isListed(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ return 1; } - } - - return 0; -} - -//============================================================================= -/*! return the element number of the component */ -inline CPPL_INT dssmatrix::number(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || n<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << n << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j)); - - const std::vector<CPPL_INT>::const_iterator line_ii_end =line[ii].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[ii].begin(); p!=line_ii_end; p++){ - if(data[*p].i==ii && data[*p].j==jj){ return *p; } - } - - return -1; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _drovector dssmatrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector vec(n); - vec.zero(); - - const std::vector<CPPL_INT>::const_iterator line__m_end =line[_m].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[_m].begin(); p!=line__m_end; p++){ - if(data[*p].i==_m){ - vec(data[*p].j) =data[*p].v; - } - else{ - vec(data[*p].i) =data[*p].v; - } - } - return _(vec); -} - -//============================================================================= -/*! get column of the matrix */ -inline _dcovector dssmatrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector vec(m); - vec.zero(); - - const std::vector<CPPL_INT>::const_iterator line__n_end =line[_n].end(); - for(std::vector<CPPL_INT>::const_iterator p=line[_n].begin(); p!=line__n_end; p++){ - if(data[*p].i==_n){ - vec(data[*p].j) =data[*p].v; - } - else{ - vec(data[*p].i) =data[*p].v; - } - } - return _(vec); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! erase components less than DBL_MIN */ -inline void dssmatrix::diet(const double eps) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::reverse_iterator data_rend =data.rend(); - for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data_rend; it++){ - if( fabs(it->v)<eps ){ del( CPPL_INT(data_rend-it-1) ); } - } -} - -//============================================================================= -/*! reorder components so that all diagonal componets are placed in front */ -/* -inline CPPL_INT dssmatrix::diag_front() -{CPPL_VERBOSE_REPORT; - //////// set initial dsize //////// - CPPL_INT dsize(0); - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data.end(); it++){ - if(it->i==it->j){ dsize++; } - else{ break; } - } - - //////// swapping loop //////// - for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data.rend()-dsize; it++){ - if(it->i==it->j){//is diag - CPPL_INT c(data.rend()-it-1);//current it's index - CPPL_INT i(data[dsize].i), j(data[dsize].j), k(it->i); - //// search (k,k) line //// - for(std::vector<CPPL_INT>::iterator p=line[k].begin(); p!=line[k].end(); p++){ - if(CPPL_INT(data[*p].i)==k && CPPL_INT(data[*p].j)==k){ *p=dsize; } - } - //// search (i,j) line //// - for(std::vector<CPPL_INT>::iterator p=line[i].begin(); p!=line[i].end(); p++){ - if(CPPL_INT(*p)==dsize){ *p=c; } - } - //// search (j,i) line //// - if(i!=j){ - for(std::vector<CPPL_INT>::iterator p=line[j].begin(); p!=line[j].end(); p++){ - if(CPPL_INT(*p)==dsize){ *p=c; } - } - } - else{//i==j - it--; - } - //// swap //// - std::swap(data[dsize],data[c]); - //// update //// - dsize++; - } - } - - return dsize; -} -*/ - -//============================================================================= -/*! reorder components */ -inline void dssmatrix::reorder(const bool mode) -{CPPL_VERBOSE_REPORT; - //// sort data //// - if(mode==0){ - std::sort(data.begin(), data.end(), dcomponent::ilt); - } - else{ - std::sort(data.begin(), data.end(), dcomponent::jlt); - } - //// rebuild line //// - rebuild(); -} - -//============================================================================= -/*! rebuild line */ -inline void dssmatrix::rebuild() -{CPPL_VERBOSE_REPORT; - //// clear line //// - for(CPPL_INT i=0; i<n; i++){ line[i].resize(0); } - - //// build line //// - CPPL_INT c(0); - const std::vector<dcomponent>::iterator data_end =data.end(); - for(std::vector<dcomponent>::iterator it=data.begin(); it!=data_end; it++){ - line[it->i].push_back(c); - if( (it->i) != (it->j) ){ - line[it->j].push_back(c); - } - c++; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! health checkup */ -inline void dssmatrix::checkup() -{CPPL_VERBOSE_REPORT; - //////// write //////// - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - std::cerr << "array[" << it-data.begin() << "] = (" << it->i << "," << it->j << ") = " << it->v << std::endl; - } - std::cerr << std::endl; - - for(CPPL_INT i=0; i<n; i++){ - std::cerr << "line[" << i << "] =" << std::flush; - const size_t line_i_size =line[i].size(); - for(size_t k=0; k<line_i_size; k++){ - std::cerr << " " << line[i][k] << std::flush; - } - std::cerr << std::endl; - } - std::cerr << std::endl; - - //////// Elements //////// - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - //// m bound //// - if(it->i>=n){ - ERROR_REPORT; - std::cerr << "The indx of the " << it-data.begin() << "th element is out of the matrix size." << std::endl - << "Its i index was " << it->i << "." << std::endl; - exit(1); - } - - //// n bound //// - if(it->j>=n){ - ERROR_REPORT; - std::cerr << "The jndx of the " << it-data.begin() << "th element is out of the matrix size." << std::endl - << "Its j index was " << it->j << "." << std::endl; - exit(1); - } - - //// double-listed //// - for(std::vector<dcomponent>::const_iterator IT=it+1; IT!=data_end; IT++){ - if( it->i==IT->i && it->j==IT->j ){ - ERROR_REPORT; - std::cerr << "The (" << it->i << ", " << it->j << ") component is double-listed at the " << it-data.begin() << "th and the" << IT-data.begin() << "the elements."<< std::endl; - exit(1); - } - } - } - - //////// NOTE //////// - std::cerr << "# [NOTE]@dssmatrix::checkup(): This symmetric sparse matrix is fine." << std::endl; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(dssmatrix& A, dssmatrix& B) -{CPPL_VERBOSE_REPORT; - std::swap(A.n,B.n); - std::swap(A.data,B.data); - std::swap(A.line,B.line); -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _dssmatrix _(dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - _dssmatrix newmat; - - //////// shallow copy //////// - newmat.n =mat.n; - std::swap(newmat.data,mat.data); - std::swap(newmat.line,mat.line); - - //////// nullify //////// - mat.n =0; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/dc/dc829351facff7bcc314aee119bb1315d2f4f61d.svn-base b/cpplapack-r198/.svn/pristine/dc/dc829351facff7bcc314aee119bb1315d2f4f61d.svn-base deleted file mode 100644 index 92d8a982dfbd7228aee1e1c8e38575ccfae8994d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/dc/dc829351facff7bcc314aee119bb1315d2f4f61d.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -//============================================================================= -/*! dgrmatrix*=double operator */ -inline dgrmatrix& dgrmatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<double>::iterator a_end =a.end(); - for(std::vector<double>::iterator it=a.begin(); it!=a_end; it++){ - (*it) *=d; - } - - return *this; -} - -//============================================================================= -/*! dgrmatrix/=double operator */ -inline dgrmatrix& dgrmatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<double>::iterator a_end =a.end(); - for(std::vector<double>::iterator it=a.begin(); it!=a_end; it++){ - (*it) /=d; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgrmatrix*double operator */ -inline dgrmatrix operator*(const dgrmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgrmatrix newmat =mat; - - const std::vector<double>::iterator newmat_a_end =newmat.a.end(); - for(std::vector<double>::iterator it=newmat.a.begin(); it!=newmat_a_end; it++){ - (*it) *=d; - } - - return newmat; -} - -//============================================================================= -/*! dgrmatrix/double operator */ -inline dgrmatrix operator/(const dgrmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - dgrmatrix newmat =mat; - - const std::vector<double>::iterator newmat_a_end =newmat.a.end(); - for(std::vector<double>::iterator it=newmat.a.begin(); it!=newmat_a_end; it++){ - (*it) /=d; - } - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/dd/dd2bb9d546278d4f69e114a32e99ce9e8d14f155.svn-base b/cpplapack-r198/.svn/pristine/dd/dd2bb9d546278d4f69e114a32e99ce9e8d14f155.svn-base deleted file mode 100644 index 80e2303aa8beb3c6b40b24f4bd1ca93c92ac9dee..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/dd/dd2bb9d546278d4f69e114a32e99ce9e8d14f155.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - cout << "A*10. =\n" << A*10. << endl; - cout << "A/10. =\n" << A/10. << endl; - - cout << "#### A*=10.; ####" << endl; - A*=10.; - cout << "A =\n" << A << endl; - cout << "#### A/=10.; ####" << endl; - A/=10.; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/dd/dd573a2ed0f2a7c8bd4c7772323378afa1907128.svn-base b/cpplapack-r198/.svn/pristine/dd/dd573a2ed0f2a7c8bd4c7772323378afa1907128.svn-base deleted file mode 100644 index 4a6bdeb7a31f65be8d3af953d70e981b2885bd54..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/dd/dd573a2ed0f2a7c8bd4c7772323378afa1907128.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _zgematrix*double operator */ -inline _zgematrix operator*(const _zgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - zdscal_(&size, &d, mat.array, &inc); - return mat; -} - -//============================================================================= -/*! _zgematrix/double operator */ -inline _zgematrix operator/(const _zgematrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - double dinv =1./d; - CPPL_INT inc =1; - zdscal_(&size, &dinv, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/dd/ddc20d5a9d6513d369e28390e22a8ebc76dd682a.svn-base b/cpplapack-r198/.svn/pristine/dd/ddc20d5a9d6513d369e28390e22a8ebc76dd682a.svn-base deleted file mode 100644 index 22989f9b7009a6ff497eddae61d4416633d00bf7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/dd/ddc20d5a9d6513d369e28390e22a8ebc76dd682a.svn-base +++ /dev/null @@ -1,160 +0,0 @@ -//============================================================================= -/*! zgsmatrix=zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator=(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - if(&data!=&mat.data){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix+=zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator+=(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) +=it->v; - } - - return *this; -} - -//============================================================================= -/*! zgsmatrix-=zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator-=(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -=it->v; - } - - return *this; -} - -//============================================================================= -/*! zgsmatrix*=zgsmatrix operator */ -inline zgsmatrix& zgsmatrix::operator*=(const zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(m, mat.n); - - const std::vector<zcomponent>::const_iterator data_end =data.end(); - for(std::vector<zcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::const_iterator mat_rows_k_end =mat.rows[k].end(); - for(std::vector<CPPL_INT>::const_iterator p=mat.rows[k].begin(); p!=mat_rows_k_end; p++){ - newmat(it->i,mat.data[*p].j) +=it->v*mat.data[*p].v; - } - } - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zgsmatrix+zgsmatrix operator */ -inline _zgsmatrix operator+(const zgsmatrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix-zgsmatrix operator */ -inline _zgsmatrix operator-(const zgsmatrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA); - - const std::vector<zcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<zcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i, it->j) -=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! zgsmatrix*zgsmatrix operator */ -inline _zgsmatrix operator*(const zgsmatrix& matA, const zgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgsmatrix newmat(matA.m, matB.n); - - const std::vector<zcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - CPPL_INT k =it->j; - const std::vector<CPPL_INT>::const_iterator matB_rows_k_end =matB.rows[k].end(); - for(std::vector<CPPL_INT>::const_iterator p=matB.rows[k].begin(); p!=matB_rows_k_end; p++){ - newmat(it->i,matB.data[*p].j) +=it->v*matB.data[*p].v; - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/dd/ddd621d2fb6ee05ddaabfc65a0314f520e147e4e.svn-base b/cpplapack-r198/.svn/pristine/dd/ddd621d2fb6ee05ddaabfc65a0314f520e147e4e.svn-base deleted file mode 100644 index 5bdd17964f3fc595de0256b91947863e3fd83a57..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/dd/ddd621d2fb6ee05ddaabfc65a0314f520e147e4e.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! zrovector*_zgsmatrix operator */ -inline _zrovector operator*(const zrovector& vec, const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/dd/dddce256f4aa67a2124bfd7b47e3c99533d56e65.svn-base b/cpplapack-r198/.svn/pristine/dd/dddce256f4aa67a2124bfd7b47e3c99533d56e65.svn-base deleted file mode 100644 index dc659c9d74095b0f9e4b220b6743dfdbc907f42d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/dd/dddce256f4aa67a2124bfd7b47e3c99533d56e65.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! _zgbmatrix*comple operator */ -inline _zgbmatrix operator*(const _zgbmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - CPPL_INT inc =1; - zscal_(&size, &d, mat.array, &inc); - return mat; -} - -//============================================================================= -/*! _zgbmatrix/comple operator */ -inline _zgbmatrix operator/(const _zgbmatrix& mat, const comple& d) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - comple dinv =1./d; - CPPL_INT inc =1; - zscal_(&size, &dinv, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/de/de1a664d45312ad472e30d469b88a42b8c318465.svn-base b/cpplapack-r198/.svn/pristine/de/de1a664d45312ad472e30d469b88a42b8c318465.svn-base deleted file mode 100644 index 39dfed2721e6a68632fa6e46b9f47d17eee9a929..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/de/de1a664d45312ad472e30d469b88a42b8c318465.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! cast to _zcovector */ -inline _zcovector dcovector::to_zcovector() const -{CPPL_VERBOSE_REPORT; - zcovector newvec(l); - - for(CPPL_INT i=0; i<l; i++){ - newvec.array[i] =comple(array[i], 0.); - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/de/de32ee47aabbd724821fefdade418d56376ab841.svn-base b/cpplapack-r198/.svn/pristine/de/de32ee47aabbd724821fefdade418d56376ab841.svn-base deleted file mode 100644 index 07695faf92206b3c26e32f22201626f4e3ab90af..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/de/de32ee47aabbd724821fefdade418d56376ab841.svn-base +++ /dev/null @@ -1,15 +0,0 @@ -//============================================================================= -/*! _dcovector*drovector operator */ -inline _dgematrix operator*(const _dcovector& covec, const drovector& rovec) -{CPPL_VERBOSE_REPORT; - dgematrix newmat(covec.l, rovec.l); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - newmat(i,j) =covec(i)*rovec(j); - } - } - - covec.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/de/de4e67014960ad3b0d47ae5891ba22bf895e581b.svn-base b/cpplapack-r198/.svn/pristine/de/de4e67014960ad3b0d47ae5891ba22bf895e581b.svn-base deleted file mode 100644 index 60c4da456c8ccbd88eeff23f0ebc0f0436158592..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/de/de4e67014960ad3b0d47ae5891ba22bf895e581b.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline comple& _zcovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is (" << l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ - s << " " << vec.array[i] << std::endl; - } - - vec.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _zcovector::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zcovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/de/de59c358f9d61a9ecb8d487ddf9bb4d0be727106.svn-base b/cpplapack-r198/.svn/pristine/de/de59c358f9d61a9ecb8d487ddf9bb4d0be727106.svn-base deleted file mode 100644 index f69ace815bc41a6163e8678227a2733e9d3de8ea..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/de/de59c358f9d61a9ecb8d487ddf9bb4d0be727106.svn-base +++ /dev/null @@ -1,33 +0,0 @@ -//============================================================================= -/*! _dgematrix constructor without arguments */ -inline _dgematrix::_dgematrix() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - array =NULL; - darray =NULL; -} - -//============================================================================= -/*! _dgematrix copy constructor */ -inline _dgematrix::_dgematrix(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - array =mat.array; - darray =mat.darray; - - mat.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix destructor */ -inline _dgematrix::~_dgematrix() -{CPPL_VERBOSE_REPORT; - delete [] darray; - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/df/df0381167681ab81cbf5ac8a8f21bdc73ccc02a7.svn-base b/cpplapack-r198/.svn/pristine/df/df0381167681ab81cbf5ac8a8f21bdc73ccc02a7.svn-base deleted file mode 100644 index 88b4d460eaf76c21a1c23f7b0100ff38a23f995d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/df/df0381167681ab81cbf5ac8a8f21bdc73ccc02a7.svn-base +++ /dev/null @@ -1,82 +0,0 @@ -//============================================================================= -/*! dgbmatrix+dsymatrix operator */ -inline _dgematrix operator+(const dgbmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB.n,matB.n); - - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) = matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix-dsymatrix operator */ -inline _dgematrix operator-(const dgbmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB.n,matB.n); - for(CPPL_INT i=0; i<matA.m; i++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(i,j) = -matB(i,j); - } - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j) += matA(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix*dsymatrix operator */ -inline _dgematrix operator*(const dgbmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT k=std::max(CPPL_INT(0),i-matA.kl); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/df/df1a68e4341b4070fb580f934587c5964c7d373d.svn-base b/cpplapack-r198/.svn/pristine/df/df1a68e4341b4070fb580f934587c5964c7d373d.svn-base deleted file mode 100644 index 2482587be3f3bb5fe9ffc9b76225c15f0010ed17..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/df/df1a68e4341b4070fb580f934587c5964c7d373d.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! comple*zrovector operator */ -inline _zrovector operator*(const comple& d, const zrovector& vec) -{CPPL_VERBOSE_REPORT; - zrovector newvec(vec.l); - - for(CPPL_INT i=0; i<vec.l; i++){ - newvec.array[i] =d*vec.array[i]; - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/df/df38886478e71e8a1f6922a9a3c53abb44a8eab2.svn-base b/cpplapack-r198/.svn/pristine/df/df38886478e71e8a1f6922a9a3c53abb44a8eab2.svn-base deleted file mode 100644 index 8433b1c632f2244fd767a2936baa58509ec42ad0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/df/df38886478e71e8a1f6922a9a3c53abb44a8eab2.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! _dssmatrix*double operator */ -inline _dssmatrix operator*(const _dssmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v *=d; - } - - return mat; -} - -//============================================================================= -/*! _dssmatrix/double operator */ -inline _dssmatrix operator/(const _dssmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<dcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v /=d; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/df/df3bfe7dbbd15f5706c7d8d0c937f5ade3c43b49.svn-base b/cpplapack-r198/.svn/pristine/df/df3bfe7dbbd15f5706c7d8d0c937f5ade3c43b49.svn-base deleted file mode 100644 index 4993f7b8cb8a43af86ad43aecc60fe1dbc94dee8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/df/df3bfe7dbbd15f5706c7d8d0c937f5ade3c43b49.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! drovector*dssmatrix operator */ -inline _drovector operator*(const drovector& vec, const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) +=vec(it->j)*it->v; - } - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/df/df42fa7afc044c6e418e46404c18c677092da4bf.svn-base b/cpplapack-r198/.svn/pristine/df/df42fa7afc044c6e418e46404c18c677092da4bf.svn-base deleted file mode 100644 index 4925fbdb6dd6e8ee0f1c70518982334b8788e3dd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/df/df42fa7afc044c6e418e46404c18c677092da4bf.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+zhematrix operator */ -/* -inline _zgematrix operator+(const _zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix-zhematrix operator */ -/* -inline _zgematrix operator-(const _zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(-matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix*zhematrix operator */ -/* -inline _zgematrix operator*(const _zgsmatrix& matA, const zhematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/df/df4e43c1b57985cdc0fda4cd6b4e080dc2e239b4.svn-base b/cpplapack-r198/.svn/pristine/df/df4e43c1b57985cdc0fda4cd6b4e080dc2e239b4.svn-base deleted file mode 100644 index ff4b35545b61be1d144ddd70b9527b88625124d7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/df/df4e43c1b57985cdc0fda4cd6b4e080dc2e239b4.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -//============================================================================= -/*! drovector constructor */ -inline _drovector::_drovector() -{CPPL_VERBOSE_REPORT; - l =0; - cap =0; - array =NULL; -} - -//============================================================================= -/*! _drovector copy constructor */ -inline _drovector::_drovector(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - array =vec.array; - - vec.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _drovector destructor */ -inline _drovector::~_drovector() -{CPPL_VERBOSE_REPORT; - delete[] array; -} diff --git a/cpplapack-r198/.svn/pristine/df/dfc3518198989f7a0ee3d1463377101b2ab82063.svn-base b/cpplapack-r198/.svn/pristine/df/dfc3518198989f7a0ee3d1463377101b2ab82063.svn-base deleted file mode 100644 index e3e512482cce712076a4aca89f7741ba887f233a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/df/dfc3518198989f7a0ee3d1463377101b2ab82063.svn-base +++ /dev/null @@ -1,36 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::zcovector x(M); - CPPL::zrovector y(M); - - for(int i=0; i<x.l; i++){ - x(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - for(int i=0; i<y.l; i++){ - y(i) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - cout << "x =\n" << x << endl; - cout << "y =\n" << y << endl; - cout << "x*y =\n" << x*y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/e0/e057b2069a27ec118b34385e1809d80391acf29c.svn-base b/cpplapack-r198/.svn/pristine/e0/e057b2069a27ec118b34385e1809d80391acf29c.svn-base deleted file mode 100644 index ef3c6d2b79fff6845c9f5248a842661c5400f375..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e0/e057b2069a27ec118b34385e1809d80391acf29c.svn-base +++ /dev/null @@ -1,61 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double& _dgbmatrix::operator()(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j || i-j>kl || j-i>ku ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is (" << m << "," << n << " , " << kl << "," << ku << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //return array[ku+i+(kl+ku)*j]; - return darray[j][ku-j+i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m; i++){ - for(CPPL_INT j=0; j<mat.n; j++){ - if( i-j>mat.kl || j-i>mat.ku ){ s << " x"; } - else{ s << " " << mat(i,j); } - } - s << std::endl; - } - - mat.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _dgbmatrix::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dgbmatrix" << " " << m << " " << n << " " << kl << " " << ku << std::endl; - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - ofs << operator()(i,j) << " "; - } - ofs << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/e0/e07216b850ef207375126b262fd6d46d43e11407.svn-base b/cpplapack-r198/.svn/pristine/e0/e07216b850ef207375126b262fd6d46d43e11407.svn-base deleted file mode 100644 index d53e881e6bc99637dbf2ae6bdc1b8e7dcd3b9754..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e0/e07216b850ef207375126b262fd6d46d43e11407.svn-base +++ /dev/null @@ -1,133 +0,0 @@ -//============================================================================= -/*! dssmatrix=dssmatrix operator */ -inline dssmatrix& dssmatrix::operator=(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - if(&data!=&mat.data){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix+=dssmatrix operator */ -inline dssmatrix& dssmatrix::operator+=(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << n << "x" << n << ") += (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) +=it->v; - } - - return *this; -} - -//============================================================================= -/*! dssmatrix-=dssmatrix operator */ -inline dssmatrix& dssmatrix::operator-=(const dssmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << n << "x" << n << ") -= (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - (*this)(it->i,it->j) -=it->v; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dssmatrix+dssmatrix operator */ -inline _dssmatrix operator+(const dssmatrix& matA, const dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) +=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dssmatrix-dssmatrix operator */ -inline _dssmatrix operator-(const dssmatrix& matA, const dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat(matA); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -=it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dssmatrix*dssmatrix operator */ -/* -inline _dgsmatrix operator*(const dssmatrix& matA, const dssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dssmatrix newmat( matA.n, 0 ); - - for(CPPL_INT c=0; c<matA.vol; c++){ - CPPL_INT k(matA.jndx[c]); - std::vector< std::pair<CPPL_INT,CPPL_INT> >::iterator p; - for(p=matB.Col[k].begin(); p!=matB.Col[k].end(); p++){ - newmat(matA.indx[c],p->first) +=matA.array[c]*matB.array[p->second]; - } - } - - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/e0/e075d03b691e87484f432a82d3dc622d0dd0161e.svn-base b/cpplapack-r198/.svn/pristine/e0/e075d03b691e87484f432a82d3dc622d0dd0161e.svn-base deleted file mode 100644 index b75730398bb6b89ae64128cd5eb68af9f74d527c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e0/e075d03b691e87484f432a82d3dc622d0dd0161e.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! +drovector operator */ -inline const drovector& operator+(const drovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -drovector operator */ -inline _drovector operator-(const drovector& vec) -{CPPL_VERBOSE_REPORT; - drovector newvec(vec.l); - for(CPPL_INT i=0; i<newvec.l; i++){ newvec.array[i]=-vec.array[i]; } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/e0/e08f01e628530cc8996317afcb6b0b4b52dfc1a4.svn-base b/cpplapack-r198/.svn/pristine/e0/e08f01e628530cc8996317afcb6b0b4b52dfc1a4.svn-base deleted file mode 100644 index 9249e37ba1fcf6969d33b4e073cd899abe59b326..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e0/e08f01e628530cc8996317afcb6b0b4b52dfc1a4.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -//============================================================================= -/*! _zhematrix+_zgbmatrix operator */ -inline _zgematrix operator+(const _zhematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix-_zgbmatrix operator */ -inline _zgematrix operator-(const _zhematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix*_zgbmatrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const _zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e0/e0f996a295bb5189191871098791eb563eba4367.svn-base b/cpplapack-r198/.svn/pristine/e0/e0f996a295bb5189191871098791eb563eba4367.svn-base deleted file mode 100644 index 07100135ce4c020451d217368d7740225c81c13c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e0/e0f996a295bb5189191871098791eb563eba4367.svn-base +++ /dev/null @@ -1,8 +0,0 @@ -//============================================================================= -/*! comple*_zrovector operator */ -inline _zrovector operator*(const comple& d, const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - zscal_(&vec.l, &d, vec.array, &inc); - return vec; -} diff --git a/cpplapack-r198/.svn/pristine/e1/e1279a58a3e224b1c212ea6c3d9f08db5d037ca5.svn-base b/cpplapack-r198/.svn/pristine/e1/e1279a58a3e224b1c212ea6c3d9f08db5d037ca5.svn-base deleted file mode 100644 index 8de30104bd677d3b99364a9f14fa2a86a68126f0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e1/e1279a58a3e224b1c212ea6c3d9f08db5d037ca5.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+_dsymatrix operator */ -/* -inline _dgematrix operator+(const _dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix-_dsymatrix operator */ -/* -inline _dgematrix operator-(const _dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to dgematrix //// - dgematrix newmat(-matB); - - //// add //// - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix*_dsymatrix operator */ -/* -inline _dgematrix operator*(const _dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/e1/e12a23e9161b29141242fd0fd2326d88897520a6.svn-base b/cpplapack-r198/.svn/pristine/e1/e12a23e9161b29141242fd0fd2326d88897520a6.svn-base deleted file mode 100644 index fd644be1749b54a462d9e7151fc206bdff2adc57..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e1/e12a23e9161b29141242fd0fd2326d88897520a6.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! dgbmatrix+_dgsmatrix operator */ -inline _dgematrix operator+(const dgbmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix-_dgsmatrix operator */ -inline _dgematrix operator-(const dgbmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( (-matB).to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)-=matA(i,j); - } - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix*_dgsmatrix operator */ -inline _dgematrix operator*(const dgbmatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - const CPPL_INT imax =std::min(matA.m,it->i+matA.kl); - for(CPPL_INT i=std::max(CPPL_INT(0),it->i-(matA.ku+1)); i<imax; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e1/e13c3be93f8247eda58c7bf3af65371444846ff2.svn-base b/cpplapack-r198/.svn/pristine/e1/e13c3be93f8247eda58c7bf3af65371444846ff2.svn-base deleted file mode 100644 index 1a82d4ad66a5c256073ea9dc735e2e2667d3af6b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e1/e13c3be93f8247eda58c7bf3af65371444846ff2.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+dsymatrix operator */ -inline _dgematrix operator+(const _dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix-dsymatrix operator */ -inline _dgematrix operator-(const _dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( (-matB).to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix*dsymatrix operator */ -inline _dgematrix operator*(const _dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e1/e1e68b5942404451367c01ac9927a1b441a9070d.svn-base b/cpplapack-r198/.svn/pristine/e1/e1e68b5942404451367c01ac9927a1b441a9070d.svn-base deleted file mode 100644 index 3d248099fb552da9a567ab86dc2d33d7d6386dd1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e1/e1e68b5942404451367c01ac9927a1b441a9070d.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! dssmatrix*dcovector operator */ -inline _dcovector operator*(const dssmatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=it->v*vec(it->i); - } - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/e2/e27c872aa886da9894776187c2280c73d2169faa.svn-base b/cpplapack-r198/.svn/pristine/e2/e27c872aa886da9894776187c2280c73d2169faa.svn-base deleted file mode 100644 index f716f6aa81b7a5f111a33f25e79fb39b15ed3d6b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e2/e27c872aa886da9894776187c2280c73d2169faa.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -/*! dcovector constructor */ -inline dcovector::dcovector() -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =0; - cap =0; - array =NULL; -} - -//============================================================================= -/*! dcovector copy constructor */ -inline dcovector::dcovector(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - cap =vec.cap; - array =new double[cap]; - - //////// copy //////// - CPPL_INT inc =1; - dcopy_(&l, vec.array, &inc, array, &inc); -} - -//============================================================================= -/*! dcovector constructor to cast _dcovector */ -inline dcovector::dcovector(const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - //////// initialize //////// - l =vec.l; - cap =vec.cap; - array =vec.array; - - vec.nullify(); -} - -//============================================================================= -/*! dcovector constructor with size specification */ -inline dcovector::dcovector(const CPPL_INT& _l, const CPPL_INT margin) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _l<0 ){ - ERROR_REPORT; - std::cerr << "Vector size must be positive integers. " << std::endl - << "Your input was (" << _l << ")." << std::endl; - exit(1); - } - if( margin<0 ){ - ERROR_REPORT; - std::cerr << "Vector margin must be zero or above. " << std::endl - << "Your input was (" << _l << ", " << margin << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //////// initialize //////// - l =_l; - cap =l+margin; - array =new double[cap]; -} - -//============================================================================= -/*! dcovector constructor with filename */ -inline dcovector::dcovector(const char* filename) -{CPPL_VERBOSE_REPORT; - array =NULL; - read(filename); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dcovector destructor */ -inline dcovector::~dcovector() -{CPPL_VERBOSE_REPORT; - //////// delete array //////// - delete [] array; -} diff --git a/cpplapack-r198/.svn/pristine/e3/e307da2c3968a2b87ed340e0d65c128b8c1af5b1.svn-base b/cpplapack-r198/.svn/pristine/e3/e307da2c3968a2b87ed340e0d65c128b8c1af5b1.svn-base deleted file mode 100644 index d4627abea56d44e85e6f63fad50d3cee2f934a3b..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e3/e307da2c3968a2b87ed340e0d65c128b8c1af5b1.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! zhematrix+_zssmatrix operator */ -inline _zgematrix operator+(const zhematrix& matA, const _zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zhematrix-_zssmatrix operator */ -inline _zgematrix operator-(const zhematrix& matA, const _zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c]; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! zhematrix*_zssmatrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const _zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e3/e3ed1205506665ac177b23c551ef2d71c50bdc96.svn-base b/cpplapack-r198/.svn/pristine/e3/e3ed1205506665ac177b23c551ef2d71c50bdc96.svn-base deleted file mode 100644 index 29b3e9de65238dec4abe32e45c7f97c3f8b7f425..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e3/e3ed1205506665ac177b23c551ef2d71c50bdc96.svn-base +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -/*! +dgsmatrix operator */ -inline const dgsmatrix& operator+(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -dgsmatrix operator */ -inline _dgsmatrix operator-(const dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgsmatrix newmat(mat); - - const std::vector<dcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<dcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v =-it->v; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e4/e457c0ea65e301bf8b8fb5757bd322c6d7cb826f.svn-base b/cpplapack-r198/.svn/pristine/e4/e457c0ea65e301bf8b8fb5757bd322c6d7cb826f.svn-base deleted file mode 100644 index ec42c4fd5b4b3f45943ee778cd048d565cac154d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e4/e457c0ea65e301bf8b8fb5757bd322c6d7cb826f.svn-base +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -rootdir=`pwd` -MAKEFILE=$HOME/local/cpplapack/makefiles/Makefile - -rm -f do.log - -for i in `find * -type d | grep -v .svn`; do - if [ -d $i ]; then - echo "################ Enter into $i/ ################" - cd $i - if [ -f main.cpp ]; then - make -f $MAKEFILE fullclean && rm -f SUCCEEDED tmp.txt - fi - if [ $? != 0 ]; then exit 1; fi - cd $rootdir - echo "################ Exit from $i/ ################" - fi -done diff --git a/cpplapack-r198/.svn/pristine/e4/e47a9036fbd9bea2c6ba958ad7b1d50fc61895cd.svn-base b/cpplapack-r198/.svn/pristine/e4/e47a9036fbd9bea2c6ba958ad7b1d50fc61895cd.svn-base deleted file mode 100644 index a2b426a7e072c323e36d785194bae60c48aafe62..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e4/e47a9036fbd9bea2c6ba958ad7b1d50fc61895cd.svn-base +++ /dev/null @@ -1,14 +0,0 @@ -//============================================================================= -/*! +_zgematrix operator */ -inline const _zgematrix& operator+(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_zgematrix operator */ -inline _zgematrix operator-(const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<mat.m*mat.n; i++){ mat.array[i]=-mat.array[i]; } - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/e4/e4a1f2759e53e720501f34b110e616e1f4928c03.svn-base b/cpplapack-r198/.svn/pristine/e4/e4a1f2759e53e720501f34b110e616e1f4928c03.svn-base deleted file mode 100644 index 1d98f26028bcdfc9c71a2d015476194cf4e2b955..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e4/e4a1f2759e53e720501f34b110e616e1f4928c03.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! drovector*_dsymatrix operator */ -inline _drovector operator*(const drovector& vec, const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/e4/e4f9f3cefac52eb0419ef09562342ea949a70357.svn-base b/cpplapack-r198/.svn/pristine/e4/e4f9f3cefac52eb0419ef09562342ea949a70357.svn-base deleted file mode 100644 index 3cdb6157331f1470dd2b6b42d903c7c9f1a76f8f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e4/e4f9f3cefac52eb0419ef09562342ea949a70357.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! zrovector*zhematrix operator */ -inline _zrovector operator*(const zrovector& vec, const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - char uplo ='l'; - comple alpha =comple(1.,0.); - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zhemv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/e5/e56fb09e3adc70b10b26e5e9866ba1e0fb209826.svn-base b/cpplapack-r198/.svn/pristine/e5/e56fb09e3adc70b10b26e5e9866ba1e0fb209826.svn-base deleted file mode 100644 index 10c77130231b52d9ac055893529f1989584417a2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e5/e56fb09e3adc70b10b26e5e9866ba1e0fb209826.svn-base +++ /dev/null @@ -1,72 +0,0 @@ -//============================================================================= -/*! return transposed zgbmatrix */ -inline _zgbmatrix t(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - newmat(i,j) =mat(j,i); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _zgematrix i(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgbmatrix mat_cp(mat); - zgematrix mat_inv(mat.m,mat.n); - mat_inv.identity(); - mat_cp.zgbsv(mat_inv); - - return _(mat_inv); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its conjugate matrix */ -inline _zgbmatrix conj(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - for(CPPL_INT i=0; i<mat.m; i++){ - const CPPL_INT jmax =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - newmat(i,j) =std::conj(mat(i,j)); - } - } - - return _(newmat); -} - -//============================================================================= -/*! return its conjugate transposed zgbmatrix */ -inline _zgbmatrix conjt(const zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - newmat(i,j) =std::conj(mat(j,i)); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e5/e59448f0993651371bd2f188732ff3ebc6fb29e0.svn-base b/cpplapack-r198/.svn/pristine/e5/e59448f0993651371bd2f188732ff3ebc6fb29e0.svn-base deleted file mode 100644 index f06e23cdf7e5c6c10e50c1f75cf538a2abe37ab2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e5/e59448f0993651371bd2f188732ff3ebc6fb29e0.svn-base +++ /dev/null @@ -1,22 +0,0 @@ -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const dgrmatrix& mat) -{CPPL_VERBOSE_REPORT; - //////// exception //////// - if(mat.a.size()==0){ - return 0.; - } - - //////// find //////// - const size_t mat_a_size =mat.a.size(); - double amax =0.; - double vmax; - for(size_t k=0; k<mat_a_size; k++){ - if( amax < fabs(mat.a[k]) ){ - amax =fabs(mat.a[k]); - vmax =mat.a[k]; - } - } - - return vmax; -} diff --git a/cpplapack-r198/.svn/pristine/e6/e66cf4c1d3e40114fc419b569a208c7884cc5295.svn-base b/cpplapack-r198/.svn/pristine/e6/e66cf4c1d3e40114fc419b569a208c7884cc5295.svn-base deleted file mode 100644 index 65180f2fce4c082229101a90ef765c8373ee7dca..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e6/e66cf4c1d3e40114fc419b569a208c7884cc5295.svn-base +++ /dev/null @@ -1,27 +0,0 @@ -//============================================================================= -/*! zhsmatrix*_zcovector operator */ -inline _zcovector operator*(const zhsmatrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.n << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) +=it->v*vec(it->j); - if(it->i!=it->j){ - newvec(it->j) +=std::conj(it->v)*vec(it->i); - } - } - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/e6/e6a9fe091c43894802680bdb6c94c154ad7d386f.svn-base b/cpplapack-r198/.svn/pristine/e6/e6a9fe091c43894802680bdb6c94c154ad7d386f.svn-base deleted file mode 100644 index 0689bb068877f1961854d837e9499de703d72d50..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e6/e6a9fe091c43894802680bdb6c94c154ad7d386f.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================= -/*! _dgematrix+_dgbmatrix operator */ -inline _dgematrix operator+(const _dgematrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) += matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix-_dgbmatrix operator */ -inline _dgematrix operator-(const _dgematrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<matB.m; i++){ - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - matA(i,j) -= matB(i,j); - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dgematrix*_dgbmatrix operator */ -inline _dgematrix operator*(const _dgematrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e7/e737e9433c7d9d6d8a8226d629693c4030e73af9.svn-base b/cpplapack-r198/.svn/pristine/e7/e737e9433c7d9d6d8a8226d629693c4030e73af9.svn-base deleted file mode 100644 index ae2bd50ad74b3894f63ee7a52707edf672a40eb8..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e7/e737e9433c7d9d6d8a8226d629693c4030e73af9.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! return transposed _dssmatrix */ -inline _dssmatrix t(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax(0); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if(vmax < it->v){ - vmax=fabs(it->v); - itx=it; - } - } - - i=itx->i; - j=itx->j; - - mat.destroy(); -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const _dssmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<dcomponent>::const_iterator itx(mat.data.begin()); - double vmax(0); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if(vmax < it->v){ - vmax=fabs(it->v); - itx=it; - } - } - - double val(itx->v); - mat.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/e7/e7510d7cd9843ab66a284353e54534e863628cac.svn-base b/cpplapack-r198/.svn/pristine/e7/e7510d7cd9843ab66a284353e54534e863628cac.svn-base deleted file mode 100644 index 9263e87756c582f74a92180eed48cfb7dc4c38e4..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e7/e7510d7cd9843ab66a284353e54534e863628cac.svn-base +++ /dev/null @@ -1,256 +0,0 @@ -//============================================================================= -/*! complete the upper-right components */ -inline void zhematrix::complete() const -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - darray[i][j] =std::conj(darray[j][i]); - } -#ifdef CPPL_DEBUG - if(std::fabs(std::imag(operator()(i,i))) > DBL_MIN){ - WARNING_REPORT; - std::cerr << "The " << i << "th diagonal component of the zhematrix is not a real number." << std::endl; - } -#endif//CPPL_DEBUG - } -} - -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void zhematrix::clear() -{CPPL_VERBOSE_REPORT; - n =0; - delete [] array; - array =NULL; - delete [] darray; - darray =NULL; -} - -//============================================================================= -/*! change the matrix into a zero matrix */ -inline zhematrix& zhematrix::zero() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i]=comple(0.,0.); - } - } - return *this; -} - -//============================================================================= -/*! change the matrix into an identity matrix */ -inline zhematrix& zhematrix::identity() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - darray[j][j] =comple(1.,0.); - for(CPPL_INT i=j+1; i<n; i++){ - darray[j][i]=comple(0.,0.); - } - } - return *this; -} - -//============================================================================= -/*! change sign(+/-) of the matrix */ -inline void zhematrix::chsign() -{CPPL_VERBOSE_REPORT; - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] =-darray[j][i]; - } - } -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void zhematrix::copy(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; - n =mat.n; - delete [] array; - array =new comple[n*n]; - delete [] darray; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } - - for(CPPL_INT j=0; j<n; j++){ - for(CPPL_INT i=j; i<n; i++){ - darray[j][i] =mat.darray[j][i]; - } - } -} - -//============================================================================= -/*! make a shallow copy of the matrix\n - This function is not designed to be used in project codes. */ -inline void zhematrix::shallow_copy(const _zhematrix& mat) -{CPPL_VERBOSE_REPORT; - n =mat.n; - delete [] array; - array =mat.array; - delete [] darray; - darray =mat.darray; - - mat.nullify(); -} - -//============================================================================= -/*! resize the matrix */ -inline void zhematrix::resize(const CPPL_INT& _n) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be positive integers." << std::endl - << "Your input was (" << _n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - n =_n; - delete [] array; - array =new comple[n*n]; - delete [] darray; - darray =new comple*[n]; - for(int i=0; i<n; i++){ - darray[i] =&array[i*n]; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! get row of the matrix */ -inline _zrovector zhematrix::row(const CPPL_INT& _m) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _m<0 || _m>m ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << m << "." << std::endl - << "Your input was " << _m << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector v(n); - for(CPPL_INT j=0; j<n; j++){ - v(j)=(*this)(_m,j); - } - return _(v); -} - -//============================================================================= -/*! get column of the matrix */ -inline _zcovector zhematrix::col(const CPPL_INT& _n) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( _n<0 || _n>n ){ - ERROR_REPORT; - std::cerr << "Input row number must be between 0 and " << n << "." << std::endl - << "Your input was " << _n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector v(m); - for(CPPL_INT i=0; i<m; i++){ - v(i)=(*this)(i,_n); - } - return _(v); -} - -//============================================================================= -/*! extract the real part of the matrix */ -inline _dsymatrix zhematrix::real() const -{CPPL_VERBOSE_REPORT; - dsymatrix mat(n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - mat.darray[j][i] =darray[j][i].real(); - } - } - return _(mat); -} - -//============================================================================= -/*! extract the imag part of the matrix */ -inline _dgematrix zhematrix::imag() const -{CPPL_VERBOSE_REPORT; - dgematrix mat(n,n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - mat.darray[j][i] =darray[j][i].imag(); - } - for(CPPL_INT j=i; j<n; j++){ - mat.darray[j][i] =-darray[i][j].imag(); - } - } - return _(mat); -} - -//============================================================================= -/*! extract the absolute of the matrix */ -inline _dsymatrix zhematrix::abs() const -{CPPL_VERBOSE_REPORT; - dsymatrix mat(n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<=i; j++){ - mat.darray[j][i] =std::abs(darray[j][i]); - } - } - return _(mat); -} - -//============================================================================= -/*! extract the argument the matrix */ -inline _dgematrix zhematrix::arg() const -{CPPL_VERBOSE_REPORT; - dgematrix mat(n,n); - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - mat.darray[j][i] =std::arg(darray[j][i]); - } - for(CPPL_INT j=i; j<n; j++){ - mat.darray[j][i] =std::arg(-darray[i][j]); - } - } - return _(mat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(zhematrix& A, zhematrix& B) -{CPPL_VERBOSE_REPORT; - CPPL_INT A_n =A.n; - comple* A_array =A.array; - comple** A_darray =A.darray; - A.n=B.n; A.array=B.array; A.darray=B.darray; - B.n=A_n; B.array=A_array; B.darray=A_darray; -} - -//============================================================================= -/*! convert user object to smart-temporary object */ -inline _zhematrix _(zhematrix& mat) -{CPPL_VERBOSE_REPORT; - _zhematrix newmat; - - //////// shallow copy //////// - newmat.n =mat.n; - newmat.array =mat.array; - newmat.darray =mat.darray; - - //////// nullify //////// - mat.n =0; - mat.array =NULL; - mat.darray =NULL; - - return newmat; -} diff --git a/cpplapack-r198/.svn/pristine/e7/e7cc57decb50608b3d0056118157052c554ffeeb.svn-base b/cpplapack-r198/.svn/pristine/e7/e7cc57decb50608b3d0056118157052c554ffeeb.svn-base deleted file mode 100644 index d8a74d6eb11e6c26d4b71ecb186216d1760748b6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e7/e7cc57decb50608b3d0056118157052c554ffeeb.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! solve A*X=Y using dgbsv\n - The argument is dgematrix Y. Y is overwritten and become the solution X. - A is also overwritten. */ -inline CPPL_INT dgbmatrix::dgbsv(dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || n!=mat.m){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat(m,n,kl,ku+kl); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =operator()(i,j); - } - } - - CPPL_INT NRHS(mat.n), LDAB(2*kl+ku+1), *IPIV(new CPPL_INT[n]), LDB(mat.m), INFO(1); - dgbsv_(&n, &kl, &ku, &NRHS, newmat.array, &LDAB, IPIV, mat.array, &LDB, &INFO); - delete [] IPIV; - - swap(*this,newmat); - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} - -//============================================================================= -/*! solve A*x=y using dgbsv\n - The argument is dcovector y. y is overwritten and become the solution x. - A is also overwritten. */ -inline CPPL_INT dgbmatrix::dgbsv(dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(m!=n || n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat(m,n,kl,ku+kl); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax; j++){ - newmat(i,j) =operator()(i,j); - } - } - - CPPL_INT NRHS(1), LDAB(2*kl+ku+1), *IPIV(new CPPL_INT[n]), LDB(vec.l), INFO(1); - dgbsv_(&n, &kl, &ku, &NRHS, newmat.array, &LDAB, IPIV, vec.array, &LDB, &INFO); - delete [] IPIV; - - swap(*this,newmat); - - if(INFO!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. INFO = " << INFO << "." << std::endl; - } - return INFO; -} diff --git a/cpplapack-r198/.svn/pristine/e8/e8063763a643f9af8c960184e8f671c42e5c65df.svn-base b/cpplapack-r198/.svn/pristine/e8/e8063763a643f9af8c960184e8f671c42e5c65df.svn-base deleted file mode 100644 index b7df5837ab0725151614fa6a83a92cb1b7e6fa09..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e8/e8063763a643f9af8c960184e8f671c42e5c65df.svn-base +++ /dev/null @@ -1,12 +0,0 @@ -//============================================================================= -/*! cast to _zgematrix */ -inline _zgematrix _dgematrix::to_zgematrix() const -{CPPL_VERBOSE_REPORT; - zgematrix newmat(m,n); - for(CPPL_INT i=0; i<m*n; i++){ - newmat.array[i] =comple(array[i],0.0); - } - - destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e8/e82e97f925dbce3e4c88e1ae2475b1d803a46931.svn-base b/cpplapack-r198/.svn/pristine/e8/e82e97f925dbce3e4c88e1ae2475b1d803a46931.svn-base deleted file mode 100644 index 20a22f5980357666b10af2b7b63a9747bf3ed6e7..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e8/e82e97f925dbce3e4c88e1ae2475b1d803a46931.svn-base +++ /dev/null @@ -1,71 +0,0 @@ -//============================================================================= -/*! dgsmatrix+dgematrix operator */ -inline _dgematrix operator+(const dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix-dgematrix operator */ -inline _dgematrix operator-(const dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix*dgematrix operator */ -inline _dgematrix operator*(const dgsmatrix& matA, const dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT j=0; j<matB.n; j++){ - newmat(it->i,j) += it->v*matB(it->j,j); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e8/e837fd19c9000de04b24c1e582e05b4db05273e1.svn-base b/cpplapack-r198/.svn/pristine/e8/e837fd19c9000de04b24c1e582e05b4db05273e1.svn-base deleted file mode 100644 index aafa5b2f55cc2a0f5d8c5bad773c8c8fdc9da43c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e8/e837fd19c9000de04b24c1e582e05b4db05273e1.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+_dsymatrix operator */ -inline _dgematrix operator+(const _dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix-_dsymatrix operator */ -inline _dgematrix operator-(const _dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to dgematrix //// - dgematrix newmat( (-matB).to_dgematrix() ); - - //// add //// - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgsmatrix*_dsymatrix operator */ -inline _dgematrix operator*(const _dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e8/e85f66f511b90caff8056dd105302a90f1b837df.svn-base b/cpplapack-r198/.svn/pristine/e8/e85f66f511b90caff8056dd105302a90f1b837df.svn-base deleted file mode 100644 index 92133971ed13530ec2c8254170b2713bfde2b513..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e8/e85f66f511b90caff8056dd105302a90f1b837df.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! +_zgbmatrix operator */ -inline const _zgbmatrix& operator+(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_zgbmatrix operator */ -inline _zgbmatrix operator-(const _zgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<(mat.kl+mat.ku+1)*mat.n; i++){ - mat.array[i] =-mat.array[i]; - } - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/e8/e8b8ffd2b6c379a753a6b276b40ec0a26a9c4ad7.svn-base b/cpplapack-r198/.svn/pristine/e8/e8b8ffd2b6c379a753a6b276b40ec0a26a9c4ad7.svn-base deleted file mode 100644 index 90bd27fd595cda2e60810c1a99e02b95eb3bd3c2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e8/e8b8ffd2b6c379a753a6b276b40ec0a26a9c4ad7.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! drovector*dgematrix operator */ -inline _drovector operator*(const drovector& vec, const dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char trans ='T'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/e8/e8c6e169428083bd8532d22fd976b58ff81e8db1.svn-base b/cpplapack-r198/.svn/pristine/e8/e8c6e169428083bd8532d22fd976b58ff81e8db1.svn-base deleted file mode 100644 index 3a442e4c0ba256e9233aec9ddacc6ea59a917906..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e8/e8c6e169428083bd8532d22fd976b58ff81e8db1.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! dsymatrix+_dgsmatrix operator */ -inline _dgematrix operator+(const dsymatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dsymatrix-_dgsmatrix operator */ -inline _dgematrix operator-(const dsymatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - newmat(it->i,it->j) -= it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dsymatrix*_dgsmatrix operator */ -inline _dgematrix operator*(const dsymatrix& matA, const _dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,it->j) += matB(i,it->i)*it->v; - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/e8/e8cfd7bbc6d78371ea1c2f867d2ec2e59e3905f3.svn-base b/cpplapack-r198/.svn/pristine/e8/e8cfd7bbc6d78371ea1c2f867d2ec2e59e3905f3.svn-base deleted file mode 100644 index 5c91496b7bb314ca6e204e3607e0328bf2e63799..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e8/e8cfd7bbc6d78371ea1c2f867d2ec2e59e3905f3.svn-base +++ /dev/null @@ -1,18 +0,0 @@ -//============================================================================= -/*! +_zhsmatrix operator */ -inline const _zhsmatrix& operator+(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - return mat; -} - -//============================================================================= -/*! -_zhsmatrix operator */ -inline _zhsmatrix operator-(const _zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::iterator it=mat.data.begin(); it!=mat_data_end; it++){ - it->v =-it->v; - } - - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/e9/e9109079b057c9a2a021a2ebee75d899faa9f0dc.svn-base b/cpplapack-r198/.svn/pristine/e9/e9109079b057c9a2a021a2ebee75d899faa9f0dc.svn-base deleted file mode 100644 index 4878fa6a56a460988e12a10ea5b2e708e3f3cd4f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e9/e9109079b057c9a2a021a2ebee75d899faa9f0dc.svn-base +++ /dev/null @@ -1,133 +0,0 @@ -//============================================================================= -//! Real Double-precision General Band Matrix Class -class dgbmatrix -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT m; //!< matrix row size - CPPL_INT n; //!< matrix column size - CPPL_INT kl; //!< lower band width - CPPL_INT ku; //!< upper band width - double* array; //!< 1D array to store matrix data - double** darray; //!< array of pointers of column head addresses - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline dgbmatrix(); - inline dgbmatrix(const dgbmatrix&); - inline dgbmatrix(const _dgbmatrix&); - inline dgbmatrix(const CPPL_INT&, const CPPL_INT&, const CPPL_INT&, const CPPL_INT&); - inline dgbmatrix(const char *); - inline ~dgbmatrix(); //destructor - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - //////// cast //////// - inline _zgbmatrix to_zgbmatrix() const; - inline _dgematrix to_dgematrix() const; - - //////// io //////// - inline double& operator()(const CPPL_INT&, const CPPL_INT&); - inline double operator()(const CPPL_INT&, const CPPL_INT&) const; - inline dgbmatrix& set(const CPPL_INT&, const CPPL_INT&, const double&); //const; - inline friend std::ostream& operator<<(std::ostream&, const dgbmatrix&); - inline void write(const char*) const; - inline void read(const char*); - - //////// misc //////// - inline void clear(); - inline dgbmatrix& zero(); - inline dgbmatrix& identity(); - inline void chsign(); - inline void copy(const dgbmatrix&); - inline void shallow_copy(const _dgbmatrix&); - inline dgbmatrix& resize(const CPPL_INT&, const CPPL_INT&, const CPPL_INT&, const CPPL_INT&); - inline _drovector row(const CPPL_INT&) const; - inline _dcovector col(const CPPL_INT&) const; - inline friend void swap(dgbmatrix&, dgbmatrix&); - inline friend _dgbmatrix _(dgbmatrix&); - - //////// calc //////// - inline friend _dgbmatrix t(const dgbmatrix&); - inline friend _dgematrix i(const dgbmatrix&); - - //////// lapack //////// - inline CPPL_INT dgbsv(dgematrix&); - inline CPPL_INT dgbsv(dcovector&); - - /////////////////////////////////////////////// - ///////////// numerical operators ///////////// - /////////////////////////////////////////////// - //////// = //////// - inline dgbmatrix& operator=(const dgbmatrix&); - inline dgbmatrix& operator=(const _dgbmatrix&); - - //////// += //////// - inline dgbmatrix& operator+=(const dgbmatrix&); - inline dgbmatrix& operator+=(const _dgbmatrix&); - - //////// -= //////// - inline dgbmatrix& operator-=(const dgbmatrix&); - inline dgbmatrix& operator-=(const _dgbmatrix&); - - //////// *= //////// - inline dgbmatrix& operator*=(const dgbmatrix&); - inline dgbmatrix& operator*=(const _dgbmatrix&); - inline dgbmatrix& operator*=(const double&); - - //////// /= //////// - inline dgbmatrix& operator/=(const double&); - - //////// unary //////// - inline friend const dgbmatrix& operator+(const dgbmatrix&); - inline friend _dgbmatrix operator-(const dgbmatrix&); - - //////// + //////// - inline friend _dgematrix operator+(const dgbmatrix&, const dgematrix&); - inline friend _dgematrix operator+(const dgbmatrix&, const _dgematrix&); - inline friend _dgematrix operator+(const dgbmatrix&, const dsymatrix&); - inline friend _dgematrix operator+(const dgbmatrix&, const _dsymatrix&); - inline friend _dgbmatrix operator+(const dgbmatrix&, const dgbmatrix&); - inline friend _dgbmatrix operator+(const dgbmatrix&, const _dgbmatrix&); - inline friend _dgematrix operator+(const dgbmatrix&, const dgsmatrix&); - inline friend _dgematrix operator+(const dgbmatrix&, const _dgsmatrix&); - inline friend _dgematrix operator+(const dgbmatrix&, const dssmatrix&); - inline friend _dgematrix operator+(const dgbmatrix&, const _dssmatrix&); - - //////// - //////// - inline friend _dgematrix operator-(const dgbmatrix&, const dgematrix&); - inline friend _dgematrix operator-(const dgbmatrix&, const _dgematrix&); - inline friend _dgematrix operator-(const dgbmatrix&, const dsymatrix&); - inline friend _dgematrix operator-(const dgbmatrix&, const _dsymatrix&); - inline friend _dgbmatrix operator-(const dgbmatrix&, const dgbmatrix&); - inline friend _dgbmatrix operator-(const dgbmatrix&, const _dgbmatrix&); - inline friend _dgematrix operator-(const dgbmatrix&, const dgsmatrix&); - inline friend _dgematrix operator-(const dgbmatrix&, const _dgsmatrix&); - inline friend _dgematrix operator-(const dgbmatrix&, const dssmatrix&); - inline friend _dgematrix operator-(const dgbmatrix&, const _dssmatrix&); - - //////// * //////// - inline friend _dcovector operator*(const dgbmatrix&, const dcovector&); - inline friend _dcovector operator*(const dgbmatrix&, const _dcovector&); - inline friend _dgematrix operator*(const dgbmatrix&, const dgematrix&); - inline friend _dgematrix operator*(const dgbmatrix&, const _dgematrix&); - inline friend _dgematrix operator*(const dgbmatrix&, const dsymatrix&); - inline friend _dgematrix operator*(const dgbmatrix&, const _dsymatrix&); - inline friend _dgbmatrix operator*(const dgbmatrix&, const dgbmatrix&); - inline friend _dgbmatrix operator*(const dgbmatrix&, const _dgbmatrix&); - inline friend _dgematrix operator*(const dgbmatrix&, const dgsmatrix&); - inline friend _dgematrix operator*(const dgbmatrix&, const _dgsmatrix&); - inline friend _dgematrix operator*(const dgbmatrix&, const dssmatrix&); - inline friend _dgematrix operator*(const dgbmatrix&, const _dssmatrix&); - inline friend _dgbmatrix operator*(const dgbmatrix&, const double&); - - //////// / //////// - inline friend _dgbmatrix operator/(const dgbmatrix&, const double&); - - //////// double //////// - inline friend _dgbmatrix operator*(const double&, const dgbmatrix&); -}; diff --git a/cpplapack-r198/.svn/pristine/e9/e99359203cf64dc6b1d962dac87bf6d77e699d0c.svn-base b/cpplapack-r198/.svn/pristine/e9/e99359203cf64dc6b1d962dac87bf6d77e699d0c.svn-base deleted file mode 100644 index 1d3d194f934fd7cb6da2ae5563b281151ed247fb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e9/e99359203cf64dc6b1d962dac87bf6d77e699d0c.svn-base +++ /dev/null @@ -1,38 +0,0 @@ -//============================================================================= -/*! zhematrix_small constructor */ -template<CPPL_INT n> -inline zhematrix_small<n>::zhematrix_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! zhematrix_small constructor */ -template<CPPL_INT n> -inline zhematrix_small<n>::zhematrix_small(const zhematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( n!=mat.n ){ - ERROR_REPORT; - std::cerr << "Matrix sizes must be the same." << std::endl - << "Your input was " << n << "x" << n << " and " << mat.m << "x" << mat.n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<(n*(n+1))/2; k++){ - array[k] =mat.array[k];; - } -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhematrix_small destructor */ -template<CPPL_INT n> -inline zhematrix_small<n>::~zhematrix_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/e9/e9b35eef9b9e4e9a305db7381f0e8c3fd248046d.svn-base b/cpplapack-r198/.svn/pristine/e9/e9b35eef9b9e4e9a305db7381f0e8c3fd248046d.svn-base deleted file mode 100644 index 2bc19eab989d39e3616cabaa9ee8a4c41f49c228..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/e9/e9b35eef9b9e4e9a305db7381f0e8c3fd248046d.svn-base +++ /dev/null @@ -1,265 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include <vector> -#include "cpplapack.h" - -//============================================================================= -/*! apply J */ -inline -void rotate -( - double& x, - double& y, - const double& co, - const double& si - ) -{ - double _x = co*x + si*y; - y =-si*x + co*y; - x=_x; -} - -//============================================================================= -/*! construct J */ -inline -void make_rotator -( - const double& x, - const double& y, - double& co, - double& si - ) -{ - if( fabs(y)<DBL_MIN ){ - co = 1.; - si = 0.; - } - else if( fabs(y)>fabs(x) ){ - double t = x/y; - si = 1./sqrt( 1.+t*t ); - co = si*t; - } - else{ - double t = y/x; - co = 1./sqrt( 1.+t*t ); - si = co*t; - } -} - - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! solve */ -int32_t gmres -( - const CPPL::dgsmatrix& A, - const CPPL::dcovector& b, - CPPL::dcovector& x, - const double& eps - ) -{ - /////////////////////////////////////////////// - //////////////// preconditioner /////////////// - /////////////////////////////////////////////// - CPPL::dgbmatrix Minv(x.l, x.l, 0, 0); - - //////// no precondition //////// - Minv.identity(); - - /////////////////////////////////////////////// - ///////////////// mid values ////////////////// - /////////////////////////////////////////////// - long m(10);//restart number - CPPL::dcovector r(b-A*x); - CPPL::dcovector s(m+1), co(m+1), si(m+1), w; - std::vector<CPPL::dcovector> v(m+1); - CPPL::dgematrix H(m+1,m); - //H.zero(); - //co.zero(); - //si.zero(); - //s.zero(); - - //////// norm //////// - double norm_r, norm_r_min(DBL_MAX); - const double norm_r_ini(fabs(damax(r))); - std::cerr << "[NOTE]@gmres: norm_r_ini=" << norm_r_ini << ", eps=" << eps<< std::endl; - if( norm_r_ini<DBL_MIN ){ - std::cerr << "[NOTE]@gmres: already converged. v(^^)" << std::endl; - return 0; - } - - /////////////////////////////////////////////// - //////////////////// loop ///////////////////// - /////////////////////////////////////////////// - int itc(1); - //int itmax(int(2.1*x.l)); - int itmax(int(1.1*x.l)); - //int itmax(int(0.6*x.l)); - do{ - std::cerr << "** itc=" << itc << " ********************************************" << std::endl; - //////// 0 //////// - v[0] =r/nrm2(r); - s.zero(); - s(0) =nrm2(r); - - for(long i=0; i<m; i++){ - //std::cerr << "++++ i=" << i << " ++++" << std::endl; - w =A*v[i]; - w =Minv*w; - for(long k=0; k<i+1; k++){ - H(k,i) =w%v[k]; - w -=H(k,i)*v[k]; - } - H(i+1,i) =nrm2(w); - v[i+1] =w/H(i+1,i); - - //// J,s //// - for(long k=0; k<i; k++){ - rotate(H(k,i), H(k+1,i), co(k), si(k)); - } - make_rotator( H(i,i), H(i+1,i), co(i), si(i) ); - //std::cerr << "co = " << t(co) << std::endl; std::cerr << "si = " << t(si) << std::endl; - rotate( H(i,i), H(i+1,i), co(i), si(i) );//necessary - //std::cerr << "H =\n" << H << std::endl; - rotate( s(i), s(i+1), co(i), si(i) ); - //std::cerr << "s = " << t(s) << std::endl; - } - //for(long i=0; i<m+1; i++){ for(long j=i+1; j<m+1; j++){ std::cerr << "vv = " << v[i]%v[j] << std::endl; } }// v check - //std::cerr << "H =\n" << H << std::endl; - //std::cerr << "s =" << t(s) << std::endl; - //for(long i=0; i<m+1; i++){ std::cerr << "v["<<i<<"] =" << t(v[i]) << std::flush; } - - //////// y //////// - CPPL::dcovector y(s); - for(long i=m-1; i>=0; i--){ - y(i) /= H(i,i); - for(long j=i-1; j>=0; j--){ - y(j) -= H(j,i) * y(i); - } - } - //std::cerr << "H*y = " << t(H*y) << std::endl; - //std::cerr << "s = " << t(s) << std::endl; - //std::cerr << "y = " << t(s) << std::endl; - - //////// update //////// - for(long i=0; i<m; i++){ - x += v[i] * y(i); - } - //std::cerr << "x = " << t(x) << std::endl; - - //////// residual //////// - r =b-A*x; - r =Minv*r; - //std::cerr << "r = " << t(r) << std::endl; - - //////// convergence check //////// - norm_r =fabs(damax(r)); - std::cerr << "norm_r = " << norm_r << std::endl; - if( isnan(norm_r) ){ break; }//failed - if( !std::isnormal(norm_r) ){ break; }//failed - if( !std::isfinite(norm_r) ){ break; }//failed - if( norm_r>1e3*norm_r_ini ){ break; }//failed (getting so worse) - if( norm_r<=eps ){//r satistied - std::cerr << "[NOTE]@gmres: converged. v(^^) itc=" << itc << "/" << itmax << ", norm=" << norm_r << std::endl; - return 0; - } - }while(++itc<itmax); - - //////// failed //////// - std::cerr << "[NOTE]@gmres: itc=" << itc << ", norm=" << norm_r << ", r_satisfied=" << (norm_r<=eps) << std::endl; - std::cerr << "[NOTE]@gmres: failed to converge. orz" << std::endl; - return 1; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -int main(int argc, char** argv) -{ - /////////////////////////////////////////////// - //////////////// set precision //////////////// - /////////////////////////////////////////////// - std::cout.precision(9); - std::cout.setf(std::ios::scientific, std::ios::floatfield); - std::cout.setf(std::ios::showpos); - std::cerr.precision(3); - std::cerr.setf(std::ios::scientific, std::ios::floatfield); - std::cerr.setf(std::ios::showpos); - - /////////////////////////////////////////////// - //////////////////// A,b ////////////////////// - /////////////////////////////////////////////// - CPPL::dgsmatrix A; - CPPL::dcovector b; - //const bool file =true; - const bool file =false; - /////////////////////////// - ////////// read /////////// - /////////////////////////// - if(file){ - A.read("A8.dge"); b.read("b8.dco"); - //A.read("A10.dge"); b.read("b10.dco"); - //A.read("A44.dge"); b.read("b44.dco"); - } - /////////////////////////// - ///////// random ////////// - /////////////////////////// - else{//file==false - std::cerr << "# making random matrix" << std::endl; - const int size(1000); - A.resize(size,size); - b.resize(size); - srand(time(NULL)); - for(int i=0; i<size; i++){ - for(int j=0; j<size; j++){ - if( rand()%5==0 ){ - A(i,j) =(double(rand())/double(RAND_MAX))*2.0 -1.0; - } - } - A(i,i) +=1e-2*double(size);//generalization - b(i) =(double(rand())/double(RAND_MAX))*1. -0.5; - } - A.write("A.dge"); - b.write("b.dco"); - } - - /////////////////////////////////////////////// - ////////////////// direct ///////////////////// - /////////////////////////////////////////////// - std::cerr << "# making solution with dgesv" << std::endl; - CPPL::dgematrix A2(A.to_dgematrix()); - CPPL::dcovector b2(b); - A2.dgesv(b2); - b2.write("ans.dco"); - - /////////////////////////////////////////////// - ///////////////// iterative /////////////////// - /////////////////////////////////////////////// - //////// initial x //////// - CPPL::dcovector x(b.l); - //x.read("x_ini8.dco"); - x.zero(); - //////// eps //////// - double eps(fabs(damax(b))*1e-6); - std::cerr << "eps=" << eps << std::endl; - //////// solve //////// - if( gmres(A, b, x, eps) ){ - std::cerr << "failed." << std::endl; - x.write("x.dco"); - exit(1); - } - x.write("x.dco"); - std::cerr << "fabs(damax(err))=" << fabs(damax(b2-x)) << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/ea/ea263e2ee4e5940986c1e9a63ffe547464c2e412.svn-base b/cpplapack-r198/.svn/pristine/ea/ea263e2ee4e5940986c1e9a63ffe547464c2e412.svn-base deleted file mode 100644 index c1496ecfbe606164bf19c942cca091065ce4c732..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ea/ea263e2ee4e5940986c1e9a63ffe547464c2e412.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(3), N(4); - - CPPL::dgematrix A(M,N); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - - cout << "A =\n" << A << endl; - - cout << "#### t(A) ####" << endl; - cout << "t(A) =\n" << CPPL::t(A) << endl; - - cout << "#### i(A) ####" << endl; - A.resize(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - }} - CPPL::dgematrix A_inv; - A_inv =CPPL::i(A); - //A_inv =i(A); // g++ cannot compile this line - cout << "A =\n" << A << endl; - cout << "A_inv =\n" << A_inv << endl; - cout << "A*A_inv =\n" << A*A_inv << endl; - - //// max //// - cout << "A =\n" << A << endl; - cout << "damax(A) =\n" << damax(A) << endl; - cout << "#### idamax(p,q, A) ####" << endl; - int p,q; - idamax(p,q, A); - cout << "p=" << p << ", q=" << q << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/ea/ea5c25025dfa3df1bd3c22d05a6f7561403add98.svn-base b/cpplapack-r198/.svn/pristine/ea/ea5c25025dfa3df1bd3c22d05a6f7561403add98.svn-base deleted file mode 100644 index 3777705d50d4c04be3205581a908af7dfcc5d81a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ea/ea5c25025dfa3df1bd3c22d05a6f7561403add98.svn-base +++ /dev/null @@ -1,13 +0,0 @@ -//============================================================================= -/*! double*dgbmatrix operator */ -inline _dgbmatrix operator*(const double& d, const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgbmatrix newmat(mat.m, mat.n, mat.kl, mat.ku); - - const CPPL_INT size =(mat.kl+mat.ku+1)*mat.n; - for(CPPL_INT i=0; i<size; i++){ - newmat.array[i] =d*mat.array[i]; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ea/ea78caabaf50b86bd0b2ed39918865764bac073b.svn-base b/cpplapack-r198/.svn/pristine/ea/ea78caabaf50b86bd0b2ed39918865764bac073b.svn-base deleted file mode 100644 index 789acb1cfb2fb75c63c4f5267242c23b8ef6446d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ea/ea78caabaf50b86bd0b2ed39918865764bac073b.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! drovector*_dgsmatrix operator */ -inline _drovector operator*(const drovector& vec, const _dgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/ea/ea8e43670d06d21bba4cceac3f89e4db1649a2b5.svn-base b/cpplapack-r198/.svn/pristine/ea/ea8e43670d06d21bba4cceac3f89e4db1649a2b5.svn-base deleted file mode 100644 index d0c4ab2171d7421a1be3a5f5b9e78e31b7199f17..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ea/ea8e43670d06d21bba4cceac3f89e4db1649a2b5.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! dgsmatrix+dsymatrix operator */ -inline _dgematrix operator+(const dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix-dsymatrix operator */ -inline _dgematrix operator-(const dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - //// shallow copy to dgematrix //// - dgematrix newmat( (-matB).to_dgematrix() ); - - //// add //// - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix*dsymatrix operator */ -inline _dgematrix operator*(const dgsmatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/eb/eb2631bcc2c6cb597acedcc6703bc8ba3bd6e7b5.svn-base b/cpplapack-r198/.svn/pristine/eb/eb2631bcc2c6cb597acedcc6703bc8ba3bd6e7b5.svn-base deleted file mode 100644 index 45eacef753d03d8cb30d71d9872e88c07fb920bc..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/eb/eb2631bcc2c6cb597acedcc6703bc8ba3bd6e7b5.svn-base +++ /dev/null @@ -1,111 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3); - - CPPL::drovector a(N), b(N); - CPPL::dsymatrix X(N), Y(N); - for(int i=0; i<X.n; i++){ for(int j=0; j<X.n; j++){ - X(i,j) =double( rand() /(RAND_MAX/10) ); - Y(i,j) =double( rand() /(RAND_MAX/10) ); - }} - for(int i=0; i<a.l; i++){ - a(i) =double( rand() /(RAND_MAX/10) ); - b(i) =double( rand() /(RAND_MAX/10) ); - } - CPPL::dsymatrix Z(X+Y); - - //dro+dsy - //N/A - //dro-dsy - //N/A - //dro*dsy, _dsy+_dsy - cout << "a*Z-a*X-a*Y =\n" << a*Z-a*X-a*Y << "<-Should be zero." << endl; - - //dro/dsy - //N/A - //dro=dsy - //N/A - //dro+=dsy - //N/A - //dro-=dsy - //N/A - //dro*=dsy - //N/A - //dro/=dsy - //N/A - - //dro+_dsy - //N/A - //dro-_dsy - //N/A - //dro*_dsy, dro*dsy, dsy+dsy, _dsy-_dsy - cout << "a*Z-a*(X+Y) =\n" << a*Z-a*(X+Y) << "<-Should be zero." << endl; - //dro/_dsy - //N/A - //dro=_dsy - //N/A - //dro+=_dsy - //N/A - //dro-=_dsy - //N/A - //dro*=_dsy - //N/A - //dro/=_dsy - //N/A - - //_dro+dsy - //N/A - //_dro-dsy - //N/A - //_dro*dsy, dro+dro, dro*dsy, _dsy-_dsy - cout << "(a+b)*X-a*X-b*X =\n" << (a+b)*X-a*X-b*X << "<-Should be zero." << endl; - //_dro/dsy - //N/A - //_dro=dsy - //N/A - //_dro+=dsy - //N/A - //_dro-=dsy - //N/A - //_dro*=dsy - //N/A - //_dro/=dsy - //N/A - - //_dro+_dsy - //N/A - //_dro-_dsy - //N/A - //_dro*_dsy, dro-dro, dsy-dsy, dro*dsy, _dsy-_dsy, _dsy+_dsy - cout << "(a-b)*(X-Y)-a*X+a*Y+b*X-b*Y =\n" << (a-b)*(X-Y)-a*X+a*Y+b*X-b*Y << "<-Should be zero." << endl; - //_dro/_dsy - //N/A - //_dro=_dsy - //N/A - //_dro+=_dsy - //N/A - //_dro-=_dsy - //N/A - //_dro*=_dsy - //N/A - //_dro/=_dsy - //N/A - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/eb/ebb356db9d79b959dde99cde3d5a56a6fb3f6c33.svn-base b/cpplapack-r198/.svn/pristine/eb/ebb356db9d79b959dde99cde3d5a56a6fb3f6c33.svn-base deleted file mode 100644 index a2d7c8381cff8f97ec553f3f4e25784cd0aaf7ac..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/eb/ebb356db9d79b959dde99cde3d5a56a6fb3f6c33.svn-base +++ /dev/null @@ -1,24 +0,0 @@ -//============================================================================= -/*! calculate vector product for 2D vector */ -inline double operator/(const drovec2& A, const drovec2& B) -{CPPL_VERBOSE_REPORT; - return A(0)*B(1)-A(1)*B(0); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! calculate vector product only for 3D vector */ -inline drovec3 operator/(const drovec3& A, const drovec3& B) -{CPPL_VERBOSE_REPORT; - drovec3 C; - C(0) =A(1)*B(2) -A(2)*B(1); - C(1) =A(2)*B(0) -A(0)*B(2); - C(2) =A(0)*B(1) -A(1)*B(0); - return C; -} diff --git a/cpplapack-r198/.svn/pristine/eb/ebcdde0047f67dafc8968bba0e1efbf05590e80b.svn-base b/cpplapack-r198/.svn/pristine/eb/ebcdde0047f67dafc8968bba0e1efbf05590e80b.svn-base deleted file mode 100644 index 7294743051d16d33f1fa13b4ab8a848fc81d9b92..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/eb/ebcdde0047f67dafc8968bba0e1efbf05590e80b.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4); - - CPPL::dcovector x; - cout << "x || l=" << x.l << ", array=" << x.array << endl; - - - CPPL::dcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =double( rand() /(RAND_MAX/10) ); - } - cout << "y || l=" << y.l << ", array=" << y.array << endl; - cout << y << endl; - - CPPL::dcovector z(y); - cout << "z || l=" << z.l << ", array=" << z.array << endl; - cout << z << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/ec/ecabc4c8a754d2d345bdf0326098af64fa3d0830.svn-base b/cpplapack-r198/.svn/pristine/ec/ecabc4c8a754d2d345bdf0326098af64fa3d0830.svn-base deleted file mode 100644 index fc566b95fbb728f94104f2fabcce27cd9fbe35fb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ec/ecabc4c8a754d2d345bdf0326098af64fa3d0830.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline double& _dcovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ - s << " " << vec.array[i] << std::endl; - } - - vec.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _dcovector::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#dcovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << std::endl; - } - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/ec/ecc2083deff4a7cebe92dbc6eb0d4c308f5e22ab.svn-base b/cpplapack-r198/.svn/pristine/ec/ecc2083deff4a7cebe92dbc6eb0d4c308f5e22ab.svn-base deleted file mode 100644 index e6ded7bf33d7d0189ec7763330f7ee5832061632..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ec/ecc2083deff4a7cebe92dbc6eb0d4c308f5e22ab.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================= -/*! solve A*x=b for real and unsymmetric matrix using Intel PARDISO.\n - The argument is dcovector b. - b is overwritten and become the solution x. - A is not overwritten. -*/ -inline CPPL_INT dgrmatrix::pardiso(dcovector& b) const -{CPPL_VERBOSE_REPORT; -#ifndef __INTEL_COMPILER - ERROR_REPORT; - std::cerr << "dgrmatrix::pardiso is only for intel c++ compiler (icpc)." << std::endl; - std::cerr << "Recompile your code with icpc to use pardiso." << std::endl; - (void)b; - exit(1); - - -#else //__INTEL_COMPILER is defined. - //#ifdef CPPL_DEBUG - if(m!=n || m!=b.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector cannot be solved." << std::endl - << "Your input was (" << m << "x" << n << ") and (" << b.l << ")." << std::endl; - exit(1); - } - //#endif//CPPL_DEBUG - - //////// pardisoinit //////// - //std::cerr << "initializing" << std::endl; - _MKL_DSS_HANDLE_t pt[64]; - MKL_INT mtype =11;//real unsymmetric - MKL_INT iparm[64]; - PARDISOINIT(pt, &mtype, iparm); - iparm[1] =3;//parallel fill-in reducing ordering - iparm[23] =1;//use two-level scheduling factorization algorithm - iparm[26] =0;//disable matrix checker - iparm[34] =0;//use one-base array index - - //////// pardiso //////// - //std::cerr << "solving" << std::endl; - MKL_INT maxfct =1; - MKL_INT mnum =1; - MKL_INT phase =13; - MKL_INT MKL_INT_n =MKL_INT(n); - double* a0 = const_cast<double*>(&a[0]); - MKL_INT* ia0 = const_cast<MKL_INT*>(&ia[0]); - MKL_INT* ja0 = const_cast<MKL_INT*>(&ja[0]); - std::vector<MKL_INT> perm(n); - MKL_INT nrhs =1; - MKL_INT msglvl =0; - dcovector x(b.l); - MKL_INT error =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, a0, ia0, ja0, &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error); - swap(b,x);//set b as x - if(error!=0){ - WARNING_REPORT; - std::cerr << "Serious trouble happend. error = " << error << "." << std::endl; - } - - //////// release memory //////// - phase =-1; - MKL_INT error2 =1; - PARDISO(pt, &maxfct, &mnum, &mtype, &phase, &MKL_INT_n, a0, ia0, ja0, &perm[0], &nrhs, iparm, &msglvl, b.array, x.array, &error2); - - return error; -#endif //__INTEL_COMPILER -} diff --git a/cpplapack-r198/.svn/pristine/ed/ed6f70a4ccafb59c773b5cc791bbb80fb9f18a38.svn-base b/cpplapack-r198/.svn/pristine/ed/ed6f70a4ccafb59c773b5cc791bbb80fb9f18a38.svn-base deleted file mode 100644 index 67b6dc3f83b213b65e50a18feb82597275743921..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ed/ed6f70a4ccafb59c773b5cc791bbb80fb9f18a38.svn-base +++ /dev/null @@ -1,37 +0,0 @@ -//============================================================================= -/*! return its transposed dgbmatrix */ -inline _dgbmatrix t(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - dgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - newmat(i,j) =mat(j,i); - } - } - - mat.destroy(); - return _(newmat); -} - -//============================================================================= -/*! return its inverse matrix */ -inline _dgematrix i(const _dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.m!=mat.n){ - ERROR_REPORT; - std::cerr << "This matrix is not square and has no inverse matrix." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix mat_cp(mat); - dgematrix mat_inv(mat_cp.m,mat_cp.n); - mat_inv.identity(); - mat_cp.dgbsv(mat_inv); - - return _(mat_inv); -} diff --git a/cpplapack-r198/.svn/pristine/ee/ee2dac8ebff82db6b6be3918f2972aaec267347d.svn-base b/cpplapack-r198/.svn/pristine/ee/ee2dac8ebff82db6b6be3918f2972aaec267347d.svn-base deleted file mode 100644 index 9a71363e32add04d5ec23083b7e49834cb1abb19..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ee/ee2dac8ebff82db6b6be3918f2972aaec267347d.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! _zhematrix+_zssmatrix operator */ -inline _zgematrix operator+(const _zhematrix& matA, const _zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) += matB.array[c]; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix-_zssmatrix operator */ -inline _zgematrix operator-(const _zhematrix& matA, const _zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat =matA; - - for(CPPL_INT c=0; c<matB.vol; c++){ - newmat(matB.indx[c],matB.jndx[c]) -= matB.array[c]; - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _zhematrix*_zssmatrix operator */ -inline _zgematrix operator*(const _zhematrix& matA, const _zssmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matB.vol; c++){ - for(CPPL_INT i=0; i<matA.n; i++){ - newmat(i,matB.jndx[c]) += matA(i,matB.indx[c])*matB.array[c]; - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ee/ee625f1d0b4803a8e0aeec9b4ec6eb744e07c0cc.svn-base b/cpplapack-r198/.svn/pristine/ee/ee625f1d0b4803a8e0aeec9b4ec6eb744e07c0cc.svn-base deleted file mode 100644 index 8e14bebddfdd4565bd2a5e8e3a51a131b6bc79ec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ee/ee625f1d0b4803a8e0aeec9b4ec6eb744e07c0cc.svn-base +++ /dev/null @@ -1,268 +0,0 @@ -%TGIF 4.1.43-QPL -state(0,37,100.000,0,0,0,4,1,9,1,1,1,0,1,0,1,1,'Helvetica',0,103680,0,0,0,10,0,0,1,1,0,16,0,0,1,1,1,1,1485,1050,0,0,2880,1). -% -% @(#)$Header$ -% %W% -% -unit("1 pixel/pixel"). -color_info(30,65535,0,[ - "magenta", 65535, 0, 65535, 65535, 0, 65535, 1, - "red", 65535, 0, 0, 65535, 0, 0, 1, - "green", 0, 65535, 0, 0, 65535, 0, 1, - "blue", 0, 0, 65535, 0, 0, 65535, 1, - "yellow", 65535, 65535, 0, 65535, 65535, 0, 1, - "pink", 65535, 49344, 52171, 65535, 49344, 52171, 1, - "cyan", 0, 65535, 65535, 0, 65535, 65535, 1, - "CadetBlue", 24415, 40606, 41120, 24415, 40606, 41120, 1, - "white", 65535, 65535, 65535, 65535, 65535, 65535, 1, - "black", 0, 0, 0, 0, 0, 0, 1, - "#ff4d4d", 65535, 19789, 19789, 65280, 19712, 19712, 1, - "#ff9c4d", 65535, 40092, 19789, 65280, 39936, 19712, 1, - "#ffec4d", 65535, 60652, 19789, 65280, 60416, 19712, 1, - "#c4ff4d", 50372, 65535, 19789, 50176, 65280, 19712, 1, - "#75ff4d", 30069, 65535, 19789, 29952, 65280, 19712, 1, - "#4dff75", 19789, 65535, 30069, 19712, 65280, 29952, 1, - "#4dffc4", 19789, 65535, 50372, 19712, 65280, 50176, 1, - "#4decff", 19789, 60652, 65535, 19712, 60416, 65280, 1, - "#4d9cff", 19789, 40092, 65535, 19712, 39936, 65280, 1, - "#4d4dff", 19789, 19789, 65535, 19712, 19712, 65280, 1, - "#fffffe", 65535, 65535, 65278, 65280, 65280, 65024, 1, - "#e0e0e0", 57568, 57568, 57568, 57344, 57344, 57344, 1, - "#d0d0d0", 53456, 53456, 53456, 53248, 53248, 53248, 1, - "#c0c0c0", 49344, 49344, 49344, 49152, 49152, 49152, 1, - "#b0b0b0", 45232, 45232, 45232, 45056, 45056, 45056, 1, - "#a0a0a0", 41120, 41120, 41120, 40960, 40960, 40960, 1, - "#808080", 32896, 32896, 32896, 32768, 32768, 32768, 1, - "#404040", 16448, 16448, 16448, 16384, 16384, 16384, 1, - "#101010", 4112, 4112, 4112, 4096, 4096, 4096, 1, - "#000001", 0, 0, 257, 0, 0, 256, 1 -]). -script_frac("0.6"). -fg_bg_colors('black','white'). -dont_reencode("FFDingbests:ZapfDingbats"). -page(1,"",1,''). -box('black','',652,128,708,164,0,1,1,80,0,0,0,0,0,'1',0,[ -]). -box('black','',552,128,608,164,0,1,1,170,0,0,0,0,0,'1',0,[ -]). -box('black','',496,128,552,164,5,1,1,168,0,0,0,0,0,'1',1,[ -]). -box('black','',440,128,496,164,5,1,1,164,0,0,0,0,0,'1',1,[ -]). -box('black','',340,128,396,164,5,1,1,154,0,0,0,0,0,'1',1,[ -]). -box('black','',240,128,296,164,5,1,1,127,0,0,0,0,0,'1',1,[ -]). -box('black','',184,128,240,164,5,1,1,126,0,0,0,0,0,'1',1,[ -]). -box('black','',128,128,184,164,5,1,1,122,0,0,0,0,0,'1',1,[ -]). -text('black',156,134,1,1,1,10,22,36,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "0")]) -]) -])]). -text('black',212,134,1,1,1,10,22,38,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-3,0,0,0,0,0, - "1")]) -]) -])]). -text('black',268,134,1,1,1,10,22,45,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "2")]) -]) -])]). -text('black',368,134,1,1,1,10,22,50,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,152,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "c")]) -]) -])]). -text('black',468,134,1,1,1,42,22,87,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,152,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-1,0,0,0,0,0, - "vol-2")]) -]) -])]). -text('black',680,134,1,1,1,47,22,96,18,4,0,0,0,0,2,47,22,0,0,"",0,0,0,0,152,'',[ -minilines(47,22,0,0,1,0,0,[ -mini_line(47,18,4,0,0,0,[ -str_block(0,47,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,47,18,4,0,-3,0,0,0,0,0, - "cap-1")]) -]) -])]). -oval('black','',304,144,308,148,1,3,1,135,0,0,0,0,0,'3',0,[ -]). -oval('black','',316,144,320,148,1,3,1,148,0,0,0,0,0,'3',0,[ -]). -oval('black','',328,144,332,148,1,3,1,149,0,0,0,0,0,'3',0,[ -]). -oval('black','',404,144,408,148,1,3,1,160,0,0,0,0,0,'3',0,[ -]). -oval('black','',416,144,420,148,1,3,1,161,0,0,0,0,0,'3',0,[ -]). -oval('black','',428,144,432,148,1,3,1,162,0,0,0,0,0,'3',0,[ -]). -text('black',524,134,1,1,1,42,22,167,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,152,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-3,0,0,0,0,0, - "vol-1")]) -]) -])]). -text('black',580,134,1,1,1,25,22,169,18,4,0,0,0,0,2,25,22,0,0,"",0,0,0,0,152,'',[ -minilines(25,22,0,0,1,0,0,[ -mini_line(25,18,4,0,0,0,[ -str_block(0,25,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,25,18,4,0,-1,0,0,0,0,0, - "vol")]) -]) -])]). -oval('black','',616,144,620,148,1,3,1,181,0,0,0,0,0,'3',0,[ -]). -oval('black','',628,144,632,148,1,3,1,182,0,0,0,0,0,'3',0,[ -]). -oval('black','',640,144,644,148,1,3,1,183,0,0,0,0,0,'3',0,[ -]). -box('black','',652,224,708,260,0,1,1,387,0,0,0,0,0,'1',0,[ -]). -box('black','',552,224,608,260,5,1,1,388,0,0,0,0,0,'1',0,[ -]). -box('black','',496,224,552,260,5,1,1,389,0,0,0,0,0,'1',1,[ -]). -box('black','',440,224,496,260,5,1,1,390,0,0,0,0,0,'1',1,[ -]). -box('black','',340,224,396,260,5,1,1,391,0,0,0,0,0,'1',1,[ -]). -box('black','',240,224,296,260,5,1,1,392,0,0,0,0,0,'1',1,[ -]). -box('black','',184,224,240,260,5,1,1,393,0,0,0,0,0,'1',1,[ -]). -box('black','',128,224,184,260,5,1,1,394,0,0,0,0,0,'1',1,[ -]). -text('black',156,230,1,1,1,10,22,395,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,248,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "0")]) -]) -])]). -text('black',212,230,1,1,1,10,22,396,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,248,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-3,0,0,0,0,0, - "1")]) -]) -])]). -text('black',268,230,1,1,1,10,22,397,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,248,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "2")]) -]) -])]). -text('black',368,230,1,1,1,10,22,398,18,4,0,0,0,0,2,10,22,0,0,"",0,0,0,0,248,'',[ -minilines(10,22,0,0,1,0,0,[ -mini_line(10,18,4,0,0,0,[ -str_block(0,10,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,10,18,4,0,-1,0,0,0,0,0, - "c")]) -]) -])]). -text('black',468,230,1,1,1,42,22,399,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,248,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-1,0,0,0,0,0, - "vol-3")]) -]) -])]). -text('black',680,230,1,1,1,47,22,400,18,4,0,0,0,0,2,47,22,0,0,"",0,0,0,0,248,'',[ -minilines(47,22,0,0,1,0,0,[ -mini_line(47,18,4,0,0,0,[ -str_block(0,47,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,47,18,4,0,-3,0,0,0,0,0, - "cap-1")]) -]) -])]). -oval('black','',304,240,308,244,1,3,1,401,0,0,0,0,0,'3',0,[ -]). -oval('black','',316,240,320,244,1,3,1,402,0,0,0,0,0,'3',0,[ -]). -oval('black','',328,240,332,244,1,3,1,403,0,0,0,0,0,'3',0,[ -]). -oval('black','',404,240,408,244,1,3,1,404,0,0,0,0,0,'3',0,[ -]). -oval('black','',416,240,420,244,1,3,1,405,0,0,0,0,0,'3',0,[ -]). -oval('black','',428,240,432,244,1,3,1,406,0,0,0,0,0,'3',0,[ -]). -text('black',524,230,1,1,1,42,22,407,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,248,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-1,0,0,0,0,0, - "vol-2")]) -]) -])]). -text('black',580,230,1,1,1,42,22,408,18,4,0,0,0,0,2,42,22,0,0,"",0,0,0,0,248,'',[ -minilines(42,22,0,0,1,0,0,[ -mini_line(42,18,4,0,0,0,[ -str_block(0,42,18,4,0,-3,0,0,0,[ -str_seg('black','Helvetica',0,103680,42,18,4,0,-3,0,0,0,0,0, - "vol-1")]) -]) -])]). -oval('black','',616,240,620,244,1,3,1,409,0,0,0,0,0,'3',0,[ -]). -oval('black','',628,240,632,244,1,3,1,410,0,0,0,0,0,'3',0,[ -]). -oval('black','',640,240,644,244,1,3,1,411,0,0,0,0,0,'3',0,[ -]). -text('black',80,182,1,1,1,72,22,421,18,4,0,0,0,0,2,72,22,0,0,"",0,0,0,1,200,'',[ -minilines(72,22,0,0,1,0,0,[ -mini_line(72,18,4,0,0,0,[ -str_block(0,72,18,4,0,-2,0,0,0,[ -str_seg('black','Helvetica',0,103680,72,18,4,0,-2,0,0,0,0,0, - "put(i,j,x);")]) -]) -])]). -text('black',400,182,1,1,1,171,22,424,18,4,0,0,0,0,2,171,22,0,0,"",0,0,0,1,200,'',[ -minilines(171,22,0,0,1,0,0,[ -mini_line(171,18,4,0,0,0,[ -str_block(0,171,18,4,0,0,0,0,0,[ -str_seg('black','Helvetica',0,103680,171,18,4,0,0,0,0,0,0,0, - "automatically \"vol++;\"")]) -]) -])]). -text('black',652,182,1,1,1,67,22,484,18,4,0,0,0,0,2,67,22,0,0,"",0,0,0,1,200,'',[ -minilines(67,22,0,0,1,0,0,[ -mini_line(67,18,4,0,0,0,[ -str_block(0,67,18,4,0,-1,0,0,0,[ -str_seg('black','Helvetica',0,103680,67,18,4,0,-1,0,0,0,0,0, - "assign x")]) -]) -])]). -poly('black','',3,[ - 612,196,580,208,580,224],1,2,1,489,0,0,0,0,0,0,0,'2',1,0, - "0","",[ - 0,10,4,0,'10','4','0'],[0,10,4,0,'10','4','0'],[ -]). diff --git a/cpplapack-r198/.svn/pristine/ef/ef1ea1986e8312de73f02d329260bd8505098057.svn-base b/cpplapack-r198/.svn/pristine/ef/ef1ea1986e8312de73f02d329260bd8505098057.svn-base deleted file mode 100644 index 0f4d699e46554d9993d2daf2a635f9f190956cc1..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ef/ef1ea1986e8312de73f02d329260bd8505098057.svn-base +++ /dev/null @@ -1,44 +0,0 @@ -//============================================================================= -/*! return a transposed column vector */ -inline _dcovector t(const _drovector& rovec) -{CPPL_VERBOSE_REPORT; - _dcovector covec; - covec.l =rovec.l; - covec.cap =rovec.cap; - delete [] covec.array; - covec.array =rovec.array; - - rovec.nullify(); - return covec; -} - -//============================================================================= -/*! return its Euclidean norm */ -inline double nrm2(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double val =dnrm2_(&vec.l, vec.array, &inc); - vec.destroy(); - return val; -} - -//============================================================================= -/*! return the index of element having the largest absolute value - in 0-based numbering system */ -inline CPPL_INT idamax(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - CPPL_INT i =idamax_(&vec.l, vec.array, &inc) -1; - vec.destroy(); - return i; -} - -//============================================================================= -/*! return its largest absolute value */ -inline double damax(const _drovector& vec) -{CPPL_VERBOSE_REPORT; - CPPL_INT inc =1; - double val =vec.array[idamax_(&vec.l, vec.array, &inc) -1]; - vec.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/ef/ef2958c49277b5b45ec728119ff59dce90ccdc38.svn-base b/cpplapack-r198/.svn/pristine/ef/ef2958c49277b5b45ec728119ff59dce90ccdc38.svn-base deleted file mode 100644 index 242d5fedf2dd2be92f926d8f54c0b093f26859d2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ef/ef2958c49277b5b45ec728119ff59dce90ccdc38.svn-base +++ /dev/null @@ -1,55 +0,0 @@ -//============================================================================= -/*! zhsmatrix*=double operator */ -inline zhsmatrix& zhsmatrix::operator*=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v *=d; - } - - return *this; -} - -//============================================================================= -/*! zhsmatrix/=double operator */ -inline zhsmatrix& zhsmatrix::operator/=(const double& d) -{CPPL_VERBOSE_REPORT; - const std::vector<zcomponent>::iterator data_end =data.end(); - for(std::vector<zcomponent>::iterator it=data.begin(); it!=data_end; it++){ - it->v /=d; - } - - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zhsmatrix*double operator */ -inline _zhsmatrix operator*(const zhsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v *=d; - } - - return _(newmat); -} - -//============================================================================= -/*! zhsmatrix/double operator */ -inline _zhsmatrix operator/(const zhsmatrix& mat, const double& d) -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v /=d; - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ef/effe7dd25a41602ba1e4b7c2940f2da1364c45fb.svn-base b/cpplapack-r198/.svn/pristine/ef/effe7dd25a41602ba1e4b7c2940f2da1364c45fb.svn-base deleted file mode 100644 index 73aa858bf923d958c98dce713f074184a82f44ec..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ef/effe7dd25a41602ba1e4b7c2940f2da1364c45fb.svn-base +++ /dev/null @@ -1,75 +0,0 @@ -//============================================================================= -/*! zcovector_small constructor */ -template<CPPL_INT l> -inline zcovector_small<l>::zcovector_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! zcovector_small constructor */ -template<CPPL_INT l> -inline zcovector_small<l>::zcovector_small(const zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "Vector sizes must be the same." << std::endl - << "Your input was " << l << " and " << vec.l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<l; k++){ - array[k] =vec.array[k]; - } -} - -//============================================================================= -/*! zcovector_small constructor */ -template<CPPL_INT l> -inline zcovector_small<l>::zcovector_small(const comple& x, const comple& y) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=2 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 2." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; -} - -//============================================================================= -/*! zcovector_small constructor */ -template<CPPL_INT l> -inline zcovector_small<l>::zcovector_small(const comple& x, const comple& y, const comple& z) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=3 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 3." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; - array[2] =z; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zcovector_small destructor */ -template<CPPL_INT l> -inline zcovector_small<l>::~zcovector_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/f0/f00f5c74daff4add8a125eef43cf47b18ce3fa93.svn-base b/cpplapack-r198/.svn/pristine/f0/f00f5c74daff4add8a125eef43cf47b18ce3fa93.svn-base deleted file mode 100644 index 9251196ca4ec3c8393fd4551e4a10449c86e4de3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f0/f00f5c74daff4add8a125eef43cf47b18ce3fa93.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! _zgbmatrix*_zcovector operator */ -inline _zcovector operator*(const _zgbmatrix& mat, const _zcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zcovector newvec(mat.m); - char trans ='n'; - comple alpha =comple(1.,0.); - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - comple beta =comple(0.,0.); - - zgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/f0/f05b8cff99da1579ced5a146d5de4a1ceafe2394.svn-base b/cpplapack-r198/.svn/pristine/f0/f05b8cff99da1579ced5a146d5de4a1ceafe2394.svn-base deleted file mode 100644 index 3cd9b0dd4465c817f215fb2ee2ffe4538bbafdac..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f0/f05b8cff99da1579ced5a146d5de4a1ceafe2394.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(6), N(6), KL(1), KU(1); - - CPPL::dgbmatrix A(M,N,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - - A.resize(M,M,KL,KU); - for(int i=0; i<A.m; i++){ - for(int j=std::max(0,i-A.kl); j<std::min(A.n,i+A.ku+1); j++){ - A(i,j) =double( rand() /(RAND_MAX/10) ); - } - } - CPPL::dgbmatrix A_orig(A); - - CPPL::dcovector y(M); - for(int i=0; i<y.l; i++){ - y(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "A =\n" << A << endl; - cout << "y =\n" << y << endl; - cout << "#### A.dgbsv(y) ####" << endl; - A.dgbsv(y); - cout << "A =\n" << A << endl; - cout << "y =\n" << y << endl; - cout << "A_orig*y =\n" << A_orig*y << endl; - - - cout << "#### A=A_orig ####" << endl; - A=A_orig; - - CPPL::dgematrix Y(M,N); - for(int i=0; i<Y.m; i++){ for(int j=0; j<Y.n; j++){ - Y(i,j) =double( rand() /(RAND_MAX/10) ); - }} - cout << "A =\n" << A << endl; - cout << "Y =\n" << Y << endl; - cout << "#### A.dgbsv(Y) ####" << endl; - A.dgbsv(Y); - cout << "A =\n" << A << endl; - cout << "Y =\n" << Y << endl; - cout << "A_orig*Y =\n" << A_orig*Y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/f0/f083e7d852120a87926d002f84a242504e7a8991.svn-base b/cpplapack-r198/.svn/pristine/f0/f083e7d852120a87926d002f84a242504e7a8991.svn-base deleted file mode 100644 index fd125d2c1c1274053af9fa9d6970fe2a3ad5d038..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f0/f083e7d852120a87926d002f84a242504e7a8991.svn-base +++ /dev/null @@ -1,75 +0,0 @@ -//============================================================================= -/*! zrovector_small constructor */ -template<CPPL_INT l> -inline zrovector_small<l>::zrovector_small() -{CPPL_VERBOSE_REPORT; - ; -} - -//============================================================================= -/*! zrovector_small constructor */ -template<CPPL_INT l> -inline zrovector_small<l>::zrovector_small(const zrovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=vec.l ){ - ERROR_REPORT; - std::cerr << "Vector sizes must be the same." << std::endl - << "Your input was " << l << " and " << vec.l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT k=0; k<l; k++){ - array[k] =vec.array[k]; - } -} - -//============================================================================= -/*! zrovector_small constructor */ -template<CPPL_INT l> -inline zrovector_small<l>::zrovector_small(const comple& x, const comple& y) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=2 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 2." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; -} - -//============================================================================= -/*! zrovector_small constructor */ -template<CPPL_INT l> -inline zrovector_small<l>::zrovector_small(const comple& x, const comple& y, const comple& z) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( l!=3 ){ - ERROR_REPORT; - std::cerr << "The vector size must be 3." << std::endl - << "The vector size you set was " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[0] =x; - array[1] =y; - array[2] =z; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! zrovector_small destructor */ -template<CPPL_INT l> -inline zrovector_small<l>::~zrovector_small() -{CPPL_VERBOSE_REPORT; - ; -} diff --git a/cpplapack-r198/.svn/pristine/f0/f0910cd3dd9e4c094e993a7056338fda5a2ffcdd.svn-base b/cpplapack-r198/.svn/pristine/f0/f0910cd3dd9e4c094e993a7056338fda5a2ffcdd.svn-base deleted file mode 100644 index c627559f8a085b0fea869c53f56c184066155ad6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f0/f0910cd3dd9e4c094e993a7056338fda5a2ffcdd.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -/*****************************************************************************/ -/* noname.cpp */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(4), N(3), KL(2), KU(1); - CPPL::zgematrix A(M,N); - CPPL::zgbmatrix B(M,N,KL,KU); - CPPL::zhematrix C(N); - CPPL::zcovector cv(M); - CPPL::zrovector rv(M); - - for(int i=0; i<M; i++){ for(int j=0; j<N; j++){ - A(i,j) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - for(int i=0; i<M; i++){ for(int j=0; j<N; j++){ - if( !(i-j>B.kl || j-i>B.ku) ){ - B(i,j) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - }} - - for(int i=0; i<N; i++){ - for(int j=0; j<i; j++){ - C(i,j) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - C(i,i) =std::complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - for(int i=0; i<M; i++){ - cv(i) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - rv(i) =std::complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - - std::cout << "A =\n" << A << std::endl; - std::cout << "(10.,10.)*A =\n" << std::complex<double>(10.,10.)*A << std::endl; - std::cout << "A*(10.,10.) =\n" << A*std::complex<double>(10.,10.) << std::endl; - std::cout << "A/(10.,10.) =\n" << A/std::complex<double>(10.,10.) << std::endl; - - std::cout << "B =\n" << B << std::endl; - std::cout << "(10.,10.)*B =\n" << std::complex<double>(10.,10.)*B << std::endl; - std::cout << "B*(10.,10.) =\n" << B*std::complex<double>(10.,10.) << std::endl; - std::cout << "B/(10.,10.) =\n" << B/std::complex<double>(10.,10.) << std::endl; - - std::cout << "C =\n" << C << std::endl; - std::cout << "(10.,10.)*C =\n" << std::complex<double>(10.,10.)*C << std::endl; - std::cout << "C*(10.,10.) =\n" << C*std::complex<double>(10.,10.) << std::endl; - std::cout << "C/(10.,10.) =\n" << C/std::complex<double>(10.,10.) << std::endl; - - std::cout << "cv =\n" << cv << std::endl; - std::cout << "(10.,10.)*cv =\n" << std::complex<double>(10.,10.)*cv << std::endl; - std::cout << "cv*(10.,10.) =\n" << cv*std::complex<double>(10.,10.) << std::endl; - std::cout << "cv/(10.,10.) =\n" << cv/std::complex<double>(10.,10.) << std::endl; - - std::cout << "rv =\n" << rv << std::endl; - std::cout << "(10.,10.)*rv =\n" << std::complex<double>(10.,10.)*rv << std::endl; - std::cout << "rv*(10.,10.) =\n" << rv*std::complex<double>(10.,10.) << std::endl; - std::cout << "rv/(10.,10.) =\n" << rv/std::complex<double>(10.,10.) << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/f1/f10ae373a8b9f97c580cd478d4af948cff4292af.svn-base b/cpplapack-r198/.svn/pristine/f1/f10ae373a8b9f97c580cd478d4af948cff4292af.svn-base deleted file mode 100644 index 9ad49f1b499969bbda77ed5b43d3ac5aecd2a4c2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f1/f10ae373a8b9f97c580cd478d4af948cff4292af.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! +dcovector operator */ -inline const dcovector& operator+(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - return vec; -} - -//============================================================================= -/*! -dcovector operator */ -inline _dcovector operator-(const dcovector& vec) -{CPPL_VERBOSE_REPORT; - dcovector newvec(vec.l); - for(CPPL_INT i=0; i<newvec.l; i++){ newvec.array[i]=-vec.array[i]; } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/f1/f18334365d6eb528cc193724fd73329d20bc9b20.svn-base b/cpplapack-r198/.svn/pristine/f1/f18334365d6eb528cc193724fd73329d20bc9b20.svn-base deleted file mode 100644 index 692b48ce2cb02aba560eed0e31a25c13fe2f9d07..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f1/f18334365d6eb528cc193724fd73329d20bc9b20.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _zrovector*_zgsmatrix operator */ -inline _zrovector operator*(const _zrovector& vec, const _zgsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) += vec(it->i)*it->v; - } - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/f3/f324d0d24fc74043774c6e3e5cf37697154bb275.svn-base b/cpplapack-r198/.svn/pristine/f3/f324d0d24fc74043774c6e3e5cf37697154bb275.svn-base deleted file mode 100644 index f57adc8c5a24affb059a536fd20e2cbbaa3be3dd..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f3/f324d0d24fc74043774c6e3e5cf37697154bb275.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _drovector*_dsymatrix operator */ -inline _drovector operator*(const _drovector& vec, const _dsymatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.n){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.n << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - drovector newvec(mat.n); - char uplo ='l'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dsymv_( &uplo, &mat.n, &alpha, mat.array, &mat.n, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - mat.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/f4/f44dcedc660ddc245a59780a0f8cd2eb86245f91.svn-base b/cpplapack-r198/.svn/pristine/f4/f44dcedc660ddc245a59780a0f8cd2eb86245f91.svn-base deleted file mode 100644 index cefbe8b7b76c7f22c28e1855097bd2a193b66a1d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f4/f44dcedc660ddc245a59780a0f8cd2eb86245f91.svn-base +++ /dev/null @@ -1,89 +0,0 @@ -//============================================================================= -/*! _dsymatrix+_dgbmatrix operator */ -inline _dgematrix operator+(const _dsymatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) += matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix-_dgbmatrix operator */ -inline _dgematrix operator-(const _dsymatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=i; j<matA.n; j++){ - newmat(i,j) = newmat(j,i) = matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j) -= matB(i,j); - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dsymatrix*_dgbmatrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const _dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/f4/f483bc188dd50ae6f490b5d29a45c2da26aa33a1.svn-base b/cpplapack-r198/.svn/pristine/f4/f483bc188dd50ae6f490b5d29a45c2da26aa33a1.svn-base deleted file mode 100644 index 85d9a6ab35e57f94104cb02b950676115efe7f8a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f4/f483bc188dd50ae6f490b5d29a45c2da26aa33a1.svn-base +++ /dev/null @@ -1,83 +0,0 @@ -//============================================================================= -/*! zhematrix+zgbmatrix operator */ -inline _zgematrix operator+(const zhematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)+=matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix-zgbmatrix operator */ -inline _zgematrix operator-(const zhematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA.n, matA.n); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=0; j<matA.n; j++){ - newmat(i,j) =matA(i,j); - } - const CPPL_INT jmax =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax; j++){ - newmat(i,j)-=matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! zhematrix*zgbmatrix operator */ -inline _zgematrix operator*(const zhematrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.n, matB.n ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - for(CPPL_INT j=0; j<newmat.n; j++){ - const CPPL_INT kmax =std::min(matB.m,j+matB.kl+1); - for(CPPL_INT k=std::max(CPPL_INT(0),j-matB.ku); k<kmax; k++){ - newmat(i,j)+=matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/f4/f4bf09262925f1b7a6c1912edb5b32501c1c3be0.svn-base b/cpplapack-r198/.svn/pristine/f4/f4bf09262925f1b7a6c1912edb5b32501c1c3be0.svn-base deleted file mode 100644 index 6721de5db7b2e9f316f13a106b4681927e11530d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f4/f4bf09262925f1b7a6c1912edb5b32501c1c3be0.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -//============================================================================= -/*! comple*_zgematrix operator */ -inline _zgematrix operator*(const comple& d, const _zgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - zscal_(&size, &d, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/pristine/f4/f4d974e89bc0c2ad512e7ab5dd1465bd49e6325c.svn-base b/cpplapack-r198/.svn/pristine/f4/f4d974e89bc0c2ad512e7ab5dd1465bd49e6325c.svn-base deleted file mode 100644 index f77b656bfa04e97196259c171a22a90a7b72720c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f4/f4d974e89bc0c2ad512e7ab5dd1465bd49e6325c.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -//============================================================================= -/*! _dcovector constructor */ -inline _dcovector::_dcovector() -{CPPL_VERBOSE_REPORT;CPPL_VERBOSE_REPORT; - l =0; - cap =0; - array =NULL; -} - -//============================================================================= -/*! _dcovector copy constructor */ -inline _dcovector::_dcovector(const _dcovector& vec) -{CPPL_VERBOSE_REPORT;CPPL_VERBOSE_REPORT; - l =vec.l; - cap =vec.cap; - array =vec.array; - - vec.nullify(); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! _dcovector destructor */ -inline _dcovector::~_dcovector() -{CPPL_VERBOSE_REPORT;CPPL_VERBOSE_REPORT; - delete[] array; -} diff --git a/cpplapack-r198/.svn/pristine/f5/f5e04ea974de03277af93283450d3cd69442305f.svn-base b/cpplapack-r198/.svn/pristine/f5/f5e04ea974de03277af93283450d3cd69442305f.svn-base deleted file mode 100644 index 5c5652e6fa16550992e045aeaa8d73a364f5e77f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f5/f5e04ea974de03277af93283450d3cd69442305f.svn-base +++ /dev/null @@ -1,16 +0,0 @@ -//============================================================================= -/*! nullify all the vector data */ -inline void _dcovector::nullify() const -{CPPL_VERBOSE_REPORT; - l=0; - cap=0; - array=NULL; -} - -//============================================================================= -/*! destroy all the vector data */ -inline void _dcovector::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - array=NULL; -} diff --git a/cpplapack-r198/.svn/pristine/f6/f6010566c36118a41cc4f27af3b8fa4df485540e.svn-base b/cpplapack-r198/.svn/pristine/f6/f6010566c36118a41cc4f27af3b8fa4df485540e.svn-base deleted file mode 100644 index c91d4c2c691b9177bb476691a62a37fb486c8565..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f6010566c36118a41cc4f27af3b8fa4df485540e.svn-base +++ /dev/null @@ -1,23 +0,0 @@ -//============================================================================= -/*! dgsmatrix*dcovector operator */ -inline _dcovector operator*(const dgsmatrix& mat, const dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - newvec.zero(); - - const std::vector<dcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<dcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->i) += it->v*vec(it->j); - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/f6/f6280051d93be9f69c80dd3c86e17e8de9c85873.svn-base b/cpplapack-r198/.svn/pristine/f6/f6280051d93be9f69c80dd3c86e17e8de9c85873.svn-base deleted file mode 100644 index 0080846e722f9a9ffe16cb6d48aae67d0c3f0c5d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f6280051d93be9f69c80dd3c86e17e8de9c85873.svn-base +++ /dev/null @@ -1,51 +0,0 @@ -/*****************************************************************************/ -/* main.cpp */ -/*****************************************************************************/ -#undef CPPL_VERBOSE -#undef CPPL_DEBUG - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - int size(3000); - CPPL::dgematrix A(size,size), B(size,size), C; - - srand(unsigned(time(NULL))); - for(int i=0; i<size; i++){ for(int j=0; j<size; j++){ - A(i,j) =double(rand())/double(RAND_MAX); - B(i,j) =double(rand())/double(RAND_MAX); - }} - - clock_t t0, t1, t2, t3; - - t0=clock(); - - C=A+B; - - t1=clock(); - - C.resize(size,size); - for(int i=0; i<size*size; i++){ - C.array[i] =A.array[i]+B.array[i]; - } - - t2=clock(); - - C=B; - daxpy_(size*size, 1., A.array, 1, C.array, 1); - - t3=clock(); - - std::cout << "\"A+B\" took "<< (1000./CLOCKS_PER_SEC)*(t1-t0) << "[ms]." << std::endl; - std::cout << "\"loop\" took "<< (1000./CLOCKS_PER_SEC)*(t2-t1) << "[ms]." << std::endl; - std::cout << "\"daxpy\" took "<< (1000./CLOCKS_PER_SEC)*(t3-t2) << "[ms]." << std::endl; - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/f6/f65d5fe9abc81fed4a908387ceb1f796c4ca34b7.svn-base b/cpplapack-r198/.svn/pristine/f6/f65d5fe9abc81fed4a908387ceb1f796c4ca34b7.svn-base deleted file mode 100644 index 74e57fc668087b0cb5e076b0f00c00a0188c09f0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f65d5fe9abc81fed4a908387ceb1f796c4ca34b7.svn-base +++ /dev/null @@ -1,186 +0,0 @@ -extern "C" { - // Solve Linear Equations A * x = b - /* for General Matrix */ - void dgesv_( const CPPL_INT *N, const CPPL_INT *nrhs, double *a, const CPPL_INT *lda, - CPPL_INT *ipiv, double *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for General Band Matrix */ - void dgbsv_( const CPPL_INT *N, const CPPL_INT *KL, const CPPL_INT *KU, - const CPPL_INT *nrhs, double *ab, const CPPL_INT *ldab, - CPPL_INT *ipiv, double *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for Tridiagonal Matrix */ - void dgtsv_( const CPPL_INT *N, const CPPL_INT *nrhs, double *dl, double *d, - double *du, double *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for Symmetric Positive Definite Matrix */ - void dposv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - double *a, const CPPL_INT *lda, double *b, const CPPL_INT *ldb, - CPPL_INT *info ); - /* for Symmetric Positive Definite (Packed Storage) Matrix */ - void dppsv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - double *ap, double *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for Symmetric Positive Definite Band Matrix */ - void dpbsv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *kd, - const CPPL_INT *nrhs, double *ab, const CPPL_INT *ldab, - double *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for Symmetric Positive Definite Tridiagonal Matrix */ - void dptsv_( const CPPL_INT *N, const CPPL_INT *nrhs, double *d, double *e, - double *b, const CPPL_INT *ldb, CPPL_INT *info ); - /* for Symmetric Indefinite Matrix */ - void dsysv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - double *a, const CPPL_INT *lda, CPPL_INT *ipiv, double *b, - const CPPL_INT *ldb, double *work, const CPPL_INT *lwork, - CPPL_INT *info ); - /* for Symmetric Indefinite (Packed Storage) Matrix */ - void dspsv_( const char *uplo, const CPPL_INT *N, const CPPL_INT *nrhs, - double *ap, CPPL_INT *ipiv, double *b, const CPPL_INT *ldb, - CPPL_INT *info ); - - // Linear Least Square Problems - // Solve Overdetermined or Underdetermined Linear Equations - /* Using Orthogonal Factorization, Assuming Full Rank */ - void dgels_( const char *trans, const CPPL_INT *M, const CPPL_INT *N, - const CPPL_INT *nrhs, double *a, const CPPL_INT *lda, - double *b, const CPPL_INT *ldb, - double *work, const CPPL_INT *lwork, CPPL_INT *info ); - /* Compute Minimum-Norm Solution using Orthogonal Factorization */ - void dgelsy_( const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *nrhs, - double *a, const CPPL_INT *lda, double *b, const CPPL_INT *ldb, - CPPL_INT *jpvt, const double *rcond, CPPL_INT *rank, - double *work, const CPPL_INT *lwork, CPPL_INT *info ); - /* Compute Minimum-Norm Solution using Singular Value Decomposition */ - void dgelss_( const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *nrhs, - double *a, const CPPL_INT *lda, double *b, const CPPL_INT *ldb, - double *s, const double *rcond, CPPL_INT *rank, - double *work, const CPPL_INT *lwork, CPPL_INT *info ); - /* Compute Minimum-Norm Solution using Singular Value Decomposition with Divide and Conquer Algorithm */ - void dgelsd_( const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *nrhs, - double *a, const CPPL_INT *lda, double *b, const CPPL_INT *ldb, - double *s, const double *rcond, CPPL_INT *rank, - double *work, const CPPL_INT *lwork, CPPL_INT *iwork, CPPL_INT *info ); - /* Solve Linear Equality-Constrained Least Squares (LSE) Problem */ - void dgglse_( const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *p, double *a, - const CPPL_INT *lda, double *b, const CPPL_INT *ldb, - double *c, double *d, double *x, double *work, - const CPPL_INT *lwork, CPPL_INT *info ); - /* Solve Gauss-Markov Linear Model (GLM) Problem */ - void dggglm_( const CPPL_INT *N, const CPPL_INT *M, const CPPL_INT *p, - double *a, const CPPL_INT *lda, double *b, const CPPL_INT *ldb, - double *d, double *x, double *y, - double *work, const CPPL_INT *lwork, CPPL_INT *info ); - - // Standard Eigenvalue and Singular Value Problems - // Divide and Conquer routines are more fast, but need more memory. - /* Eigenvalues/Eigenvectors for General Matrix */ - void dgeev_( const char *jobvl, const char *jobvr, const CPPL_INT *N, - double *a, const CPPL_INT *lda, double *wr, double *wi, - double *vl, const CPPL_INT *ldvl, double *vr, const CPPL_INT *ldvr, - double *work, const CPPL_INT *lwork, CPPL_INT *info ); - /* Eigenvalues/Eigenvectors for Symmetric Matrix */ - void dsyev_( const char *jobz, const char *uplo, const CPPL_INT *N, - double *a, const CPPL_INT *lda, double *w, double *work, - const CPPL_INT *lwork, CPPL_INT *info ); - void dsyevd_( const char *jobz, const char *uplo, const CPPL_INT *N, - double *a, const CPPL_INT *lda, double *w, double *work, - const CPPL_INT *lwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Eigenvalues/Eigenvectors for Symmetric (Packed Storage) Matrix */ - void dspev_( const char *jobz, const char *uplo, const CPPL_INT *N, - double *ap, double *w, double *z, const CPPL_INT *ldz, - double *work, CPPL_INT *info ); - void dspevd_( const char *jobz, const char *uplo, const CPPL_INT *N, - double *ap, double *w, double *z, const CPPL_INT *ldz, - double *work, const CPPL_INT *lwork, CPPL_INT *iwork, - const CPPL_INT *liwork, CPPL_INT *info ); /* Divide and Conqure */ - /* Eigenvalues/Eigenvectors for Symmetric Band Matrix */ - void dsbev_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *kd, double *ab, const CPPL_INT *ldab, double *w, - double *z, const CPPL_INT *ldz, double *work, CPPL_INT *info ); - void dsbevd_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *kd, double *ab, const CPPL_INT *ldab, double *w, - double *z, const CPPL_INT *ldz, double *work, - const CPPL_INT *lwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Eigenvalues/Eigenvectors for Symmetric Tridiagonal Matrix */ - void dstev_( const char *jobz, const CPPL_INT *N, double *d, double *e, - double *z, const CPPL_INT *ldz, double *work, CPPL_INT *info ); - void dstevd_( const char *jobz, const CPPL_INT *N, double *d, double *e, - double *z, const CPPL_INT *ldz, double *work, - const CPPL_INT *lwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Schur Factorization for General Matrix */ - void dgees_( const char *jobvs, const char *sort, - bool (*select)( double *, double * ), - const CPPL_INT *N, double *a, const CPPL_INT *lda, CPPL_INT *sdim, - double *wr, double *wi, double *vs, const CPPL_INT *ldvs, - double *work, const CPPL_INT *lwork, bool *bwork, - CPPL_INT *info ); - /* Singular Value Decomposition for General Matrix */ - void dgesvd_( const char *jobu, const char *jobvt, const CPPL_INT *M, - const CPPL_INT *N, double *a, const CPPL_INT *lda, double *s, - double *u, const CPPL_INT *ldu, double *vt, const CPPL_INT *ldvt, - double *work, const CPPL_INT *lwork, CPPL_INT *info ); - void dgesdd_( const char *jobz, const CPPL_INT *M, const CPPL_INT *N, double *a, - const CPPL_INT *lda, double *s, double *u, const CPPL_INT *ldu, - double *vt, const CPPL_INT *ldvt, double *work, - const CPPL_INT *lwork, CPPL_INT *iwork, - CPPL_INT *info ); /* Divide and Conqure */ - - // Generalized Eigenvalue and Sigular Value Problems - /* Generalized Eigenvalues/Eigenvectors for General Matrix */ - void dggev_( const char *jobvl, const char *jobvr, const CPPL_INT *N, - double *a, const CPPL_INT *lda, double *b, const CPPL_INT *ldb, - double *alphar, double *alphai, double *beta, - double *vl, const CPPL_INT *ldvl, double *vr, const CPPL_INT *ldvr, - double *work, const CPPL_INT *lwork, CPPL_INT *info ); - /* Generalized Eigenvalues/Eigenvectors - for Symmetric-definite Matrix */ - void dsygv_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, double *a, const CPPL_INT *lda, double *b, - const CPPL_INT *ldb, double *w, double *work, const CPPL_INT *lwork, - CPPL_INT *info ); - void dsygvd_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, double *a, const CPPL_INT *lda, double *b, - const CPPL_INT *ldb, double *w, double *work, - const CPPL_INT *lwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Generalized Eigenvalues/Eigenvectors - for Symmetric-definite (Packed Storage) Matrix */ - void dspgv_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, double *ap, double *bp, double *w, - double *z, const CPPL_INT *ldz, double *work, CPPL_INT *info ); - void dspgvd_( const CPPL_INT *itype, const char *jobz, const char *uplo, - const CPPL_INT *N, double *ap, double *bp, double *w, - double *z, const CPPL_INT *ldz, double *work, - const CPPL_INT *lwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Generalized Eigenvalues/Eigenvectors - Symmetric-definite Band Matrix */ - void dsbgv_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *ka, const CPPL_INT *kb, double *ab, const CPPL_INT *ldab, - double *bb, const CPPL_INT *ldbb, double *w, double *z, - const CPPL_INT *ldz, double *work, CPPL_INT *info ); - void dsbgvd_( const char *jobz, const char *uplo, const CPPL_INT *N, - const CPPL_INT *ka, const CPPL_INT *kb, double *ab, - const CPPL_INT *ldab, double *bb, const CPPL_INT *ldbb, double *w, - double *z, const CPPL_INT *ldz, double *work, - const CPPL_INT *lwork, CPPL_INT *iwork, const CPPL_INT *liwork, - CPPL_INT *info ); /* Divide and Conqure */ - /* Generalized Schur Factrization for General Matrix */ - void dgges_( const char *jobvsl, const char *jobvsr, const char *sort, - CPPL_INT (*delctg)( double *, double *, double * ), - const CPPL_INT *N, double *a, const CPPL_INT *lda, double *b, - const CPPL_INT *ldb, CPPL_INT *sdim, double *alphar, double *alphai, - double *beta, double *vsl, const CPPL_INT *ldvsl, double *vsr, - const CPPL_INT *ldvsr, double *work, const CPPL_INT *lwork, - bool *bwork, CPPL_INT *info ); - /* Generailized Singular Value Decomposition for General Matrix */ - void dggsvd_( const char *jobu, const char *jobv, const char *jobq, - const CPPL_INT *M, const CPPL_INT *N, const CPPL_INT *p, CPPL_INT *k, - CPPL_INT *L, double *a, const CPPL_INT *lda, double *b, - const CPPL_INT *ldb, double *alpha, double *beta, - double *u, const CPPL_INT *ldu, double *v, const CPPL_INT *ldv, - double *q, const CPPL_INT *ldq, double *work, CPPL_INT *iwork, - CPPL_INT *info ); - - void dgeqrf_( CPPL_INT* m, CPPL_INT* n, double* a, CPPL_INT* lda, double* tau, double* work, CPPL_INT* lwork, CPPL_INT *info ); - void dorgqr_( CPPL_INT* m, CPPL_INT* n, CPPL_INT* k, double* a, CPPL_INT* lda, const double* tau, double* work, CPPL_INT* lwork, CPPL_INT *info ); -} diff --git a/cpplapack-r198/.svn/pristine/f6/f680c1552fe227df9f91ff5dd9f7f8dca7aa03c4.svn-base b/cpplapack-r198/.svn/pristine/f6/f680c1552fe227df9f91ff5dd9f7f8dca7aa03c4.svn-base deleted file mode 100644 index 6d144ee610707e02ee43b1fbd2ec70078721d648..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f680c1552fe227df9f91ff5dd9f7f8dca7aa03c4.svn-base +++ /dev/null @@ -1,126 +0,0 @@ -//============================================================================= -void zggev_check_value() -{ - cout << "############ check zggev value ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make zgematrix A and B //// - CPPL::zgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make wr wi vr //// - vector< complex<double> > w; - - //// make A_original and B_original //// - CPPL::zgematrix A_original(A); - CPPL::zgematrix B_original(B); - - //// zggev //// - A.zggev(w); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "wr=" << wr[i] <<endl; - cout << "wi=" << wi[i] <<endl; - } -} - -//============================================================================= -void zggev_check_right() -{ - cout << "############ check zggev right ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make zgematrix A and B //// - CPPL::zgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make wr wi vr //// - vector<double> wr, wi; - vector<CPPL::dcovector> vrr, vri; - - //// make A_original and B_original //// - CPPL::zgematrix A_original(A); - CPPL::zgematrix B_original(B); - - //// zggev //// - A.zggev(B, wr, wi ,vrr, vri); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "wr=" << wr[i] <<endl; - cout << "wi=" << wi[i] <<endl; - cout << "vrr=\n" << vrr[i] <<endl; - cout << "vri=\n" << vri[i] <<endl; - cout << "Real[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n" - << A_original*vrr[i] - -(wr[i]*B_original*vrr[i] - wi[i]*B_original*vri[i]) - << endl; - cout << "Imag[ [A]*{x} -lambda*[B]*{x} ] = (Should be zeros)\n" - << A_original*vri[i] - -(wr[i]*B_original*vri[i] + wi[i]*B_original*vrr[i]) - << endl; - } -} - -//============================================================================= -void zggev_check_left() -{ - cout << "############ check zggev left ############" << endl; - - srand(unsigned(time(NULL))); - int M(3); - - //// make zgematrix A and B //// - CPPL::zgematrix A(M,M), B(M,M); - for(int i=0; i<A.m; i++){ for(int j=0; j<A.n; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - //// make wr wi vl //// - vector<double> wr, wi; - vector<CPPL::drovector> vlr, vli; - - //// make A_original and B_original //// - CPPL::zgematrix A_original(A); - CPPL::zgematrix B_original(B); - - //// zggev //// - A.zggev(B, wr, wi ,vlr, vli); - - //// print //// - cout << "A_original=\n" << A_original << endl; - cout << "B_original=\n" << B_original << endl; - for(int i=0; i<A.m; i++){ - cout << "#### " << i << "th eigen ####" << endl; - cout << "wr = " << wr[i] << endl; - cout << "wi = " << wi[i] << endl; - cout << "vlr = " << vlr[i]; - cout << "vli = " << vli[i] << endl; - cout << "Real[ {x}*[A] -lambda*{x}*[B] ] = (Should be zeros)\n" - << vlr[i]*A_original - -(wr[i]*vlr[i]*B_original - wi[i]*vli[i]*B_original) - << endl; - cout << "Imag[ [A]*{x} -lambda*{x}*[B] ] = (Should be zeros)\n" - << vli[i]*A_original - -(wr[i]*vli[i]*B_original + wi[i]*vlr[i]*B_original) - << endl; - } -} diff --git a/cpplapack-r198/.svn/pristine/f6/f68302da39802f59b226eb2f9e7b61aca911d70f.svn-base b/cpplapack-r198/.svn/pristine/f6/f68302da39802f59b226eb2f9e7b61aca911d70f.svn-base deleted file mode 100644 index a1581a4d6507d2d1779d3e172389075d29d1dab6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f68302da39802f59b226eb2f9e7b61aca911d70f.svn-base +++ /dev/null @@ -1,129 +0,0 @@ -//============================================================================= -/*! operator() for non-const object */ -inline comple& zcovector::operator()(const CPPL_INT& i) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -//============================================================================= -/*! operator() for const object */ -inline comple zcovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! set value for const object */ -inline zcovector& zcovector::set(const CPPL_INT& i, const comple& v) //const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is " << l << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - array[i] =v; - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zcovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ - s << " " << vec.array[i] << std::endl; - } - - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void zcovector::write(const char *filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zcovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << std::endl; - } - - ofs.close(); -} - -//============================================================================= -inline void zcovector::read(const char *filename) -{CPPL_VERBOSE_REPORT; - std::ifstream s(filename); - if(!s){ - ERROR_REPORT; - std::cerr << "The file \"" << filename << "\" can not be opened." << std::endl; - exit(1); - } - - std::string id; - s >> id; - if( id != "zcovector" && id != "#zcovector" ){ - ERROR_REPORT; - std::cerr << "The type name of the file \"" << filename << "\" is not zcovector." << std::endl - << "Its type name was " << id << " ." << std::endl; - exit(1); - } - - s >> l; - resize(l); - for(CPPL_INT i=0; i<l; i++){ - s >> operator()(i); - } - if(s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there is not enough data components, or a linefeed code or space code is missing at the end of the last line." << std::endl; - exit(1); - } - - s >> id; - if(!s.eof()){ - ERROR_REPORT; - std::cerr << "There is something is wrong with the file \"" << filename << "\"." << std::endl - << "Most likely, there are extra data components." << std::endl; - exit(1); - } - - s.close(); -} diff --git a/cpplapack-r198/.svn/pristine/f6/f69759d95b767bb2bd09cec93254db8c47bcf682.svn-base b/cpplapack-r198/.svn/pristine/f6/f69759d95b767bb2bd09cec93254db8c47bcf682.svn-base deleted file mode 100644 index 4b8f24cb27bfff864c287897f107be2df0cf9a01..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f69759d95b767bb2bd09cec93254db8c47bcf682.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -/*! operator() for const object */ -inline comple& _zrovector::operator()(const CPPL_INT& i) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || l<=i ){ - ERROR_REPORT; - std::cerr << "The required component is out of the vector size." << std::endl - << "Your input is (" << i << "), whereas the vector size is (" << l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - return array[i]; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const _zrovector& vec) -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<vec.l; i++){ s << " " << vec.array[i]; } - s << std::endl; - - vec.destroy(); - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline void _zrovector::write(const char* filename) const -{CPPL_VERBOSE_REPORT; - std::ofstream ofs(filename, std::ios::trunc); - ofs.setf(std::cout.flags()); - ofs.precision(std::cout.precision()); - ofs.width(std::cout.width()); - ofs.fill(std::cout.fill()); - - ofs << "#zrovector" << " " << l << std::endl; - for(CPPL_INT i=0; i<l; i++){ - ofs << operator()(i) << " "; - } - ofs << std::endl; - - ofs.close(); - destroy(); -} diff --git a/cpplapack-r198/.svn/pristine/f6/f6a2c05e12d29bd6992d11881c17811802c970d7.svn-base b/cpplapack-r198/.svn/pristine/f6/f6a2c05e12d29bd6992d11881c17811802c970d7.svn-base deleted file mode 100644 index 332873ae5d57d24c0f409fb5c9f59c779a770d53..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f6a2c05e12d29bd6992d11881c17811802c970d7.svn-base +++ /dev/null @@ -1,42 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(2); - - CPPL::zhematrix A(N); - CPPL::zgematrix B(N,N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - for(int i=0; i<B.m; i++){ for(int j=0; j<B.n; j++){ - B(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - }} - - cout << "A =\n" << A << endl; - cout << "B =\n" << B << endl; - - cout << "A+B =\n" << A+B << endl; - cout << "A-B =\n" << A-B << endl; - cout << "A*B =\n" << A*B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/f6/f6b92696e184abfad4fc6ed780291942cea3ee92.svn-base b/cpplapack-r198/.svn/pristine/f6/f6b92696e184abfad4fc6ed780291942cea3ee92.svn-base deleted file mode 100644 index 00e181ab343d6659c237bfc0bb5e112c0e1a1be3..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f6/f6b92696e184abfad4fc6ed780291942cea3ee92.svn-base +++ /dev/null @@ -1,112 +0,0 @@ -//============================================================================= -/*! clear all the matrix data and set the sizes 0 */ -inline void dgrmatrix::clear() -{CPPL_VERBOSE_REPORT; - m =0; - n =0; - a.clear(); - ia.clear(); - ja.clear(); -} - -//============================================================================= -/*! change the matrix into a zero matrix with no change in structure */ -inline dgrmatrix& dgrmatrix::zero() -{CPPL_VERBOSE_REPORT; - const std::vector<double>::iterator a_end =a.end(); - for(std::vector<double>::iterator it=a.begin(); it!=a_end; it++){ - (*it) =0.; - } - return *this; -} - -//============================================================================= -/*! make a deep copy of the matrix */ -inline void dgrmatrix::copy(const dgrmatrix& mat) -{CPPL_VERBOSE_REPORT; - m =mat.m; - n =mat.n; - a =mat.a; - ia =mat.ia; - ja =mat.ja; -} - -//============================================================================= -/*! check if the component is listed */ -inline bool dgrmatrix::isListed(const CPPL_INT& i, const CPPL_INT& j) const -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if( i<0 || j<0 || m<=i || n<=j ){ - ERROR_REPORT; - std::cerr << "The required component is out of the matrix size." << std::endl - << "Your input is (" << i << "," << j << "), whereas the matrix size is " << m << "x" << n << "." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - //////// search //////// - int k_beg =ia[i]-1; - int k_end =ia[i+1]-1; - for(int k=k_beg; k<k_end; k++){ - if(ja[k]==j+1){ - return true;//found - } - } - //////// not found //////// - return false; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! health checkup */ -inline void dgrmatrix::checkup() -{CPPL_VERBOSE_REPORT; - //////// size check //////// - if(m<0){ - ERROR_REPORT; - std::cerr << "m<0" << std::endl; - exit(1); - } - if(n<0){ - ERROR_REPORT; - std::cerr << "n<0" << std::endl; - exit(1); - } - if(a.size()!=ja.size()){ - ERROR_REPORT; - std::cerr << "a.size()!=ja.size()" << std::endl; - exit(1); - } - if(ia.size()!=size_t(m+1)){ - ERROR_REPORT; - std::cerr << "ia.size()!=m+1" << std::endl; - exit(1); - } - if(a.size()>size_t(m*n)){ - ERROR_REPORT; - std::cerr << "a.size()>m*n" << std::endl; - exit(1); - } - - //////// index check //////// - //not yet.... - - std::cerr << "# [NOTE]@dgrmatrix::checkup(): This matrix is fine." << std::endl; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! swap two matrices */ -inline void swap(dgrmatrix& A, dgrmatrix& B) -{CPPL_VERBOSE_REPORT; - std::swap(A.n,B.n); - std::swap(A.m,B.m); - std::swap(A.a,B.a); - std::swap(A.ia,B.ia); - std::swap(A.ja,B.ja); -} diff --git a/cpplapack-r198/.svn/pristine/f7/f722a721dcc27cf4abbcfe1df59aa324df755383.svn-base b/cpplapack-r198/.svn/pristine/f7/f722a721dcc27cf4abbcfe1df59aa324df755383.svn-base deleted file mode 100644 index 42331cca360409f77b8412e226aeb0c61d41fabb..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f7/f722a721dcc27cf4abbcfe1df59aa324df755383.svn-base +++ /dev/null @@ -1,35 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::zhematrix A(N); - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - cout << "A =\n" << A << endl; - cout << "+A =\n" << +A << endl; - cout << "-A =\n" << -A << endl; - cout << "A =\n" << A << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/f7/f74eaf8daa6d544fb663be62c26ce5d8e9e998be.svn-base b/cpplapack-r198/.svn/pristine/f7/f74eaf8daa6d544fb663be62c26ce5d8e9e998be.svn-base deleted file mode 100644 index c95b5d5bcb486e69bdc85e9c8713c17efea9f508..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f7/f74eaf8daa6d544fb663be62c26ce5d8e9e998be.svn-base +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -/*! zrovector*zhsmatrix operator */ -inline _zrovector operator*(const zrovector& vec, const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vec.l!=mat.m){ - ERROR_REPORT; - std::cerr << "These vector and matrix can not make a product." << std::endl - << "Your input was (" << vec.l << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zrovector newvec(mat.n); - newvec.zero(); - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - newvec(it->j) +=vec(it->i)*it->v; - if(it->i!=it->j){ - newvec(it->i) +=vec(it->j)*std::conj(it->v); - } - } - - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/f7/f75dfef1782ade88a4004e18dce6acacc948a3e8.svn-base b/cpplapack-r198/.svn/pristine/f7/f75dfef1782ade88a4004e18dce6acacc948a3e8.svn-base deleted file mode 100644 index 8f60836d8799ef82275a10fd66775967bf208d3e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f7/f75dfef1782ade88a4004e18dce6acacc948a3e8.svn-base +++ /dev/null @@ -1,86 +0,0 @@ -//============================================================================= -/*! return transposed zhsmatrix */ -inline _zhsmatrix t(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v =std::conj(it->v); - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! return its conjugate matrix */ -inline _zhsmatrix conj(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat(mat); - - const std::vector<zcomponent>::iterator newmat_data_end =newmat.data.end(); - for(std::vector<zcomponent>::iterator it=newmat.data.begin(); it!=newmat_data_end; it++){ - it->v =std::conj(it->v); - } - - return _(newmat); -} - -//============================================================================= -/*! return its conjugate matrix */ -inline _zhsmatrix conjt(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - WARNING_REPORT; - std::cerr << "This function call has no effect since the matrix is Hermitian." << std::endl; -#endif//CPPL_DEBUG - - zhsmatrix newmat(mat); - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! search the index of element having the largest absolute value - in 0-based numbering system */ -inline void idamax(CPPL_INT& i, CPPL_INT& j, const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - i =itx->i; - j =itx->j; -} - -//============================================================================= -/*! return its largest absolute value */ -inline comple damax(const zhsmatrix& mat) -{CPPL_VERBOSE_REPORT; - std::vector<zcomponent>::const_iterator itx(mat.data.begin()); - double vmax =0.; - - const std::vector<zcomponent>::const_iterator mat_data_end =mat.data.end(); - for(std::vector<zcomponent>::const_iterator it=mat.data.begin(); it!=mat_data_end; it++){ - if( vmax < norm(it->v) ){ - vmax =norm(it->v); - itx =it; - } - } - - return itx->v; -} diff --git a/cpplapack-r198/.svn/pristine/f7/f7a31da8f9c9c48294e0d7a4e64f5afa49e02724.svn-base b/cpplapack-r198/.svn/pristine/f7/f7a31da8f9c9c48294e0d7a4e64f5afa49e02724.svn-base deleted file mode 100644 index 2019c7f51da3c1004d28601f53c941a96bbafe28..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f7/f7a31da8f9c9c48294e0d7a4e64f5afa49e02724.svn-base +++ /dev/null @@ -1,70 +0,0 @@ -//============================================================================= -/*! _dsymatrix+dsymatrix operator */ -inline _dsymatrix operator+(const _dsymatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] += matB.darray[j][i]; - } - } - - return matA; -} - -//============================================================================= -/*! _dsymatrix-dsymatrix operator */ -inline _dsymatrix operator-(const _dsymatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] -= matB.darray[j][i]; - } - } - - return matA; -} - -//============================================================================= -/*! _dsymatrix*dsymatrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - dgematrix newmat(matA.n, matA.n); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/f7/f7f28021dbc0859a7de685aeef535a048805ca3d.svn-base b/cpplapack-r198/.svn/pristine/f7/f7f28021dbc0859a7de685aeef535a048805ca3d.svn-base deleted file mode 100644 index 9306b1938ccc6c6a26d3c3d2091e050166634d3d..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f7/f7f28021dbc0859a7de685aeef535a048805ca3d.svn-base +++ /dev/null @@ -1,48 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(3); - - CPPL::zhematrix A(N), B; - for(int i=0; i<A.n; i++){ - for(int j=0; j<i; j++){ - A(i,j) =complex<double>(rand()/(RAND_MAX/10), rand()/(RAND_MAX/10)); - } - A(i,i) =complex<double>(rand()/(RAND_MAX/10), 0.0); - } - - cout << "A =\n" << A << endl; - cout << "#### B.copy(A) ####" << endl; - B.copy(A); - cout << "B =\n" << B << endl; - - cout << "#### B.clear() ####" << endl; - B.clear(); - cout << "B =\n" << B << endl; - - cout << "#### B.resize(2) & B.zero() ####" << endl; - B.resize(2); - B.zero(); - cout << "B =\n" << B << endl; - - cout << "#### B.identity() ####" << endl; - B.identity(); - cout << "B =\n" << B << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/f8/f809ac17ecafe58c875f9fab1467adcf3b058136.svn-base b/cpplapack-r198/.svn/pristine/f8/f809ac17ecafe58c875f9fab1467adcf3b058136.svn-base deleted file mode 100644 index a8db27ef0e3730b9552a0118cb3ee13697258e25..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f8/f809ac17ecafe58c875f9fab1467adcf3b058136.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -/*! _zgsmatrix+zgbmatrix operator */ -/* -inline _zgematrix operator+(const _zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix-zgbmatrix operator */ -/* -inline _zgematrix operator-(const _zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _zgsmatrix*zgbmatrix operator */ -/* -inline _zgematrix operator*(const _zgsmatrix& matA, const zgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - zgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT k=max(0,matA.jndx[c]-matB.ku); - k<min(matB.m,matA.jndx[c]+matB.kl+1); k++){ - newmat(matA.indx[c],k) += matA.array[c]*matB(matA.jndx[c],k); - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/f8/f86dcd21022274d7a1717f9a5adfb677504d55a4.svn-base b/cpplapack-r198/.svn/pristine/f8/f86dcd21022274d7a1717f9a5adfb677504d55a4.svn-base deleted file mode 100644 index 4c691aa530a5b2cc0fd8874893b0037fe12853d2..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f8/f86dcd21022274d7a1717f9a5adfb677504d55a4.svn-base +++ /dev/null @@ -1,30 +0,0 @@ -//============================================================================= -/*! nullify all the matrix data */ -inline void _zhematrix::nullify() const -{CPPL_VERBOSE_REPORT; - n=0; - array=NULL; - darray=NULL; -} - -//============================================================================= -/*! destroy all the matrix data */ -inline void _zhematrix::destroy() const -{CPPL_VERBOSE_REPORT; - delete [] array; - delete [] darray; - array=NULL; - darray=NULL; -} - -//============================================================================= -/*! complete the upper-right components */ -inline void _zhematrix::complete() const -{CPPL_VERBOSE_REPORT; - for(CPPL_INT i=0; i<n; i++){ - for(CPPL_INT j=0; j<i; j++){ - darray[i][j] =std::conj(darray[j][i]); - } - } -} - diff --git a/cpplapack-r198/.svn/pristine/f9/f985baba32448a3d0c6ac2423e54ae0233c9a0cb.svn-base b/cpplapack-r198/.svn/pristine/f9/f985baba32448a3d0c6ac2423e54ae0233c9a0cb.svn-base deleted file mode 100644 index 08418bb0ca2628516aa788dbd87d507b32ecce41..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f9/f985baba32448a3d0c6ac2423e54ae0233c9a0cb.svn-base +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -/*! _dsymatrix+_dsymatrix operator */ -inline _dsymatrix operator+(const _dsymatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] +=matB.darray[j][i]; - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dsymatrix-_dsymatrix operator */ -inline _dsymatrix operator-(const _dsymatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT j=0; j<matA.n; j++){ - for(CPPL_INT i=j; i<matA.n; i++){ - matA.darray[j][i] -=matB.darray[j][i]; - } - } - - matB.destroy(); - return matA; -} - -//============================================================================= -/*! _dsymatrix*_dsymatrix operator */ -inline _dgematrix operator*(const _dsymatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.n << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - matB.complete(); - - dgematrix newmat(matA.n, matA.n); - char side ='l'; - char uplo ='l'; - double alpha =1.; - double beta =0.; - - dsymm_( &side, &uplo, &matA.n, &matB.n, &alpha, matA.array, &matA.n, matB.array, &matB.m, &beta, newmat.array, &newmat.m ); - - matA.destroy(); - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/f9/f98ab3f800e2f951d5e12fd5b042d061c170d94f.svn-base b/cpplapack-r198/.svn/pristine/f9/f98ab3f800e2f951d5e12fd5b042d061c170d94f.svn-base deleted file mode 100644 index c8ddad5695ccdc4801b8e50704b6857e16611e9c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f9/f98ab3f800e2f951d5e12fd5b042d061c170d94f.svn-base +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -/*! dssmatrix+_dsymatrix operator */ -/* -inline _dgematrix operator+(const dssmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matB); - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matB.destroy(); - return _(newmat); -} -*/ - -//============================================================================= -/*! dssmatrix-_dsymatrix operator */ -/* -inline _dgematrix operator-(const dssmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.n || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(-matB); - - for(CPPL_INT c=0; c<matA.vol; c++){ - newmat(matA.indx[c],matA.jndx[c]) += matA.array[c]; - } - - matB.destroy(); - return _(newmat); -} -*/ - -//============================================================================= -/*! dssmatrix*_dsymatrix operator */ -/* -inline _dgematrix operator*(const dssmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.n << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(matA.indx[c],i) += matA.array[c]*matB(matA.jndx[c],i); - } - } - - matB.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/f9/f98ee25e92c1dc4ac0922e8efd892aaf7f23876d.svn-base b/cpplapack-r198/.svn/pristine/f9/f98ee25e92c1dc4ac0922e8efd892aaf7f23876d.svn-base deleted file mode 100644 index 6b0c09068d8f851a40ee3452090fc0f4674db5b6..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/f9/f98ee25e92c1dc4ac0922e8efd892aaf7f23876d.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! dgbmatrix*_dcovector operator */ -inline _dcovector operator*(const dgbmatrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT lda =mat.kl+mat.ku+1; - CPPL_INT inc =1; - double beta =0.; - - dgbmv_( &trans, &mat.m, &mat.n, &mat.kl, &mat.ku, &alpha, mat.array, &lda, vec.array, &inc, &beta, newvec.array, &inc ); - - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/fa/fa02dfce4cfa875c1bbb506fc0203c59f9e83003.svn-base b/cpplapack-r198/.svn/pristine/fa/fa02dfce4cfa875c1bbb506fc0203c59f9e83003.svn-base deleted file mode 100644 index 8b9cff03276ea208818a27ab2d2a5400c4255aed..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fa/fa02dfce4cfa875c1bbb506fc0203c59f9e83003.svn-base +++ /dev/null @@ -1,225 +0,0 @@ -//============================================================================= -/*! dgbmatrix=dgbmatrix operator\n - The left side matrix is overwritten thoroughly including band width. */ -inline dgbmatrix& dgbmatrix::operator=(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; - if(array!=mat.array){ // if it is NOT self substitution - copy(mat); - } - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgbmatrix+=dgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline dgbmatrix& dgbmatrix::operator+=(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "+=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) += mat(i,j); - } - } - - return *this; - } - - else{ - dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j) += operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j) += mat(i,j); - } - } - - swap(*this,newmat); - return *this; - } -} - -//============================================================================= -/*! dgbmatrix-=dgbmatrix operator\n - If the band width of the left side matrix is narrower than the right side matrix, the band width of the left side matrix become thicker as same as the right side matrix. */ -inline dgbmatrix& dgbmatrix::operator-=(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was" << "(" << m <<"x"<< n <<","<< kl <<":"<< ku << ") "<< "-=" << "("<< mat.m <<"x"<< mat.n <<","<< mat.kl <<":"<< mat.ku <<") " << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - if(kl>=mat.kl && ku>=mat.ku){ - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax =std::min(n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax; j++){ - operator()(i,j) -= mat(i,j); - } - } - - return *this; - } - - else{ - dgbmatrix newmat(m,n,std::max(kl,mat.kl),std::max(ku,mat.ku)); - newmat.zero(); - for(CPPL_INT i=0; i<m; i++){ - const CPPL_INT jmax1 =std::min(n,i+ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-kl); j<jmax1; j++){ - newmat(i,j) += operator()(i,j); - } - const CPPL_INT jmax2 =std::min(mat.n,i+mat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-mat.kl); j<jmax2; j++){ - newmat(i,j) -= mat(i,j); - } - } - - swap(*this,newmat); - return *this; - } -} - -//============================================================================= -/*! dgbmatrix*=dgbmatrix operator */ -inline dgbmatrix& dgbmatrix::operator*=(const dgbmatrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") * (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat( m, mat.n, std::min(kl+mat.kl, m-1), std::min(ku+mat.ku, mat.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(n,i+ku+1), std::min(mat.m,j+mat.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-kl), std::max(CPPL_INT(0),j-mat.ku) ); k<kmax; k++){ - newmat(i,j) += operator()(i,k)*mat(k,j); - } - } - } - - swap(*this,newmat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgbmatrix+dgbmatrix operator */ -inline _dgbmatrix operator+(const dgbmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) += matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix-dgbmatrix operator */ -inline _dgbmatrix operator-(const dgbmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat(matA.m,matA.n,std::max(matA.kl,matB.kl),std::max(matA.ku,matB.ku)); - newmat.zero(); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax1 =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax1; j++){ - newmat(i,j) += matA(i,j); - } - const CPPL_INT jmax2 =std::min(matB.n,i+matB.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matB.kl); j<jmax2; j++){ - newmat(i,j) -= matB(i,j); - } - } - - return _(newmat); -} - -//============================================================================= -/*! dgbmatrix*dgbmatrix operator */ -inline _dgbmatrix operator*(const dgbmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgbmatrix newmat( matA.m, matB.n, std::min(matA.kl+matB.kl,matA.m-1), std::min(matA.ku+matB.ku,matB.n-1) ); - newmat.zero(); - - for(CPPL_INT i=0; i<newmat.m; i++){ - const CPPL_INT jmax =std::min(newmat.n,i+newmat.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-newmat.kl); j<jmax; j++){ - const CPPL_INT kmax =std::min( std::min(matA.n,i+matA.ku+1), std::min(matB.m,j+matB.kl+1) ); - for(CPPL_INT k=std::max( std::max(CPPL_INT(0),i-matA.kl), std::max(CPPL_INT(0),j-matB.ku) ); k<kmax; k++){ - newmat(i,j) += matA(i,k)*matB(k,j); - } - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/fa/fa502bf73dff1891b2122ebdca4a2bdf5f23d5d9.svn-base b/cpplapack-r198/.svn/pristine/fa/fa502bf73dff1891b2122ebdca4a2bdf5f23d5d9.svn-base deleted file mode 100644 index b16d2415f67a3a3ef9609a9af26f13669117704c..0000000000000000000000000000000000000000 Binary files a/cpplapack-r198/.svn/pristine/fa/fa502bf73dff1891b2122ebdca4a2bdf5f23d5d9.svn-base and /dev/null differ diff --git a/cpplapack-r198/.svn/pristine/fa/fa7f5753f9a71aa8d6e2da97dbc7c87c955c729c.svn-base b/cpplapack-r198/.svn/pristine/fa/fa7f5753f9a71aa8d6e2da97dbc7c87c955c729c.svn-base deleted file mode 100644 index 4459885145dfc9b281b7bacef897963edb5e899c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fa/fa7f5753f9a71aa8d6e2da97dbc7c87c955c729c.svn-base +++ /dev/null @@ -1,80 +0,0 @@ -//============================================================================= -/*! _dgsmatrix+dgbmatrix operator */ -/* -inline _dgematrix operator+(const _dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)+=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix-dgbmatrix operator */ -/* -inline _dgematrix operator-(const _dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA); - - for(CPPL_INT i=0; i<matB.m; i++){ - for(CPPL_INT j=max(0,i-matB.kl); j<min(matB.n,i+matB.ku+1); j++){ - newmat(i,j)-=matB(i,j); - } - } - - matA.destroy(); - return _(newmat); -} -*/ -//============================================================================= -/*! _dgsmatrix*dgbmatrix operator */ -/* -inline _dgematrix operator*(const _dgsmatrix& matA, const dgbmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - for(CPPL_INT c=0; c<matA.vol; c++){ - for(CPPL_INT k=max(0,matA.jndx[c]-matB.ku); - k<min(matB.m,matA.jndx[c]+matB.kl+1); k++){ - newmat(matA.indx[c],k) += matA.array[c]*matB(matA.jndx[c],k); - } - } - - matA.destroy(); - return _(newmat); -} -*/ diff --git a/cpplapack-r198/.svn/pristine/fa/fa81ecd6036f5f3001524ae84157a0c906c2790d.svn-base b/cpplapack-r198/.svn/pristine/fa/fa81ecd6036f5f3001524ae84157a0c906c2790d.svn-base deleted file mode 100644 index 3131cb14542b1ade249960445989eed145a4cca0..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fa/fa81ecd6036f5f3001524ae84157a0c906c2790d.svn-base +++ /dev/null @@ -1,52 +0,0 @@ -//============================================================================= -//! Component Class for Complex Double-precision Sparse Matrix Classes -class zcomponent -{ -public: - /////////////////////////////////////////////// - /////////////////// objects /////////////////// - /////////////////////////////////////////////// - CPPL_INT i; //!< i index of the component - CPPL_INT j; //!< j index of the component - comple v; //!< value of the component - - /////////////////////////////////////////////// - ///////////////// constructors //////////////// - /////////////////////////////////////////////// - inline zcomponent(){ ; } - inline zcomponent(const CPPL_INT& _i, const CPPL_INT& _j, const comple& _v) :i(_i), j(_j), v(_v){ ; } - - /////////////////////////////////////////////// - ////////////////// functions ////////////////// - /////////////////////////////////////////////// - inline friend std::ostream& operator<<(std::ostream&, const zcomponent&); -}; - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -inline std::ostream& operator<<(std::ostream& s, const zcomponent& c) -{CPPL_VERBOSE_REPORT; - s << "(" << c.i << ", " << c.j << ", " << c.v << ")" << std::flush; - return s; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! lessthan function for i of zcomponent */ -inline bool ilt(const zcomponent& a, const zcomponent& b) -{CPPL_VERBOSE_REPORT; - return a.i < b.i; -} - -//============================================================================= -/*! lessthan function for j of zcomponent */ -inline bool jlt(const zcomponent& a, const zcomponent& b) -{CPPL_VERBOSE_REPORT; - return a.j < b.j; -} diff --git a/cpplapack-r198/.svn/pristine/fa/fac100070b911ce3131070211120e88d8c365634.svn-base b/cpplapack-r198/.svn/pristine/fa/fac100070b911ce3131070211120e88d8c365634.svn-base deleted file mode 100644 index 5bbf6dfea9ea904b29cdcd0f2d23e73c7c33c26e..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fa/fac100070b911ce3131070211120e88d8c365634.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <ctime> -#include "cpplapack.h" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int N(5); - - CPPL::dssmatrix A(N); - A.put(0,0, 1.); - A.put(3,2, 2.); - A.put(1,2, 3.); - A.put(4,1, 4.); - std::cout << "A =\n" << A << std::endl; - for(std::vector<CPPL::dcomponent>::const_iterator it=A.data.begin(); it!=A.data.end(); it++){ - std::cout << "A(" << it->i << "," << it->j << ") =" << it->v << std::endl; - } - - CPPL::dcovector x(N); - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - std::cout << "x =\n" << x << std::endl; - - std::cout << "A*x =\n" << A*x << std::endl; - - CPPL::dsymatrix B(A.to_dsymatrix()); - std::cout << "B =\n" << B << std::endl; - std::cout << "B*x =\n" << B*x << std::endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/fb/fb78bed11e69af0f29518deaf1dacbe74284fdbe.svn-base b/cpplapack-r198/.svn/pristine/fb/fb78bed11e69af0f29518deaf1dacbe74284fdbe.svn-base deleted file mode 100644 index eb9a33c04852593bf0ce80350670cc02c1013142..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fb/fb78bed11e69af0f29518deaf1dacbe74284fdbe.svn-base +++ /dev/null @@ -1,41 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int L(4); - - CPPL::dcovector x(L), y; - for(int i=0; i<x.l; i++){ - x(i) =double( rand() /(RAND_MAX/10) ); - } - - cout << "x =\n" << x << endl; - cout << "#### y.copy(x) ####" << endl; - y.copy(x); - cout << "y =\n" << y << endl; - - cout << "#### y.clear() ####" << endl; - y.clear(); - cout << "y =\n" << y << endl; - - cout << "#### y.resize(2) & y.zero() ####" << endl; - y.resize(2); - y.zero(); - cout << "y =\n" << y << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/fb/fbd326792be68c191a34c3ee7971deb0a4c27bf4.svn-base b/cpplapack-r198/.svn/pristine/fb/fbd326792be68c191a34c3ee7971deb0a4c27bf4.svn-base deleted file mode 100644 index d39fe50c2c66b237ff90d2e772883b74d99cbd30..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fb/fbd326792be68c191a34c3ee7971deb0a4c27bf4.svn-base +++ /dev/null @@ -1,77 +0,0 @@ -/*****************************************************************************/ -/* noname */ -/*****************************************************************************/ - -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - srand(unsigned(time(NULL))); - int M(5), N(5), KL(2), KU(2); - - CPPL::dsymatrix A(N); - CPPL::dgbmatrix X(M,N,KL,KU), Y(M,N,KL,KU), Z(M,N,KL,KU); - - A.zero(); - for(int i=0; i<X.m; i++){ - for(int j=std::max(0,i-X.kl); j<std::min(X.n,i+X.ku+1); j++){ - if(i>=j){ - A(i,j) = double( rand() /(RAND_MAX/10) ); - X(i,j) =X(j,i) =-A(i,j); - Y(i,j) =Y(j,i) =+A(i,j); - } - } - } - - for(int i=0; i<Z.m; i++){ - for(int j=std::max(0,i-Z.kl); j<std::min(Z.n,i+Z.ku+1); j++){ - Z(i,j) = double( rand() /(RAND_MAX/10) ); - } - } - - cout << "A =\n" << A << endl; - cout << "X =\n" << X << endl; - cout << "Y =\n" << Y << endl; - cout << "Z =\n" << Z << endl; - - //dsy+dgb - cout << "A+X = (Should be zero)\n" << A+X << endl; - //dsy-dgb - cout << "A-Y = (Should be zero)\n" << A-Y << endl; - //dsy*dgb, t(_dge), t(dgb), _dgb*dsy, _dge-_dge - cout << "t(A*Z)-t(Z)*A = (Should be zero)\n" << t(A*Z)-t(Z)*A << endl; - - //dsy+_dgb, -dgb - cout << "A+(-Y) = (Should be zero)\n" << A+(-Y) << endl; - //dsy-_dgb, -dgb - cout << "A-(-X) = (Should be zero)\n" << A-(-X) << endl; - //dsy*_dgb, dgb+dgb, dsy*dgb, _dge+_dge, _dge-_dge - cout << "A*(X+Z) - (A*X+A*Z) = (Should be zero)\n" - << A*(X+Z) - (A*X+A*Z) << endl; - - //_dsy+dgb, -dsy - cout << "(-A)+Y = (Should be zero)\n" << (-A)+Y << endl; - - //_dsy-dgb, -dsy - cout << "(-A)-X = (Should be zero)\n" << (-A)-X << endl; - //_dsy*dgb, -dsy, dsy*dgb, _dge+_dge - cout << "(-A)*Z+(A*Z) = (Should be zero)\n" << ((-A)*Z+(A*Z)) << endl; - - //_dsy+_dgb, -dsy, -dgb - cout << "(-A)+(-X) = (Should be zero)\n" << (-A)+(-X) << endl; - //_dsy-_dgb, -dsy, -dgb - cout << "(-A)-(-Y) = (Should be zero)\n" << (-A)-(-Y) << endl; - //_dsy*_dgb, -dsy, -dgb, dsy*dgb, _dge-_dge - cout << "(-A)*(-Z)-(A*Z) = (Should be zero)\n" << (-A)*(-Z)-(A*Z) << endl; - - return 0; -} - -/*****************************************************************************/ diff --git a/cpplapack-r198/.svn/pristine/fc/fc49b1640ca26e51ca9db982af9a586d1e0b85d7.svn-base b/cpplapack-r198/.svn/pristine/fc/fc49b1640ca26e51ca9db982af9a586d1e0b85d7.svn-base deleted file mode 100644 index d7f88205d1ee8011dd723f4c0ed606152dfc4b32..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fc/fc49b1640ca26e51ca9db982af9a586d1e0b85d7.svn-base +++ /dev/null @@ -1,56 +0,0 @@ -//============================================================================= -/*! _dcovector+dcovector operator */ -inline _dcovector operator+(const _dcovector& vecA, const dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a sumation." << std::endl - << "Your input was (" << vecA.l << ") + (" << vecB.l << ")." << std::endl; - exit(1); - } - -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ vecA.array[i]+=vecB.array[i]; } - - return vecA; -} - -//============================================================================= -/*! dcovector-dcovector operator */ -inline _dcovector operator-(const _dcovector& vecA, const dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a subtraction." << std::endl - << "Your input was (" << vecA.l << ") - (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - for(CPPL_INT i=0; i<vecA.l; i++){ vecA.array[i]-=vecB.array[i]; } - - return vecA; -} - -//============================================================================= -/*! dcovector^T*dcovector operator (inner product) */ -inline double operator%(const _dcovector& vecA, const dcovector& vecB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(vecA.l!=vecB.l){ - ERROR_REPORT; - std::cerr << "These two vectors can not make a dot product." << std::endl - << "Your input was (" << vecA.l << ") % (" << vecB.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - CPPL_INT inc =1; - - double val =ddot_( &vecA.l, vecA.array, &inc, vecB.array, &inc ); - - vecA.destroy(); - return val; -} diff --git a/cpplapack-r198/.svn/pristine/fd/fd6f992dda336a421c1fc15d8dbb2519d2a5e65d.svn-base b/cpplapack-r198/.svn/pristine/fd/fd6f992dda336a421c1fc15d8dbb2519d2a5e65d.svn-base deleted file mode 100644 index 2006e7cde9f1f9dc92f1cb0d427d8b356f509f57..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fd/fd6f992dda336a421c1fc15d8dbb2519d2a5e65d.svn-base +++ /dev/null @@ -1,79 +0,0 @@ -//============================================================================= -/*! _dgbmatrix+dgsmatrix operator */ -inline _dgematrix operator+(const _dgbmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)+=matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix-dgsmatrix operator */ -inline _dgematrix operator-(const _dgbmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( (-matB).to_dgematrix() ); - - for(CPPL_INT i=0; i<matA.m; i++){ - const CPPL_INT jmax =std::min(matA.n,i+matA.ku+1); - for(CPPL_INT j=std::max(CPPL_INT(0),i-matA.kl); j<jmax; j++){ - newmat(i,j)-=matA(i,j); - } - } - - matA.destroy(); - return _(newmat); -} - -//============================================================================= -/*! _dgbmatrix*dgsmatrix operator */ -inline _dgematrix operator*(const _dgbmatrix& matA, const dgsmatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matB_data_end =matB.data.end(); - for(std::vector<dcomponent>::const_iterator it=matB.data.begin(); it!=matB_data_end; it++){ - const CPPL_INT imax =std::min(matA.m,it->i+matA.kl); - for(CPPL_INT i=std::max(CPPL_INT(0),it->i-(matA.ku+1)); i<imax; i++){ - newmat(i,it->j) += matA(i,it->i)*it->v; - } - } - - matA.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/fd/fda1a38499f9ab2b366f598f961d8ecfd13925f7.svn-base b/cpplapack-r198/.svn/pristine/fd/fda1a38499f9ab2b366f598f961d8ecfd13925f7.svn-base deleted file mode 100644 index edab5491a6ac185818058f6e787032ce19bc862a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fd/fda1a38499f9ab2b366f598f961d8ecfd13925f7.svn-base +++ /dev/null @@ -1,25 +0,0 @@ -//============================================================================= -/*! _dgematrix*_dcovector operator */ -inline _dcovector operator*(const _dgematrix& mat, const _dcovector& vec) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(mat.n!=vec.l){ - ERROR_REPORT; - std::cerr << "These matrix and vector can not make a product." << std::endl - << "Your input was (" << mat.m << "x" << mat.n << ") * (" << vec.l << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dcovector newvec(mat.m); - char trans ='n'; - double alpha =1.; - CPPL_INT inc =1; - double beta =0.; - - dgemv_( &trans, &mat.m, &mat.n, &alpha, mat.array, &mat.m, vec.array, &inc, &beta, newvec.array, &inc ); - - mat.destroy(); - vec.destroy(); - return _(newvec); -} diff --git a/cpplapack-r198/.svn/pristine/fe/fe0f78b15dc25915abba0f8d7c97474269e040e6.svn-base b/cpplapack-r198/.svn/pristine/fe/fe0f78b15dc25915abba0f8d7c97474269e040e6.svn-base deleted file mode 100644 index a533061e02a94d86ec41ffc080dcb08e63dbd56c..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fe/fe0f78b15dc25915abba0f8d7c97474269e040e6.svn-base +++ /dev/null @@ -1,152 +0,0 @@ -//============================================================================= -/*! dgematrix=_dgematrix operator */ -inline dgematrix& dgematrix::operator=(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - shallow_copy(mat); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+=_dgematrix operator */ -inline dgematrix& dgematrix::operator+=(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << m << "x" << n << ") += (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =m*n; - for(CPPL_INT i=0; i<mn; i++){ - array[i]+=mat.array[i]; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dgematrix-=_dgematrix operator */ -inline dgematrix& dgematrix::operator-=(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.n || m!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a sutraction." << std::endl - << "Your input was (" << m << "x" << n << ") -= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =m*n; - for(CPPL_INT i=0; i<mn; i++){ - array[i]-=mat.array[i]; - } - - mat.destroy(); - return *this; -} - -//============================================================================= -/*! dgematrix*=_dgematrix operator */ -inline dgematrix& dgematrix::operator*=(const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(n!=mat.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << m << "x" << n << ") *= (" << mat.m << "x" << mat.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( m, mat.n ); - char transa ='n'; - char transb ='n'; - double alpha =1.; - double beta =0.; - - dgemm_( &transa, &transb, &m, &mat.n, &n, &alpha, array, &m, mat.array, &mat.m, &beta, newmat.array, &m ); - - swap(*this,newmat); - mat.destroy(); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! dgematrix+_dgematrix operator */ -inline _dgematrix operator+(const dgematrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =matA.m*matA.n; - for(CPPL_INT i=0; i<mn; i++){ - matB.array[i] +=matA.array[i]; - } - - return matB; -} - -//============================================================================= -/*! dgematrix-_dgematrix operator */ -inline _dgematrix operator-(const dgematrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.n || matA.m!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - const CPPL_INT mn =matA.m*matA.n; - for(CPPL_INT i=0; i<mn; i++){ - matB.array[i] =matA.array[i]-matB.array[i]; - } - - return matB; -} - -//============================================================================= -/*! dgematrix*_dgematrix operator */ -inline _dgematrix operator*(const dgematrix& matA, const _dgematrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matA.m, matB.n ); - char transa ='n'; - char transb ='n'; - double alpha =1.; - double beta =0.; - - dgemm_( &transa, &transb, &matA.m, &matB.n, &matA.n, &alpha, matA.array, &matA.m, matB.array, &matB.m, &beta, newmat.array, &matA.m ); - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/fe/fec05a0d519f4ac2f1e67ef6e142dde79c0aec1f.svn-base b/cpplapack-r198/.svn/pristine/fe/fec05a0d519f4ac2f1e67ef6e142dde79c0aec1f.svn-base deleted file mode 100644 index 7bdfbcbb348cbc8cc1e237d931e98c3475a5a31f..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fe/fec05a0d519f4ac2f1e67ef6e142dde79c0aec1f.svn-base +++ /dev/null @@ -1,49 +0,0 @@ -############################################################################### -## Makefile ## -############################################################################### - -A.OUT = A.OUT - -############################################################################### - -include Makefile.g++ - -############################################################################### - -HEADERS:= $(shell find ./ -iname '*.hpp') -SOURCES:= $(shell find ./ -iname '*.cpp') -#SOURCES:= $(wildcard */*.cpp *.cpp) -SOURCES:= $(sort $(SOURCES)) -#SOURCES:= $(filter-out ./aho.cpp, $(SOURCES)) - -OBJECTS:= $(SOURCES:%.cpp=%.o) - -############################################################################### - -all: depend $(OBJECTS) - $(CXX) $(OBJECTS) $(LFLAGS) $(LIB_DIRS) $(LIBS) -o $(A.OUT) - @echo - -.SUFFIXES: .cpp .o -.cpp.o: - $(CXX) -c $< $(CFLAGS) $(INCLUDE_DIRS) $(MACROS) -o $@ - @echo - -depend: -# touch main.cpp - makedepend -f- -Y $(SOURCES) > Makefile.depend 2> /dev/null -# gccmakedep -- -I./ -MM -- $(SOURCES) -# $(CXX) -MM -I./ $(SOURCES) > Makefile.depend -# $(CXX) -MM $(INCLUDE_DIRS) $(SOURCES) > Makefile.depend - @echo - -clean: - rm -f $(OBJECTS) - -fullclean: - rm -f $(shell find -name '*.o') std err Makefile.depend $(A.OUT) - -remake: clean all - -############################################################################### --include Makefile.depend diff --git a/cpplapack-r198/.svn/pristine/fe/fede6c54b602d1d6d36d95826e55579b10037539.svn-base b/cpplapack-r198/.svn/pristine/fe/fede6c54b602d1d6d36d95826e55579b10037539.svn-base deleted file mode 100644 index 8242bdcf68e615e472452e35980ab474bd14c4ea..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/fe/fede6c54b602d1d6d36d95826e55579b10037539.svn-base +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================= -/*! cast to _zhsmatrix */ -inline _zhsmatrix dssmatrix::to_zhsmatrix() const -{CPPL_VERBOSE_REPORT; - zhsmatrix newmat(n,CPPL_INT(data.size())); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, comple(it->v,0.0)); - } - - return _(newmat); -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//============================================================================= -/*! convert to _dgematrix */ -inline _dgematrix dssmatrix::to_dgematrix() const -{CPPL_VERBOSE_REPORT; - dgematrix newmat(m,n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - newmat(it->j, it->i) =it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! convert to _dsymatrix */ -inline _dsymatrix dssmatrix::to_dsymatrix() const -{CPPL_VERBOSE_REPORT; - dsymatrix newmat(n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat(it->i, it->j) =it->v; - } - - return _(newmat); -} - -//============================================================================= -/*! convert to _dgsmatrix */ -inline _dgsmatrix dssmatrix::to_dgsmatrix() const -{CPPL_VERBOSE_REPORT; - dgsmatrix newmat( dgsmatrix(m,n,CPPL_INT(data.size()*2)) ); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator data_end =data.end(); - for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){ - newmat.put(it->i, it->j, it->v); - if(it->i!=it->j){ - newmat.put(it->j, it->i, it->v); - } - } - - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ff/ff3af754531d04e5dbfb1375ed694a18caba11ef.svn-base b/cpplapack-r198/.svn/pristine/ff/ff3af754531d04e5dbfb1375ed694a18caba11ef.svn-base deleted file mode 100644 index 51db6a173253e373f7ae3cc2b9ddd10b16c9a7da..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ff/ff3af754531d04e5dbfb1375ed694a18caba11ef.svn-base +++ /dev/null @@ -1,74 +0,0 @@ -//============================================================================= -/*! dgsmatrix+_dsymatrix operator */ -inline _dgematrix operator+(const dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a summation." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") + (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( matB.to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix-_dsymatrix operator */ -inline _dgematrix operator-(const dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.m!=matB.m || matA.n!=matB.n){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a subtraction." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") - (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat( (-matB).to_dgematrix() ); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - newmat(it->i,it->j) += it->v; - } - - matB.destroy(); - return _(newmat); -} - -//============================================================================= -/*! dgsmatrix*_dsymatrix operator */ -inline _dgematrix operator*(const dgsmatrix& matA, const _dsymatrix& matB) -{CPPL_VERBOSE_REPORT; -#ifdef CPPL_DEBUG - if(matA.n!=matB.m){ - ERROR_REPORT; - std::cerr << "These two matrises can not make a product." << std::endl - << "Your input was (" << matA.m << "x" << matA.n << ") * (" << matB.m << "x" << matB.n << ")." << std::endl; - exit(1); - } -#endif//CPPL_DEBUG - - dgematrix newmat(matA.m, matB.n); - newmat.zero(); - - const std::vector<dcomponent>::const_iterator matA_data_end =matA.data.end(); - for(std::vector<dcomponent>::const_iterator it=matA.data.begin(); it!=matA_data_end; it++){ - for(CPPL_INT i=0; i<matB.n; i++){ - newmat(it->i,i) += it->v*matB(it->j,i); - } - } - - matB.destroy(); - return _(newmat); -} diff --git a/cpplapack-r198/.svn/pristine/ff/ff8fe391f02d2e82b43855d89f6f193ade7b9197.svn-base b/cpplapack-r198/.svn/pristine/ff/ff8fe391f02d2e82b43855d89f6f193ade7b9197.svn-base deleted file mode 100644 index 3b717878a36442d6e8e38b942686e780cf1f2272..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ff/ff8fe391f02d2e82b43855d89f6f193ade7b9197.svn-base +++ /dev/null @@ -1,39 +0,0 @@ -//============================================================================= -#include <iostream> -#include <cstdlib> -#include <ctime> -#include "cpplapack.h" -using namespace std; - - -#include "zgesv_check.hpp" -#include "zgels_check.hpp" -#include "zgelss_check.hpp" -#include "zgeev_check.hpp" -//#include "zggev_check.hpp" -#include "zgesvd_check.hpp" - -//============================================================================= -/*! main */ -int main(int argc, char** argv) -{ - zgesv_check_vector(); - zgesv_check_matrix(); - - zgels_check_vector(); - zgels_check_matrix(); - - zgelss_check(); - - zgeev_check_value(); - zgeev_check_right(); - zgeev_check_left(); - - //zggev_check_value(); - //zggev_check_right(); - //zggev_check_left(); - - zgesvd_check(); - - return 0; -} diff --git a/cpplapack-r198/.svn/pristine/ff/ffbdd7020d6f2a5eacbd41802fad590bb277381c.svn-base b/cpplapack-r198/.svn/pristine/ff/ffbdd7020d6f2a5eacbd41802fad590bb277381c.svn-base deleted file mode 100644 index cb5751c53983c3b2737c70108ab6eaa8959ad31a..0000000000000000000000000000000000000000 --- a/cpplapack-r198/.svn/pristine/ff/ffbdd7020d6f2a5eacbd41802fad590bb277381c.svn-base +++ /dev/null @@ -1,9 +0,0 @@ -//============================================================================= -/*! double*_dgematrix operator */ -inline _dgematrix operator*(const double& d, const _dgematrix& mat) -{CPPL_VERBOSE_REPORT; - CPPL_INT size =mat.m*mat.n; - CPPL_INT inc =1; - dscal_(&size, &d, mat.array, &inc); - return mat; -} diff --git a/cpplapack-r198/.svn/wc.db b/cpplapack-r198/.svn/wc.db deleted file mode 100644 index c957951691fb3b118068712255966163b4076149..0000000000000000000000000000000000000000 Binary files a/cpplapack-r198/.svn/wc.db and /dev/null differ diff --git a/cpplapack-r198/.svn/wc.db-journal b/cpplapack-r198/.svn/wc.db-journal deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000