All Packages Class Hierarchy This Package Previous Next Index
Class Acme.Matrix
java.lang.Object
|
+----Acme.Matrix
- public class Matrix
- extends Object
Simple double matrix class.
Fetch the software.
Fetch the entire Acme package.
-
Matrix(int)
- Constructor - create an identity matrix.
-
Matrix(int, int)
-
-
Matrix(int, int, double)
-
-
Matrix(Matrix)
- Constructor - copy a matrix.
-
add(Matrix, Matrix)
- Add two matricies.
-
equals(Object)
- Equality test.
-
get(int, int)
- Get an element.
-
getCols()
- Get the column count.
-
getRows()
- Get the row count.
-
hashCode()
- Compute a hash code for the matrix.
-
max()
- Find the largest element.
-
mean()
- Compute the mean of all the elements.
-
min()
- Find the smallest element.
-
multiply(double, Matrix)
- Multiply a scalar by a matrix.
-
multiply(Matrix, double)
- Multiply a matrix by a scalar.
-
multiply(Matrix, Matrix)
- Multiply two matricies.
-
set(int, int, double)
- Set an element.
-
solve(Matrix, Matrix)
- Solve ax=b using Gaussian elimination.
-
subtract(Matrix, Matrix)
- Subtract one matrix from another.
-
sum()
- Compute the sum of all the elements.
-
swapCols(int, int)
- Swap columns in a matrix.
-
swapRows(int, int)
- Swap rows in a matrix.
-
toString()
- Convert to a string.
-
transpose(Matrix)
- Transpose a matrix.
Matrix
public Matrix(int rows,
int cols) throws ArithmeticException
Matrix
public Matrix(int rows,
int cols,
double value) throws ArithmeticException
Matrix
public Matrix(int size) throws ArithmeticException
- Constructor - create an identity matrix.
Matrix
public Matrix(Matrix o) throws ArithmeticException
- Constructor - copy a matrix.
getRows
public int getRows()
- Get the row count.
getCols
public int getCols()
- Get the column count.
get
public double get(int row,
int col)
- Get an element.
set
public void set(int row,
int col,
double value)
- Set an element.
equals
public boolean equals(Object o)
- Equality test.
- Overrides:
- equals in class Object
hashCode
public int hashCode()
- Compute a hash code for the matrix.
- Overrides:
- hashCode in class Object
toString
public String toString()
- Convert to a string.
- Overrides:
- toString in class Object
sum
public double sum()
- Compute the sum of all the elements.
mean
public double mean()
- Compute the mean of all the elements.
max
public double max()
- Find the largest element.
min
public double min()
- Find the smallest element.
swapRows
public void swapRows(int r1,
int r2)
- Swap rows in a matrix.
swapCols
public void swapCols(int c1,
int c2)
- Swap columns in a matrix.
transpose
public static Matrix transpose(Matrix m)
- Transpose a matrix.
add
public static Matrix add(Matrix a,
Matrix b) throws ArithmeticException
- Add two matricies.
subtract
public static Matrix subtract(Matrix a,
Matrix b) throws ArithmeticException
- Subtract one matrix from another.
multiply
public static Matrix multiply(Matrix a,
double b)
- Multiply a matrix by a scalar.
multiply
public static Matrix multiply(double a,
Matrix b)
- Multiply a scalar by a matrix.
multiply
public static Matrix multiply(Matrix a,
Matrix b) throws ArithmeticException
- Multiply two matricies.
solve
public static Matrix solve(Matrix a,
Matrix b) throws ArithmeticException
- Solve ax=b using Gaussian elimination. The matrix a must be square,
and b must be a vector with the same number of rows as a. Returns
another vector of the same size as b.
All Packages Class Hierarchy This Package Previous Next Index
ACME Java ACME Labs