net.java.dev.joode.util
Class MathUtils

java.lang.Object
  extended by net.java.dev.joode.util.MathUtils

public class MathUtils
extends java.lang.Object

Some comment conventions I use, to keep it simple:
A.B := the dotproduct between a and b
A x B := the crossproduct between a and b

Author:
Tom Larkworthy

Field Summary
static float M_SQRT1_2
           
static java.util.Random rnd
           
static RealPointer tmpA
           
static RealPointer tmpAA
           
static RealPointer tmpB
           
static RealPointer tmpBB
           
static RealPointer tmpC
           
static RealPointer tmpCC
           
static RealPointer tmpD
           
 
Constructor Summary
MathUtils()
           
 
Method Summary
static void dCROSS_EQUAL_MINUS(RealPointer a, Real b, Real c)
          a -= b x c
static void dCROSS_MINUSEQUAL(RealPointer a, RealPointer b, RealPointer c)
          a -= b x c
static void dCROSS_MINUSEQUAL(Real a, Real b, Real c)
          a -= b x c
static void dCROSSMAT_MINUS_PLUS(RealPointer A, RealPointer a, int skip)
          sets matrix a that is packed with row width s to be the skew-symetric matrix that represents the NEGATIVE cross product of a Vector3#bar(Matrix3);
static void dCROSSMAT_PLUS_MINUS(Matrix3 A, Vector3 a, int skip)
           
static void dCROSSMAT_PLUS_MINUS(RealPointer A, RealPointer a, int skip)
          sets matrix a that is packed with row width s to be the skew-symetric matrix that represents the posative cross product of a
static float dDOTpq(Real a, Real b, int s1, int s2, int p, int q)
          3-way dot product.
static boolean dFactorCholesky(RealPointer A, int n)
          might not work!!
static boolean dIsPositiveDefinite(Matrix a, int n)
          Tests whether a submatrix is positive definite.
static void dMULTIPLY0_331(RealPointer A, RealPointer B, Real C)
          calculates A = B mul C, where C is an Vector
static void dMULTIPLY0_331(RealPointer A, RealPointer B, RealPointer C)
          calculates A = B mul C, where C is an Vector
static void dMULTIPLY0_331(Real A, RealPointer B, Real C)
          calculates A = B mul C, where C is an Vector
static void dMULTIPLY0_331(Real A, Real B, Real C)
          calculates A = B mul C, where C is an Vector
static void dMULTIPLY0_331(Real A, Real B, Real C, int as, int bs, int cs)
          calculates A = B mul C, where C is an Vector
static void dMULTIPLY0_333(RealPointer A, RealPointer B, RealPointer C)
          calculates A = B mul C
static void dMULTIPLY0_333(RealPointer A, Real B, Real C)
          calculates A = B mul C
static void dMULTIPLY0_333(RealPointer A, Real B, RealPointer C)
          calculates A = B mul C
static void dMULTIPLY0_333(Real A, Real B, Real C, int as, int bs, int cs)
          calculates A = B mul C
static void dMultiply0(RealPointer A, RealPointer B, RealPointer C, int p, int q, int r)
          Matrix Operation: A = B' * C
static void dMULTIPLY1_331(Real A, Real B, Real C)
          calculates first row of A = C mul B
static void dMultiply1(RealPointer A, RealPointer B, RealPointer C, int p, int q, int r)
          Matrix Operation: A = B * C
static void dMULTIPLY2_333(RealPointer A, Real B, Real C)
          calculates A = B mul transpose(C)
static void dMULTIPLY2_333(Real A, Real B, Real C, int as, int bs, int cs)
          calculates A = B mul transpose(C)
static void dMultiply2(RealPointer A, RealPointer B, RealPointer C, int p, int q, int r)
          Matrix Operation: A = B * C'
static void dMULTIPLYADD0_331(Real A, Real B, Real C)
          calculates first row of A += C mul transpose(B)
static void dMULTIPLYADD0_331(Real A, Real B, Real C, int as, int bs, int cs)
          calculates first row of A += C mul transpose(B)
static void dSolveCholesky(RealPointer L, RealPointer b, int n)
          might not work!!
static void dSolveL1T(RealPointer L, RealPointer b, int n, int nskip)
          this has been replaced by a faster version
static void dSolveLDLT(RealPointer L, RealPointer d, RealPointer b, int n, int nskip)
          ?
static Jama.Matrix toJAMAMatrix(Matrix a)
          Converts a JOODE Matrix to a JAMA one.
static Jama.Matrix toJAMAMatrix(RealPointer rp, int numColumns, int numRows)
          helper function for converting from ODE matrix representations to JAMA representations is this really correct?
static Jama.Matrix toJAMAReversePackingMatrix(RealPointer rp, int numColumns, int numRows)
          helper function for converting from ODE matrix representations to JAMA representations
static RealPointer toODEMatrix(Jama.Matrix matrix)
          helper function for converting from ODE matrix representations to JAMA representations
static Vector3 toODEVector(Vector3f vec)
          transforms a vecmath Vector3f to a Vector3
static Matrix3f toVectorMathMatrix3f(Matrix3 rot)
          transforms a Matrix3 to a vecmath Vector3f
static Vector3f toVectorMathVector3f(Vector3 vec)
          transforms a Vector3 to a vecmath Vector3f
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M_SQRT1_2

public static final float M_SQRT1_2
See Also:
Constant Field Values

rnd

public static java.util.Random rnd

tmpA

public static final RealPointer tmpA

tmpB

public static final RealPointer tmpB

tmpC

public static final RealPointer tmpC

tmpAA

public static final RealPointer tmpAA

tmpBB

public static final RealPointer tmpBB

tmpCC

public static final RealPointer tmpCC

tmpD

public static final RealPointer tmpD
Constructor Detail

MathUtils

public MathUtils()
Method Detail

dDOTpq

public static float dDOTpq(Real a,
                           Real b,
                           int s1,
                           int s2,
                           int p,
                           int q)
3-way dot product. dDOTpq means that elements of `a' and `b' are spaced p and q indexes apart respectively. starting at s1 & s2.

Parameters:
a -
b -
s1 - start index
s2 - start index
p - step size
q - step size

dCROSS_MINUSEQUAL

public static void dCROSS_MINUSEQUAL(Real a,
                                     Real b,
                                     Real c)
a -= b x c


dCROSS_MINUSEQUAL

public static void dCROSS_MINUSEQUAL(RealPointer a,
                                     RealPointer b,
                                     RealPointer c)
a -= b x c

Parameters:
a -
b -
c -

dCROSS_EQUAL_MINUS

public static void dCROSS_EQUAL_MINUS(RealPointer a,
                                      Real b,
                                      Real c)
a -= b x c

Parameters:
a -
b -
c -

dCROSSMAT_PLUS_MINUS

public static void dCROSSMAT_PLUS_MINUS(Matrix3 A,
                                        Vector3 a,
                                        int skip)

dCROSSMAT_PLUS_MINUS

public static void dCROSSMAT_PLUS_MINUS(RealPointer A,
                                        RealPointer a,
                                        int skip)
sets matrix a that is packed with row width s to be the skew-symetric matrix that represents the posative cross product of a

Parameters:
A -
a -
skip -
See Also:
Vector3.bar(Matrix3);

dCROSSMAT_MINUS_PLUS

public static void dCROSSMAT_MINUS_PLUS(RealPointer A,
                                        RealPointer a,
                                        int skip)
sets matrix a that is packed with row width s to be the skew-symetric matrix that represents the NEGATIVE cross product of a Vector3#bar(Matrix3);

Parameters:
A -
a -
skip -

dMULTIPLY0_331

public static void dMULTIPLY0_331(Real A,
                                  Real B,
                                  Real C)
calculates A = B mul C, where C is an Vector

See Also:
dMULTIPLYOP0_EQUAL_331(Real, Real, Real, int, int, int)

dMULTIPLY0_331

public static void dMULTIPLY0_331(RealPointer A,
                                  RealPointer B,
                                  RealPointer C)
calculates A = B mul C, where C is an Vector

See Also:
dMULTIPLYOP0_EQUAL_331(Real, Real, Real, int, int, int)

dMULTIPLY0_331

public static void dMULTIPLY0_331(Real A,
                                  RealPointer B,
                                  Real C)
calculates A = B mul C, where C is an Vector

See Also:
dMULTIPLYOP0_EQUAL_331(Real, Real, Real, int, int, int)

dMULTIPLY0_331

public static void dMULTIPLY0_331(Real A,
                                  Real B,
                                  Real C,
                                  int as,
                                  int bs,
                                  int cs)
calculates A = B mul C, where C is an Vector

See Also:
dMULTIPLYOP0_EQUAL_331(Real, Real, Real, int, int, int)

dMULTIPLY0_331

public static void dMULTIPLY0_331(RealPointer A,
                                  RealPointer B,
                                  Real C)
calculates A = B mul C, where C is an Vector

See Also:
dMULTIPLYOP0_EQUAL_331(Real, Real, Real, int, int, int)

dMULTIPLY1_331

public static void dMULTIPLY1_331(Real A,
                                  Real B,
                                  Real C)
calculates first row of A = C mul B

See Also:
dMULTIPLYOP1_EQUAL_331(Real, Real, Real, int, int, int)

dMULTIPLY0_333

public static void dMULTIPLY0_333(Real A,
                                  Real B,
                                  Real C,
                                  int as,
                                  int bs,
                                  int cs)
calculates A = B mul C

See Also:
dMULTIPLYOP0_EQUAL_333(Real, Real, Real, int, int, int)

dMULTIPLY0_333

public static void dMULTIPLY0_333(RealPointer A,
                                  RealPointer B,
                                  RealPointer C)
calculates A = B mul C

See Also:
dMULTIPLYOP0_EQUAL_333(Real, Real, Real, int, int, int)

dMULTIPLY0_333

public static void dMULTIPLY0_333(RealPointer A,
                                  Real B,
                                  Real C)
calculates A = B mul C

See Also:
dMULTIPLYOP0_EQUAL_333(Real, Real, Real, int, int, int)

dMULTIPLY0_333

public static void dMULTIPLY0_333(RealPointer A,
                                  Real B,
                                  RealPointer C)
calculates A = B mul C

See Also:
dMULTIPLYOP0_EQUAL_333(Real, Real, Real, int, int, int)

dMULTIPLY2_333

public static void dMULTIPLY2_333(RealPointer A,
                                  Real B,
                                  Real C)
calculates A = B mul transpose(C)

See Also:
dMULTIPLYOP2_EQUAL_333(Real, Real, Real, int, int, int)

dMULTIPLY2_333

public static void dMULTIPLY2_333(Real A,
                                  Real B,
                                  Real C,
                                  int as,
                                  int bs,
                                  int cs)
calculates A = B mul transpose(C)

See Also:
dMULTIPLYOP2_EQUAL_333(Real, Real, Real, int, int, int)

dMULTIPLYADD0_331

public static void dMULTIPLYADD0_331(Real A,
                                     Real B,
                                     Real C)
calculates first row of A += C mul transpose(B)

See Also:
dMULTIPLYOP0_ADDEQUAL_331(Real, Real, Real, int, int, int)

dMULTIPLYADD0_331

public static void dMULTIPLYADD0_331(Real A,
                                     Real B,
                                     Real C,
                                     int as,
                                     int bs,
                                     int cs)
calculates first row of A += C mul transpose(B)

See Also:
dMULTIPLYOP0_ADDEQUAL_331(Real, Real, Real, int, int, int)

dMultiply0

public static void dMultiply0(RealPointer A,
                              RealPointer B,
                              RealPointer C,
                              int p,
                              int q,
                              int r)
Matrix Operation: A = B' * C


dMultiply1

public static void dMultiply1(RealPointer A,
                              RealPointer B,
                              RealPointer C,
                              int p,
                              int q,
                              int r)
Matrix Operation: A = B * C

See Also:
Matrix.mul(Real)

dMultiply2

public static void dMultiply2(RealPointer A,
                              RealPointer B,
                              RealPointer C,
                              int p,
                              int q,
                              int r)
Matrix Operation: A = B * C'


dFactorCholesky

public static boolean dFactorCholesky(RealPointer A,
                                      int n)
might not work!!


dSolveCholesky

public static void dSolveCholesky(RealPointer L,
                                  RealPointer b,
                                  int n)
might not work!!


dIsPositiveDefinite

public static boolean dIsPositiveDefinite(Matrix a,
                                          int n)
Tests whether a submatrix is positive definite. This tests the upper-left nxn submatrix of matrix a.

Parameters:
a - the matrix containing the submatrix to be tested
n - the size of the submatrix to be tested
Returns:
true if the submatrix is positive definite, and false otherwise

dSolveL1T

public static void dSolveL1T(RealPointer L,
                             RealPointer b,
                             int n,
                             int nskip)
this has been replaced by a faster version


dSolveLDLT

public static void dSolveLDLT(RealPointer L,
                              RealPointer d,
                              RealPointer b,
                              int n,
                              int nskip)
?

Parameters:
L -
d -
b -
n -
nskip -

toJAMAMatrix

public static final Jama.Matrix toJAMAMatrix(RealPointer rp,
                                             int numColumns,
                                             int numRows)
helper function for converting from ODE matrix representations to JAMA representations is this really correct?

Parameters:
rp -
Returns:

toJAMAMatrix

public static Jama.Matrix toJAMAMatrix(Matrix a)
Converts a JOODE Matrix to a JAMA one.


toODEMatrix

public static final RealPointer toODEMatrix(Jama.Matrix matrix)
helper function for converting from ODE matrix representations to JAMA representations

Returns:

toJAMAReversePackingMatrix

public static final Jama.Matrix toJAMAReversePackingMatrix(RealPointer rp,
                                                           int numColumns,
                                                           int numRows)
helper function for converting from ODE matrix representations to JAMA representations

Parameters:
rp -
Returns:

toVectorMathMatrix3f

public static final Matrix3f toVectorMathMatrix3f(Matrix3 rot)
transforms a Matrix3 to a vecmath Vector3f

Parameters:
rot -
Returns:

toVectorMathVector3f

public static final Vector3f toVectorMathVector3f(Vector3 vec)
transforms a Vector3 to a vecmath Vector3f

Parameters:
vec -
Returns:

toODEVector

public static final Vector3 toODEVector(Vector3f vec)
transforms a vecmath Vector3f to a Vector3

Parameters:
vec -
Returns: