本文整理汇总了C++中_dgbmatrix类的典型用法代码示例。如果您正苦于以下问题:C++ _dgbmatrix类的具体用法?C++ _dgbmatrix怎么用?C++ _dgbmatrix使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了_dgbmatrix类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: newmat
/*! _dgbmatrix*_dgbmatrix operator */
inline _dgbmatrix operator*(const _dgbmatrix& matA, const _dgbmatrix& 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
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(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++){
for(long k=std::max( std::max(long(0),i-matA.kl), std::max(long(0),j-matB.ku) );
k< std::min( std::min(matA.n,i+matA.ku+1), 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,代码行数:28,代码来源:_dgbmatrix-_dgbmatrix.hpp
示例2: if
/*! _dgbmatrix+_dgbmatrix operator */
inline _dgbmatrix operator+(const _dgbmatrix& matA, const _dgbmatrix& matB)
{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(long i=0; i<matB.m; i++){
for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
matA(i,j)+=matB(i,j);
}
}
matB.destroy();
return matA;
}
else if(matB.kl>matA.kl && matB.ku>matA.ku){
for(long i=0; i<matA.m; i++){
for(long j=std::max(long(0),i-matA.kl); j<std::min(matA.n,i+matA.ku+1); 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(long i=0; i<matA.m; i++){
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);
}
for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
newmat(i,j)+=matB(i,j);
}
}
matA.destroy();
matB.destroy();
return _(newmat);
}
}
开发者ID:phelrine,项目名称:NBTools,代码行数:52,代码来源:_dgbmatrix-_dgbmatrix.hpp
示例3: newmat
/*! _dsymatrix*_dgbmatrix operator */
inline _dgematrix operator*(const _dsymatrix& matA, const _dgbmatrix& matB)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator*(const _dsymatrix&, const _dgbmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(matA.N!=matB.M){
std::cerr << "[ERROR] operator*(_dsymatrix&, _dgbmatrix&)" << 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
dgematrix 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);
}
}
}
matA.destroy();
matB.destroy();
return _(newmat);
}
开发者ID:skempken,项目名称:interverdikom,代码行数:34,代码来源:_dsymatrix-_dgbmatrix.hpp
示例4: newvec
/*! _dgbmatrix*_dcovector operator */
inline _dcovector operator*(const _dgbmatrix& mat, const _dcovector& vec)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator*(const _dgbmatrix&, const _dcovector&)"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(mat.N!=vec.L){
std::cerr << "[ERROR] operator*(const _dgbmatrix&, const _dcovector&)"
<< std::endl
<< "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);
dgbmv_( 'N', mat.M, mat.N, mat.KL, mat.KU, 1.0, mat.Array,
mat.KL+mat.KU+1, vec.Array, 1, 0.0, newvec.array, 1 );
mat.destroy();
vec.destroy();
return _(newvec);
}
开发者ID:ninghang,项目名称:bayesianPlay,代码行数:27,代码来源:_dgbmatrix-_dcovector.hpp
示例5: newmat
/*! dssmatrix*_dgbmatrix operator */
inline _dgematrix operator*(const dssmatrix& matA, const _dgbmatrix& matB)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] operator*(const dssmatrix&, const _dgbmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
#ifdef CPPL_DEBUG
if(matA.N!=matB.M){
std::cerr << "[ERROR] operator*(const dssmatrix&, const _dgbmatrix&)"
<< 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
dgematrix newmat( matA.M, matB.N );
newmat.zero();
for(long c=0; c<matA.VOL; c++){
for(long 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);
}
开发者ID:ninghang,项目名称:bayesianPlay,代码行数:32,代码来源:dssmatrix-_dgbmatrix.hpp
示例6: _dgbmatrix
/*! _dgbmatrix copy constructor */
inline _dgbmatrix::_dgbmatrix(const _dgbmatrix& 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,代码来源:_dgbmatrix-constructor.hpp
示例7: t
/*! return its transposed dgbmatrix */
inline _dgbmatrix t(const _dgbmatrix& mat)
{VERBOSE_REPORT;
dgbmatrix 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) =mat(j,i);
}
}
mat.destroy();
return _(newmat);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:14,代码来源:_dgbmatrix-calc.hpp
示例8: shallow_copy
/*! 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)
{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,代码来源:dgbmatrix-misc.hpp
示例9: t
/*! return its transposed dgbmatrix */
inline _dgbmatrix t(const _dgbmatrix& mat)
{
#ifdef CPPL_VERBOSE
std::cerr << "# [MARK] t(const _dgbmatrix&)"
<< std::endl;
#endif//CPPL_VERBOSE
dgbmatrix newmat(mat.N, mat.M, mat.KU, mat.KL);
for(long i=0; i<newmat.m; i++){
for(long j=max(0,i-newmat.kl); j<min(newmat.n,i+newmat.ku+1); j++){
newmat(i,j) =mat(j,i);
}
}
mat.destroy();
return _(newmat);
}
开发者ID:ninghang,项目名称:bayesianPlay,代码行数:18,代码来源:_dgbmatrix-calc.hpp
示例10: newvec
/*! _drovector*_dgbmatrix operator */
inline _drovector operator*(const _drovector& vec, const _dgbmatrix& mat)
{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);
dgbmv_( 'T', mat.m, mat.n, mat.kl, mat.ku, 1.0, mat.array, mat.kl+mat.ku+1, vec.array, 1, 0.0, newvec.array, 1 );
vec.destroy();
mat.destroy();
return _(newvec);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:20,代码来源:_drovector-_dgbmatrix.hpp
示例11: newmat
/*! dgsmatrix-_dgbmatrix operator */
inline _dgematrix operator-(const dgsmatrix& matA, const _dgbmatrix& matB)
{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(long i=0; i<matB.m; i++){
for(long j=std::max(long(0),i-matB.kl); j<std::min(matB.n,i+matB.ku+1); j++){
newmat(i,j)-=matB(i,j);
}
}
matB.destroy();
return _(newmat);
}
开发者ID:phelrine,项目名称:NBTools,代码行数:23,代码来源:dgsmatrix-_dgbmatrix.hpp
注:本文中的_dgbmatrix类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论