Beispiel #1
0
bool intersectionIsEmpty(const IntervalObject & v, const IntervalObject &w){

   typename IntervalObject::const_iterator iv = v.begin(), iw = w.begin(), endv = v.end();
   while(iv != endv){
     if((iv->leftBound() > iw->rightBound()) || (iw->leftBound() > iv->rightBound()))
       return true;
     ++iv; ++iw;
   }
   return false;
 }
Beispiel #2
0
void rightObject(const IntervalObject &v, ResultType& result)
{
  typename ResultType::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = b->rightBound();
    ++i;
    ++b;
  }
}
Beispiel #3
0
bool containsZero(const IntervalObject& v)
{

  typename IntervalObject::const_iterator b = v.begin(), e=v.end();
  while(b!=e)
  {
    if(!(isSingular(*b)))
      return false;
    ++b;
  }
  return true;
}
Beispiel #4
0
typename IntervalObject::ScalarType size(const IntervalObject& v)
{
  typedef typename IntervalObject::ScalarType ScalarType;
  ScalarType result(0.);
  typename IntervalObject::const_iterator b=v.begin(), e=v.end();
  while(b!=e)
  {
     result = chomp::max(result,diam(*b));
     ++b;
  }
  return ScalarType(result.rightBound());
}
Beispiel #5
0
void split(IntervalObject& v, IntervalObject& rv)
{
  if(v.dimension()!=rv.dimension())
    throw std::range_error("Unequal dimensions in function chomp::vectalg::split");
  typename IntervalObject::iterator b = v.begin(),e=v.end(), i=rv.begin();
  while(b!=e)
  {
    b->split(*i);
    ++b;
    ++i;
  }
}
Beispiel #6
0
void leftObject(const IntervalObject &v, ResultType& result)
{
  typename ResultType::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = b->leftBound();
    ++i;
    ++b;
  }
 // std::transform(v.begin(), v.end(), result.begin(), leftBound<ScalarType> );
}
Beispiel #7
0
bool subsetInterior(const IntervalObject& v1, const IntervalObject& v2)
{
  if(v1.dimension()!=v2.dimension())
    throw std::range_error("Unequal dimensions in function capd::vectalg::subsetInterior");
  typename IntervalObject::const_iterator b = v1.begin(), e=v1.end(), i=v2.begin();
  while(b!=e)
  {
    if(!(b->subsetInterior(*i))) return false;
    ++b;
    ++i;
  }
  return true;
}
Beispiel #8
0
void mid(const IntervalObject& v, ResultType& result)
{
  if(v.dimension()!=result.dimension())
    throw std::range_error("Unequal dimensions in function capd::vectalg::mid");
  typename ResultType::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = mid(*b);
    ++i;
    ++b;
  }
}
Beispiel #9
0
void diameter(const IntervalObject &v, ResultContainer &result)
{
  if(v.dimension()!=result.dimension())
    throw std::range_error("Unequal dimensions in function capd::vectalg::diameter");
  typename ResultContainer::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = diam(*b);
    ++i;
    ++b;
  }
}
Beispiel #10
0
ResultType midObject(const IntervalObject &v)
{
  ResultType result(v.dimension());
  typedef typename ResultType::ScalarType ScalarType;
  typename ResultType::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = (b->leftBound()+b->rightBound())/ScalarType(2.0);
    ++i;
    ++b;
  }
  return result;
}
Beispiel #11
0
void mid(const IntervalObject &v, IntervalObject &result)
{
  if(v.dimension()!=result.dimension())
    throw std::range_error("Unequal dimensions in function chomp::vectalg::mid");
  typedef typename IntervalObject::ScalarType ScalarType;
  typename IntervalObject::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = b->mid();
    ++i;
    ++b;
  }
}
Beispiel #12
0
void diameter(const IntervalObject &v, ResultContainer &result)
{
  if(v.dimension()!=result.dimension())
    throw std::range_error("Unequal dimensions in function chomp::vectalg::diameter");
  typedef typename IntervalObject::ScalarType ScalarType;
  typename ResultContainer::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = (ScalarType(b->rightBound()) - ScalarType(b->leftBound())).rightBound();
    ++i;
    ++b;
  }
}
Beispiel #13
0
void split(const IntervalObject & v, IntervalObject& center, IntervalObject & diameter) {
  if((v.dimension()!=center.dimension()) && (v.dimension()!=diameter.dimension()))
    throw std::range_error("Unequal dimensions in function chomp::vectalg::split");
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();
  typename IntervalObject::iterator c = center.begin(), d=diameter.begin();
  while(b!=e) {
    b->split(*c, *d);
    b++; c++; d++;
  }
}
Beispiel #14
0
void intervalHull(const IntervalObject &v1, const IntervalObject &v2, IntervalObject &result)
{
  if(v1.dimension()!=v2.dimension())
    throw std::range_error("Unequal dimensions in function capd::vectalg::intervalHull");
  if(v1.dimension()!=result.dimension())
    throw std::range_error("Unequal dimensions in function capd::vectalg::intervalHull");
  typedef typename IntervalObject::ContainerType ContainerType;
  typename ContainerType::const_iterator b1 = v1.ContainerType::begin(), b2=v2.ContainerType::begin();
  typename ContainerType::iterator b = result.ContainerType::begin(), e=result.ContainerType::end();

  while(b!=e)
  {
    *b = intervalHull(*b1,*b2);
    ++b;
    ++b1;
    ++b2;
  }
}
Beispiel #15
0
bool intersection(const IntervalObject &v1, const IntervalObject &v2, IntervalObject &result)
{
  if(v1.dimension()!=v2.dimension())
    throw std::range_error("Unequal dimensions in function chomp::vectalg::intersection");
  if(v1.dimension()!=result.dimension())
    throw std::range_error("Unequal dimensions in function chomp::vectalg::intersection");
  typename IntervalObject::const_iterator b1 = v1.begin(), b2=v2.begin();
  typename IntervalObject::iterator b = result.begin(), e=result.end();

  while(b!=e)
  {
    if( !intersection(*b1,*b2,*b))
      return false;
    ++b;
    ++b1;
    ++b2;
  }
  return true;
}