Esempio n. 1
0
C1AffineSet<MatrixType,Policies>::C1AffineSet(const VectorType& x, const MatrixType& B, const VectorType& r, ScalarType t)
  : SetType(
      x+B*r,
      VectorType(x.dimension()),
      MatrixType::Identity(x.dimension()),
      MatrixType(x.dimension(),x.dimension()),
      t),
    C0BaseSet(x, B, r),
    C1BaseSet(x.dimension())
{}
Esempio n. 2
0
Pped2Set<MatrixType>::Pped2Set(const VectorType& the_x)
  : m_x(the_x),
    m_r(the_x.dimension()),
    m_r0(the_x.dimension()),
    m_B(MatrixType::Identity(the_x.dimension())),
    m_C(MatrixType::Identity(the_x.dimension())) {

  m_r.clear();
  split(m_x,m_r0);
}
Esempio n. 3
0
typename SumLNorm<VectorType, MatrixType>::ScalarType
SumLNorm<VectorType, MatrixType>::operator()(const VectorType &x) const {
  ScalarType s(0.0);
  for(int i=0; i<x.dimension(); i++)
    s += capd::abs(x[i]);
  return s;
}
Esempio n. 4
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));
}
Esempio n. 5
0
typename MatrixType::ScalarType::BoundType OdeNum<MatrixType>::quadEscTime(const VectorType& x,const VectorType& y,int& dir)
{
  VectorType firstCoef=ode.f(x);
  VectorType remainder1=ode.f(y);
  VectorType remainder2=ode.df(y)*ode.f(y)/2;
  TimeDoubleton<Real> the_linEscTime = OdeNum<MatrixType>::linEscTime(x[0],remainder1[0],y[0]);
  TimeDoubleton<Real> the_quadEscTime = OdeNum<MatrixType>::quadEscTime(x[0],firstCoef[0],remainder2[0],y[0]);
  Real result = capd::min(
                    capd::max(the_linEscTime.left,the_quadEscTime.left),
                    capd::max(the_linEscTime.right,the_quadEscTime.right)
                );
  dir=0;

  for(int i=1;i<x.dimension();++i)
  {
    TimeDoubleton<Real> the_linEscTime=OdeNum<MatrixType>::linEscTime(x[i],remainder1[i],y[i]);
    TimeDoubleton<Real> the_quadEscTime=OdeNum<MatrixType>::quadEscTime(x[i],firstCoef[i],remainder2[i],y[i]);
    Real escTime = capd::min(
               capd::max(the_linEscTime.left,the_quadEscTime.left),
               capd::max(the_linEscTime.right,the_quadEscTime.right)
            );
    if( escTime < result )
    {
      result = escTime;
      dir=i;
    }
  }
  return result;
}
Esempio n. 6
0
typename MaxNorm<VectorType, MatrixType>::ScalarType
MaxNorm<VectorType, MatrixType>::operator()(const VectorType &x) const {
  ScalarType s(0.);
  for(int i=0;i<x.dimension();i++) {
    s = capd::max(s, capd::abs(x[i]));
  }
  return s;
}
Esempio n. 7
0
 std::vector<typename SetType::VectorType> getCorners(const SetType & set) {
   typedef typename SetType::VectorType VectorType;
   std::vector<VectorType> cor;
   VectorType v = set.get_r();
   corners(v, set.get_r(), 0, v.dimension(), cor);
   for(typename std::vector<VectorType>::iterator it = cor.begin(); it != cor.end(); ++it){
     *it = set.get_x() + set.get_C() * set.get_r0() + set.get_B() * *it;
   }
   return cor;
 }
Esempio n. 8
0
VectorType conjVector(const VectorType & v){
  VectorType result(v.dimension());
  typename VectorType::const_iterator b = v.begin(), e = v.end();
  typename VectorType::iterator  r = result.begin();
  while(b!=e){
    *r = conj(*b);
    ++r; ++b;
  }
  return result;
}
Esempio n. 9
0
typename OdeNum<MatrixType>::VectorType OdeNum<MatrixType>::enclosureGuaranteeingBounds(
      const VectorType &x,
      int *found
    )
{
  ScalarType trial_step = ScalarType(-0.2,1.2)*step;
  int dim = x.dimension();
  VectorType y(dim), z(dim), Small(dim);

  ScalarType h = ScalarType(0,1)*step;
  Real multf=1.5;
  *found=0;
  int counter=0,limit=10;

  for(int i=0;i<dim;i++)
    Small[i] = ScalarType(-1,1) * 1e-15;

  z = x + trial_step*ode.f(x);
  z += Small; // to be sure that z has noempty interior

  while((!(*found)) && (counter<limit))
  {
    counter++;
    y = x + h*ode.f(z);
    *found=1;
    for(int i=0;i<dim;i++)
    {
      if(!(y[i].subsetInterior(z[i])))
      {
        *found = 0;
        z[i] = y[i];
        ScalarType s;
        z[i].split(s);
        s = multf*s;
        z[i] += s;
      }
    }
  }

  if(!(*found))
  {
    //status="enclosureGuaranteeingBounds - loop limit exceeded";
    diagBadEnlcosure(x);
  }

  return y;
}
typename DiffInclusionLN<MapT, DynSysT>::VectorType DiffInclusionLN<MapT, DynSysT>::perturbations(const VectorType& x){

  VectorType W_1 = dynamicalSystemEnclosure(x);
  VectorType W_2 = diffInclusionEnclosure(x);

  MatrixType J = m_diffIncl.getVectorField()[W_2]; 
  VectorType deltha = m_diffIncl.perturbations(W_2);

  ScalarType C = right((*m_norm)(deltha));
  ScalarType l = right((*m_norm)(J));

  ScalarType D = (l.contains(0.0))? C*getStep() : (C*(exp(l*getStep())-1))/l;
  VectorType result(x.dimension());

  for(int i=0; i< result.dimension(); ++i)
    result[i] = ScalarType(-D.rightBound(), D.rightBound());

  return result;
}
Esempio n. 11
0
typename MatrixType::ScalarType::BoundType OdeNum<MatrixType>::linEscTime(const VectorType& x,const VectorType& y,int& dir)
{
  VectorType remainder=ode.f(y);
  TimeDoubleton<Real> the_linEscTime=OdeNum<MatrixType>::linEscTime(x[0],remainder[0],y[0]);
  Real result=capd::min(the_linEscTime.left,the_linEscTime.right);
  dir=0;

  for(int i=1;i<x.dimension();i++)
  {
    the_linEscTime=OdeNum<MatrixType>::linEscTime(x[i],remainder[i],y[i]);
    Real escTime=capd::min(the_linEscTime.left,the_linEscTime.right);
    if( escTime < result )
    {
      result = escTime;
      dir=i;
    }
  }
  return result;
}
Esempio n. 12
0
ResultType matrixByVector(const MatrixType& m,const VectorType& u){
  ResultType result(m.numberOfRows(),true);
  if(m.numberOfColumns()!=u.dimension())
    throw std::range_error("operator Matrix*Vector: incompatible dimensions");

  typename ResultType::iterator b=result.begin(), e=result.end();
  typename MatrixType::const_iterator i = m.begin();
  while(b!=e)
  {
    typename ResultType::ScalarType x = chomp::TypeTraits<typename ResultType::ScalarType>::zero();
    typename VectorType::const_iterator bv=u.begin(), be=u.end();
    while(bv!=be)
    {
      x += (*bv) * (*i);
      ++bv;
      ++i;
    }
    *b=x;
    ++b;
  }
  return result;
}
Esempio n. 13
0
void OdeNum<MatrixType>::diagBadEnlcosure(const VectorType &x) const
{
  std::ofstream raport("raport.ecl",std::ios::app);
  raport << "-------------------------\n";
  raport << "x=" << x << "\n";
  raport << "step=" << step << "\n";
  raport << "f(x)=" << ode.f(x) << "\n";

  int dim = x.dimension();
  ScalarType trial_step = ScalarType(-0.2,1.2) * step;

  int diag=0;
  VectorType max_r = trial_step*ode.f(x);
  VectorType Ye = x+max_r;

  raport << "Ye=" << Ye << "\n";
  raport << "diam Ye=" ;
  for(int i=0; i<dim; i++)
    raport << rightBound(capd::abs(diam(Ye[i]))) << "  " ;
  raport << "\n";


  MatrixType dv = ode.df(x+max_r);
  capd::vectalg::MaxNorm<VectorType,MatrixType> maxN;
  ScalarType L = maxN(dv);

  if (!(step*L < 1))
  {
    diag=1;
    raport << "hL > 1 \n";
  }
  raport << "hL=" << step*L << "\n";

  Real *diamvect = new Real[dim];
  Real *dfabs = new Real[dim*dim];
  if (!diag)
  {
    int i;

    for(i=0;i<dim; i++)
      diamvect[i] = rightBound(capd::abs(diam(Ye[i])));

    for(i=0;i<dim; i++)
      for(int j=0; j<dim; j++)
        dfabs[i*dim+j]= rightBound(capd::abs(dv[i][j]));

    for(i=0;i<dim;i++)
    {
      Real t=0;
      for(int j=0;j<dim;j++)
        t += dfabs[i*dim+j]*diamvect[j];
      t *= 2.5* rightBound(capd::abs(step));
      if(t > diamvect[i])
      {
        diag=2;
        raport << "5/2 h Dfi/Dxj diam(Ye_j)=t" << t <<
           " >  diam(Ye_i)= " << diamvect[i] <<
           "  ; i=" << i << "\n";
      }
    }// i-loop
  } // if(!diag)

  if(!diag)
  {
    diag=3;
    raport << "unknown reason \n" ;
  }
  delete [] diamvect;
  delete [] dfabs;
}
Esempio n. 14
0
C0FlowballSet<MatrixType>::C0FlowballSet(const VectorType& x, const ScalarType& r, const NormType& aNorm, ScalarType t)
  : C0Set<MatrixType>(intervalBall(x,r),VectorType(x.dimension()),t),
    m_x(x),m_r(r),m_n(aNorm.clone())
{}