My Project: dynamics.mod/NewtonDynamics/source/core/dgGeneralMatrix.h Source File

My Project

dgGeneralMatrix.h
Go to the documentation of this file.
1 /* Copyright (c) <2003-2011> <Julio Jerez, Newton Game Dynamics>
2 *
3 * This software is provided 'as-is', without any express or implied
4 * warranty. In no event will the authors be held liable for any damages
5 * arising from the use of this software.
6 *
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 *
11 * 1. The origin of this software must not be misrepresented; you must not
12 * claim that you wrote the original software. If you use this software
13 * in a product, an acknowledgment in the product documentation would be
14 * appreciated but is not required.
15 *
16 * 2. Altered source versions must be plainly marked as such, and must not be
17 * misrepresented as being the original software.
18 *
19 * 3. This notice may not be removed or altered from any source distribution.
20 */
21
22 #ifndef __dgGeneralMatrix__
23 #define __dgGeneralMatrix__
24
25 #include "dgStdafx.h"
26 #include "dgDebug.h"
27 #include "dgGeneralVector.h"
28
29
30
31
32 template <class T> dgInt32 dgGeneralMatrixCalcBufferSizeInBytes (dgInt32 row, dgInt32 column)
33 {
34 dgInt32 columnPad;
35 columnPad = ((column * sizeof (T) + 0x0f) & -0x0f) / sizeof (T);
36 return row * columnPad * sizeof (T) + row * sizeof (dgGeneralVector<T>);
37 }
38
39
40 template<class T>
41 class dgGeneralMatrix
42 {
43 public:
44 dgGeneralMatrix (dgInt32 row, dgInt32 column);
45 dgGeneralMatrix (const dgGeneralMatrix<T>& src);
46 dgGeneralMatrix (const dgGeneralMatrix<T>& src, T *elemBuffer);
47 dgGeneralMatrix (dgInt32 row, dgInt32 column, T *elemBuffer);
48 ~dgGeneralMatrix ();
49
50 dgGeneralVector<T>& operator[] (dgInt32 i);
51 const dgGeneralVector<T>& operator[] (dgInt32 i) const;
52
53 dgInt32 GetRowCount() const;
54 dgInt32 GetColCount() const;
55
56 void Clear (T val);
57 void Identity ();
58
59 void SwapRows (dgInt32 i, dgInt32 j);
60 void SwapColumns (dgInt32 i, dgInt32 j);
61
62 // dgGeneralMatrix Transpose ();
63 // void Inverse (dgGeneralMatrix& inverseOut);
64 void GaussianPivotStep (dgInt32 srcRow, dgInt32 pivotRow, dgInt32 pivotCol, T tol = T (1.0e-6f));
65
66
67 // calculate out = V * A;
68 void VectorTimeMatrix (const dgGeneralVector<T> &v, dgGeneralVector<T> &out);
69
70 // calculate out = A * transpose (V);
71 void MatrixTimeVectorTranspose (const dgGeneralVector<T> &v, dgGeneralVector<T> &out);
72
73
74 // calculate M = A * B;
75 void MatrixTimeMatrix (const dgGeneralMatrix<T>& A, const dgGeneralMatrix<T>& B);
76
77 // calculate M = A * transpose (B);
78 void MatrixTimeMatrixTranspose (const dgGeneralMatrix<T>& A, const dgGeneralMatrix<T>& Bt);
79
80 bool Solve (dgGeneralVector<T> &b, T tol = T(0.0f));
81
82 bool CholeskyDecomposition ();
83 bool TestPSD () const;
84 bool TestSymetry () const;
85
86
87 void Trace () const;
88
89
90 protected:
91 bool m_ownMemory;
92 dgInt32 m_rowCount;
93 dgInt32 m_colCount;
94 dgGeneralVector<T>* m_rows;
95
96 private:
97 T* m_buffer;
98 };
99
100
101 // ***********************************************************************************************
102 //
103 // LinearSystem
104 //
105 // ***********************************************************************************************
106 template<class T>
107 dgGeneralMatrix<T>::dgGeneralMatrix (dgInt32 row, dgInt32 column)
108 {
109 dgInt32 i;
110 dgInt32 columnPad;
111 dgAssert (row > 0);
112 dgAssert (column > 0);
113
114 m_rowCount = row;
115 m_colCount = column;
116 m_ownMemory = true;
117
118
119 columnPad = ((column * sizeof (T) + 0x0f) & -0x0f) / sizeof (T);
120 m_buffer = new T [row * columnPad];
121
122 m_rows = new dgGeneralVector<T>[row];
123 for (i = 0; i < row; i ++) {
124 m_rows[i] = dgGeneralVector<T> (column, &m_buffer[i * columnPad]);
125 }
126 }
127
128
129 template<class T>
130 dgGeneralMatrix<T>::dgGeneralMatrix (const dgGeneralMatrix<T>& src)
131 {
132 dgInt32 i;
133 dgInt32 columnPad;
134
135 m_ownMemory = true;
136 m_rowCount = src.m_rowCount;
137 m_colCount = src.m_colCount;
138
139 columnPad = ((m_colCount * sizeof (T) + 0x0f) & -0x0f) / sizeof (T);
140 m_buffer = new T [m_rowCount * columnPad];
141 m_rows = new dgGeneralVector<T>[m_rowCount];
142
143 for (i = 0; i < m_rowCount; i ++) {
144 m_rows[i] = dgGeneralVector<T> (src[i], &m_buffer[i * columnPad]);
145 }
146 }
147
148 template<class T>
149 dgGeneralMatrix<T>::dgGeneralMatrix (
150 dgInt32 row,
151 dgInt32 column,
152 T *elemBuffer)
153 {
154 dgInt32 i;
155 dgInt32 columnPad;
156
157 m_ownMemory = false;
158 m_rowCount = row;
159 m_colCount = column;
160
161
162 dgAssert ((((dgUnsigned32) elemBuffer) & 0x0f) == 0);
163
164 m_buffer = elemBuffer;
165 columnPad = ((m_colCount * sizeof (T) + 0x0f) & -0x0f) / sizeof (T);
166 m_rows = (dgGeneralVector<T>*) &elemBuffer[m_rowCount * columnPad];
167 for (i = 0; i < row; i ++) {
168 m_rows[i] = dgGeneralVector<T> (column, &m_buffer[i * columnPad]);
169 }
170 }
171
172
173 template<class T>
174 dgGeneralMatrix<T>::dgGeneralMatrix (
175 const dgGeneralMatrix<T>& src,
176 T *elemBuffer)
177 {
178 dgInt32 i;
179 dgInt32 columnPad;
180
181 m_ownMemory = false;
182 m_rowCount = src.m_rowCount;
183 m_colCount = src.m_colCount;
184
185 dgAssert ((((dgUnsigned32) elemBuffer) & 0x0f) == 0);
186 m_buffer = elemBuffer;
187
188 columnPad = ((m_colCount * sizeof (T) + 0x0f) & -0x0f) / sizeof (T);
189 m_rows = (dgGeneralVector<T>*) &elemBuffer[m_rowCount * columnPad];
190 for (i = 0; i < m_rowCount; i ++) {
191 m_rows[i] = dgGeneralVector<T> (src[i], &m_buffer[i * columnPad]);
192 }
193 }
194
195
196
197 template<class T>
198 dgGeneralMatrix<T>::~dgGeneralMatrix ()
199 {
200 if (m_ownMemory) {
201 delete[] m_rows;
202 delete[] m_buffer;
203 }
204 }
205
206
207 template<class T>
208 dgInt32 dgGeneralMatrix<T>::GetRowCount() const
209 {
210 return m_rowCount;
211 }
212
213 template<class T>
214 dgInt32 dgGeneralMatrix<T>::GetColCount() const
215 {
216 return m_colCount;
217 }
218
219
220 template<class T>
221 void dgGeneralMatrix<T>::Trace () const
222 {
223 dgInt32 i;
224
225 for (i = 0; i < m_rowCount; i ++) {
226 m_rows[i].Trace ();
227 }
228 }
229
230
231
232 template<class T>
233 dgGeneralVector<T>& dgGeneralMatrix<T>::operator[] (dgInt32 i)
234 {
235 dgAssert (i < m_rowCount);
236 dgAssert (i >= 0);
237 return m_rows[i];
238 }
239
240 template<class T>
241 const dgGeneralVector<T>& dgGeneralMatrix<T>::operator[] (dgInt32 i) const
242 {
243 dgAssert (i < m_rowCount);
244 dgAssert (i >= 0);
245 return m_rows[i];
246 }
247
248 template<class T>
249 void dgGeneralMatrix<T>::Clear (T val)
250 {
251 dgInt32 i;
252 for (i = 0; i < m_rowCount; i ++ ) {
253 m_rows[i].Clear(val);
254 }
255 }
256
257 template<class T>
258 void dgGeneralMatrix<T>::Identity ()
259 {
260 dgInt32 i;
261
262 for (i = 0; i < m_rowCount; i ++ ) {
263 m_rows[i].Clear(T (0.0f));
264 m_rows[i][i] = T (1.0f);
265 }
266 }
267
268
269 //template<class T>
270 //void dgGeneralMatrix<T>::Transpose ()
271 //{
272 // dgInt32 i;
273 // dgInt32 j;
274 //
275 // dgAssert (m_rowCount ==
276 // dgGeneralMatrix<T>& me = *this;
277 // for (i = 0; i < m_rowCount; i ++) {
278 // for (j = i + 1; j < m_rowCount; j ++) {
279 // T tmp (me[i][j]);
280 // me[i][j] = me[j][i];
281 // me[j][i] = tmp;
282 //
283 // #ifdef DG_COUNT_FLOAT_OPS
284 // dgGeneralVector<T>::m_memoryWrite += 2;
285 // #endif
286 // }
287 // }
288 //}
289
290
291 template<class T>
292 void dgGeneralMatrix<T>::GaussianPivotStep (
293 dgInt32 srcRow,
294 dgInt32 pivotRow,
295 dgInt32 pivotCol,
296 T tol)
297 {
298 dgGeneralMatrix<T>& me = *this;
299
300 T num (me[pivotRow][pivotCol]);
301 if (T(dgAbsf (num)) > tol) {
302 T den (me[srcRow][pivotCol]);
303 dgAssert (T(dgAbsf (den)) > T (0.0f));
304
305 #ifdef DG_COUNT_FLOAT_OPS
306 dgGeneralVector<T>::m_floatsOp += 2;
307 #endif
308
309 den = - num / den;
310 me[pivotRow].LinearCombine (den, me[srcRow], me[pivotRow]);
311 }
312 }
313
314
315 //template<class T>
316 //void dgGeneralMatrix<T>::Inverse (dgGeneralMatrix& inverseOut)
317 //{
318 // dgAssert (m_colCount == m_rowCount);
319 //}
320
321
322 template<class T>
323 void dgGeneralMatrix<T>::VectorTimeMatrix (const dgGeneralVector<T> &v, dgGeneralVector<T> &out)
324 {
325 dgInt32 i;
326 dgInt32 j;
327 T acc;
328 T* outMem;
329 const T* inMem;
330
331 dgAssert (&v != &out);
332 dgAssert (m_rowCount == v.m_colCount);
333 dgAssert (m_colCount == out.m_colCount);
334
335 inMem = &v[0];
336 outMem = &out[0];
337 const dgGeneralMatrix<T>& me = *this;
338 for (i = 0; i < m_colCount; i ++) {
339 acc = T (0.0f);
340 for (j = 0; j < m_rowCount; j ++) {
341 acc = acc + inMem[j] * me[j][i];
342
343 #ifdef DG_COUNT_FLOAT_OPS
344 dgGeneralVector<T>::m_floatsOp += 2;
345 #endif
346 }
347 outMem[i] = acc;
348 #ifdef DG_COUNT_FLOAT_OPS
349 dgGeneralVector<T>::m_memoryWrite += 1;
350 #endif
351 }
352 }
353
354
355 template<class T>
356 void dgGeneralMatrix<T>::MatrixTimeVectorTranspose (const dgGeneralVector<T> &v, dgGeneralVector<T> &out)
357 {
358 dgInt32 i;
359
360 dgAssert (&v != &out);
361 dgAssert (m_rowCount == out.m_colCount);
362 dgAssert (m_colCount == v.m_colCount);
363
364 for (i = 0; i < m_rowCount; i ++) {
365 out[i] = v.DotProduct (m_rows[i]);
366 }
367 }
368
369 template<class T>
370 void dgGeneralMatrix<T>::MatrixTimeMatrix (const dgGeneralMatrix<T>& A, const dgGeneralMatrix<T>& B)
371 {
372 dgInt32 i;
373 dgInt32 j;
374 dgInt32 k;
375 dgInt32 count;
376 T* out;
377 T* rowA;
378
379 dgAssert (m_rowCount == A.m_rowCount);
380 dgAssert (m_colCount == B.m_colCount);
381 dgAssert (A.m_colCount == B.m_rowCount);
382
383 dgAssert (this != &A);
384
385 count = A.m_colCount;
386 for (i = 0; i < m_rowCount; i ++) {
387 out = &m_rows[i][0];
388 rowA = &A.m_rows[i][0];
389 for (j = 0; j < m_colCount; j ++) {
390 T acc (0.0f);
391 for (k = 0; k < count; k ++) {
392 acc = acc + rowA[k] * B.m_rows[k][j];
393
394 #ifdef DG_COUNT_FLOAT_OPS
395 dgGeneralVector<T>::m_floatsOp += 2;
396 #endif
397 }
398 out[j] = acc;
399
400 #ifdef DG_COUNT_FLOAT_OPS
401 dgGeneralVector<T>::m_memoryWrite += 1;
402 #endif
403 }
404 }
405 }
406
407
408 template<class T>
409 void dgGeneralMatrix<T>::MatrixTimeMatrixTranspose (const dgGeneralMatrix<T>& A, const dgGeneralMatrix<T>& Bt)
410 {
411 dgInt32 i;
412 dgInt32 j;
413 dgInt32 k;
414 dgInt32 count;
415 T* out;
416 T* rowA;
417 T* rowB;
418
419 dgAssert (m_rowCount == A.m_rowCount);
420 dgAssert (m_colCount == Bt.m_rowCount);
421 dgAssert (A.m_colCount == Bt.m_colCount);
422
423 dgAssert (this != &A);
424 dgAssert (this != &Bt);
425
426 count = A.m_colCount;
427 for (i = 0; i < m_rowCount; i ++) {
428 out = &m_rows[i][0];
429 rowA = &A.m_rows[i][0];
430 for (j = 0; j < m_colCount; j ++) {
431 T acc (0.0f);
432 rowB = &Bt.m_rows[j][0];
433 for (k = 0; k < count; k ++) {
434 acc = acc + rowA[k] * rowB[k];
435
436 #ifdef DG_COUNT_FLOAT_OPS
437 dgGeneralVector<T>::m_floatsOp += 2;
438 #endif
439 }
440 out[j] = acc;
441
442 #ifdef DG_COUNT_FLOAT_OPS
443 dgGeneralVector<T>::m_memoryWrite += 1;
444 #endif
445 }
446 }
447 }
448
449
450
451
452 template<class T>
453 bool dgGeneralMatrix<T>::Solve (dgGeneralVector<T> &b, T tol)
454 {
455 dgInt32 i;
456 dgInt32 j;
457 dgInt32 k;
458 T* B;
459 T* rowI;
460 T* rowK;
461
462 dgAssert (m_rowCount == m_colCount);
463 dgAssert (b.m_colCount == m_colCount);
464
465 B = &b[0];
466 // convert to upper triangular matrix by applying gauss pivoting
467 for (i = 0; i < m_rowCount - 1; i ++) {
468 rowI = &m_rows[i][0];
469 T den (rowI[i]);
470
471 if (T (dgAbsf (den)) < T (0.0f)) {
472 return false;
473 }
474
475 for (k = i + 1; k < m_rowCount; k ++) {
476 rowK = &m_rows[k][0];
477 T num (rowK[i]);
478
479 if (T (dgAbsf (num)) > tol) {
480 num = num / den;
481 for (j = i + 1; j < m_rowCount; j ++) {
482 rowK[j] = rowK[j] - rowI[j] * num;
483
484 #ifdef DG_COUNT_FLOAT_OPS
485 dgGeneralVector<T>::m_floatsOp += 2;
486 dgGeneralVector<T>::m_memoryWrite += 1;
487 #endif
488 }
489 B[k] = B[k] - B[i] * num;
490
491 #ifdef DG_COUNT_FLOAT_OPS
492 dgGeneralVector<T>::m_floatsOp += 3;
493 dgGeneralVector<T>::m_memoryWrite += 1;
494 #endif
495 }
496 }
497 }
498
499
500 B[m_rowCount-1] = B[m_rowCount-1] / m_rows[m_rowCount-1][m_rowCount-1];
501 for (i = m_rowCount - 2; i >= 0; i --) {
502 T acc (0);
503 rowI = &m_rows[i][0];
504 for (j = i + 1 ; j < m_rowCount; j ++) {
505 acc = acc + rowI[j] * B[j];
506
507 #ifdef DG_COUNT_FLOAT_OPS
508 dgGeneralVector<T>::m_floatsOp += 2;
509 #endif
510 }
511 B[i] = (B[i] - acc) / rowI[i];
512
513 #ifdef DG_COUNT_FLOAT_OPS
514 dgGeneralVector<T>::m_floatsOp += 2;
515 dgGeneralVector<T>::m_memoryWrite += 1;
516 #endif
517 }
518
519 #ifdef DG_COUNT_FLOAT_OPS
520 dgGeneralVector<T>::m_floatsOp += 1;
521 dgGeneralVector<T>::m_memoryWrite += 1;
522 #endif
523
524 return true;
525 }
526
527 template<class T>
528 void dgGeneralMatrix<T>::SwapRows (dgInt32 i, dgInt32 j)
529 {
530 dgAssert (i >= 0);
531 dgAssert (j >= 0);
532 dgAssert (i < m_rowCount);
533 dgAssert (j < m_rowCount);
534 dgAssert (j != i);
535 dgSwap(m_rows[i].m_columns, m_rows[j].m_columns);
536 }
537
538 template<class T>
539 void dgGeneralMatrix<T>::SwapColumns (dgInt32 i, dgInt32 j)
540 {
541 dgInt32 k;
542 dgAssert (i >= 0);
543 dgAssert (j >= 0);
544 dgAssert (i < m_colCount);
545 dgAssert (j < m_colCount);
546 for (k = 0; k < m_colCount; k ++) {
547 dgSwap(m_rows[k][i], m_rows[k][j]);
548 }
549 }
550
551
552
553 template<class T>
554 bool dgGeneralMatrix<T>::TestSymetry () const
555 {
556 dgInt32 i;
557 dgInt32 j;
558
559 if (m_colCount != m_rowCount) {
560 return false;
561 }
562
563 dgGeneralMatrix<T> mat = *this;
564 for (i = 0; i < m_rowCount; i ++) {
565 for (j = i + 1; j < m_rowCount; j ++) {
566 if (dgAbsf (mat[i][j] - mat[j][i]) > 1.0e-12f) {
567 return false;
568 }
569 }
570 }
571 return true;
572 }
573
574 template<class T>
575 bool dgGeneralMatrix<T>::TestPSD () const
576 {
577 if (!TestSymetry ()) {
578 return false;
579 }
580
581 dgGeneralMatrix<T> tmp (*this);
582 return tmp.CholeskyDecomposition();
583 }
584
585
586
587 template<class T>
588 bool dgGeneralMatrix<T>::CholeskyDecomposition()
589 {
590 dgInt32 i;
591 dgInt32 j;
592 dgInt32 k;
593 T factor;
594 T* rowK;
595 T* rowJ;
596
597 #ifdef DG_COUNT_FLOAT_OPS
598 dgInt32 memCount;
599 dgInt32 floatCount;
600
601 memCount = dgGeneralVector<T>::GetMemWrites();
602 floatCount = dgGeneralVector<T>::GetFloatOps();
603 #endif
604
605 for (j = 0; j < m_rowCount; j++) {
606 //Trace ();
607 //dgTrace (("\n"));
608 rowJ = &m_rows[j].m_columns[0];
609
610 for (k = 0; k < j; k ++ ) {
611 rowK = &m_rows[k].m_columns[0];
612
613 factor = rowK[j];
614 if (dgAbsf (factor) > 1.0e-6f) {
615 for (i = j; i < m_rowCount; i ++) {
616 rowJ[i] -= rowK[i] * factor;
617 #ifdef DG_COUNT_FLOAT_OPS
618 memCount += 1;
619 floatCount += 2;
620 #endif
621 }
622 }
623 }
624
625 factor = rowJ[j];
626 if (factor <= T (0.0f)) {
627 if (factor <= T(-5.0e-4f)) {
628 return false;
629 }
630 factor = T(1.0e-12f);
631 }
632
633 factor = T (dgFloat64 (1.0) / T (sqrt (factor)));
634 rowJ[j] = factor;
635 factor = T(1.0f / factor);
636
637 #ifdef DG_COUNT_FLOAT_OPS
638 memCount += 1;
639 floatCount += 1;
640 #endif
641
642 for (k = j + 1; k < m_rowCount; k ++) {
643 rowJ[k] *= factor;
644 #ifdef DG_COUNT_FLOAT_OPS
645 memCount += 1;
646 floatCount += 1;
647 #endif
648 }
649 }
650
651 #ifdef DG_COUNT_FLOAT_OPS
652 dgGeneralVector<T>::SetMemWrites(memCount);
653 dgGeneralVector<T>::SetFloatOps(floatCount);
654 #endif
655
656 return true;
657 }
658
659
660 #endif
661
dgGeneralVector.h
dgGeneralVector
Definition: dgGeneralVector.h:34
dgGeneralMatrix::dgGeneralMatrix
dgGeneralMatrix(dgInt32 row, dgInt32 column)
Definition: dgGeneralMatrix.h:107
dgGeneralMatrix::m_rows
dgGeneralVector< T > * m_rows
Definition: dgGeneralMatrix.h:94
dgAbsf
DG_INLINE dgFloat32 dgAbsf(dgFloat32 x)
Definition: dgTypes.h:627
dgGeneralMatrix::MatrixTimeMatrix
void MatrixTimeMatrix(const dgGeneralMatrix< T > &A, const dgGeneralMatrix< T > &B)
Definition: dgGeneralMatrix.h:370
dgDebug.h
dgGeneralMatrix::m_ownMemory
bool m_ownMemory
Definition: dgGeneralMatrix.h:91
dgAssert
#define dgAssert(x)
Definition: dgTypes.h:158
dgInt32
int dgInt32
Definition: dgTypes.h:218
dgGeneralMatrix::m_rowCount
dgInt32 m_rowCount
Definition: dgGeneralMatrix.h:92
dgSwap
DG_INLINE void dgSwap(T &A, T &B)
Definition: dgTypes.h:323
dgGeneralMatrix::operator[]
dgGeneralVector< T > & operator[](dgInt32 i)
Definition: dgGeneralMatrix.h:233
dgGeneralMatrix::TestSymetry
bool TestSymetry() const
Definition: dgGeneralMatrix.h:554
dgFloat64
double dgFloat64
Definition: dgTypes.h:224
dgGeneralMatrix::GetColCount
dgInt32 GetColCount() const
Definition: dgGeneralMatrix.h:214
dgGeneralVector::m_colCount
dgInt32 m_colCount
Definition: dgGeneralVector.h:76
dgGeneralVector::GetMemWrites
static dgInt32 GetMemWrites()
Definition: dgGeneralVector.h:156
dgGeneralMatrix::GetRowCount
dgInt32 GetRowCount() const
Definition: dgGeneralMatrix.h:208
dgGeneralMatrix::Solve
bool Solve(dgGeneralVector< T > &b, T tol=T(0.0f))
Definition: dgGeneralMatrix.h:453
dgGeneralMatrix::TestPSD
bool TestPSD() const
Definition: dgGeneralMatrix.h:575
dgGeneralMatrix::GaussianPivotStep
void GaussianPivotStep(dgInt32 srcRow, dgInt32 pivotRow, dgInt32 pivotCol, T tol=T(1.0e-6f))
Definition: dgGeneralMatrix.h:292
dgStdafx.h
dgGeneralMatrix::MatrixTimeMatrixTranspose
void MatrixTimeMatrixTranspose(const dgGeneralMatrix< T > &A, const dgGeneralMatrix< T > &Bt)
Definition: dgGeneralMatrix.h:409
dgGeneralMatrix::SwapColumns
void SwapColumns(dgInt32 i, dgInt32 j)
Definition: dgGeneralMatrix.h:539
dgGeneralMatrix::VectorTimeMatrix
void VectorTimeMatrix(const dgGeneralVector< T > &v, dgGeneralVector< T > &out)
Definition: dgGeneralMatrix.h:323
dgGeneralMatrix::SwapRows
void SwapRows(dgInt32 i, dgInt32 j)
Definition: dgGeneralMatrix.h:528
dgGeneralMatrix::CholeskyDecomposition
bool CholeskyDecomposition()
Definition: dgGeneralMatrix.h:588
dgUnsigned32
unsigned dgUnsigned32
Definition: dgTypes.h:219
dgGeneralMatrix::MatrixTimeVectorTranspose
void MatrixTimeVectorTranspose(const dgGeneralVector< T > &v, dgGeneralVector< T > &out)
Definition: dgGeneralMatrix.h:356
dgGeneralVector::SetFloatOps
static void SetFloatOps(dgInt32 initialCount=0)
Definition: dgGeneralVector.h:149
dgGeneralMatrix
Definition: dgGeneralMatrix.h:41
dgGeneralMatrix::Trace
void Trace() const
Definition: dgGeneralMatrix.h:221
dgGeneralMatrix::m_colCount
dgInt32 m_colCount
Definition: dgGeneralMatrix.h:93
dgGeneralMatrixCalcBufferSizeInBytes
dgInt32 dgGeneralMatrixCalcBufferSizeInBytes(dgInt32 row, dgInt32 column)
Definition: dgGeneralMatrix.h:32
dgGeneralVector::DotProduct
T DotProduct(const dgGeneralVector &b) const
Definition: dgGeneralVector.h:216
dgGeneralMatrix::Identity
void Identity()
Definition: dgGeneralMatrix.h:258
dgGeneralMatrix::~dgGeneralMatrix
~dgGeneralMatrix()
Definition: dgGeneralMatrix.h:198
dgGeneralMatrix::Clear
void Clear(T val)
Definition: dgGeneralMatrix.h:249
dgGeneralVector::SetMemWrites
static void SetMemWrites(dgInt32 initialCount=0)
Definition: dgGeneralVector.h:163
dgGeneralVector::GetFloatOps
static dgInt32 GetFloatOps()
Definition: dgGeneralVector.h:143