maspack.matrix
Class Matrix6x1

java.lang.Object
  extended by maspack.matrix.MatrixBase
      extended by maspack.matrix.DenseMatrixBase
          extended by maspack.matrix.Matrix6x1
All Implemented Interfaces:
DenseMatrix, LinearTransformNd, Matrix
Direct Known Subclasses:
Matrix6x1Block

public class Matrix6x1
extends DenseMatrixBase

Implements a 6 x 1 matrix


Nested Class Summary
 
Nested classes/interfaces inherited from interface maspack.matrix.Matrix
Matrix.Partition, Matrix.WriteFormat
 
Field Summary
 double m00
           
 double m10
           
 double m20
           
 double m30
           
 double m40
           
 double m50
           
static Matrix6x1 ZERO
          Global zero matrix.
 
Fields inherited from interface maspack.matrix.Matrix
INDEFINITE, POSITIVE_DEFINITE, SPD, SYMMETRIC
 
Constructor Summary
Matrix6x1()
          Creates a new Matrix6x1.
 
Method Summary
 void add(Matrix M)
          Adds this matrix to M and places the result in this matrix.
 void add(Matrix6x1 M)
          Adds the contents of a Matrix6x1 to this matrix block.
 Matrix6x1 clone()
          Creates a clone of this matrix.
 int colSize()
          Number of columns in the matrix associated with this transformation.
 double dot(Matrix6x1 M)
          Returns the dot product of the elements of this matrix with a another 6 x 1 matrix.
 double dot(Vector3d v1, Vector3d v2)
          Returns the dot product of the elements of this matrix with a 6-element vector formed from two 3-element vectors.
 double get(int i, int j)
          Gets a single element of this matrix.
 void get(Vector3d v1, Vector3d v2)
          Gets the contents of this Matrix6x1 into two Vector3ds.
 void mul(Matrix6d M1, Matrix6x1 M2)
          Forms the product of a 6x6 matrix with a 6x1 matrix and places the result in this matrix.
 int rowSize()
          Number of rows in the matrix associated with this transformation.
 void scale(double s)
          Scales the elements of this matrix by s.
 void scaledAdd(double s, Matrix M)
          Scales the matrix M and add the result to this matrix.
 void scaledAdd(double s, Matrix6x1 M)
          Adds the scaled contents of a Matrix6x1 to this matrix block.
 void set(int i, int j, double value)
          Sets a single element of this matrix.
 void set(Matrix M)
          Sets the size and values of this matrix to those of another matrix.
 void set(Matrix6x1 M)
          Sets the contents of this Matrix6x1 to those of a specified block.
 void set(Vector3d v1, Vector3d v2)
          Sets the contents of this Matrix6x1 from two Vector3ds.
 void setWrench(Vector3d nrm, Vector3d pnt)
          Sets the contents of this Matrix6x1 to the wrench produced from nrm and pnt.
 void setZero()
          Sets the elements of this matrix to zero.
 void sub(Matrix M)
          Subtracts this matrix from M and places the result in this matrix.
 void sub(Matrix6x1 M)
          Subtracts the contents of a Matrix6x1 from this matrix block.
 void transform(RotationMatrix3d R)
          Transforms the first three and last three elements of this Matrix6x1 into a new coordinate system specified by a rotation matrix R.
 java.lang.String transposeToString()
           
 java.lang.String transposeToString(NumberFormat fmt)
           
 java.lang.String transposeToString(java.lang.String fmtStr)
           
 
Methods inherited from class maspack.matrix.DenseMatrixBase
add, checkConsistency, set, set, set, set, setCCSValues, setColumn, setColumn, setCRSValues, setRow, setRow, setSubMatrix
 
Methods inherited from class maspack.matrix.MatrixBase
containsNaN, determinant, epsilonEquals, equals, frobeniusNorm, get, get, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getColumn, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getDefaultFormat, getRow, getRow, getRow, getSize, getSubMatrix, hasNaN, idString, infinityNorm, isFixedSize, isSymmetric, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, scan, setCRSValues, setDefaultFormat, setSize, toString, toString, toString, trace, write, write, write, write, write, writeToFile
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface maspack.matrix.Matrix
determinant, epsilonEquals, equals, frobeniusNorm, get, getCCSIndices, getCCSIndices, getCCSValues, getCCSValues, getColumn, getColumn, getColumn, getCRSIndices, getCRSIndices, getCRSValues, getCRSValues, getRow, getRow, getRow, getSize, getSubMatrix, infinityNorm, isFixedSize, isSymmetric, mul, mul, mul, mulAdd, mulAdd, mulAdd, mulTranspose, mulTranspose, mulTranspose, mulTransposeAdd, mulTransposeAdd, mulTransposeAdd, numNonZeroVals, numNonZeroVals, oneNorm, scan, setSize, toString, trace, write, write, write
 

Field Detail

m00

public double m00

m10

public double m10

m20

public double m20

m30

public double m30

m40

public double m40

m50

public double m50

ZERO

public static final Matrix6x1 ZERO
Global zero matrix. Should not be modified.

Constructor Detail

Matrix6x1

public Matrix6x1()
Creates a new Matrix6x1.

Method Detail

rowSize

public int rowSize()
Number of rows in the matrix associated with this transformation. This will equal the size of the output vector in mul.

Specified by:
rowSize in interface LinearTransformNd
Specified by:
rowSize in interface Matrix
Specified by:
rowSize in class MatrixBase
Returns:
number of rows

colSize

public int colSize()
Number of columns in the matrix associated with this transformation. This will equal the size of the input vector in mul.

Specified by:
colSize in interface LinearTransformNd
Specified by:
colSize in interface Matrix
Specified by:
colSize in class MatrixBase
Returns:
number of columns

get

public double get(int i,
                  int j)
Gets a single element of this matrix.

Specified by:
get in interface Matrix
Specified by:
get in class MatrixBase
Parameters:
i - element row index
j - element column index
Returns:
element value

get

public void get(Vector3d v1,
                Vector3d v2)
Gets the contents of this Matrix6x1 into two Vector3ds.

Parameters:
v1 - vector to return first three elements in
v2 - vector to return second three elements in

set

public void set(int i,
                int j,
                double value)
Sets a single element of this matrix.

Specified by:
set in interface DenseMatrix
Specified by:
set in class DenseMatrixBase
Parameters:
i - element row index
j - element column index
value - element value

setZero

public void setZero()
Sets the elements of this matrix to zero.


set

public void set(Matrix M)
Sets the size and values of this matrix to those of another matrix.

Specified by:
set in interface Matrix
Overrides:
set in class DenseMatrixBase
Parameters:
M - matrix whose size and values are copied

set

public void set(Matrix6x1 M)
Sets the contents of this Matrix6x1 to those of a specified block.

Parameters:
M - matrix block providing new values

set

public void set(Vector3d v1,
                Vector3d v2)
Sets the contents of this Matrix6x1 from two Vector3ds.

Parameters:
v1 - vector providing first three values
v2 - vector providing second three values

setWrench

public void setWrench(Vector3d nrm,
                      Vector3d pnt)
Sets the contents of this Matrix6x1 to the wrench produced from nrm and pnt. The first three elements are set to nrm, and the last three elements are set to pnt x nrm.

Parameters:
nrm - normal vector used to form the wrench
pnt - point used to form the wrench

transform

public void transform(RotationMatrix3d R)
Transforms the first three and last three elements of this Matrix6x1 into a new coordinate system specified by a rotation matrix R.

Parameters:
R - Rotation matrix specifying the rotation

mul

public void mul(Matrix6d M1,
                Matrix6x1 M2)
Forms the product of a 6x6 matrix with a 6x1 matrix and places the result in this matrix.

Parameters:
M1 - 6x6 matrix
M2 - 6x1 matrix

scale

public void scale(double s)
Scales the elements of this matrix by s.

Parameters:
s - scaling factor

add

public void add(Matrix M)
Adds this matrix to M and places the result in this matrix.

Parameters:
M - right-hand matrix
Throws:
ImproperSizeException - if this matrix and M have different sizes

scaledAdd

public void scaledAdd(double s,
                      Matrix M)
Scales the matrix M and add the result to this matrix.

Parameters:
s - scaling factor
M - matrix to be scaled and added
Throws:
ImproperSizeException - if this matrix and M have different sizes

add

public void add(Matrix6x1 M)
Adds the contents of a Matrix6x1 to this matrix block.

Parameters:
M - matrix block to add

scaledAdd

public void scaledAdd(double s,
                      Matrix6x1 M)
Adds the scaled contents of a Matrix6x1 to this matrix block.

Parameters:
M - matrix block to add

sub

public void sub(Matrix M)
Subtracts this matrix from M and places the result in this matrix.

Parameters:
M - right-hand matrix
Throws:
ImproperSizeException - if this matrix and M have different sizes

sub

public void sub(Matrix6x1 M)
Subtracts the contents of a Matrix6x1 from this matrix block.

Parameters:
M - matrix block to subtract

dot

public double dot(Vector3d v1,
                  Vector3d v2)
Returns the dot product of the elements of this matrix with a 6-element vector formed from two 3-element vectors.

Parameters:
v1 - first three vector elements
v2 - second three vector elements
Returns:
dot product of this with [v1 v2]

dot

public double dot(Matrix6x1 M)
Returns the dot product of the elements of this matrix with a another 6 x 1 matrix.

Parameters:
M - matrix to take dot product with
Returns:
dot product of this with M

transposeToString

public java.lang.String transposeToString()

transposeToString

public java.lang.String transposeToString(java.lang.String fmtStr)

transposeToString

public java.lang.String transposeToString(NumberFormat fmt)

clone

public Matrix6x1 clone()
Creates a clone of this matrix.

Overrides:
clone in class java.lang.Object