Exemplo n.º 1
0
//Y <- a M X + b Y
// ---------------------------------------------------------------------- 
int dgemv(double alpha, const DblNumMat& A, const DblNumVec& X, double beta, DblNumVec& Y)
{
  assert(Y.m() == A.m());
  assert(A.n() == X.m());
  iC( dgemv(A.m(), A.n(), alpha, A.data(), X.data(), beta, Y.data()) );
  return 0;
}
Exemplo n.º 2
0
// ---------------------------------------------------------------------- 
int dger(double alpha, const DblNumVec& X, const DblNumVec& Y, DblNumMat& A)
{
  assert(X.m() == A.m());
  assert(Y.m() == A.n());
  iC( dger(A.m(), A.n(), alpha, X.data(), Y.data(), A.data()) );
  return 0;
}
Exemplo n.º 3
0
/* ********************************************************************** */
int SVDRep::dgemv(double alpha, const DblNumVec& X, double beta, DblNumVec& Y, double tol)
{
  iA(Y.m() == _matU.m());
  iA(X.m() == _matVT.n());
  iC( dgemv(alpha, X.data(), beta, Y.data(), tol) );
  
  return 0;
}
Exemplo n.º 4
0
//Y <- a M X + b Y
// ---------------------------------------------------------------------- 
int dgemv(double alpha, const DblNumMat& A, const DblNumVec& X, double beta, DblNumVec& Y)
{
  assert(Y.m() == A.m());
  assert(A.n() == X.m());
  char trans = 'N';
  int m = A.m();  int n = A.n();
  int incx = 1;  int incy = 1;
  dgemv_(&trans, &m, &n, &alpha, A.data(), &m, X.data(), &incx, &beta, Y.data(), &incy);
  return 0;
}
Exemplo n.º 5
0
inline void cpp2mex(const DblNumVec& cd, mxArray*& md)
{
  int m = cd.m();
  md = mxCreateDoubleMatrix(m, 1, mxREAL);
  double* xr = mxGetPr(md);
  for(int i=0; i<m; i++)
	 xr[i] = cd(i);
  return;
}
Exemplo n.º 6
0
// ---------------------------------------------------------------------- 
int Dense3d::evaluate(const DblNumVec& srcDen, DblNumVec& trgVal) 
{
  //-----------------------------------
  iA(srcDen.m()==srcDOF()*(*_srcPos).n());  iA(trgVal.m()==trgDOF()*(*_trgPos).n());

  int dim  = this->dim();
  int srcDOF = this->srcDOF();
  int trgDOF = this->trgDOF();
  /* Number of sources */
  int numSrc = (*_srcPos).n();
  /* Number of targets */
  int numTrg = (*_trgPos).n();

  DblNumMat inter(trgDOF, numSrc*srcDOF);
  for(int i=0; i<numTrg; i++) {
    DblNumMat onePosMat(dim, 1, false, (*_trgPos).clmdata(i));
    DblNumVec oneValVec(trgDOF, false, trgVal.data()+trgDOF*i);
    iC( _knl.kernel((*_srcPos), (*_srcNor), onePosMat, inter) );
    iC( dgemv(1.0, inter, srcDen, 0.0, oneValVec) );
  }

  return 0;
}
Exemplo n.º 7
0
// ---------------------------------------------------------------------- 
int daxpy(double a, const DblNumVec& X, DblNumVec& Y)
{
  assert( X.m() == Y.m() );
  daxpy(X.m(), a, X.data(), Y.data());
  return 0;
}
Exemplo n.º 8
0
// ---------------------------------------------------------------------- 
int dscal(double alpha, DblNumVec& X)
{
  dscal( X.m(), alpha, X.data() );
  return 0;
}