|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mpv2.AllMatrices mpv2.BandMatrix
public class BandMatrix
This class is a band diagonal matrix implementation of the AllMatrices superclass.
The N-by-K matrix A
is represented as an array of column vectors,
and for each stored array (column vector) it is also stored how many zeros
that preceed this array in the column vector of the matrix.
Thus the lengths of the stored column vectors are usualle less than N
.
Field Summary |
---|
Fields inherited from class mpv2.AllMatrices |
---|
K, N |
Constructor Summary | |
---|---|
BandMatrix(double[][] A)
Construct a matrix from a 2-D array. |
|
BandMatrix(int iN,
int iK)
Construct a N×K matrix with only zero values. |
|
BandMatrix(int iN,
int iK,
double[] vals)
Construct a N×K matrix or dictionary with values
from given one-dimensional array (which represents the matrix). |
Method Summary | |
---|---|
void |
addColumn(int k,
double factor,
double[] x)
Add a column of the matrix multiplied by a factor to a given vector. |
double |
get(int n,
int k)
Return an entry of the matrix. |
void |
getColumn(int k,
double[] d)
Copy a column of the matrix into argument d Legal range of the integer argument is 0 <= k < K . |
double |
innerProduct(int k1,
int k2)
Returns the inner product of two matrix column vectors. |
void |
set(int n,
int k,
double val)
Set an entry (a value) in the matrix. |
void |
setAll(double[] vals)
Set all entries of to matrix to the supplied new values If argument is wrong length an IllegalArgumentException is thrown. |
void |
setColumn(int k,
double[] col)
Replace a column in the dictionary with the given column vector. |
void |
times(double[] y,
double[] x)
Multiplies the matrix by an array. |
void |
transposeTimes(double[] x,
double[] y)
Multiplies the transposed matrix by an array. |
Methods inherited from class mpv2.AllMatrices |
---|
chol, columnNorm0, columnNorm1, columnNorm2, columnNormInf, cond, det, eig, eqConstant, eqCopy, eqCopy, eqCopy, eqCopy, eqCopy, eqDifference, eqEProduct, eqEQuotient, eqIdentity, eqInverse, eqIProduct, eqNegate, eqOnes, eqPermuteColumns, eqPermuteRows, eqProduct, eqProduct, eqRandom, eqScaleColumns, eqScaleRows, eqSum, eqTProduct, eqTranspose, eqZeros, getAll, getAll, getColumn, getColumnDimension, getK, getN, getRow, getRow, getRowDimension, getSubMatrix, getSubMatrix, getSubMatrix, getSubMatrix, getValue, lu, lup, norm1, norm2, normF, normInf, pluseqOuterProduct, print, print, print, print, qr, rank, setRow, setValue, sumAll, svd, times, times, times, trace, transposeTimes, transposeTimes, transposeTimes |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BandMatrix(int iN, int iK)
N×K
matrix with only zero values.
iN
- number of rows, i.e. length of column vectors of the matrix.iK
- number of columnspublic BandMatrix(int iN, int iK, double[] vals)
N×K
matrix or dictionary with values
from given one-dimensional array (which represents the matrix).
Length of the array should be N*K
.
iN
- number of rows, i.e. length of column vectors of the matrix.iK
- number of columnsvals
- the values (ordered by column)public BandMatrix(double[][] A)
A
- Two-dimensional array of doubles.
java.lang.IllegalArgumentException
- All rows must have the same lengthMethod Detail |
---|
public double get(int n, int k)
0 <= n < N
and 0 <= k < K
.
If any argument is outside legal range 0.0 is returned without error or warning.
get
in class AllMatrices
n
- row number for the returned entry value.k
- column number for the returned entry value.
public void set(int n, int k, double val)
0 <= n < N
and 0 <= k < K
.
If any argument is outside legal range nothing is done.
set
in class AllMatrices
n
- row number for the entry value to be changed.k
- column number for the entry value to be changed.val
- the value to be put into the given entry of the dictionary.public void getColumn(int k, double[] d)
0 <= k < K
.
If argument is out of range a length N
array of zeros should be returned. A(:,k+1)
.
getColumn
in class AllMatrices
k
- number of the column in the matrixd
- the given column of the matrixpublic void setColumn(int k, double[] col)
N
.
We should have: 0 <= k < K
.
If any argument is outside legal dimension or range nothing is done.
setColumn
in class AllMatrices
k
- column number for the column to be changed.col
- the value to be put into the given entry of the dictionary.public void addColumn(int k, double factor, double[] x)
0 <= k < K
. x = x+factor*D(:,k+1)
.
addColumn
in class AllMatrices
k
- number of the column in dictionary, i.e. matrix D
.factor
- a factor to multiply the column vector by.x
- an array of length N
.public void setAll(double[] vals)
setAll
in class AllMatrices
vals
- One-dimensional array of doubles, packed by columns (ala Fortran).public double innerProduct(int k1, int k2)
0 <= k1 < K
and 0 <= k2 < K
. k1
or k2
is out of range, 0.0 is returned.
innerProduct
in class AllMatrices
k1
- number for the first column.k2
- number for the second column.public void times(double[] y, double[] x)
A
is
N×K
, x
is N×1
,
and y
is K×1
.x = A*y
.
times
in class AllMatrices
y
- the input arrayx
- the results as an array of length N
.public void transposeTimes(double[] x, double[] y)
A
is
N×K
, x
is N×1
,
and y
is K×1
.y = A'*x
.
transposeTimes
in class AllMatrices
x
- the input arrayy
- the results as an array of length K
.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |