00001 /** 00002 * Implementation of the complement. 00003 * @file Complement.cpp 00004 * @date July 17, 2001 00005 * @author Ed Bachta 00006 */ 00007 00008 #include "Complement.h" 00009 00010 REGISTER_IMPLICIT(Complement, "UnaryOp:Complement"); 00011 00012 #ifndef INTERVAL_EVAL_ONLY 00013 /** 00014 * Negates the value of the implicit. 00015 */ 00016 double Complement::proc(gmVector3 x) 00017 { 00018 return (m_f ? -m_f->proc(x) : 0.0); 00019 } 00020 00021 /** 00022 * Negates the gradient of the implicit. 00023 */ 00024 gmVector3 Complement::grad(gmVector3 x) 00025 { 00026 return (m_f ? -m_f->grad(x) : gmVector3()); 00027 } 00028 00029 /** Negates the Hessian of the implicit. 00030 */ 00031 gmMatrix3 Complement::hess(gmVector3 x) 00032 { 00033 return (m_f ? -m_f->hess(x) : gmMatrix3()); 00034 } 00035 #endif 00036 00037 Intervald Complement::proc(Box<double> x) 00038 { 00039 return (m_f ? -m_f->proc(x) : Intervald(0.0)); 00040 } 00041 00042 Box3d Complement::grad(Box<double> x) 00043 { 00044 if (m_f) 00045 return -(m_f->grad(x)); 00046 else 00047 return Box3d(0.0); 00048 } 00049 00050 IMatrix3d Complement::hess(Box<double> x) 00051 { 00052 if (m_f) 00053 return -(m_f->hess(x)); 00054 else 00055 return IMatrix3d(0.0); 00056 } 00057 00058 /** 00059 * Evaluate the derivative of proc with respect to q at a given point. 00060 * This is the same as the underlying function, with all values negated. 00061 * 00062 * @param p The point at which to evaluate. 00063 * @param q The derivatives with respect to q vector elements, 00064 * on return. Must have this->qlen() elements. 00065 */ 00066 void Complement::procq(gmVector3 p, double * q) 00067 { 00068 if (!m_f) 00069 return; 00070 00071 m_f->procq(p,q); 00072 for(int i=0; i < m_f->qlen(); i++ ) 00073 q[i] = -q[i]; 00074 } 00075
1.3.4