public class Matrix
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) double[][] |
m
The values of the Matrix
|
| Constructor and Description |
|---|
Matrix(double[][] mat)
Creates a matrix from a bidimensional array
|
Matrix(java.io.InputStream is)
Creates a matrix from an InputStream in which the first integer value
is the number of rows of the Matrix and the second integer value is
the number of columns.
|
Matrix(java.io.Reader r)
Creates a matrix from a Reader in which the first integer value
is the number of rows of the Matrix and the second integer value is
the number of columns.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object mi)
Tells if an Object is equal to this Matrix
|
int |
getColumnsNumber()
Returns the number of columns of this Matrix
|
double[][] |
getMatrix()
Gets the bidimensional array representing this Matrix
|
int |
getRowsNumber()
Returns the number of rows of this Matrix
|
static double[][] |
identity(int n)
Returns a bidimensional array containing an identity matrix
|
static boolean |
isRect(double[][] m)
Tells if a bidimensional array is a rectangle
|
void |
load(java.io.InputStream is)
Loads a matrix from an InputStream in which the first integer value
is the number of rows of the Matrix and the second integer value is
the number of columns.
|
void |
load(java.io.Reader r)
Loads a matrix from an InputStream in which the first integer value
is the number of rows of the Matrix and the second integer value is
the number of columns.
|
static void |
main(java.lang.String[] ar) |
static double[][] |
nullMatrix(int n)
Returns a bidimensional array containing an zero matrix
|
static Matrix |
one(int n)
Returns the identity Matrix
|
int |
order()
Returns the order of this Matrix if it is a square matrix
|
static double[][] |
pow(double[][] m,
int n)
Returns the n-th power of a bidimensional array.
|
Matrix |
pow(int n)
Returns the Matrix that n-th power of this Matrix to another Matrix
|
static double[][] |
prod(double[][] m1,
double[][] m2)
Returns the cartesian product of two bidimensional arrays.
|
Matrix |
prod(Matrix mat)
Returns the Matrix that is the cartesian product of this Matrix to another Matrix
|
static double[][] |
sum(double[][] m1,
double[][] m2)
Returns the sum of two bidimensional arrays.
|
Matrix |
sum(Matrix mat)
Returns the Matrix that is the sum of this Matrix to another Matrix
|
java.lang.String |
toString()
Returns a String representing this Matrix
|
static Matrix |
zero(int n)
Returns the zero Matrix
|
public Matrix(double[][] mat)
mat - the bidimensional arraypublic Matrix(java.io.InputStream is)
is - the InputStreampublic Matrix(java.io.Reader r)
r - the Readerpublic void load(java.io.InputStream is)
is - the InputStreampublic void load(java.io.Reader r)
r - the Readerpublic Matrix sum(Matrix mat)
mat - the Matrix to sumpublic static double[][] sum(double[][] m1,
double[][] m2)
m1 - the first bidimensional arraym2 - the second bidimensional arraypublic static boolean isRect(double[][] m)
m - the bidimensional arraypublic Matrix prod(Matrix mat)
mat - the Matrix to make the product withpublic static double[][] prod(double[][] m1,
double[][] m2)
m1 - the first bidimensional arraym2 - the second bidimensional arraypublic Matrix pow(int n)
n - the esponent of the powerpublic static double[][] pow(double[][] m,
int n)
m - the first bidimensional arrayn - the esponent of the powerpublic int getRowsNumber()
public int getColumnsNumber()
public int order()
public double[][] getMatrix()
public static Matrix one(int n)
n - the order of the identity Matrixpublic static double[][] identity(int n)
n - the order of the identity matrixpublic static Matrix zero(int n)
n - the order of the zero Matrixpublic static double[][] nullMatrix(int n)
n - the order of the zero matrixpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object mi)
equals in class java.lang.Objectmi - the Object to comparepublic static void main(java.lang.String[] ar)