本文整理汇总了C++中_zgbmatrix::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ _zgbmatrix::destroy方法的具体用法?C++ _zgbmatrix::destroy怎么用?C++ _zgbmatrix::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_zgbmatrix
的用法示例。
在下文中一共展示了_zgbmatrix::destroy方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: newmat
/*! _zssmatrix-_zgbmatrix operator */
inline _zgematrix operator-(const _zssmatrix& matA, const _zgbmatrix& matB)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator-(const _zssmatrix&, const _zgbmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(matA.N!=matB.N || matA.M!=matB.M){
std::cerr << "[ERROR] operator+(const _zssmatrix&, const _zgbmatrix&)"
<< std::endl
<< "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(long i=0; i<matB.M; i++){
for(long 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);
}
示例2: newmat
/*! zhematrix*_zgbmatrix operator */
inline _zgematrix operator*(const zhematrix& matA, const _zgbmatrix& matB)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator*(const zhematrix&, const _zgbmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(matA.N!=matB.M){
std::cerr << "[ERROR] operator*(zhematrix&, _zgbmatrix&)" << std::endl
<< "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();
long i, j, k;
for(i=0; i<newmat.m; i++){
for(j=0; j<newmat.n; j++){
for(k=max(0,j-matB.KU); k<min(matB.M,j+matB.KL+1); k++){
newmat(i,j)+=matA(i,k)*matB(k,j);
}
}
}
matB.destroy();
return _(newmat);
}
示例3: newvec
/*! _zrovector*_zgbmatrix operator */
inline _zrovector operator*(const _zrovector& vec, const _zgbmatrix& mat)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator*(const _zrovector&, const _zgbmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(vec.L!=mat.M){
std::cerr << "[ERROR] operator*(const zrovector&, const _zgbmatrix&)"
<< std::endl
<< "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);
zgbmv_( 'T', mat.M, mat.N, mat.KL, mat.KU, std::complex<double>(1.0,0.0),
mat.Array, mat.KL+mat.KU+1, vec.Array, 1, std::complex<double>(0.0,0.0), newvec.array, 1 );
vec.destroy();
mat.destroy();
return _(newvec);
}
示例4: newmat
/*! _zgematrix*_zgbmatrix operator */
inline _zgematrix operator*(const _zgematrix& matA, const _zgbmatrix& matB)
{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(long i=0; i<newmat.m; i++){
for(long j=0; j<newmat.n; j++){
for(long k=std::max(long(0),j-matB.ku); k<std::min(matB.m,j+matB.kl+1); k++){
newmat(i,j)+=matA(i,k)*matB(k,j);
}
}
}
matA.destroy();
matB.destroy();
return _(newmat);
}
示例5: zgematrix
/*! zgematrix constructor to cast _zgbmatrix */
inline zgematrix::zgematrix(const _zgbmatrix& mat)
: m(M), n(N), array(Array), darray(Darray)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] zgematrix::zgematrix(const _zgbmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
//////// initialize ////////
M =mat.M;
N =mat.N;
Array =new std::complex<double>[M*N];
Darray =new std::complex<double>*[N];
for(int i=0; i<N; i++){ Darray[i] =&Array[i*M]; }
//////// copy ////////
zero();
for(long i=0; i<mat.M; i++){
for(long j=max(0,i-mat.KL); j<min(N,i+mat.KU+1); j++){
operator()(i,j) =mat(i,j);
}
}
mat.destroy();
#ifdef CPPL_DEBUG
std::cerr << "# [NOTE] zgematrix::zgematrix(const zgbmatrix&) "
<< "A new matrix at " << Array << " has been made." << std::endl;
#endif//CPPL_DEBUG
}
示例6: newmat
/*! _zgbmatrix-_zhematrix operator */
inline _zgematrix operator-(const _zgbmatrix& matA, const _zhematrix& matB)
{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(long i=0; i<newmat.m; i++){
for(long j=0; j<newmat.n; j++){
newmat(i,j)=-matB(i,j);
}
for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); j++){
newmat(i,j)+=matA(i,j);
}
}
matA.destroy();
matB.destroy();
return _(newmat);
}
示例7: conjt
/*! return its conjugate transposed zgbmatrix */
inline _zgbmatrix conjt(const _zgbmatrix& mat)
{VERBOSE_REPORT;
zgbmatrix newmat(mat.n, mat.m, mat.ku, mat.kl);
for(long i=0; i<newmat.m; i++){
for(long j=std::max(long(0),i-newmat.kl); j<std::min(newmat.n,i+newmat.ku+1); j++){
newmat(i,j) =std::conj(mat(j,i));
}
}
mat.destroy();
return _(newmat);
}
示例8: newvec
/*! _zgbmatrix*zcovector operator */
inline _zcovector operator*(const _zgbmatrix& mat, const zcovector& vec)
{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);
zgbmv_( 'n', mat.m, mat.n, mat.kl, mat.ku, comple(1.0,0.0), mat.array,
mat.kl+mat.ku+1, vec.array, 1, comple(0.0,0.0), newvec.array, 1 );
mat.destroy();
return _(newvec);
}
示例9: newmat
/*! zgsmatrix*_zgbmatrix operator */
inline _zgematrix operator*(const zgsmatrix& matA, const _zgbmatrix& matB)
{ 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(std::vector<zcomponent>::const_iterator it=matA.data.begin(); it!=matA.data.end(); it++) {
for(long j=std::max(0l,long(it->j)-matB.kl); j<std::min(matB.n,long(it->j)+matB.ku+1); j++) {
newmat(it->i,j) += it->v*matB(it->j,j);
}
}
matB.destroy();
return _(newmat);
}
示例10: newmat
/*! _zgbmatrix*zhematrix operator */
inline _zgematrix operator*(const _zgbmatrix& matA, const zhematrix& matB)
{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(long c=0; c<matB.vol; c++){
for(long 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);
}