本文整理汇总了C++中teuchos::BLAS::DOT方法的典型用法代码示例。如果您正苦于以下问题:C++ BLAS::DOT方法的具体用法?C++ BLAS::DOT怎么用?C++ BLAS::DOT使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类teuchos::BLAS
的用法示例。
在下文中一共展示了BLAS::DOT方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timer
double
do_time_teuchos_fad_dot(unsigned int m, unsigned int ndot, unsigned int nloop)
{
Sacado::Random<double> urand(0.0, 1.0);
Teuchos::BLAS<int,FadType> blas;
std::vector<FadType> X(m), Y(m);
for (unsigned int i=0; i<m; i++) {
X[i] = FadType(ndot, urand.number());
Y[i] = FadType(ndot, urand.number());
for (unsigned int k=0; k<ndot; k++) {
X[i].fastAccessDx(k) = urand.number();
Y[i].fastAccessDx(k) = urand.number();
}
}
Teuchos::Time timer("Teuchos Fad DOT", false);
timer.start(true);
for (unsigned int j=0; j<nloop; j++) {
FadType z = blas.DOT(m, &X[0], 1, &Y[0], 1);
}
timer.stop();
return timer.totalElapsedTime() / nloop;
}
示例2: computeIntegral
/*
Computes integrals of monomials over a given reference cell.
*/
double computeIntegral(shards::CellTopology & cellTopology, int cubDegree, int xDeg, int yDeg, int zDeg) {
DefaultCubatureFactory<double> cubFactory; // create factory
Teuchos::RCP<Cubature<double> > myCub = cubFactory.create(cellTopology, cubDegree); // create default cubature
double val = 0.0;
int cubDim = myCub->getDimension();
int numCubPoints = myCub->getNumPoints();
FieldContainer<double> point(cubDim);
FieldContainer<double> cubPoints(numCubPoints, cubDim);
FieldContainer<double> cubWeights(numCubPoints);
FieldContainer<double> functValues(numCubPoints);
myCub->getCubature(cubPoints, cubWeights);
for (int i=0; i<numCubPoints; i++) {
for (int j=0; j<cubDim; j++) {
point(j) = cubPoints(i,j);
}
functValues(i) = computeMonomial(point, xDeg, yDeg, zDeg);
}
Teuchos::BLAS<int, double> myblas;
int inc = 1;
val = myblas.DOT(numCubPoints, &functValues[0], inc, &cubWeights[0], inc);
return val;
}
示例3: _Orthogonalize
void Arnoldi::_Orthogonalize(cSDV& q){
Teuchos::BLAS<int, complex<double> > blas;
complex<double> OrthogFactor;
for( int j = 0; j <= _k; ++j ){
OrthogFactor = blas.DOT(_length, q.values(), 1, _Q[j], 1);
_H[_k][j] = OrthogFactor;
complex<double>* iterQ = _Q[j];
complex<double>* iterq = q.values();
for( int i = 0; i < _length; ++i, ++iterQ, ++iterq ){
*iterq -= OrthogFactor*(*iterQ);
}
}
}