本文整理汇总了C++中MatrixDouble::getRowVector方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixDouble::getRowVector方法的具体用法?C++ MatrixDouble::getRowVector怎么用?C++ MatrixDouble::getRowVector使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MatrixDouble
的用法示例。
在下文中一共展示了MatrixDouble::getRowVector方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: offsetTimeseries
void DTW::offsetTimeseries(MatrixDouble ×eries){
VectorDouble firstRow = timeseries.getRowVector(0);
for(UINT i=0; i<timeseries.getNumRows(); i++){
for(UINT j=0; j<timeseries.getNumCols(); j++){
timeseries[i][j] -= firstRow[j];
}
}
}
示例2: getClassificationData
ClassificationData TimeSeriesClassificationDataStream::getClassificationData( const bool includeNullGestures ) const {
ClassificationData classificationData;
classificationData.setNumDimensions( getNumDimensions() );
classificationData.setAllowNullGestureClass( includeNullGestures );
bool addSample = false;
for(UINT i=0; i<timeSeriesPositionTracker.size(); i++){
addSample = includeNullGestures ? true : timeSeriesPositionTracker[i].getClassLabel() != GRT_DEFAULT_NULL_CLASS_LABEL;
if( addSample ){
MatrixDouble dataSegment = getTimeSeriesData( timeSeriesPositionTracker[i] );
for(UINT j=0; j<dataSegment.getNumRows(); j++){
classificationData.addSample(timeSeriesPositionTracker[i].getClassLabel(), dataSegment.getRowVector(j) );
}
}
}
return classificationData;
}
示例3: main
int main (int argc, const char * argv[])
{
//Create an empty matrix double
MatrixDouble matrix;
//Resize the matrix
matrix.resize( 100, 2 );
//Set all the values in the matrix to zero
matrix.setAllValues( 0 );
//Loop over the data and set the values to random values
UINT counter = 0;
for(UINT i=0; i<matrix.getNumRows(); i++){
for(UINT j=0; j<matrix.getNumCols(); j++){
matrix[i][j] = counter++;
}
}
//Add a new row at the very end of the matrix
VectorDouble newRow(2);
newRow[0] = 1000;
newRow[1] = 2000;
matrix.push_back( newRow );
//Print the values
cout << "Matrix Data: \n";
for(UINT i=0; i<matrix.getNumRows(); i++){
for(UINT j=0; j<matrix.getNumCols(); j++){
cout << matrix[i][j] << "\t";
}
cout << endl;
}
cout << endl;
//Get the second row as a vector
VectorDouble rowVector = matrix.getRowVector( 1 );
cout << "Row Vector Data: \n";
for(UINT i=0; i<rowVector.size(); i++){
cout << rowVector[i] << "\t";
}
cout << endl;
//Get the second column as a vector
VectorDouble colVector = matrix.getColVector( 1 );
cout << "Column Vector Data: \n";
for(UINT i=0; i<colVector.size(); i++){
cout << colVector[i] << "\n";
}
cout << endl;
//Get the mean of each column
VectorDouble mean = matrix.getMean();
cout << "Mean: \n";
for(UINT i=0; i<mean.size(); i++){
cout << mean[i] << "\n";
}
cout << endl;
//Get the Standard Deviation of each column
VectorDouble stdDev = matrix.getStdDev();
cout << "StdDev: \n";
for(UINT i=0; i<stdDev.size(); i++){
cout << stdDev[i] << "\n";
}
cout << endl;
//Get the covariance matrix
MatrixDouble cov = matrix.getCovarianceMatrix();
cout << "Covariance Matrix: \n";
for(UINT i=0; i<cov.getNumRows(); i++){
for(UINT j=0; j<cov.getNumCols(); j++){
cout << cov[i][j] << "\t";
}
cout << endl;
}
cout << endl;
vector< MinMax > ranges = matrix.getRanges();
cout << "Ranges: \n";
for(UINT i=0; i<ranges.size(); i++){
cout << "i: " << i << "\tMinValue: " << ranges[i].minValue << "\tMaxValue:" << ranges[i].maxValue << "\n";
}
cout << endl;
//Save the matrix data to a csv file
matrix.save( "data.csv" );
//load the matrix data from a csv file
matrix.load( "data.csv" );
return EXIT_SUCCESS;
}