当前位置: 首页>>代码示例>>C++>>正文


C++ Array1D::dim方法代码示例

本文整理汇总了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;
	}
}
开发者ID:uentity,项目名称:smadopt,代码行数:9,代码来源:m_algorithm.cpp

示例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;
}
开发者ID:Sage-Bionetworks,项目名称:bfrm,代码行数:63,代码来源:bfrmscreener.cpp


注:本文中的Array1D::dim方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。