aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ode-0.9/ode/src/mat.h
diff options
context:
space:
mode:
authordan miller2007-10-19 05:20:48 +0000
committerdan miller2007-10-19 05:20:48 +0000
commitd48ea5bb797037069d641da41da0f195f0124491 (patch)
tree40ff433d94859d629aac933d5ec73b382f62ba1a /libraries/ode-0.9/ode/src/mat.h
parentdont ask (diff)
downloadopensim-SC-d48ea5bb797037069d641da41da0f195f0124491.zip
opensim-SC-d48ea5bb797037069d641da41da0f195f0124491.tar.gz
opensim-SC-d48ea5bb797037069d641da41da0f195f0124491.tar.bz2
opensim-SC-d48ea5bb797037069d641da41da0f195f0124491.tar.xz
one more for the gipper
Diffstat (limited to 'libraries/ode-0.9/ode/src/mat.h')
-rw-r--r--libraries/ode-0.9/ode/src/mat.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/libraries/ode-0.9/ode/src/mat.h b/libraries/ode-0.9/ode/src/mat.h
new file mode 100644
index 0000000..2814a01
--- /dev/null
+++ b/libraries/ode-0.9/ode/src/mat.h
@@ -0,0 +1,71 @@
1/*************************************************************************
2 * *
3 * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith. *
4 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
5 * *
6 * This library is free software; you can redistribute it and/or *
7 * modify it under the terms of EITHER: *
8 * (1) The GNU Lesser General Public License as published by the Free *
9 * Software Foundation; either version 2.1 of the License, or (at *
10 * your option) any later version. The text of the GNU Lesser *
11 * General Public License is included with this library in the *
12 * file LICENSE.TXT. *
13 * (2) The BSD-style license that is included with this library in *
14 * the file LICENSE-BSD.TXT. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
19 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
20 * *
21 *************************************************************************/
22
23// matrix class. this is mostly for convenience in the testing code, it is
24// not optimized at all. correctness is much more importance here.
25
26#ifndef _ODE_MAT_H_
27#define _ODE_MAT_H_
28
29#include <ode/common.h>
30
31
32class dMatrix {
33 int n,m; // matrix dimension, n,m >= 0
34 dReal *data; // if nonzero, n*m elements allocated on the heap
35
36public:
37 // constructors, destructors
38 dMatrix(); // make default 0x0 matrix
39 dMatrix (int rows, int cols); // construct zero matrix of given size
40 dMatrix (const dMatrix &); // construct copy of given matrix
41 // create copy of given data - element (i,j) is data[i*rowskip+j*colskip]
42 dMatrix (int rows, int cols, dReal *_data, int rowskip, int colskip);
43 ~dMatrix(); // destructor
44
45 // data movement
46 dReal & operator () (int i, int j); // reference an element
47 void operator= (const dMatrix &); // matrix = matrix
48 void operator= (dReal); // matrix = scalar
49 dMatrix transpose(); // return transposed matrix
50 // return a permuted submatrix of this matrix, made up of the rows in p
51 // and the columns in q. p has np elements, q has nq elements.
52 dMatrix select (int np, int *p, int nq, int *q);
53
54 // operators
55 dMatrix operator + (const dMatrix &);
56 dMatrix operator - (const dMatrix &);
57 dMatrix operator - ();
58 dMatrix operator * (const dMatrix &);
59 void operator += (const dMatrix &);
60 void operator -= (const dMatrix &);
61
62 // utility
63 void clearUpperTriangle();
64 void clearLowerTriangle();
65 void makeRandom (dReal range);
66 void print (char *fmt = "%10.4f ", FILE *f=stdout);
67 dReal maxDifference (const dMatrix &);
68};
69
70
71#endif