public class Matrix
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
double[][] |
elements |
Constructor and Description |
---|
Matrix(int rows,
int cols) |
Modifier and Type | Method and Description |
---|---|
Matrix |
addTo(Matrix m) |
java.lang.Double |
dot(Matrix m)
Computes the dot product (or scalar product) of two matrices by multiplying
corresponding elements and summing all the products.
|
boolean |
equals(double val) |
int |
getNumCols() |
int |
getNumRows() |
Matrix |
multiply(double s)
Scalar multiplication- multiplies each element by a scalar
|
Matrix |
multiply(Matrix m) |
Matrix |
pseudoInverse()
Calculates the matrix's Moore-Penrose pseudoinverse
|
static Matrix |
scaling(double sx,
double sy,
double sz) |
Matrix |
subtractFrom(Matrix m) |
java.lang.String |
toString() |
static Matrix |
translation(double tx,
double ty,
double tz) |
Matrix |
transpose() |
static Matrix |
xRotation(double theta) |
static Matrix |
yRotation(double theta) |
static Matrix |
zRotation(double theta) |
public static Matrix scaling(double sx, double sy, double sz)
sx
- scaling in the x directionsy
- scaling in the y directionsz
- scaling in the z directionpublic static Matrix translation(double tx, double ty, double tz)
tx
- translations in the x directionty
- translations in the y directiontz
- translations in the z directionpublic static Matrix xRotation(double theta)
theta
- an angle in radianspublic static Matrix yRotation(double theta)
theta
- an angle in radianspublic static Matrix zRotation(double theta)
theta
- an angle in radianspublic Matrix addTo(Matrix m)
m
- a Matrixpublic java.lang.Double dot(Matrix m)
m
- A Matrix with the same dimensionspublic boolean equals(double val)
val
- a scalarpublic int getNumCols()
public int getNumRows()
public Matrix multiply(double s)
s
- a scalarpublic Matrix multiply(Matrix m)
m
- a Matrixpublic Matrix pseudoInverse()
public Matrix subtractFrom(Matrix m)
m
- a Matrixpublic java.lang.String toString()
toString
in class java.lang.Object
public Matrix transpose()