Beispiel #1
0
typename EuclNorm<VectorType, MatrixType>::ScalarType
EuclNorm<VectorType, MatrixType>::operator()(const MatrixType &A) const {
  
  return sqrt(nonnegativePart(
        capd::matrixAlgorithms::spectralRadiusOfSymMatrix(Transpose(A) * A)
        ));
}
Beispiel #2
0
typename EuclLNorm<VectorType, MatrixType>::ScalarType
EuclLNorm<VectorType, MatrixType>::operator()(const VectorType &x) const {
  ScalarType s(0.);
  for(int i=0;i<x.dimension();++i)
    s += power(x[i], 2);
  return sqrt(nonnegativePart(s));
}
Beispiel #3
0
typename Object::ScalarType euclNorm(const Object& u){
  typedef typename Object::ScalarType Scalar;
  Scalar sum = TypeTraits<Scalar>::zero();
  typename Object::const_iterator b=u.begin(), e=u.end();
  while(b!=e)
  {
    sum += static_cast<Scalar>(power(*b,2));
    ++b;
  }
  return Scalar(sqrt(nonnegativePart(sum)));
}
Beispiel #4
0
typename MatrixType::ScalarType::BoundType OdeNum<MatrixType>::quadEscTime(Real a, Real b, Real c, Real r)
{
  if(a>r) return -1;
  else{
    if( c == 0)
      return OdeNum<MatrixType>::linEscTime(a,b,r);
    else{
         ScalarType ib = ScalarType(b);
         ScalarType delta = power(ib,2)-4*ScalarType(c)*(ScalarType(a)-ScalarType(r));
//        ScalarType delta=ib^2-4*ScalarType(c)*(ScalarType(a)-ScalarType(r));
      if(c>0 || (delta > 0 && b > 0))
        return ((-b+sqrt(nonnegativePart(delta)))/2/c).leftBound();
      else
        return OdeNum<MatrixType>::infty;
    }
  }
}