33 #ifndef __zd_f_vector_hpp
34 #define __zd_f_vector_hpp
36 #include "zqb_macros.h"
37 #include "zd_function.hpp"
40 #ifndef __zd_f_vector_global_vars
43 extern int g_iZdFVectorCounter;
46 extern char* g_szZdFVectorOwnType;
75 const T *m_pFuncC, *m_pArgC;
78 std::vector<T> *m_vFunc, *m_vArg;
90 ZdFVector (
int n, T* pFunc,
double fArgStep = 1.0,
double fArg0 = 0.0)
91 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
93 m_pFunc(pFunc), m_pArg(NULL),
94 m_pFuncC(NULL), m_pArgC(NULL),
95 m_vFunc(NULL), m_vArg(NULL),
96 m_fArg0(fArg0), m_fArgStep(fArgStep)
98 if(NULL == m_pFunc || m_nPoints < 0)
105 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
107 m_pFunc(pFunc), m_pArg(pArg),
108 m_pFuncC(NULL), m_pArgC(NULL),
109 m_vFunc(NULL), m_vArg(NULL),
110 m_fArg0(0.0), m_fArgStep(0.0)
112 if(NULL == m_pArg || NULL == m_pFunc || m_nPoints < 0)
119 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
121 m_pFunc(NULL), m_pArg(NULL),
122 m_pFuncC(pFunc), m_pArgC(pArg),
123 m_vFunc(NULL), m_vArg(NULL),
124 m_fArg0(0.0), m_fArgStep(0.0)
126 if(NULL == m_pArg || NULL == m_pFunc || m_nPoints < 0)
132 ZdFVector (std::vector<T>* pvArg, std::vector<T>* pvFunc)
133 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
135 m_pFunc(NULL), m_pArg(NULL),
136 m_pFuncC(NULL), m_pArgC(NULL),
137 m_vFunc(pvFunc), m_vArg(pvArg),
138 m_fArg0(0.0), m_fArgStep(0.0)
140 if(NULL == m_vArg || NULL == m_vFunc)
143 m_nPoints = ZqbMIN(m_vArg->size(), m_vFunc->size());
160 if(NULL != m_pArg || NULL != m_pArgC || NULL != m_vArg)
166 virtual double arg (
int i) {
169 else if(NULL != m_pArgC)
171 else if(NULL != m_vArg)
173 return m_fArg0 + m_fArgStep * i;
179 if(i < 0 || i >=
count())
181 else if(NULL != m_pFunc)
183 else if(NULL != m_pFuncC)
185 else if(NULL != m_vFunc)
186 return (*m_vFunc)[i];
191 virtual void setFunc (
int i,
double fNewValue) {
192 if(i < 0 || i >=
count())
195 m_pFunc[i] = fNewValue;
196 else if(NULL != m_vFunc)
197 (*m_vFunc)[i] = fNewValue;
207 typedef class ZdFVector<int> ZdFVectorInt;
208 typedef class ZdFVector<float> ZdFVectorFloat;
209 typedef class ZdFVector<double> ZdFVectorDouble;
virtual void setFunc(int i, double fNewValue)
Definition: zd_f_vector.hpp:191
ZdFVector(int n, T *pArg, T *pFunc)
Definition: zd_f_vector.hpp:104
ZdFVector(int n, const T *pArg, const T *pFunc)
Definition: zd_f_vector.hpp:118
virtual ~ZdFVector()
Definition: zd_f_vector.hpp:148
Definition: zd_function.hpp:27
virtual double func(int i)
Definition: zd_f_vector.hpp:178
Definition: zd_f_vector.hpp:63
virtual double arg(int i)
Definition: zd_f_vector.hpp:166
Definition: zqb_autoname.hpp:18
ZdFVector(std::vector< T > *pvArg, std::vector< T > *pvFunc)
Definition: zd_f_vector.hpp:132
virtual int count()
Definition: zd_f_vector.hpp:153
ZdFVector(int n, T *pFunc, double fArgStep=1.0, double fArg0=0.0)
Definition: zd_f_vector.hpp:90
virtual double argStep()
Definition: zd_f_vector.hpp:159