[vtk-developers] Possible changes to vtkMath...
Will Schroeder
will.schroeder at kitware.com
Thu Jul 10 18:42:09 EDT 2003
Hi Folks-
I was profiling VTK and discovered a couple of issues with vtkMath. The
fabs() function (used in LUSolve, etc) is taking an surprising amount of
time, and I find some leftover static variables. Here's what I'm
thinking---I'd like your comments.
fabs()
We can define a macro #define VTK_FABS(x) (x) < 0.0 )?(-(x)):(x))
Another alternative is to do what vnl does:
inline float VTK_FABS(float x) { return ::fabsf(x); }
inline double VTK_FABS(double x) { return ::fabs(x); }
The macro seems to be a bit faster but I'm running debug not release.
Static variables will be replaced with code like this that is partially
optimized for small matrices:
> int *index, scratch[10];
> index = ( size < 10 ? scratch : new int[size] );
> if (size >= 10 ) delete [] index;
Comments?
Will
More information about the vtk-developers
mailing list