87 memcpy(m_pElements, v.m_pElements, m_nSize *
sizeof(
double));
93 delete [] m_pElements;
105 memcpy(m_pElements, v.m_pElements, m_nSize *
sizeof(
double));
114 if (m_nSize != v.m_nSize)
118 CVecd result(m_nSize);
120 for (
int i = 0; i < m_nSize; i++)
121 result.m_pElements[i] = m_pElements[i] + v.m_pElements[i];
131 if (m_nSize != v.m_nSize)
135 CVecd result(m_nSize);
137 for (
int i = 0; i < m_nSize; i++)
138 result.m_pElements[i] = m_pElements[i] - v.m_pElements[i];
148 if (m_nSize != v.m_nSize)
152 double dResult = 0.0;
154 for (
int i = 0; i < m_nSize; i++)
155 dResult += m_pElements[i] * v.m_pElements[i];
165 return m_pElements[n];
179 delete [] m_pElements;
182 m_pElements =
new double[nSize];
184 for (
int i = 0; i < nSize; i++)
185 m_pElements[i] = 0.0;
195 for (
int i = 0; i < m_nSize; i++)
196 sum += m_pElements[i] * m_pElements[i];
double & operator[](const int n) const
CVecd & operator=(const CVecd &v)
CVecd operator+(const CVecd &v)
double operator*(const CVecd &v)
CVecd operator-(const CVecd &v)
Data structure and operations for calculating with vectors of arbitrary dimension.