|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mp.MPDictionary
This abstract class is the superclass for finite real dictionaries
used for Matching Pursuit. Note that this class is not related in
any way to the util.Dictionary
class.
To make a subclass it is necessary to implement the two abstract methods here,
i.e. the getValue(..)
and setValue(..)
functions.
It is also needed to implement a constructor.
The rest of the needed functions will
then be inherited from the superclass, but often
more effective implementations are possible and these should be implemented
and override the methods from this superclass.
The dictionary is (here) logically represented as an N×K
matrix D
, but the actual representation may vary in differnt implementations.
It may actually not be stored at all, i.e. be defined from the functions alone.
Since its inteded use is in the Matching Pursuit algorithms most effort should be
put into making transposeMulitply()
and innerProduct()
effective.
The dictionary elements are vectors in space matrix RN
,
i.e. standard Euclidian N-dimensional real space, and the inner product is
the standard sum of products with the induced norm as the common 2-norm.
The dictionary elements are represented as columns in matrix D
.
Constructor Summary | |
MPDictionary()
|
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[] |
getColumn(int k)
Returns a column of the matrix, i.e. a dictionary element or atom. |
void |
getColumn(int k,
double[] d)
Returns, in argument d, a column of the matrix, i.e. a dictionary element or atom. |
int |
getColumns()
Returns number of columns in the matrix, i.e. number of dictionary elements or atoms. |
int |
getK()
Returns number of columns in the matrix, i.e. number of dictionary elements or atoms. |
int |
getN()
Returns number of rows in the matrix, i.e. dimension of the dictionary elements or atoms. |
double[] |
getRow(int n)
Returns a row of the matrix which represents the dictionary. |
void |
getRow(int n,
double[] r)
Returns, in argument r, a row of the matrix which represents the dictionary. |
int |
getRows()
Returns number of rows in the matrix, i.e. dimension of the dictionary elements or atoms. |
abstract double |
getValue(int n,
int k)
Returns the value of an entry of the matrix, i.e. a single entry of a dictionary element (atom). |
double |
innerProduct(int k1,
int k2)
Returns the inner product of two dictionary elements, i.e. matrix column vectors. |
boolean |
isNormalized()
Returns true if the dictionary is normalized, i.e. the 2-norm of all dictionary elements (atoms) is one, else it returns false. |
double[] |
multiply(double[] y)
Multiplies the dictionary D by array y .
|
void |
multiply(double[] y,
double[] x)
Multiplies the dictionary D by array y .
|
void |
normalize()
Normalize the dictionary, i.e. multiply each dictionary element (matrix column vector) by a number (scalar) such that the 2-norm, i.e. sum of squares, will be 1.0. |
void |
setColumn(int k,
double[] d)
Set a column of the matrix, i.e. a dictionary element or atom, to values in d. |
void |
setRow(int n,
double[] r)
Set a row of the matrix which represents the dictionary to values in r. |
abstract void |
setValue(int n,
int k,
double val)
Set an entry (a value) in the dictionary. |
double[] |
transposeMultiply(double[] x)
Multiplies the transposed dictionary D' by array x .
|
void |
transposeMultiply(double[] x,
double[] y)
Multiplies the transposed dictionary D' by array x .
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MPDictionary()
Method Detail |
public int getRows()
N
.
public int getColumns()
K
.
public int getN()
N
.
public int getK()
K
.
public boolean isNormalized()
normalized
.
public abstract double getValue(int n, int k)
0 <= n < N
and 0 <= k < K
.
If arguments are outside legal range a zero should be returned without error or warning.
n
- row number for the returned entry value.k
- column number for the returned entry value.public abstract void setValue(int n, int k, double val)
0 <= n < N
and 0 <= k < K
.
If any argument is outside legal range nothing should be done.
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 double innerProduct(int k1, int k2)
0 <= k1 < K
and 0 <= k2 < K
.
If k1
or k2
are out of range, 0.0 should be returned.
k1
- number for the first dictionary element.k2
- number for the second dictionary element.public void normalize()
normalized
to true.
public double[] getColumn(int k)
0 <= k < K
.
If argument is out of range a length N
array of zeros should be returned. D(:,k+1)
.
k
- number of the column in dictionary, i.e. matrix D
.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. d = D(:,k+1)
.
k
- number of the column in dictionary, i.e. matrix D
.d
- the given column of matrix D
.public void setColumn(int k, double[] d)
0 <= k < K
.
If argument is out of range an IllegalArgumentException is thrown. D(:,k+1) = d
.
k
- number of the column in dictionary, i.e. matrix D
.d
- the given column of matrix D
.public void addColumn(int k, double factor, double[] x)
0 <= k < K
. x = x+f*D(:,k+1)
.
Note that this function can not be used from Matlab, use getColumn(k) to
get D(:,k+1) and calculate the new x in Matlab.
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 double[] getRow(int n)
0 <= n < N
.
If argument is out of range a length K
array of zeros should be returned. D(n+1,:)
.
n
- number of the row in dictionary, i.e. matrix D
.public void getRow(int n, double[] r)
0 <= n < N
.
If argument is out of range a length K
array of zeros should be returned. r = D(n+1,:)
.
n
- number of the row in dictionary, i.e. matrix D
.r
- the given row of matrix D
.public void setRow(int n, double[] r)
0 <= n < N
.
If argument is out of range an IllegalArgumentException is thrown. D(n+1,:) = r
.
n
- number of the row in dictionary, i.e. matrix D
.r
- the given row of matrix D
.public double[] transposeMultiply(double[] x)
D'
by array x
.
D
is the matrix representing the dictionary, each column is a dictionary
element. An array y
is returned. D
is
N×K
, x
is N×1
,
and y
is K×1
. y = D'*x
.
x
- the signal (column vector) that is multiplied by the transposed dictionary.
K
.public void transposeMultiply(double[] x, double[] y)
D'
by array x
.
D
is the matrix representing the dictionary, each column is a dictionary
element. An array y
is returned. D
is
N×K
, x
is N×1
,
and y
is K×1
. y = D'*x
.
x
- the signal (column vector) that is multiplied by the transposed dictionary.y
- the results as an array of length K
.public double[] multiply(double[] y)
D
by array y
.
D
is the matrix representing the dictionary,
each column is a dictionary element.
An array x
is returned. D
is
N×K
, x
is N×1
,
and y
is K×1
. x = D*y
.
y
- the coefficient vector that is multiplied by the dictionary.
N
.public void multiply(double[] y, double[] x)
D
by array y
.
D
is the matrix representing the dictionary,
each column is a dictionary element.
An array x
is returned. D
is
N×K
, x
is N×1
,
and y
is K×1
. x = D*y
.
y
- the coefficient vector that is multiplied by the dictionary.x
- the results as an array of length N
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |