本文整理汇总了C++中Blackbox::getEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ Blackbox::getEntry方法的具体用法?C++ Blackbox::getEntry怎么用?C++ Blackbox::getEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blackbox
的用法示例。
在下文中一共展示了Blackbox::getEntry方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testRandomApply1
bool testRandomApply1 (Field &F, const char *text, unsigned int iterations, VectorStream<Row> &A_stream)
{
typedef SparseMatrix <Field, Row> Blackbox;
ostringstream str;
str << "Testing sparse random apply (1, " << text << ")" << ends;
commentator().start (str.str ().c_str (), "testRandomApply1", iterations);
bool ret = true;
bool iter_passed;
size_t i, k;
VectorDomain<Field> VD (F);
StandardBasisStream<Field, Vector> stream (F, A_stream.n ());
Vector e_j, w;
VectorWrapper::ensureDim (e_j, A_stream.n ());
VectorWrapper::ensureDim (w, A_stream.m ());
for (i = 0; i < iterations; i++) {
commentator().startIteration ((unsigned)i);
iter_passed = true;
Blackbox A (F, A_stream);
A_stream.reset ();
ostream &report = commentator().report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
report << "Matrix:" << endl;
A.write (report, FORMAT_PRETTY);
stream.reset ();
while (stream) {
stream.next (e_j);
A.apply (w, e_j);
for (k = 0; k < A_stream.m (); k++)
if (!F.areEqual (A.getEntry (k, stream.j () - 1), VectorWrapper::constRef<Field> (w, k)))
ret = iter_passed = false;
report << "Output vector " << stream.j () << ": ";
VD.write (report, w) << endl;
}
if (!iter_passed)
commentator().report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
<< "ERROR: Output vectors were incorrect" << endl;
commentator().stop ("done");
commentator().progress ();
}
commentator().stop (MSG_STATUS (ret), (const char *) 0, "testRandomApply1");
return ret;
}
示例2: testRandomApply2
bool testRandomApply2 (Field &F, const char *text, unsigned int iterations, VectorStream<Row> &A_stream)
{
typedef SparseMatrix <Field, Row> Blackbox;
ostringstream str;
str << "Testing sparse random apply (2, " << text << ")" << ends;
commentator().start (str.str ().c_str (), "testRandomApply2", iterations);
bool ret = true;
bool iter_passed;
size_t i, j, k;
VectorDomain<Field> VD (F);
typename Field::RandIter r (F);
typename Field::Element sum;
integer c;
// long width;
F.characteristic (c);
// width = logp (c, 10) + 1;
Vector v, w;
VectorWrapper::ensureDim (v, A_stream.n ());
VectorWrapper::ensureDim (w, A_stream.m ());
for (k = 0; k < A_stream.n (); k++)
F.init (VectorWrapper::ref<Field> (v, k), 1);
for (i = 0; i < iterations; i++) {
commentator().startIteration ((unsigned)i);
iter_passed = true;
Blackbox A (F, A_stream);
A_stream.reset ();
ostream &report = commentator().report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
report << "Matrix:" << endl;
A.write (report, FORMAT_PRETTY);
A.apply (w, v);
for (j = 0; j < A_stream.m (); j++) {
F.init (sum, 0);
for (k = 0; k < A_stream.n (); k++)
F.addin (sum, A.getEntry (j, k));
if (!F.areEqual (sum, VectorWrapper::constRef<Field> (w, j)))
ret = iter_passed = false;
}
report << "Output vector: ";
VD.write (report, w) << endl;
if (!iter_passed)
commentator().report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
<< "ERROR: Output vector was incorrect" << endl;
commentator().stop ("done");
commentator().progress ();
}
commentator().stop (MSG_STATUS (ret), (const char *) 0, "testRandomApply2");
return ret;
}