Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:55

0001 /****************************************************************************
0002 **
0003 ** Copyright (c) 2008-2020 C.B. Barber. All rights reserved.
0004 ** $Id: //main/2019/qhull/src/libqhullcpp/functionObjects.h#2 $$Change: 2953 $
0005 ** $DateTime: 2020/05/21 22:05:32 $$Author: bbarber $
0006 **
0007 ****************************************************************************/
0008 
0009 #ifndef QHFUNCTIONOBJECTS_H
0010 #define QHFUNCTIONOBJECTS_H
0011 
0012 #include <stdlib.h>
0013 #include <math.h>
0014 
0015 namespace orgQhull {
0016 
0017 #//!\name Defined here
0018 
0019     //! Sum of absolute values of the elements in a container
0020     class AbsoluteSumOf;
0021     //! Sum of the elements in a container
0022     class SumOf;
0023     //! Sum of squares of the elements in a container
0024     class SumSquaresOf;
0025 
0026 #//!\name Class
0027 
0028 //! Absolute sum of the elements in a container
0029 class AbsoluteSumOf
0030 {
0031 private:
0032     double sum;
0033 public:
0034     inline AbsoluteSumOf() : sum(0.0) {}
0035     inline void operator()(double v) { sum += fabs(v); }
0036     inline operator double() { return sum; }
0037 };//AbsoluteSumOf
0038 
0039 //! Sum of the elements in a container
0040 class SumOf
0041 {
0042 private:
0043     double sum;
0044 public:
0045     inline SumOf() : sum(0.0) {}
0046     inline void operator()(double v) { sum += v; }
0047     inline operator double() { return sum; }
0048 };//SumOf
0049 
0050 
0051 //! Sum of squares of the elements in a container
0052 class SumSquaresOf
0053 {
0054 private:
0055     double sum;
0056 public:
0057     inline SumSquaresOf() : sum(0.0) {}
0058     inline void operator()(double v) { sum += v*v; }
0059     inline operator double() { return sum; }
0060 };//SumSquaresOf
0061 
0062 
0063 }//orgQhull
0064 
0065 
0066 #endif //QHFUNCTIONOBJECTS_H
0067