Stokhos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Stokhos_UnitTestHelpers.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Stokhos Package
4 //
5 // Copyright 2009 NTESS and the Stokhos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef STOKHOS_UNIT_TEST_HELPERS_HPP
11 #define STOKHOS_UNIT_TEST_HELPERS_HPP
12 
14 #include "Stokhos_ProductBasis.hpp"
17 #include "Teuchos_FancyOStream.hpp"
18 
19 namespace Stokhos {
20 
21  template<class OrdinalType, class ValueType>
23  const std::string& a1_name,
25  const std::string& a2_name,
26  const ValueType& rel_tol, const ValueType& abs_tol,
28  {
29  bool success = true;
30 
31  out << "Comparing " << a1_name << " == " << a2_name << " ... ";
32 
33  const OrdinalType n = a1.size();
34 
35  // Compare sizes
36  if (a2.size() != n) {
37  out << "\nError, "<<a1_name<<".size() = "<<a1.size()<<" == "
38  << a2_name<<".size() = "<<a2.size()<<" : failed!\n";
39  return false;
40  }
41 
42  // Compare elements
43  for( OrdinalType i = 0; i < n; ++i ) {
44  ValueType nrm = std::sqrt(a1.basis()->norm_squared(i));
45  ValueType err = std::abs(a1[i] - a2[i]) / nrm;
46  ValueType tol =
47  abs_tol + rel_tol*std::max(std::abs(a1[i]),std::abs(a2[i]))/nrm;
48  if (err > tol) {
49  out
50  <<"\nError, relErr("<<a1_name<<"["<<i<<"],"
51  <<a2_name<<"["<<i<<"]) = relErr("<<a1[i]<<","<<a2[i]<<") = "
52  <<err<<" <= tol = "<<tol<<": failed!\n";
53  success = false;
54  }
55  }
56  if (success) {
57  out << "passed\n";
58  }
59  else {
60  out << std::endl
61  << a1_name << " = " << a1 << std::endl
62  << a2_name << " = " << a2 << std::endl;
63  }
64 
65  return success;
66  }
67 
68  template<class ValueType>
69  bool compareValues(const ValueType& a1,
70  const std::string& a1_name,
71  const ValueType&a2,
72  const std::string& a2_name,
73  const ValueType& rel_tol, const ValueType& abs_tol,
75  {
76  bool success = true;
77 
78  ValueType err = std::abs(a1 - a2);
79  ValueType tol = abs_tol + rel_tol*std::max(std::abs(a1),std::abs(a2));
80  if (err > tol) {
81  out << "\nError, relErr(" << a1_name <<","
82  << a2_name << ") = relErr(" << a1 <<"," << a2 <<") = "
83  << err << " <= tol = " << tol << ": failed!\n";
84  success = false;
85  }
86 
87  return success;
88  }
89 
90  template<class ValueType, class VectorType1, class VectorType2>
91  bool compareVecs(const VectorType1& a1,
92  const std::string& a1_name,
93  const VectorType2&a2,
94  const std::string& a2_name,
95  const ValueType& rel_tol, const ValueType& abs_tol,
97  {
98  using value_t_1 = typename VectorType1::value_type;
99  using value_t_2 = typename VectorType2::value_type;
100  static_assert(std::is_same<value_t_1,value_t_2>::value,"Inconsistent types.");
101 
102  bool success = true;
103 
104  out << "Comparing " << a1_name << " == " << a2_name << " ... ";
105 
106  const int n = a1.size();
107 
108  // Compare sizes
109  if (a2.size() != n) {
110  out << "\nError, "<<a1_name<<".size() = "<<a1.size()<<" == "
111  << a2_name<<".size() = "<<a2.size()<<" : failed!\n";
112  return false;
113  }
114 
115  // Compare elements
116  for( int i = 0; i < n; ++i ) {
117  ValueType err = abs(a1.coeff(i) - a2.coeff(i));
118  ValueType tol =
119  abs_tol + rel_tol*std::max(abs(a1.fastAccessCoeff(i)),
120  abs(a2.fastAccessCoeff(i)));
121  if ( (err > tol) && (err != 0.) ) {
122  out
123  <<"\nError, relErr("<<a1_name<<"["<<i<<"],"
124  <<a2_name<<"["<<i<<"]) = relErr("<<a1.coeff(i)<<","<<a2.coeff(i)
125  <<") = "<<err<<" <= tol = "<<tol<<": failed!\n";
126  success = false;
127  }
128  }
129  if (success) {
130  out << "passed\n";
131  }
132  else {
133  out << std::endl
134  << a1_name << " = " << a1 << std::endl
135  << a2_name << " = " << a2 << std::endl;
136  }
137 
138  return success;
139  }
140 
141  template<class Array1, class Array2, class ValueType>
142  bool compareArrays(const Array1& a1, const std::string& a1_name,
143  const Array2& a2, const std::string& a2_name,
144  const ValueType& rel_tol,
145  const ValueType& abs_tol,
147  {
148  using Teuchos::as;
149  bool success = true;
150 
151  out << "Comparing " << a1_name << " == " << a2_name << " ... ";
152 
153  const int n = a1.size();
154 
155  // Compare sizes
156  if (as<int>(a2.size()) != n) {
157  out << "\nError, "<<a1_name<<".size() = "<<a1.size()<<" == "
158  << a2_name<<".size() = "<<a2.size()<<" : failed!\n";
159  return false;
160  }
161 
162  // Compare elements
163  for( int i = 0; i < n; ++i ) {
164  ValueType err = std::abs(a1[i] - a2[i]);
165  ValueType tol =
166  abs_tol + rel_tol*std::max(std::abs(a1[i]),std::abs(a2[i]));
167  if (err > tol) {
168  out << "\nError, relErr(" << a1_name << "[" << i << "]," << a2_name
169  << "[" << i << "]) = relErr(" << a1[i] << "," <<a2[i] <<") = "
170  << err << " <= tol = " << tol << ": failed!\n";
171  success = false;
172  }
173  }
174  if (success) {
175  out << "passed\n";
176  }
177 
178  return success;
179  }
180 
181  template<class ordinal_type, class scalar_type>
184  const std::string& a1_name,
186  const std::string& a2_name,
187  const scalar_type& rel_tol,
188  const scalar_type& abs_tol,
190  {
191  using Teuchos::as;
192  bool success = true;
193 
194  out << "Comparing " << a1_name << " == " << a2_name << " ... ";
195 
196  const ordinal_type m = a1.numRows();
197  const ordinal_type n = a1.numCols();
198 
199  // Compare number of rows
200  if (a2.numRows() != m) {
201  out << "\nError, "<<a1_name<<".numRows() = "<<a1.numRows()<<" == "
202  << a2_name<<".numRows() = "<<a2.numRows()<<" : failed!\n";
203  return false;
204  }
205 
206  // Compare number of columnns
207  if (a2.numCols() != n) {
208  out << "\nError, "<<a1_name<<".numCols() = "<<a1.numCols()<<" == "
209  << a2_name<<".numCols() = "<<a2.numCols()<<" : failed!\n";
210  return false;
211  }
212 
213  // Compare elements
214  for (ordinal_type i=0; i<m; i++) {
215  for (ordinal_type j=0; j<n; j++) {
216  scalar_type err = std::abs(a1(i,j) - a2(i,j));
217  scalar_type tol =
218  abs_tol + rel_tol*std::max(std::abs(a1(i,j)),std::abs(a2(i,j)));
219  if (err > tol) {
220  out << "\nError, relErr(" << a1_name << "(" << i << "," << j << "), "
221  << a2_name << "(" << i << "," << j << ")) = relErr("
222  << a1(i,j) << ", " <<a2(i,j) <<") = "
223  << err << " <= tol = " << tol << ": failed!\n";
224  success = false;
225  }
226  }
227  }
228  if (success) {
229  out << "passed\n";
230  }
231 
232  return success;
233  }
234 
235  template<class ordinal_type, class scalar_type>
238  const std::string& cijk1_name,
240  const std::string& cijk2_name,
241  const scalar_type& rel_tol,
242  const scalar_type& abs_tol,
244  {
246  bool success = true;
247 
248  out << "Comparing " << cijk1_name << " == " << cijk2_name << " ... ";
249 
250  // Check number of nonzeros
251  TEUCHOS_TEST_EQUALITY(Cijk1.num_entries(), Cijk2.num_entries(), out,
252  success);
253 
254  // Check entries
255  for (typename Cijk_type::k_iterator k_it=Cijk2.k_begin();
256  k_it!=Cijk2.k_end(); ++k_it) {
257  ordinal_type k = Stokhos::index(k_it);
258  for (typename Cijk_type::kj_iterator j_it = Cijk2.j_begin(k_it);
259  j_it != Cijk2.j_end(k_it); ++j_it) {
260  ordinal_type j = Stokhos::index(j_it);
261  for (typename Cijk_type::kji_iterator i_it = Cijk2.i_begin(j_it);
262  i_it != Cijk2.i_end(j_it); ++i_it) {
263  ordinal_type i = Stokhos::index(i_it);
264  scalar_type c1 = Cijk1.getValue(i,j,k);
265  scalar_type c2 = Stokhos::value(i_it);
266 
267  double tol = abs_tol + c2*rel_tol;
268  double err = std::abs(c1-c2);
269  bool s = err < tol;
270  if (!s) {
271  out << std::endl
272  << "Check: rel_err( C(" << i << "," << j << "," << k << ") )"
273  << " = " << "rel_err( " << c1 << ", " << c2 << " ) = " << err
274  << " <= " << tol << " : ";
275  if (s) out << "Passed.";
276  else
277  out << "Failed!";
278  out << std::endl;
279  }
280  success = success && s;
281  }
282  }
283  }
284 
285  return success;
286  }
287 
288  template<class ordinal_type, class scalar_type>
292  const scalar_type& sparse_tol,
293  const scalar_type& rel_tol,
294  const scalar_type& abs_tol,
296  bool linear = false)
297  {
298  ordinal_type d = basis.dimension();
299  ordinal_type sz = basis.size();
303  for (ordinal_type i=0; i<d; i++)
304  Cijk_1d[i] = bases[i]->computeTripleProductTensor();
305  for (ordinal_type j=0; j<sz; j++) {
306  Stokhos::MultiIndex<ordinal_type> terms_j = basis.term(j);
307  for (ordinal_type i=0; i<sz; i++) {
308  Stokhos::MultiIndex<ordinal_type> terms_i = basis.term(i);
309  for (ordinal_type k=0; k<sz; k++) {
310  Stokhos::MultiIndex<ordinal_type> terms_k = basis.term(k);
311  if (!linear || terms_k.order() <= 1) {
312  scalar_type c = 1.0;
313  for (ordinal_type l=0; l<d; l++)
314  c *= (*Cijk_1d[l])(terms_i[l],terms_j[l],terms_k[l]);
315  if (std::abs(c/basis.norm_squared(i)) > sparse_tol)
316  Cijk2.add_term(i,j,k,c);
317  }
318  }
319  }
320  }
321  Cijk2.fillComplete();
322 
323  // std::cout << std::endl << Cijk << std::endl;
324  // std::cout << std::endl << Cijk2 << std::endl;
325 
326  bool success = compareSparse3Tensor(Cijk, "Cijk", Cijk2, "Cijk2",
327  rel_tol, abs_tol, out);
328 
329  return success;
330  }
331 
332  template <typename operator_type1, typename operator_type2,
333  typename scalar_type>
334  bool testPseudoSpectralPoints(const operator_type1& op1,
335  const operator_type2& op2,
336  const scalar_type& rel_tol,
337  const scalar_type& abs_tol,
338  Teuchos::FancyOStream& out) {
339  bool success = true;
340 
341  typedef typename operator_type1::const_set_iterator point_iterator_type;
342 
343  // Check sizes
344  TEUCHOS_TEST_EQUALITY(op1.point_size(), op2.point_size(), out, success);
345  if (!success) return false;
346 
347  // Compare points
348  point_iterator_type pi1 = op1.set_begin();
349  point_iterator_type pi2 = op2.set_begin();
350  while (pi1 != op1.set_end() || pi2 != op2.set_end()) {
351  std::stringstream ss1, ss2;
352  ss1 << pi1->first;
353  ss2 << pi2->first;
354  success = success &&
355  Stokhos::compareArrays(pi1->first, ss1.str(),
356  pi2->first, ss2.str(),
357  rel_tol, abs_tol, out);
358 
359  std::stringstream ss3, ss4;
360  ss3 << pi1->second.first;
361  ss4 << pi2->second.first;
362  success = success &&
363  Stokhos::compareValues(pi1->second.first, ss3.str(),
364  pi2->second.first, ss4.str(),
365  rel_tol, abs_tol, out);
366  ++pi1;
367  ++pi2;
368  }
369 
370  return success;
371  }
372 
373  template <typename operator_type1, typename operator_type2,
374  typename func_type1, typename func_type2,
375  typename scalar_type>
376  bool testPseudoSpectralApply(const operator_type1& op1,
377  const operator_type2& op2,
378  const func_type1& func1,
379  const func_type2& func2,
380  const scalar_type& rel_tol,
381  const scalar_type& abs_tol,
382  Teuchos::FancyOStream& out) {
383  bool success = true;
384 
386  typedef typename operator_type1::value_type value_type;
387  typedef typename operator_type1::const_iterator point_iterator_type;
388 
389  // Check sizes
390  TEUCHOS_TEST_EQUALITY(op1.coeff_size(), op2.coeff_size(), out, success);
391  if (!success)
392  return false;
393 
394  ordinal_type point_sz1 = op1.point_size();
395  ordinal_type point_sz2 = op2.point_size();
396  ordinal_type coeff_sz = op1.coeff_size();
397 
398  // Evaluate function at quadrature points
400  ordinal_type idx = 0;
401  for (point_iterator_type pi = op1.begin(); pi != op1.end(); ++pi) {
402  f(idx,0) = func1(*pi);
403  f(idx,1) = func2(*pi);
404  ++idx;
405  }
406 
408  idx = 0;
409  for (point_iterator_type pi = op2.begin(); pi != op2.end(); ++pi) {
410  f2(idx,0) = func1(*pi);
411  f2(idx,1) = func2(*pi);
412  ++idx;
413  }
414 
415  // Compare function evaluations
416  if (point_sz1 == point_sz2)
417  success = success &&
418  Stokhos::compareSDM(f, "f", f2, "f2", rel_tol, abs_tol, out);
419 
420  // Compute PCE coefficients
422  op1.transformQP2PCE(1.0, f, x, 0.0);
423 
425  op2.transformQP2PCE(1.0, f2, x2, 0.0);
426 
427  // Compare PCE coefficients
428  success = success &&
429  Stokhos::compareSDM(x, "x", x2, "x2", rel_tol, abs_tol, out);
430 
431  return success;
432  }
433 
434  template <typename operator_type1, typename operator_type2,
435  typename func_type1, typename func_type2,
436  typename scalar_type>
437  bool testPseudoSpectralApplyTrans(const operator_type1& op1,
438  const operator_type2& op2,
439  const func_type1& func1,
440  const func_type2& func2,
441  const scalar_type& rel_tol,
442  const scalar_type& abs_tol,
443  Teuchos::FancyOStream& out) {
444  bool success = true;
445 
447  typedef typename operator_type1::value_type value_type;
448  typedef typename operator_type1::const_iterator point_iterator_type;
449 
450  // Check sizes
451  TEUCHOS_TEST_EQUALITY(op1.coeff_size(), op2.coeff_size(), out, success);
452  if (!success)
453  return false;
454 
455  ordinal_type point_sz1 = op1.point_size();
456  ordinal_type point_sz2 = op2.point_size();
457  ordinal_type coeff_sz = op1.coeff_size();
458 
459  // Evaluate function at quadrature points
461  ordinal_type idx = 0;
462  for (point_iterator_type pi = op1.begin(); pi != op1.end(); ++pi) {
463  f(0,idx) = func1(*pi);
464  f(1,idx) = func2(*pi);
465  ++idx;
466  }
467 
469  idx = 0;
470  for (point_iterator_type pi = op2.begin(); pi != op2.end(); ++pi) {
471  f2(0,idx) = func1(*pi);
472  f2(1,idx) = func2(*pi);
473  ++idx;
474  }
475 
476  // Compare function evaluations
477  if (point_sz1 == point_sz2)
478  success = success &&
479  Stokhos::compareSDM(f, "f", f2, "f2", rel_tol, abs_tol, out);
480 
481  // Compute PCE coefficients
483  op1.transformQP2PCE(1.0, f, x, 0.0, true);
484 
486  op2.transformQP2PCE(1.0, f2, x2, 0.0, true);
487 
488  // Compare PCE coefficients
489  success = success &&
490  Stokhos::compareSDM(x, "x", x2, "x2", rel_tol, abs_tol, out);
491 
492  return success;
493  }
494 
495  template <typename basis_type, typename operator_type, typename scalar_type>
497  const operator_type& op,
498  const scalar_type& rel_tol,
499  const scalar_type& abs_tol,
500  Teuchos::FancyOStream& out) {
501  typedef typename operator_type::ordinal_type ordinal_type;
502  typedef typename operator_type::value_type value_type;
503 
504  ordinal_type coeff_sz = op.coeff_size();
505  ordinal_type point_sz = op.point_size();
507  eye.putScalar(0.0);
508  for (ordinal_type i=0; i<coeff_sz; ++i)
509  eye(i,i) = 1.0;
510 
511  // Map PCE coefficients to quad values
513  op.transformPCE2QP(1.0, eye, f, 0.0);
514 
515  // Map quad values to PCE coefficients
517  op.transformQP2PCE(1.0, f, x, 0.0);
518 
519  // Subtract identity
520  for (ordinal_type i=0; i<coeff_sz; ++i)
521  x(i,i) -= 1.0;
522 
523  // Expected answer, which is zero
525  z.putScalar(0.0);
526 
527  out << "Discrete orthogonality error = " << x.normInf() << std::endl;
528 
529  // Compare PCE coefficients
530  bool success = Stokhos::compareSDM(x, "x", z, "zero", rel_tol, abs_tol, out);
531 
532  return success;
533  }
534 
535  /*
536  template <typename basis_type, typename operator_type, typename scalar_type>
537  bool testPseudoSpectralDiscreteOrthogonality(const basis_type& basis,
538  const operator_type& op,
539  const scalar_type& rel_tol,
540  const scalar_type& abs_tol,
541  Teuchos::FancyOStream& out) {
542  typedef typename operator_type::ordinal_type ordinal_type;
543  typedef typename operator_type::value_type value_type;
544 
545  // Evaluate full basis at all quadrature points
546  ordinal_type coeff_sz = op.coeff_size();
547  ordinal_type point_sz = op.point_size();
548  Teuchos::SerialDenseMatrix<ordinal_type,value_type> f(point_sz,coeff_sz);
549  Teuchos::Array<value_type> vals(coeff_sz);
550  ordinal_type i = 0;
551  typename operator_type::const_iterator pi = op.begin();
552  for (; pi != op.end(); ++pi) {
553  basis.evaluateBases(*pi, vals);
554  for (ordinal_type j=0; j<coeff_sz; ++j)
555  f(i,j) = vals[j];
556 
557  ++i;
558  }
559 
560  // Compute PCE coefficients
561  Teuchos::SerialDenseMatrix<ordinal_type,value_type> x(coeff_sz,coeff_sz);
562  op.transformQP2PCE(1.0, f, x, 0.0);
563 
564  // Subtract identity
565  for (ordinal_type i=0; i<coeff_sz; ++i)
566  x(i,i) -= 1.0;
567 
568  // Expected answer, which is zero
569  Teuchos::SerialDenseMatrix<ordinal_type,value_type> z(coeff_sz,coeff_sz);
570  z.putScalar(0.0);
571 
572  out << "Discrete orthogonality error = " << x.normInf() << std::endl;
573 
574  // Compare PCE coefficients
575  bool success = Stokhos::compareSDM(x, "x", z, "zero", 1e-14, 1e-14, out);
576 
577  return success;
578  }
579  */
580 }
581 
582 #endif // STOKHOS_UNIT_TEST_HELPERS_HPP
KOKKOS_INLINE_FUNCTION PCE< Storage > sqrt(const PCE< Storage > &a)
bool compareVecs(const VectorType1 &a1, const std::string &a1_name, const VectorType2 &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
k_iterator k_begin() const
Iterator pointing to first k entry.
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
bool compareArrays(const Array1 &a1, const std::string &a1_name, const Array2 &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
kj_iterator j_begin(const k_iterator &k) const
Iterator pointing to first j entry for given k.
bool comparePCEs(const PCEType &a1, const std::string &a1_name, const Stokhos::OrthogPolyApprox< OrdinalType, ValueType > &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
void fillComplete()
Signal all terms have been added.
bool compareValues(const ValueType &a1, const std::string &a1_name, const ValueType &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
virtual ordinal_type dimension() const =0
Return dimension of basis.
bool compareSparse3Tensor(const Stokhos::Sparse3Tensor< ordinal_type, scalar_type > &Cijk1, const std::string &cijk1_name, const Stokhos::Sparse3Tensor< ordinal_type, scalar_type > &Cijk2, const std::string &cijk2_name, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out)
kj_iterator j_end(const k_iterator &k) const
Iterator pointing to last j entry for given k.
bool testSparse3Tensor(const Stokhos::Sparse3Tensor< ordinal_type, scalar_type > &Cijk, const Stokhos::ProductBasis< ordinal_type, scalar_type > &basis, const scalar_type &sparse_tol, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out, bool linear=false)
virtual const MultiIndex< ordinal_type > & term(ordinal_type i) const =0
Get orders of each coordinate polynomial given an index i.
bool compareSDM(const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &a1, const std::string &a1_name, const Teuchos::SerialDenseMatrix< ordinal_type, scalar_type > &a2, const std::string &a2_name, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out)
int putScalar(const ScalarType value=Teuchos::ScalarTraits< ScalarType >::zero())
void add_term(ordinal_type i, ordinal_type j, ordinal_type k, const value_type &c)
Add new term for given (i,j,k)
KOKKOS_INLINE_FUNCTION PCE< Storage > max(const typename PCE< Storage >::value_type &a, const PCE< Storage > &b)
Teuchos::RCP< const Stokhos::OrthogPolyBasis< ordinal_type, value_type > > basis() const
Return basis.
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
Abstract base class for multivariate orthogonal polynomials generated from tensor products of univari...
TypeTo as(const TypeFrom &t)
virtual const Teuchos::Array< value_type > & norm_squared() const =0
Return array storing norm-squared of each basis polynomial.
k_iterator k_end() const
Iterator pointing to last k entry.
virtual Teuchos::Array< Teuchos::RCP< const OneDOrthogPolyBasis< ordinal_type, value_type > > > getCoordinateBases() const =0
Return array of coordinate bases.
Legendre polynomial basis.
Stokhos::Sparse3Tensor< int, double > Cijk_type
OrdinalType numCols() const
ScalarTraits< ScalarType >::magnitudeType normInf() const
#define TEUCHOS_TEST_EQUALITY(v1, v2, out, success)
bool testPseudoSpectralDiscreteOrthogonality(const basis_type &basis, const operator_type &op, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out)
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
ordinal_type order() const
Compute total order of index.
ordinal_type size() const
Return size.
value_type getValue(ordinal_type i, ordinal_type j, ordinal_type k) const
Get Cijk value for a given i, j, k indices.
kji_iterator i_begin(const kj_iterator &j) const
Iterator pointing to first i entry for given j and k.
bool testPseudoSpectralPoints(const operator_type1 &op1, const operator_type2 &op2, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out)
kji_iterator i_end(const kj_iterator &j) const
Iterator pointing to last i entry for given j and k.
bool testPseudoSpectralApply(const operator_type1 &op1, const operator_type2 &op2, const func_type1 &func1, const func_type2 &func2, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out)
int n
virtual ordinal_type size() const =0
Return total size of basis.
bool testPseudoSpectralApplyTrans(const operator_type1 &op1, const operator_type2 &op2, const func_type1 &func1, const func_type2 &func2, const scalar_type &rel_tol, const scalar_type &abs_tol, Teuchos::FancyOStream &out)
ordinal_type num_entries() const
Return number of non-zero entries.
OrdinalType numRows() const