本文整理汇总了C++中Array1D::dim方法的典型用法代码示例。如果您正苦于以下问题:C++ Array1D::dim方法的具体用法?C++ Array1D::dim怎么用?C++ Array1D::dim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array1D
的用法示例。
在下文中一共展示了Array1D::dim方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assign_mat_ar1d
void assign_mat_ar1d(Matrix& m, const Array1D< double >& a)
{
m.NewMatrix(1, a.dim());
Matrix::r_iterator p_m(m.begin());
for(long i = 0; i < a.dim(); ++i) {
*p_m = a[i];
++p_m;
}
}
示例2: SetData
int BfrmScreener::SetData(Array2D<double>& AllData, Array2D<double>& AllMask, Array1D<int>& indicator,
Array2D<double>& FH, Array1D<double>& Weight, int yfactors,
Array1D<int>& VariablesIn, int nVarIn, bool bHasXMask) {
int i,j;
maOriginalIndex.clear();
//X first
mnVariables = indicator.dim() + yfactors;
mbHasXMask = bHasXMask;
mnSampleSize = FH.dim2();
mX = Array2D<double>(mnVariables, mnSampleSize);
if (mbHasXMask) {
mXMask = Array2D<double>(mnVariables - yfactors, mnSampleSize);
}
for (j = 0; j < mnSampleSize; j++) {
for (i = 0; i < yfactors; i++) {
mX[i][j] = AllData[i][j];
}
for (i = 0; i < nVarIn; i++) {
mX[i+yfactors][j] = AllData[yfactors + VariablesIn[i]][j];
}
if (mbHasXMask) {
for (i = 0; i < nVarIn; i++) {
mXMask[i][j] = AllMask[VariablesIn[i]][j];
}
}
}
for (i = 0; i < nVarIn; i++) {
maOriginalIndex.push_back(VariablesIn[i]);
}
int count = nVarIn + yfactors;
for (i = 0; i < indicator.dim(); i++) {
if (indicator[i]) {
for (j = 0; j < mnSampleSize; j++) {
mX[count][j] = AllData[yfactors + i][j];
}
if (mbHasXMask) {
for (j = 0; j < mnSampleSize; j++) {
mXMask[count-yfactors][j] = AllMask[i][j];
}
}
count++;
maOriginalIndex.push_back(i);
}
}
//mH
mH = Array2D<double>(FH.dim2(), FH.dim1());
for (i = 0; i < FH.dim1(); i++) {
for (j = 0; j < FH.dim2(); j++) {
mH[j][i] = FH[i][j];
}
}
//mWeight
mnLeaveout = 0;
mWeight = Array1D<double>(Weight.dim());
for (i = 0; i < mWeight.dim(); i++) {
mWeight[i] = Weight[i];
if (mWeight[i] == 0) { mnLeaveout++; }
}
return 1;
}