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.


Constructor Index

 o Matrix(int)
Constructor - create an identity matrix.
 o Matrix(int, int)
 o Matrix(int, int, double)
 o Matrix(Matrix)
Constructor - copy a matrix.

Method Index

 o add(Matrix, Matrix)
Add two matricies.
 o equals(Object)
Equality test.
 o get(int, int)
Get an element.
 o getCols()
Get the column count.
 o getRows()
Get the row count.
 o hashCode()
Compute a hash code for the matrix.
 o max()
Find the largest element.
 o mean()
Compute the mean of all the elements.
 o min()
Find the smallest element.
 o multiply(double, Matrix)
Multiply a scalar by a matrix.
 o multiply(Matrix, double)
Multiply a matrix by a scalar.
 o multiply(Matrix, Matrix)
Multiply two matricies.
 o set(int, int, double)
Set an element.
 o solve(Matrix, Matrix)
Solve ax=b using Gaussian elimination.
 o subtract(Matrix, Matrix)
Subtract one matrix from another.
 o sum()
Compute the sum of all the elements.
 o swapCols(int, int)
Swap columns in a matrix.
 o swapRows(int, int)
Swap rows in a matrix.
 o toString()
Convert to a string.
 o transpose(Matrix)
Transpose a matrix.

Constructors

 o Matrix
 public Matrix(int rows,
               int cols) throws ArithmeticException
 o Matrix
 public Matrix(int rows,
               int cols,
               double value) throws ArithmeticException
 o Matrix
 public Matrix(int size) throws ArithmeticException
Constructor - create an identity matrix.

 o Matrix
 public Matrix(Matrix o) throws ArithmeticException
Constructor - copy a matrix.

Methods

 o getRows
 public int getRows()
Get the row count.

 o getCols
 public int getCols()
Get the column count.

 o get
 public double get(int row,
                   int col)
Get an element.

 o set
 public void set(int row,
                 int col,
                 double value)
Set an element.

 o equals
 public boolean equals(Object o)
Equality test.

Overrides:
equals in class Object
 o hashCode
 public int hashCode()
Compute a hash code for the matrix.

Overrides:
hashCode in class Object
 o toString
 public String toString()
Convert to a string.

Overrides:
toString in class Object
 o sum
 public double sum()
Compute the sum of all the elements.

 o mean
 public double mean()
Compute the mean of all the elements.

 o max
 public double max()
Find the largest element.

 o min
 public double min()
Find the smallest element.

 o swapRows
 public void swapRows(int r1,
                      int r2)
Swap rows in a matrix.

 o swapCols
 public void swapCols(int c1,
                      int c2)
Swap columns in a matrix.

 o transpose
 public static Matrix transpose(Matrix m)
Transpose a matrix.

 o add
 public static Matrix add(Matrix a,
                          Matrix b) throws ArithmeticException
Add two matricies.

 o subtract
 public static Matrix subtract(Matrix a,
                               Matrix b) throws ArithmeticException
Subtract one matrix from another.

 o multiply
 public static Matrix multiply(Matrix a,
                               double b)
Multiply a matrix by a scalar.

 o multiply
 public static Matrix multiply(double a,
                               Matrix b)
Multiply a scalar by a matrix.

 o multiply
 public static Matrix multiply(Matrix a,
                               Matrix b) throws ArithmeticException
Multiply two matricies.

 o 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