2.5.10 - A 4x4 Matrix - Jdl4x4

John W. Campbell

2.5.10.1 Introduction

This is a simple class to store a 4x4 matrix. The matrix data may be converted between object and array forms. Methods for inverting the matrix and calculating its determinant are included. Such 4x4 matrices are used in the handling of crystallographic symmetry in the package Jdl.JdlPX. The Jdl4x4 object is cloneable.

Constructor and methods:

Class Details
Accessible Fields
Constructors
Methods

2.5.10.2 Class Details

Package:
Jdl.JdlLib;
Class name:
Jdl4x4
Class definition:
public class Jdl4x4
Extends:
Object
Implements:
Cloneable
Actions:
none

2.5.10.3 Accessible Fields

No fields with public, package or protected access defined.

2.5.10.4 Constructors

2.5.10.4.1 Introduction

Five constructors are available to construct an empty Jdl4x4 object, to create a Jdl4x4 object with element[4][4] set to 1.0, to create a Jdl4x4 object from an array of double values or an array of float values or from another Jdl4x4 object.

Constructors:

Constructor 1
Constructor 2
Constructor 3
Constructor 4
Constructor 5

2.5.10.4.2 Constructor 1

Create a Jdl4x4 matrix object with zeroed elements.

Constructor Definition:
public Jdl4x4 ()
Parameters List:
none

2.5.10.4.3 Constructor 2

Create a Jdl4x4 matrix object with option to specify a type. At present only one type is defined; this sets element [4][4] to 1.0 and zeroes all other elements. If an unknown type is given, all elements will be set to zero.

Constructor Definition:
public Jdl4x4 (String typ)
Parameters List:
typ
Type required t1 (element [4][4] set to 1.0)

2.5.10.4.4 Constructor 3

Create a Jdl4x4 matrix object from the elements of a 4x4 double array.

Constructor Definition:
public Jdl4x4 (double[][] mat)
Parameters List:
mat
The matrix elements in a 4x4 double array.

2.5.10.4.5 Constructor 4

Create a Jdl4x4 matrix object from the elements of a 4x4 float array.

Constructor Definition:
public Jdl4x4 (float[][] mat)
Parameters List:
mat
The matrix elements in a 4x4 float array.

2.5.10.4.6 Constructor 5

Create a Jdl4x4 matrix object from another Jdl4x4 object.

Constructor Definition:
public Jdl4x4 (Jdl4x4 mtx)
Parameters List:
mtx
The Jdl4x4 object from which to create a new matrix object.

2.5.10.5 Methods

2.5.10.5.1 Introduction

This section contains methods to return the matrix data in double or float arrays and to calculate its inverse and determinant.

Methods:

Return in double array - getMatrixArray
Return in float array - getMatrixArray
Calculate determinant - determinant
Invert the matrix - inverse

2.5.10.5.2 Return in double array - getMatrixArray

Return the array elements in a 4x4 double array.

Method Definition:
public void getMatrixArray(double[][] mat)
Parameters List:
mat
4x4 double array in which the data are to be returned.

2.5.10.5.3 Return in float array - getMatrixArray

Return the array elements in a 4x4 float array.

Method Definition:
public void getMatrixArray(float[][] mat)
Parameters List:
mat
4x4 float array in which the data are to be returned.

2.5.10.5.4 Calculate determinant - determinant

Calculate the determinant of the matrix.

Method Definition:
public double determinant()
Parameters List:
none
Method Return:
The determinant of the 4x4 matrix

2.5.10.5.5 Invert the matrix - inverse

Calculate the inverse of the 4x4 matrix and return as a Jdl4x4 object.

Method Definition:
public Jdl4x4 inverse()
Parameters List:
none
Method Return:
A matrix which is the inverse of the stored 4x4 matrix (null if determinant is zero).

⇑ Up 2   ⇑ Up 1   ⇑ Top of this