R
Roland
Hi!
I am working on a project in which i implement a mathematical
optimization algorithm. One of the requirements on the code is very
good performance. So i started to optimize a bit. Now i do have a very
strange effect which i do not understand. Maybe somebody knows about:
I have the following class
template<class T> class SimplexL2Penalty : public Function<T,T>
{
public:
ASIString GetTypeInfo() const;
SimplexL2Penalty(const Simplex<T>& simplex);
SimplexL2Penalty(const Simplex<T>& simplex,const T& weight);
SimplexL2Penalty(const Simplex<T>& simplex,const Vector<T>&
w);
SimplexL2Penalty(const SimplexL2Penalty& toBeCopied);
virtual ~SimplexL2Penalty();
T Evaluate(const Vector<T>& point) const;
void operator*= (const T& factor);
ASIString ToXML() const;
Function<T,T>* ConstructCopy() const;
ASI_FLOGIC LargerOrEqual(const T& value) const;
const VectorSet<T>* GetZeroSet();
protected:
Vector<T> ComputePerturbation(const Vector<T>& point) const;
Simplex<T> m_Simplex;
T* m_WeightVector;
T m_Factor;
//Vector<T> *m_PerturbationVector1;
};
This class is used in an iterative algorithm. Performance is about 500
iterations per second.
When i add the pointer m_PerturbationVector1 to the class (without
using it at all) performance drops to 250 iterations per second.
What is going on? What can i do to overcome this effect.
Thanks a lot,
Roland
PS: I am using Microsoft Visual C++ 6.0.
I am working on a project in which i implement a mathematical
optimization algorithm. One of the requirements on the code is very
good performance. So i started to optimize a bit. Now i do have a very
strange effect which i do not understand. Maybe somebody knows about:
I have the following class
template<class T> class SimplexL2Penalty : public Function<T,T>
{
public:
ASIString GetTypeInfo() const;
SimplexL2Penalty(const Simplex<T>& simplex);
SimplexL2Penalty(const Simplex<T>& simplex,const T& weight);
SimplexL2Penalty(const Simplex<T>& simplex,const Vector<T>&
w);
SimplexL2Penalty(const SimplexL2Penalty& toBeCopied);
virtual ~SimplexL2Penalty();
T Evaluate(const Vector<T>& point) const;
void operator*= (const T& factor);
ASIString ToXML() const;
Function<T,T>* ConstructCopy() const;
ASI_FLOGIC LargerOrEqual(const T& value) const;
const VectorSet<T>* GetZeroSet();
protected:
Vector<T> ComputePerturbation(const Vector<T>& point) const;
Simplex<T> m_Simplex;
T* m_WeightVector;
T m_Factor;
//Vector<T> *m_PerturbationVector1;
};
This class is used in an iterative algorithm. Performance is about 500
iterations per second.
When i add the pointer m_PerturbationVector1 to the class (without
using it at all) performance drops to 250 iterations per second.
What is going on? What can i do to overcome this effect.
Thanks a lot,
Roland
PS: I am using Microsoft Visual C++ 6.0.