bool RKButcherTableauBase<Scalar>::operator== (const RKButcherTableauBase<Scalar>& rkbt) const { if (this->numStages() != rkbt.numStages()) { return false; } if (this->order() != rkbt.order()) { return false; } int N = rkbt.numStages(); // Check b and c first: const Teuchos::SerialDenseVector<int,Scalar> b_ = this->b(); const Teuchos::SerialDenseVector<int,Scalar> c_ = this->c(); const Teuchos::SerialDenseVector<int,Scalar> other_b = rkbt.b(); const Teuchos::SerialDenseVector<int,Scalar> other_c = rkbt.c(); for (int i=0 ; i<N ; ++i) { if (b_(i) != other_b(i)) { return false; } if (c_(i) != other_c(i)) { return false; } } // Then check A: const Teuchos::SerialDenseMatrix<int,Scalar>& A_ = this->A(); const Teuchos::SerialDenseMatrix<int,Scalar>& other_A = rkbt.A(); for (int i=0 ; i<N ; ++i) { for (int j=0 ; j<N ; ++j) { if (A_(i,j) != other_A(i,j)) { return false; } } } return true; }
bool isERKButcherTableau( const RKButcherTableauBase<Scalar>& rkbt) { if (isEmptyRKButcherTableau(rkbt)) { return false; } // Verify the diagonal is zero and the upper triangular part is zero typedef ScalarTraits<Scalar> ST; int numStages_local = rkbt.numStages(); const Teuchos::SerialDenseMatrix<int,Scalar> A_local = rkbt.A(); for (int i=0 ; i<numStages_local ; ++i) { for (int j=0 ; j<numStages_local ; ++j) { if ((j>=i) && ((A_local(i,j) != ST::zero()))) { return false; } } } const Teuchos::SerialDenseVector<int,Scalar> c_local = rkbt.c(); if( c_local(0) != ST::zero() ) { return false; } // 08/13/08 tscoffe: I'm not sure what else I can check for b & c... return true; }