org.jmatrices.dbl.transformer
Class MatrixTransformer

java.lang.Object
  extended byorg.jmatrices.dbl.transformer.MatrixTransformer

public final class MatrixTransformer
extends java.lang.Object

MatrixTransformer is responsible for classical non element-by-element transformation of a matrix

Captures classical transformations that aren't applicable in an element-by-element way (only exception is negate(org.jmatrices.dbl.Matrix) )

We might decide to remove this restriction and provide some important ebe transformations here or we might move them(to be methods) and negate to MatrixEBETransformer

Author: purangp
Date: 07.03.2004 Time: 17:03:20

See Also:
MatrixEBETransformation, MatrixEBETransformer

Method Summary
static Matrix cumulativeColumnProduct(Matrix m)
           x = 1 -3 2 2 3 -1 y = cumulativeColumnProduct(x); 1 -3 2 -6 6 6
static Matrix cumulativeColumnSum(Matrix m)
           x = 1 -3 2 2 3 -1 y = cumulativeColumnSum(x); 1 -3 3 -1 6 -2
static Matrix diagonal(Matrix m)
          Column vector contatining the diagonal elements of the matrix x= 1 0 0 0 1 0 0 0 1 then y = diagonal(x) is 1 1 1
static Matrix embedDiagonal(Matrix m, int offset)
          Returns a matrix with diagonal (indicated by offset) composed of the elements from the passed row or column vector m
static Matrix extractDiagonal(Matrix m, int offset)
          Gets the elements of the indicated diagonal (offset) as a column vector
static Matrix extractLowerTriangular(Matrix m, int offset)
          Extracts the lower triangular matrix given an offset that indicates the relative diagonal
static Matrix extractUpperTriangular(Matrix m, int offset)
          Extracts the upper triangular matrix given an offset that indicates the relative diagonal
static Matrix inverse(Matrix m)
          Inverts the matrix
static Matrix negate(Matrix m)
          Transforms the matrix by negating all the elements
static Matrix pow(Matrix m, int n)
          Multiplies the square matrix with itself multiple times.
static Matrix secondaryDiagonal(Matrix m)
          //secondary diagonal - the diagonal of a square matrix running from the lower left entry to the upper right entry to implement it use .... 1. first element is 0 and col 2. second element is (0+1)or1 and col-1 3. third element is (1+1)or2 and col-2 4. and so on till rows() and 0 is reached ..
static Matrix transpose(Matrix m)
          Transforms the matrix into it's transpose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

negate

public static Matrix negate(Matrix m)
Transforms the matrix by negating all the elements

Parameters:
m - Matrix
Returns:
-aij for all i,j

transpose

public static Matrix transpose(Matrix m)
Transforms the matrix into it's transpose

Parameters:
m -
Returns:
A'

inverse

public static Matrix inverse(Matrix m)
Inverts the matrix

Parameters:
m - Matrix
Returns:
A-1

diagonal

public static Matrix diagonal(Matrix m)
Column vector contatining the diagonal elements of the matrix
    x=
  1 0 0
  0 1 0
  0 0 1
   then y = diagonal(x) is
  1
  1
  1
 

Parameters:
m -
Returns:
c(mx1) column vector containing the diagonal elements of the matrix

embedDiagonal

public static Matrix embedDiagonal(Matrix m,
                                   int offset)
Returns a matrix with diagonal (indicated by offset) composed of the elements from the passed row or column vector m

Parameters:
m - a column or row Vector
offset - the diagonal to be embeded (=0 will embed the elements as the main diagonal)
Returns:

extractDiagonal

public static Matrix extractDiagonal(Matrix m,
                                     int offset)
Gets the elements of the indicated diagonal (offset) as a column vector

Parameters:
m -
offset - the diagonal to be extracted (=0 will extract the main diagonal)
Returns:
Column vector of elements extracted from the indiacated diagonal

extractUpperTriangular

public static Matrix extractUpperTriangular(Matrix m,
                                            int offset)
Extracts the upper triangular matrix given an offset that indicates the relative diagonal

Parameters:
m -
offset -
Returns:

extractLowerTriangular

public static Matrix extractLowerTriangular(Matrix m,
                                            int offset)
Extracts the lower triangular matrix given an offset that indicates the relative diagonal

Parameters:
m -
offset -
Returns:

pow

public static Matrix pow(Matrix m,
                         int n)
Multiplies the square matrix with itself multiple times.

Parameters:
m - is a square matrix
n - if n>1 performs the operation else if (n<=0) returns a matrix composed of ones.
Returns:
C = An

secondaryDiagonal

public static Matrix secondaryDiagonal(Matrix m)
//secondary diagonal - the diagonal of a square matrix running from the lower left entry to the upper right entry
 to implement it use ....
 1. first element is 0 and col
 2. second element is (0+1)or1 and col-1
 3. third element is   (1+1)or2 and col-2
 4. and so on till rows() and 0 is reached ..
 

Parameters:
m -
Returns:

cumulativeColumnProduct

public static Matrix cumulativeColumnProduct(Matrix m)
 x =
 1 -3
 2  2
 3 -1

 y = cumulativeColumnProduct(x);
 1 -3
 2 -6
 6 6
 

Parameters:
m -
Returns:

cumulativeColumnSum

public static Matrix cumulativeColumnSum(Matrix m)
 x =
 1 -3
 2  2
 3 -1

 y = cumulativeColumnSum(x);
 1 -3
 3 -1
 6 -2
 

Parameters:
m -
Returns: