org.jcae.mesh.amibe.metrics
Class Matrix3D

java.lang.Object
  extended by org.jcae.mesh.amibe.metrics.Matrix3D
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Metric3D

public class Matrix3D
extends java.lang.Object
implements java.io.Serializable

General 3D matrix.

See Also:
Serialized Form

Field Summary
protected  double[] data
           
 
Constructor Summary
Matrix3D()
          Create a Matrix3D instance and set it to the identity matrix.
Matrix3D(double[] e1, double[] e2, double[] e3)
          Create a Matrix3D instance from three column vectors.
 
Method Summary
 void apply(double[] in, double[] out)
           
static double computeNormal3D(double[] p0, double[] p1, double[] p2, double[] tempD1, double[] tempD2, double[] ret)
           
static double computeNormal3DT(double[] p0, double[] p1, double[] p2, double[] tempD1, double[] tempD2, double[] ret)
           
protected  void copyColumn(int i, double[] dest)
           
 Matrix3D multL(Matrix3D A)
          Create a Matrix3D instance containing the multiplication of another Matrix3D instance by this one.
 Matrix3D multR(Matrix3D A)
          Create a Matrix3D instance containing the multiplication of this Matrix3D instance by another one.
static double norm(double[] A)
          Return the Euclidian norm of a 3D vector.
static double prodSca(double[] A, double[] B)
          Return the dot product between two 3D vectors.
static void prodVect3D(double[] v1, double[] v2, double[] ret)
          Return the outer product of two 3D vectors.
 void reset()
          Reset all coefficients to zero.
 void saxpby0(double l1, Matrix3D a, double l2, Matrix3D b)
           
protected  void scale(double f)
          Multiply all matrix coefficients by a factor.
protected  void setDiagonal(double d1, double d2, double d3)
          Set diagonal coefficients.
protected  void swap(int i, int j)
           
 java.lang.String toString()
           
 void transp()
          Transpose current matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

protected double[] data
Constructor Detail

Matrix3D

public Matrix3D()
Create a Matrix3D instance and set it to the identity matrix.


Matrix3D

public Matrix3D(double[] e1,
                double[] e2,
                double[] e3)
Create a Matrix3D instance from three column vectors.

Parameters:
e1 - first column.
e2 - second column.
e3 - third column.
Method Detail

reset

public void reset()
Reset all coefficients to zero.


transp

public void transp()
Transpose current matrix.


multR

public Matrix3D multR(Matrix3D A)
Create a Matrix3D instance containing the multiplication of this Matrix3D instance by another one.

Parameters:
A - another Matrix3D
Returns:
a new Matrix3D containing the multiplication this*A

multL

public Matrix3D multL(Matrix3D A)
Create a Matrix3D instance containing the multiplication of another Matrix3D instance by this one.

Parameters:
A - another Matrix3D
Returns:
a new Matrix3D containing the multiplication A*this

apply

public void apply(double[] in,
                  double[] out)

scale

protected void scale(double f)
Multiply all matrix coefficients by a factor.

Parameters:
f - scale factor

setDiagonal

protected void setDiagonal(double d1,
                           double d2,
                           double d3)
Set diagonal coefficients.

Parameters:
d1 - first diagonal coefficient
d2 - second diagonal coefficient
d3 - third diagonal coefficient

saxpby0

public void saxpby0(double l1,
                    Matrix3D a,
                    double l2,
                    Matrix3D b)

swap

protected final void swap(int i,
                          int j)

copyColumn

protected final void copyColumn(int i,
                                double[] dest)

prodSca

public static double prodSca(double[] A,
                             double[] B)
Return the dot product between two 3D vectors.

Parameters:
A - first 3D vector
B - second 3D vector
Returns:
the dot product between the two vectors.

norm

public static double norm(double[] A)
Return the Euclidian norm of a 3D vector.

Parameters:
A - 3D vector.
Returns:
the Euclidian norm of A.

prodVect3D

public static void prodVect3D(double[] v1,
                              double[] v2,
                              double[] ret)
Return the outer product of two 3D vectors.

Parameters:
v1 - first vector
v2 - second vector
ret - allocated array to store the output product.

computeNormal3D

public static final double computeNormal3D(double[] p0,
                                           double[] p1,
                                           double[] p2,
                                           double[] tempD1,
                                           double[] tempD2,
                                           double[] ret)

computeNormal3DT

public static final double computeNormal3DT(double[] p0,
                                            double[] p1,
                                            double[] p2,
                                            double[] tempD1,
                                            double[] tempD2,
                                            double[] ret)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object