22 #ifndef __dgGeneralVector__ 23 #define __dgGeneralVector__ 28 #define DG_COUNT_FLOAT_OPS 46 T &operator[](dgInt32 i);
47 const T &operator[](dgInt32 i)
const;
49 dgInt32 GetRowCount()
const;
64 static dgInt32 GetFloatOps();
65 static dgInt32 GetMemWrites();
67 static void SetFloatOps(dgInt32 initialCount = 0);
68 static void SetMemWrites(dgInt32 initialCount = 0);
78 static dgInt32 m_floatsOp;
79 static dgInt32 m_memoryWrite;
100 NEWTON_ASSERT(size > 0);
103 m_columns =
new T[size];
104 NEWTON_ASSERT((((dgUnsigned32) m_columns) & 0x0f) == 0);
112 NEWTON_ASSERT((((dgUnsigned32) m_columns) & 0x0f) == 0);
118 m_colCount = src.m_colCount;
119 m_columns =
new T[m_colCount];
120 NEWTON_ASSERT((((dgUnsigned32) m_columns) & 0x0f) == 0);
128 m_colCount = src.m_colCount;
130 NEWTON_ASSERT((((dgUnsigned32) m_columns) & 0x0f) == 0);
143 m_floatsOp = initialCount;
149 return m_memoryWrite;
155 m_memoryWrite = initialCount;
170 for (i = 0; i < m_colCount; i ++) {
171 dgTrace((
"%f ", m_columns[i]));
181 NEWTON_ASSERT(i < m_colCount);
182 NEWTON_ASSERT(i >= 0);
188 NEWTON_ASSERT(i < m_colCount);
189 NEWTON_ASSERT(i >= 0);
204 NEWTON_ASSERT(m_colCount == A.m_colCount);
206 for (i = 0; i < m_colCount; i ++) {
207 val = val + m_columns[i] * A.m_columns[i];
210 #ifdef DG_COUNT_FLOAT_OPS 211 m_floatsOp += 2 * m_colCount;
212 m_memoryWrite += m_colCount;
224 for (i = 0; i < m_colCount; i ++) {
228 #ifdef DG_COUNT_FLOAT_OPS 229 m_memoryWrite += m_colCount;
237 NEWTON_ASSERT(m_colCount == src.m_colCount);
238 for (i = 0; i < m_colCount; i ++) {
239 m_columns[i] = src.m_columns[i];
242 #ifdef DG_COUNT_FLOAT_OPS 243 m_memoryWrite += m_colCount;
252 for (i = 0; i < m_colCount; i ++) {
253 m_columns[i] = m_columns[i] *
scale;
256 #ifdef DG_COUNT_FLOAT_OPS 257 m_floatsOp += m_colCount;
258 m_memoryWrite += m_colCount;
269 for (i = 0; i < m_colCount; i ++) {
270 max = GetMax(m_columns[i] * m_columns[i], max);
273 #ifdef DG_COUNT_FLOAT_OPS 274 m_floatsOp += m_colCount;
275 m_memoryWrite += m_colCount;
283 return T(sqrt(Norm2()));
291 NEWTON_ASSERT(A.m_colCount == m_colCount);
292 NEWTON_ASSERT(B.m_colCount == m_colCount);
293 for (i = 0; i < m_colCount; i ++) {
294 m_columns[i] = A.m_columns[i] *
scale + B.m_columns[i];
297 #ifdef DG_COUNT_FLOAT_OPS 298 m_floatsOp += 3 * m_colCount;
299 m_memoryWrite += m_colCount;
308 NEWTON_ASSERT(A.m_colCount == m_colCount);
309 for (i = 0; i < m_colCount; i ++) {
310 m_columns[i] += A.m_columns[i];
313 #ifdef DG_COUNT_FLOAT_OPS 314 m_floatsOp += m_colCount;
315 m_memoryWrite += m_colCount;
323 NEWTON_ASSERT(A.m_colCount == m_colCount);
324 for (i = 0; i < m_colCount; i ++) {
325 m_columns[i] -= A.m_columns[i];
328 #ifdef DG_COUNT_FLOAT_OPS 329 m_floatsOp += m_colCount;
330 m_memoryWrite += m_colCount;
Definition: dgGeneralVector.h:34
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
Definition: dgGeneralVector.h:30
Definition: dgGeneralMatrix.h:40