de.lmu.ifi.dbs.elki.math.linearalgebra
Interface MatrixLike<M extends MatrixLike<M>>

All Superinterfaces:
Cloneable
All Known Implementing Classes:
Centroid, Matrix, ProjectedCentroid, Vector

public interface MatrixLike<M extends MatrixLike<M>>
extends Cloneable

Common Interface for Matrix and Vector objects, where M is the actual type. The type M guarantees type safety for many operations.


Method Summary
 Object clone()
          Clone the Matrix object.
 M copy()
          Make a deep copy of a matrix.
 double get(int i, int j)
          Get a single element.
 int getColumnDimensionality()
          Returns the dimensionality of the columns of this matrix.
 Vector getColumnVector(int i)
          Returns the ith column of this matrix as vector.
 int getRowDimensionality()
          Returns the dimensionality of the rows of this matrix.
 M increment(int i, int j, double s)
          Increments a single element.
 M minus(M B)
          C = A - B
 M minusEquals(M B)
          A = A - B
 M minusTimes(M B, double s)
          C = A - s*B
 M minusTimesEquals(M B, double s)
          C = A - s*B
 M plus(M B)
          C = A + B
 M plusEquals(M B)
          A = A + B
 M plusTimes(M B, double s)
          C = A + s*B
 M plusTimesEquals(M B, double s)
          C = A + s*B
 M set(int i, int j, double s)
          Set a single element.
 M times(double s)
          Multiply a matrix by a scalar, C = s*A
 M timesEquals(double s)
          Multiply a matrix by a scalar in place, A = s*A
 Matrix transpose()
          Matrix transpose.
 

Method Detail

copy

M copy()
Make a deep copy of a matrix.

Returns:
a new matrix containing the same values as this matrix

clone

Object clone()
Clone the Matrix object.


getRowDimensionality

int getRowDimensionality()
Returns the dimensionality of the rows of this matrix.

Returns:
m, the number of rows.

getColumnDimensionality

int getColumnDimensionality()
Returns the dimensionality of the columns of this matrix.

Returns:
n, the number of columns.

get

double get(int i,
           int j)
Get a single element.

Parameters:
i - Row index.
j - Column index.
Returns:
A(i,j)
Throws:
ArrayIndexOutOfBoundsException - on bounds error

set

M set(int i,
      int j,
      double s)
Set a single element.

Parameters:
i - Row index.
j - Column index.
s - A(i,j).
Throws:
ArrayIndexOutOfBoundsException - on bounds error

increment

M increment(int i,
            int j,
            double s)
Increments a single element.

Parameters:
i - the row index
j - the column index
s - the increment value: A(i,j) = A(i.j) + s.
Throws:
ArrayIndexOutOfBoundsException - on bounds error

getColumnVector

Vector getColumnVector(int i)
Returns the ith column of this matrix as vector.

Parameters:
i - the index of the column to be returned
Returns:
the ith column of this matrix

transpose

Matrix transpose()
Matrix transpose.

Returns:
AT

plus

M plus(M B)
C = A + B

Parameters:
B - another matrix
Returns:
A + B in a new Matrix

plusTimes

M plusTimes(M B,
            double s)
C = A + s*B

Parameters:
B - another matrix
s - scalar
Returns:
A + s*B in a new Matrix

plusEquals

M plusEquals(M B)
A = A + B

Parameters:
B - another matrix
Returns:
A + B in this Matrix

plusTimesEquals

M plusTimesEquals(M B,
                  double s)
C = A + s*B

Parameters:
B - another matrix
s - scalar
Returns:
A + s*B in this Matrix

minus

M minus(M B)
C = A - B

Parameters:
B - another matrix
Returns:
A - B in a new Matrix

minusTimes

M minusTimes(M B,
             double s)
C = A - s*B

Parameters:
B - another matrix
s - Scalar
Returns:
A - s*B in a new Matrix

minusEquals

M minusEquals(M B)
A = A - B

Parameters:
B - another matrix
Returns:
A - B in this Matrix

minusTimesEquals

M minusTimesEquals(M B,
                   double s)
C = A - s*B

Parameters:
B - another matrix
s - Scalar
Returns:
A - s*B in a new Matrix

times

M times(double s)
Multiply a matrix by a scalar, C = s*A

Parameters:
s - scalar
Returns:
s*A

timesEquals

M timesEquals(double s)
Multiply a matrix by a scalar in place, A = s*A

Parameters:
s - scalar
Returns:
replace A by s*A

Release 0.4.0 (2011-09-20_1324)