• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ _zgbmatrix类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中_zgbmatrix的典型用法代码示例。如果您正苦于以下问题:C++ _zgbmatrix类的具体用法?C++ _zgbmatrix怎么用?C++ _zgbmatrix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了_zgbmatrix类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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.M){
    std::cerr << "[ERROR] operator*(const _zssmatrix&, const _zgbmatrix&)"
              << std::endl
              << "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<matA.VOL; c++){
    for(long 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);
}
开发者ID:ninghang,项目名称:bayesianPlay,代码行数:33,代码来源:_zssmatrix-_zgbmatrix.hpp


示例2: 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);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:27,代码来源:_zgematrix-_zgbmatrix.hpp


示例3: 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);
}
开发者ID:skempken,项目名称:interverdikom,代码行数:33,代码来源:zhematrix-_zgbmatrix.hpp


示例4: 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);
}
开发者ID:ninghang,项目名称:bayesianPlay,代码行数:28,代码来源:_zrovector-_zgbmatrix.hpp


示例5: m

/*! 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
}
开发者ID:ninghang,项目名称:bayesianPlay,代码行数:31,代码来源:zgematrix-constructor.hpp


示例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);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:26,代码来源:_zgbmatrix-_zhematrix.hpp


示例7: zgbmatrix

/*! zgbmatrix constructor to cast _zgbmatrix */
inline zgbmatrix::zgbmatrix(const _zgbmatrix& mat)
{VERBOSE_REPORT;
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  array =mat.array;
  darray =mat.darray;
  
  mat.nullify();
}
开发者ID:phelrine,项目名称:NBTools,代码行数:12,代码来源:zgbmatrix-constructor.hpp


示例8: _zgbmatrix

/*! _zgbmatrix copy constructor */
inline _zgbmatrix::_zgbmatrix(const _zgbmatrix& mat)
{VERBOSE_REPORT;
  //////// initialize ////////
  m =mat.m;
  n =mat.n;
  kl =mat.kl;
  ku =mat.ku;
  array =mat.array;
  darray =mat.darray;

  mat.nullify();
}
开发者ID:phelrine,项目名称:NBTools,代码行数:13,代码来源:_zgbmatrix-constructor.hpp


示例9: 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);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:13,代码来源:_zgbmatrix-calc.hpp


示例10: shallow_copy

/*! 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)
{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();
}
开发者ID:phelrine,项目名称:NBTools,代码行数:15,代码来源:zgbmatrix-misc.hpp


示例11: 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);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:19,代码来源:_zgbmatrix-zcovector.hpp


示例12: 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);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:24,代码来源:zgsmatrix-_zgbmatrix.hpp


示例13: 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);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:25,代码来源:_zgbmatrix-zssmatrix.hpp



注:本文中的_zgbmatrix类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ _zhematrix类代码示例发布时间:2022-05-31
下一篇:
C++ _tstring类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap