edu.pdx.cs399J.rmi
Class Matrix

java.lang.Object
  extended by edu.pdx.cs399J.rmi.Matrix

public class Matrix
extends Object

Represents a matrix of doubles. Contains methods to create special matrices for this assignment. It also contains general methods to multiply matrices.

Author:
David Whitlock

Constructor Summary
Matrix()
           
 
Method Summary
static int countColumns(double[][] m)
          Returns the number of columns in a matrix
static int countRows(double[][] m)
          Returns the number of rows in a matrix
static double[][] multiply(double[][] a, double[][] b)
          Multiplies two matrices and returns their product.
static void print(String name, double[][] m, PrintWriter out)
          Prints this a matrix
static void print(String name, double[] v, PrintWriter out)
          Prints a vector in column form
static void setPrecision(int n)
          Sets the number of decimal places to be displayed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix

public Matrix()
Method Detail

setPrecision

public static void setPrecision(int n)
Sets the number of decimal places to be displayed.


countRows

public static int countRows(double[][] m)
Returns the number of rows in a matrix


countColumns

public static int countColumns(double[][] m)
Returns the number of columns in a matrix

Throws:
IllegalArgumentException - The columns are not length-consistent

multiply

public static double[][] multiply(double[][] a,
                                  double[][] b)
Multiplies two matrices and returns their product.


print

public static void print(String name,
                         double[][] m,
                         PrintWriter out)
Prints this a matrix


print

public static void print(String name,
                         double[] v,
                         PrintWriter out)
Prints a vector in column form



Copyright © 2000-2009 Portland State University. All Rights Reserved.