diff options
author | dan miller | 2007-10-19 05:15:33 +0000 |
---|---|---|
committer | dan miller | 2007-10-19 05:15:33 +0000 |
commit | 79eca25c945a535a7a0325999034bae17da92412 (patch) | |
tree | 40ff433d94859d629aac933d5ec73b382f62ba1a /libraries/ode-0.9/include/ode/misc.h | |
parent | adding ode source to /libraries (diff) | |
download | opensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.zip opensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.tar.gz opensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.tar.bz2 opensim-SC_OLD-79eca25c945a535a7a0325999034bae17da92412.tar.xz |
resubmitting ode
Diffstat (limited to '')
-rw-r--r-- | libraries/ode-0.9/include/ode/misc.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/libraries/ode-0.9/include/ode/misc.h b/libraries/ode-0.9/include/ode/misc.h new file mode 100644 index 0000000..0c55fc5 --- /dev/null +++ b/libraries/ode-0.9/include/ode/misc.h | |||
@@ -0,0 +1,85 @@ | |||
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 | /* miscellaneous math functions. these are mostly useful for testing */ | ||
24 | |||
25 | #ifndef _ODE_MISC_H_ | ||
26 | #define _ODE_MISC_H_ | ||
27 | |||
28 | #include <ode/common.h> | ||
29 | |||
30 | |||
31 | #ifdef __cplusplus | ||
32 | extern "C" { | ||
33 | #endif | ||
34 | |||
35 | |||
36 | /* return 1 if the random number generator is working. */ | ||
37 | ODE_API int dTestRand(void); | ||
38 | |||
39 | /* return next 32 bit random number. this uses a not-very-random linear | ||
40 | * congruential method. | ||
41 | */ | ||
42 | ODE_API unsigned long dRand(void); | ||
43 | |||
44 | /* get and set the current random number seed. */ | ||
45 | ODE_API unsigned long dRandGetSeed(void); | ||
46 | ODE_API void dRandSetSeed (unsigned long s); | ||
47 | |||
48 | /* return a random integer between 0..n-1. the distribution will get worse | ||
49 | * as n approaches 2^32. | ||
50 | */ | ||
51 | ODE_API int dRandInt (int n); | ||
52 | |||
53 | /* return a random real number between 0..1 */ | ||
54 | ODE_API dReal dRandReal(void); | ||
55 | |||
56 | /* print out a matrix */ | ||
57 | #ifdef __cplusplus | ||
58 | ODE_API void dPrintMatrix (const dReal *A, int n, int m, char *fmt = "%10.4f ", | ||
59 | FILE *f=stdout); | ||
60 | #else | ||
61 | ODE_API void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f); | ||
62 | #endif | ||
63 | |||
64 | /* make a random vector with entries between +/- range. A has n elements. */ | ||
65 | ODE_API void dMakeRandomVector (dReal *A, int n, dReal range); | ||
66 | |||
67 | /* make a random matrix with entries between +/- range. A has size n*m. */ | ||
68 | ODE_API void dMakeRandomMatrix (dReal *A, int n, int m, dReal range); | ||
69 | |||
70 | /* clear the upper triangle of a square matrix */ | ||
71 | ODE_API void dClearUpperTriangle (dReal *A, int n); | ||
72 | |||
73 | /* return the maximum element difference between the two n*m matrices */ | ||
74 | ODE_API dReal dMaxDifference (const dReal *A, const dReal *B, int n, int m); | ||
75 | |||
76 | /* return the maximum element difference between the lower triangle of two | ||
77 | * n*n matrices */ | ||
78 | ODE_API dReal dMaxDifferenceLowerTriangle (const dReal *A, const dReal *B, int n); | ||
79 | |||
80 | |||
81 | #ifdef __cplusplus | ||
82 | } | ||
83 | #endif | ||
84 | |||
85 | #endif | ||