33 #ifndef __zd_f_vector_hpp
34 #define __zd_f_vector_hpp
36 #include "zqb_macros.h"
37 #include "zd_function.hpp"
41 #ifndef __zd_f_vector_global_vars
44 extern int g_iZdFVectorCounter;
47 extern char* g_szZdFVectorOwnType;
76 const T *m_pFuncC, *m_pArgC;
79 std::vector<T> *m_vFunc, *m_vArg;
91 ZdFVector (
int n, T* pFunc,
double fArgStep = 1.0,
double fArg0 = 0.0)
92 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
94 m_pFunc(pFunc), m_pArg(NULL),
95 m_pFuncC(NULL), m_pArgC(NULL),
96 m_vFunc(NULL), m_vArg(NULL),
97 m_fArg0(fArg0), m_fArgStep(fArgStep)
99 if(NULL == m_pFunc || m_nPoints < 0)
106 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
108 m_pFunc(pFunc), m_pArg(pArg),
109 m_pFuncC(NULL), m_pArgC(NULL),
110 m_vFunc(NULL), m_vArg(NULL),
111 m_fArg0(0.0), m_fArgStep(0.0)
113 if(NULL == m_pArg || NULL == m_pFunc || m_nPoints < 0)
120 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
122 m_pFunc(NULL), m_pArg(NULL),
123 m_pFuncC(pFunc), m_pArgC(pArg),
124 m_vFunc(NULL), m_vArg(NULL),
125 m_fArg0(0.0), m_fArgStep(0.0)
127 if(NULL == m_pArg || NULL == m_pFunc || m_nPoints < 0)
133 ZdFVector (std::vector<T>* pvArg, std::vector<T>* pvFunc)
134 :
ZqbAutoName(&g_iZdFVectorCounter, g_szZdFVectorOwnType),
136 m_pFunc(NULL), m_pArg(NULL),
137 m_pFuncC(NULL), m_pArgC(NULL),
138 m_vFunc(pvFunc), m_vArg(pvArg),
139 m_fArg0(0.0), m_fArgStep(0.0)
141 if(NULL == m_vArg || NULL == m_vFunc)
144 m_nPoints = ZqbMIN(m_vArg->size(), m_vFunc->size());
150 printf(
"~ZdFVector: deleted (%p)\n",
this);
162 if(NULL != m_pArg || NULL != m_pArgC || NULL != m_vArg)
168 virtual double arg (
int i) {
171 else if(NULL != m_pArgC)
173 else if(NULL != m_vArg)
175 return m_fArg0 + m_fArgStep * i;
181 if(i < 0 || i >=
count())
183 else if(NULL != m_pFunc)
185 else if(NULL != m_pFuncC)
187 else if(NULL != m_vFunc)
188 return (*m_vFunc)[i];
193 virtual void setFunc (
int i,
double fNewValue) {
194 if(i < 0 || i >=
count())
197 m_pFunc[i] = fNewValue;
198 else if(NULL != m_vFunc)
199 (*m_vFunc)[i] = fNewValue;
209 typedef class ZdFVector<int> ZdFVectorInt;
210 typedef class ZdFVector<float> ZdFVectorFloat;
211 typedef class ZdFVector<double> ZdFVectorDouble;
virtual void setFunc(int i, double fNewValue)
Definition: zd_f_vector.hpp:193
ZdFVector(int n, T *pArg, T *pFunc)
Definition: zd_f_vector.hpp:105
ZdFVector(int n, const T *pArg, const T *pFunc)
Definition: zd_f_vector.hpp:119
virtual ~ZdFVector()
Definition: zd_f_vector.hpp:149
Definition: zd_function.hpp:27
virtual double func(int i)
Definition: zd_f_vector.hpp:180
Definition: zd_f_vector.hpp:63
virtual double arg(int i)
Definition: zd_f_vector.hpp:168
Definition: zqb_autoname.hpp:18
ZdFVector(std::vector< T > *pvArg, std::vector< T > *pvFunc)
Definition: zd_f_vector.hpp:133
virtual int count()
Definition: zd_f_vector.hpp:155
ZdFVector(int n, T *pFunc, double fArgStep=1.0, double fArg0=0.0)
Definition: zd_f_vector.hpp:91
virtual double argStep()
Definition: zd_f_vector.hpp:161