2.5.9 - A 3x3 Matrix - Jdl3x3

John W. Campbell

2.5.9.1 Introduction

This is a simple class to store a 3x3 matrix. The matrix data may be converted between object and array forms. Methods for inverting the matrix and calculating its determinant are included. Other matrix methods using Jdl3x3 matrix objects are available in the JdlUtils class of static methods. The Jdl3x3 object is cloneable.

Constructor and methods:

Class Details
Accessible Fields
Constructors
Methods

2.5.9.2 Class Details

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

2.5.9.3 Accessible Fields

No fields with public, package or protected access defined.

2.5.9.4 Constructors

2.5.9.4.1 Introduction

Three constructors are available to construct a Jdl3x3 object from an array of double values, an array of float values or from another Jdl3x3 object.

Constructors:

Constructor 1
Constructor 2
Constructor 2

2.5.9.4.2 Constructor 1

Create a Jdl3x3 matrix object from the elements of a 3x3 double array.

Constructor Definition:
public Jdl3x3 (double[][] mat)
Parameters List:
mat
The matrix elements in a 3x3 double array.

2.5.9.4.3 Constructor 2

Create a Jdl3x3 matrix object from from the elements of a 3x3 float array.

Constructor Definition:
public Jdl3x3 (float[][] mat)
Parameters List:
mat
The matrix elements in a 3x3 float array.

2.5.9.4.4 Constructor 2

Create a Jdl3x3 matrix object from another Jdl3x3 object

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

2.5.9.5 Methods

2.5.9.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
List matrix - listContents

2.5.9.5.2 Return in double array - getMatrixArray

Return the array elements in a 3x3 double array.

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

2.5.9.5.3 Return in float array - getMatrixArray

Return the array elements in a 3x3 float array.

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

2.5.9.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 3x3 matrix.

2.5.9.5.5 Invert the matrix - inverse

Calculate the inverse of the 3x3 matrix and return as a Jdl3x3 object.

Method Definition:
public Jdl3x3 inverse()
Parameters List:
none
Method Return:
A matrix which is the inverse of the stored 3x3 matrix (null if determinant is zero).

2.5.9.5.6 List matrix - listContents

This method lists the matrix to the standard output stream.

Method Definition:
public void listContents()
Parameters List:
none

⇑ Up 2   ⇑ Up 1   ⇑ Top of this