1 /*************************************************************************
2 * D bindings for ODE *
3 * *
4 * C header port by Daniel "q66" Kolesa <quaker66@gmail.com> *
5 * *
6 * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
7 * All rights reserved. Email: russ@q12.org Web: www.q12.org *
8 * *
9 * This library is free software; you can redistribute it and/or *
10 * modify it under the terms of EITHER: *
11 * (1) The GNU Lesser General Public License as published by the Free *
12 * Software Foundation; either version 2.1 of the License, or (at *
13 * your option) any later version. The text of the GNU Lesser *
14 * General Public License is included with this library in the *
15 * file LICENSE.TXT. *
16 * (2) The BSD-style license that is included with this library in *
17 * the file LICENSE-BSD.TXT. *
18 * *
19 * This library is distributed in the hope that it will be useful, *
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
22 * LICENSE.TXT and LICENSE-BSD.TXT for more details. *
23 * *
24 *************************************************************************/25 26 /* miscellaneous math functions. these are mostly useful for testing */27 28 moduledeimos.ode.misc;
29 30 privateimportdeimos.ode.common;
31 privateimportcore.stdc.config;
32 privateimportcore.stdc.stdio: FILE;
33 34 extern (C):
35 nothrow:
36 37 /* return 1 if the random number generator is working. */38 intdTestRand();
39 40 /* return next 32 bit random number. this uses a not-very-random linear
41 * congruential method.
42 */43 c_ulongdRand();
44 45 /* get and set the current random number seed. */46 c_ulongdRandGetSeed();
47 voiddRandSetSeed(c_ulongs);
48 49 /* return a random integer between 0..n-1. the distribution will get worse
50 * as n approaches 2^32.
51 */52 intdRandInt(intn);
53 54 /* return a random real number between 0..1 */55 dRealdRandReal();
56 57 /* print out a matrix */58 voiddPrintMatrix(indReal* A, intn, intm, char* fmt, FILE* f);
59 60 /* make a random vector with entries between +/- range. A has n elements. */61 voiddMakeRandomVector(dReal* A, intn, dRealrange);
62 63 /* make a random matrix with entries between +/- range. A has size n*m. */64 voiddMakeRandomMatrix(dReal* A, intn, intm, dRealrange);
65 66 /* clear the upper triangle of a square matrix */67 voiddClearUpperTriangle(dReal* A, intn);
68 69 /* return the maximum element difference between the two n*m matrices */70 dRealdMaxDifference(indReal* A, indReal* B, intn, intm);
71 72 /* return the maximum element difference between the lower triangle of two
73 * n*n matrices */74 dRealdMaxDifferenceLowerTriangle(indReal* A, indReal* B, intn);