edu.isi.karma.modeling.semantictypes.mycrf.math
Class Matrix

java.lang.Object
  extended by edu.isi.karma.modeling.semantictypes.mycrf.math.Matrix

public class Matrix
extends java.lang.Object

This class represents matrices and vectors. It is primarily used to perform vector computations, such as, addition, dot product, and scalar multiplication.

Author:
amangoel

Constructor Summary
Matrix(java.util.ArrayList<java.util.ArrayList<java.lang.Double>> newData)
           
Matrix(double[][] newData)
           
Matrix(int numOfRows, int numOfCols)
           
 
Method Summary
 Matrix add(Matrix otherMatrix)
           
 Matrix clone()
           
static double dotProduct(double[] x, double[] y)
           
 Matrix multiply_with_constant(double k)
           
 Matrix multiply(Matrix otherMatrix)
           
static double norm(double[] x)
           
static double norm(Matrix m)
           
static void plusEquals(double[] x, double[] y, double m)
           
 Matrix subtract(Matrix otherMatrix)
           
 Matrix transpose()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Matrix

public Matrix(int numOfRows,
              int numOfCols)

Matrix

public Matrix(java.util.ArrayList<java.util.ArrayList<java.lang.Double>> newData)

Matrix

public Matrix(double[][] newData)
Method Detail

multiply

public Matrix multiply(Matrix otherMatrix)

transpose

public Matrix transpose()

add

public Matrix add(Matrix otherMatrix)

subtract

public Matrix subtract(Matrix otherMatrix)

multiply_with_constant

public Matrix multiply_with_constant(double k)

clone

public Matrix clone()
Overrides:
clone in class java.lang.Object

norm

public static double norm(Matrix m)

plusEquals

public static void plusEquals(double[] x,
                              double[] y,
                              double m)

dotProduct

public static double dotProduct(double[] x,
                                double[] y)

norm

public static double norm(double[] x)