本文整理汇总了C++中DMat::load方法的典型用法代码示例。如果您正苦于以下问题:C++ DMat::load方法的具体用法?C++ DMat::load怎么用?C++ DMat::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DMat
的用法示例。
在下文中一共展示了DMat::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dumpDM
// simple {DM,IM} and {DV,IV} arrays
void dumpDM(const DM& A, const char* s) {
DMat M; M.load(A.num_rows(),A.num_cols(), A.data());
M.print(g_MSGFile, s, "lf", 4, 8, 51,0,50);
}
示例2: oldtonew
//---------------------------------------------------------
void NDG2D::OutputSampleXYZ
(
int sample_N,
DMat &newX,
DMat &newY,
DMat &newZ, // e.g. triangles on a sphere
const DMat &FData, // old field data
DMat &newFData, // new field data
int zfield // if>0, use as z-elevation
)
//---------------------------------------------------------
{
DVec newR, newS, newT;
DMat newVDM;
int newNpts = 0;
// Triangles
OutputSampleNodes2D(sample_N, newR, newS);
newNpts = newR.size();
newVDM = Vandermonde2D(this->N, newR, newS);
const DMat& oldV = this->V;
DMat oldtonew(newNpts, this->Np, "OldToNew");
oldtonew = trans(trans(oldV) | trans(newVDM));
//-----------------------------------
// interpolate the field data
//-----------------------------------
int Nfields = FData.num_cols();
newFData.resize(newNpts*this->K, Nfields);
//DVec scales(Nfields);
// For each field, use tOldF to wrap field i.
// Use tNewF to load the interpolated field
// directly into column i of the output array.
DMat tOldF, tNewF;
for (int i=1; i<=Nfields; ++i) {
tOldF.borrow(this->Np, this->K, (double*) FData.pCol(i));
tNewF.borrow(newNpts, this->K, (double*)newFData.pCol(i));
tNewF = oldtonew * tOldF;
//scales(i) = tNewF.max_col_val_abs(i);
}
//-----------------------------------
// interpolate the vertices
//-----------------------------------
newX = oldtonew * this->x;
newY = oldtonew * this->y;
if (this->bCoord3D) {
newZ = oldtonew * this->z;
}
else
{
if (zfield>=1 && zfield<=Nfields) {
// use field data for z-height
newZ.load(newNpts, K, newFData.pCol(Nfields));
} else {
// set z-data to 0.0
newZ.resize(newNpts, K, true, 0.0);
}
}
}