本文整理汇总了C++中Row::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Row::clear方法的具体用法?C++ Row::clear怎么用?C++ Row::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Row
的用法示例。
在下文中一共展示了Row::clear方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteFeature
// This function if to delete the feature with index in indexList.
void deleteFeature(Mat &dataSet, Row &featureName, vector<int> &indexList) {
if (dataSet.size() == 0)
return;
Mat matTemp = dataSet;
Row featureNameTemp = featureName;
dataSet.clear();
featureName.clear();
int dataRowSize = (int)matTemp[0].size();
vector<int> indexIsDelete(dataRowSize);
for (int i = 0; i != dataRowSize; ++i)
indexIsDelete[i] = 0;
for (auto item : indexList)
indexIsDelete[item] = 1;
for (auto row : matTemp) {
Row rowTemp;
for (int i = 0; i < dataRowSize; ++i) {
if(indexIsDelete[i] == 0) {
rowTemp.push_back(row[i]);
}
}
dataSet.push_back(rowTemp);
}
for (int i = 0; i < featureNameTemp.size(); ++i) {
if (indexIsDelete[i] == 0)
featureName.push_back(featureNameTemp[i]);
}
}
示例2: copyDenseArrayToSparseRow
inline void copyDenseArrayToSparseRow(const Ring& R, uint64* arr1, uint64* arr2, const uint32 line_size, Row& v, bool reduce)
{
//Row tmp;
v.clear ();
if(v.size() != 0)
cout << "EROOOOR\n";
//if(v.capacity () < 128)
//v.reserve (128);
//register uint16 l;
register typename Ring::Element e1, e2;
if(reduce)
for(uint32 j=0; j<DEFAULT_BLOC_WIDTH; ++j)
{
//ModularTraits<typename Ring::Element>::reduce (e, arr[j], R._modulus);
//l = arr[j] >> 16;
//l = R._modulus - l;
ModularTraits<typename Ring::Element>::reduce (e1, arr1[j], R._modulus);
ModularTraits<typename Ring::Element>::reduce (e2, arr2[j], R._modulus);
if ((!R.isZero(e1)) || (!R.isZero(e2)))
{
v.IndexData.push_back (j); // (typename SparseBloc<typename Ring::Element>::Row::value_type (j, e));
v.ValuesData.push_back (e1);
v.ValuesData.push_back (e2);
}
}
else
for(uint32 j=0; j<DEFAULT_BLOC_WIDTH; ++j)
{
if (arr1[j] != 0 || arr2[j] != 0)
{
v.IndexData.push_back (j); // (typename SparseBloc<typename Ring::Element>::Row::value_type (j, e));
v.ValuesData.push_back (arr1[j]);
v.ValuesData.push_back (arr2[j]);
}
}
//v.swap(tmp);
}
示例3: _row
void OsiIF::_row(int i, Row &r) const
{
const CoinPackedMatrix* coinMatrix;
CoinPackedVector coinVector;
int coinNumEl;
const int* coinIndices;
const double* coinElements;
coinMatrix = osiLP_->getMatrixByRow();
coinVector = coinMatrix->getVector(i);
coinNumEl = coinVector.getNumElements();
coinIndices = coinVector.getIndices();
coinElements = coinVector.getElements();
r.clear();
for (int j = 0; j < coinNumEl; j++)
r.insert(coinIndices[j], coinElements[j]);
r.sense(osi2csense(rowsense_[i]));
r.rhs(_rhs(i));
}
示例4: readRow
FileCSV::ReadResult FileCSV::readRow(Row &row)
{
row.clear();
if (!isOpen() || m_file.eof())
return rrEmpty;
ReadResult rr;
while (true)
{
GVariant value;
rr = readValue(value);
if (rr == rrEmpty)
break;
row.push_back(value);
if (rr == rrEOL)
break;
}
if (rr != rrEmpty && m_lineNo++ > 0 && row.size() != m_header.size())
return rrInvalidSize;
return rr == rrEmpty ? rrEmpty : rrOK;
}
示例5: Table
SparseMatrix& SparseMatrix::transposition() {
Table& t = *(new Table(size));
Row r;
bool null;
size_t first_num;
real crnt;
for (size_t i = 0; i < size; ++i) {
first_num = 0;
null = true;
for (size_t j = i; j < size; ++j) {
crnt = (*this)(i,j);
if (!null)
r.push_back(crnt);
else {
if (crnt == 0)
++first_num;
else {
null = false;
if (first_num == 1) {
r.push_back(0);
first_num = 0;
}
else
if (first_num == 2) {
r.push_back(0);
r.push_back(0);
first_num = 0;
}
r.push_back(crnt);
}
}
}
SparseArray* t_i = new SparseArray(r, first_num);
t[i] = t_i;
r.clear();
}
return *(new SparseMatrix(t));
}