no.uib.cipr.matrix
Class AGDenseMatrix

java.lang.Object
  extended by no.uib.cipr.matrix.AbstractMatrix
      extended by no.uib.cipr.matrix.DenseMatrix
          extended by no.uib.cipr.matrix.AGDenseMatrix
All Implemented Interfaces:
java.lang.Iterable<no.uib.cipr.matrix.MatrixEntry>, no.uib.cipr.matrix.Matrix

public class AGDenseMatrix
extends no.uib.cipr.matrix.DenseMatrix
implements Matrix


Nested Class Summary
 
Nested classes/interfaces inherited from interface no.uib.cipr.matrix.Matrix
no.uib.cipr.matrix.Matrix.Norm
 
Field Summary
 
Fields inherited from class no.uib.cipr.matrix.AbstractMatrix
numColumns, numRows
 
Constructor Summary
AGDenseMatrix()
           
AGDenseMatrix(double[][] values)
           
AGDenseMatrix(int numRows, int numColumns)
           
AGDenseMatrix(int numRows, int numColumns, double[] indata)
          Creates new matrix from existing array.
AGDenseMatrix(no.uib.cipr.matrix.Matrix A)
           
AGDenseMatrix(Matrix A, boolean deep)
           
AGDenseMatrix(Matrix m, int ni, int nj)
          Create a new matrix by tiling the input matrix.
AGDenseMatrix(no.uib.cipr.matrix.io.MatrixVectorReader r)
           
AGDenseMatrix(no.uib.cipr.matrix.Vector x)
           
AGDenseMatrix(no.uib.cipr.matrix.Vector v, int ni, int nj)
          Create a new matrix by tiling a vector.
 
Method Summary
 Matrix add(double a)
           
 AGDenseMatrix append(double d)
          append double value.
 AGDenseMatrix append(Matrix mm)
          Append the matrix as new rows onto the existing matrix.
 AGDenseMatrix append(no.uib.cipr.matrix.Vector mm)
          Append the matrix as new rows onto the existing matrix.
 void appendCol(AGDenseMatrix r)
           
 double asScalar()
           
 no.uib.cipr.matrix.DenseVector asVector()
          return a copy of the data as a vector.
 no.uib.cipr.matrix.Vector asVector(int istart)
          return a copy of the data as a vector.
 no.uib.cipr.matrix.DenseVector asVector(int istart, int iend)
          return a copy of the data as a vector.
 Matrix delCol(int k)
          Delete column k from the matrix.
 Matrix delRow(int del)
           
 double det()
          Return the determinant.
 Matrix divide(Matrix b, Matrix c)
          C= A/B where the division is elementwise.
static Matrix identity(int ncentres)
          Return a square identity matrix.
 int insert(no.uib.cipr.matrix.DenseMatrix m)
           
 int insert(no.uib.cipr.matrix.DenseMatrix m, int position)
           
 int insert(no.uib.cipr.matrix.DenseVector vector, int inpos)
           
 Matrix inv()
          Computes the inverse of the matrix.
 Matrix ones()
           
 Matrix pow(double i)
          Return a matrix with elements raised to the power.
static AGDenseMatrix repeatColumn(no.uib.cipr.matrix.Vector v, int n)
           
static AGDenseMatrix repeatRow(no.uib.cipr.matrix.Vector v, int n)
           
 AGDenseMatrix reshape(int irow, int icol)
          Reshapes the matrix to have the new size.
 AGDenseMatrix selectCols(int[] cols, int ncols)
           
 Matrix setColumn(int idx, Matrix v)
          Set a complete column in the matrix to the value given.
 Matrix setColumn(int idx, no.uib.cipr.matrix.Vector v)
          Set a complete column in the matrix to the value given.
 Matrix setRow(int k, Matrix m)
           
 Matrix setRow(int k, no.uib.cipr.matrix.Vector v)
           
 Matrix slice(int rowstart, int rowend, int colstart, int colend)
          slice an array - indices are 0 based.
 no.uib.cipr.matrix.Vector sliceCol(int colstart)
          Returns a new Matrix consisting of only the specified column.
 Matrix sliceCol(int colstart, int ncols)
          Returns a new Matrix consisting of only the specified columns.
 Matrix slicem(int idx, boolean dorow)
           
 no.uib.cipr.matrix.Vector sliceRow(int idx)
          returns a row as a vector.
 Matrix sliceRowM(int k)
          returns a row as a matrix.
 no.uib.cipr.matrix.Vector slicev(int idx, boolean dorow)
          Return a single column or row of the matrix
 no.uib.cipr.matrix.Vector sum(int dim)
          Return the sum of a matrix along a dimension.
 double trace()
          Produce the trace of the matrix.
 
Methods inherited from class no.uib.cipr.matrix.DenseMatrix
copy, multAdd, multAdd, rank1, solve, solve, transABmultAdd, transAmultAdd, transBmultAdd, transMultAdd, transSolve, transSolve
 
Methods inherited from class no.uib.cipr.matrix.AbstractMatrix
add, add, check, checkMultAdd, checkMultAdd, checkRank1, checkRank1, checkRank2, checkRank2, checkSize, checkSolve, checkSolve, checkTransABmultAdd, checkTransAmultAdd, checkTransBmultAdd, checkTransMultAdd, checkTranspose, checkTranspose, checkTransRank1, checkTransRank2, isSquare, iterator, max, max, mult, mult, mult, mult, multAdd, multAdd, norm, norm1, normF, normInf, numColumns, numRows, rank1, rank1, rank1, rank1, rank1, rank2, rank2, rank2, rank2, scale, set, toString, transABmult, transABmult, transABmultAdd, transAmult, transAmult, transAmultAdd, transBmult, transBmult, transBmultAdd, transMult, transMult, transMultAdd, transpose, transpose, transRank1, transRank1, transRank2, transRank2
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface no.uib.cipr.matrix.Matrix
add, add, add, copy, get, isSquare, mult, mult, mult, mult, multAdd, multAdd, multAdd, multAdd, norm, numColumns, numRows, rank1, rank1, rank1, rank1, rank1, rank1, rank2, rank2, rank2, rank2, scale, set, set, set, solve, solve, transABmult, transABmult, transABmultAdd, transABmultAdd, transAmult, transAmult, transAmultAdd, transAmultAdd, transBmult, transBmult, transBmultAdd, transBmultAdd, transMult, transMult, transMultAdd, transMultAdd, transpose, transpose, transRank1, transRank1, transRank2, transRank2, transSolve, transSolve, zero
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

AGDenseMatrix

public AGDenseMatrix(no.uib.cipr.matrix.io.MatrixVectorReader r)
              throws java.io.IOException
Parameters:
r -
Throws:
java.io.IOException

AGDenseMatrix

public AGDenseMatrix(no.uib.cipr.matrix.Vector x)
Parameters:
x -

AGDenseMatrix

public AGDenseMatrix(double[][] values)
Parameters:
values -

AGDenseMatrix

public AGDenseMatrix()

AGDenseMatrix

public AGDenseMatrix(int numRows,
                     int numColumns)
Parameters:
numRows -
numColumns -

AGDenseMatrix

public AGDenseMatrix(Matrix A,
                     boolean deep)
Parameters:
A -
deep -

AGDenseMatrix

public AGDenseMatrix(no.uib.cipr.matrix.Matrix A)
Parameters:
A -

AGDenseMatrix

public AGDenseMatrix(no.uib.cipr.matrix.Vector v,
                     int ni,
                     int nj)
Create a new matrix by tiling a vector. The vector is assumed to be copied columnwise.

Parameters:
v -
ni -
nj -

AGDenseMatrix

public AGDenseMatrix(Matrix m,
                     int ni,
                     int nj)
Create a new matrix by tiling the input matrix.

Parameters:
m -
ni -
nj -

AGDenseMatrix

public AGDenseMatrix(int numRows,
                     int numColumns,
                     double[] indata)
Creates new matrix from existing array. Note that the array is simply used as internal storage

Parameters:
numRows -
numColumns -
indata -
Method Detail

repeatColumn

public static AGDenseMatrix repeatColumn(no.uib.cipr.matrix.Vector v,
                                         int n)

repeatRow

public static AGDenseMatrix repeatRow(no.uib.cipr.matrix.Vector v,
                                      int n)

slice

public Matrix slice(int rowstart,
                    int rowend,
                    int colstart,
                    int colend)
Description copied from interface: Matrix
slice an array - indices are 0 based. Creates a new array storage - original data is untouched.

Returns:

slicev

public no.uib.cipr.matrix.Vector slicev(int idx,
                                        boolean dorow)
Return a single column or row of the matrix

Parameters:
idx - the 0 based index of the row or column to return;
dorow - if true return a row - if false return a column.
Returns:

slicem

public Matrix slicem(int idx,
                     boolean dorow)

sum

public no.uib.cipr.matrix.Vector sum(int dim)
Description copied from interface: Matrix
Return the sum of a matrix along a dimension.

Parameters:
dim - the dimension along which to sum 1=sum the columns 2 = sum the rows
Returns:

identity

public static Matrix identity(int ncentres)
Return a square identity matrix.

Parameters:
ncentres -
Returns:

pow

public Matrix pow(double i)
Description copied from interface: Matrix
Return a matrix with elements raised to the power.

Returns:

sliceCol

public Matrix sliceCol(int colstart,
                       int ncols)
Description copied from interface: Matrix
Returns a new Matrix consisting of only the specified columns. This is equivalent to the Matlab syntax mat(:, colstart:colstart+ncols).

Returns:

sliceCol

public no.uib.cipr.matrix.Vector sliceCol(int colstart)
Description copied from interface: Matrix
Returns a new Matrix consisting of only the specified column. This is equivalent to the Matlab syntax mat(:, col).

Returns:

ones

public Matrix ones()
Returns:

reshape

public AGDenseMatrix reshape(int irow,
                             int icol)
Description copied from interface: Matrix
Reshapes the matrix to have the new size. Elements are copied columnwise.

Returns:

asVector

public no.uib.cipr.matrix.DenseVector asVector()
Description copied from interface: Matrix
return a copy of the data as a vector. The storage is assumed to be column major. This is similar to the A(:) 'linear' addressing in matlab.

Returns:

asVector

public no.uib.cipr.matrix.DenseVector asVector(int istart,
                                               int iend)
Description copied from interface: Matrix
return a copy of the data as a vector. The storage is assumed to be column major. This is similar to the A(:) 'linear' addressing in matlab.

Returns:

asVector

public no.uib.cipr.matrix.Vector asVector(int istart)
Description copied from interface: Matrix
return a copy of the data as a vector. The storage is assumed to be column major. a matrix treating as one large columnwise array. - Indices are 0 based.

Returns:

det

public double det()
Return the determinant. This is done by using the LU factorization.

Returns:
See Also:
Matrix.det()

trace

public double trace()
Description copied from interface: Matrix
Produce the trace of the matrix.

Returns:

inv

public Matrix inv()
Description copied from interface: Matrix
Computes the inverse of the matrix. B = A^-1

Returns:

divide

public Matrix divide(Matrix b,
                     Matrix c)
C= A/B where the division is elementwise.

Parameters:
b -
c -
Returns:

sliceRow

public no.uib.cipr.matrix.Vector sliceRow(int idx)
returns a row as a vector. matlab syntax mat(idx, :)

Returns:
See Also:
Matrix.sliceRow(int)

add

public Matrix add(double a)

sliceRowM

public Matrix sliceRowM(int k)
returns a row as a matrix. matlab syntax mat(idx, :)

Returns:
See Also:
Matrix.sliceRowM(int)

insert

public int insert(no.uib.cipr.matrix.DenseMatrix m)

insert

public int insert(no.uib.cipr.matrix.DenseMatrix m,
                  int position)

insert

public int insert(no.uib.cipr.matrix.DenseVector vector,
                  int inpos)

append

public AGDenseMatrix append(Matrix mm)
Description copied from interface: Matrix
Append the matrix as new rows onto the existing matrix.

Returns:

asScalar

public double asScalar()

append

public AGDenseMatrix append(no.uib.cipr.matrix.Vector mm)
Description copied from interface: Matrix
Append the matrix as new rows onto the existing matrix.

Returns:

appendCol

public void appendCol(AGDenseMatrix r)

setColumn

public Matrix setColumn(int idx,
                        no.uib.cipr.matrix.Vector v)
Description copied from interface: Matrix
Set a complete column in the matrix to the value given.

Returns:

setColumn

public Matrix setColumn(int idx,
                        Matrix v)
Description copied from interface: Matrix
Set a complete column in the matrix to the value given. Note that the matrix must have only one column.

Returns:

append

public AGDenseMatrix append(double d)
Description copied from interface: Matrix
append double value.


setRow

public Matrix setRow(int k,
                     Matrix m)

setRow

public Matrix setRow(int k,
                     no.uib.cipr.matrix.Vector v)

selectCols

public AGDenseMatrix selectCols(int[] cols,
                                int ncols)

delCol

public Matrix delCol(int k)
Description copied from interface: Matrix
Delete column k from the matrix.

Returns:

delRow

public Matrix delRow(int del)


Copyright © 2008-2010 AstroGrid. All Rights Reserved.