|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object yawn.util.Pattern
public class Pattern
A pattern (or vector or stimuli) of real numbers (double). $Id: Pattern.java,v 1.12 2005/04/07 17:28:30 supermarti Exp $
Field Summary | |
---|---|
static java.lang.String |
ELEMENT_SEPARATOR
|
Constructor Summary | |
---|---|
Pattern()
Creates a zero elements Pattern . |
|
Pattern(double[] source)
Creates a Pattern whose elements are copied from
source . |
|
Pattern(int size)
Creates a Pattern of the desired size initialized to zero. |
|
Pattern(Pattern source)
Creates a Pattern whose elements are copied from
source . |
Method Summary | |
---|---|
Pattern |
add(double operand)
Scalar addition. |
Pattern |
add(Pattern operand)
Element-wise addition. |
void |
appendComponent(double value)
Appends an element to the Pattern . |
double[] |
asDoubleArray()
The elements of this Pattern as a double[] . |
protected void |
checkEqualSize(Pattern comp)
Checks if a Pattern has equal size. |
java.lang.Object |
clone()
|
double |
dist(Pattern other)
Calculates an Euclidean distance from this Pattern . |
boolean |
equals(Pattern other)
|
double |
getComponent(int i)
Returns the i -nary element of the Pattern . |
double |
innerProduct(Pattern operand)
Calculates the inner product of two Pattern s. |
Pattern |
multiply(double operand)
Scalar multipication. |
double |
norm1()
Calculates a norm1 (sum of absolute values) of the Pattern . |
double |
norm2()
Calculates a norm2 (square root of the sum of the squared values) of the Pattern . |
static Pattern |
parsePattern(java.lang.String str)
Parses a String into a Pattern . |
void |
randomize(double min,
double max)
Randomizes this Pattern with values bounded by
min and max . |
void |
setAllComponents(double value)
Sets all Pattern elements to value . |
void |
setComponent(double value,
int i)
Sets element of index i to value . |
void |
setComponents(Pattern orig)
Sets elements to the ones of orig . |
int |
size()
|
Pattern |
substract(Pattern operand)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ELEMENT_SEPARATOR
Constructor Detail |
---|
public Pattern()
Pattern
.
public Pattern(double[] source)
Pattern
whose elements are copied from
source
.
source
- the array from which elements are copiedpublic Pattern(int size)
Pattern
of the desired size initialized to zero.
size
- the dimension of the new Pattern
public Pattern(Pattern source)
Pattern
whose elements are copied from
source
.
source
- the Pattern
to be used as sourceMethod Detail |
---|
public Pattern add(Pattern operand)
operand
- the Pattern
to add
public Pattern add(double operand)
operand
- the amount to add
public void appendComponent(double value)
Pattern
. Note that is an
inefficient operation and should be rarely used.
value
- the value of the element to appendpublic double[] asDoubleArray()
Pattern
as a double[]
.
double[]
protected void checkEqualSize(Pattern comp)
Pattern
has equal size.
comp
- Pattern
to test with
java.lang.ArrayIndexOutOfBoundsException
public java.lang.Object clone()
clone
in class java.lang.Object
public double dist(Pattern other)
Pattern
.
other
- the Pattern
to measure the distance with
public boolean equals(Pattern other)
public double getComponent(int i)
Pattern
.
i
- the index of the desired element
public double innerProduct(Pattern operand)
Pattern
s.
operand
- the Pattern
to be used in calculation
public Pattern multiply(double operand)
operand
- the amount to multiply
Pattern
public double norm1()
Pattern
.
public double norm2()
Pattern
.
public void setAllComponents(double value)
Pattern
elements to value
.
value
- the value to setpublic void setComponent(double value, int i)
i
to value
.
value
- the value to seti
- index of the element to set
java.lang.IndexOutOfBoundsException
public void setComponents(Pattern orig)
orig
.
orig
- the Pattern
with the elements to setpublic int size()
Pattern
public java.lang.String toString()
toString
in class java.lang.Object
public static Pattern parsePattern(java.lang.String str)
Pattern
. Elements are separated by
Pattern.ELEMENT_SEPARATOR
str
- the String to parse
Pattern
ELEMENT_SEPARATOR
public void randomize(double min, double max)
Pattern
with values bounded by
min
and max
. It does not initializes the
random number generator.
min
- lower boundmax
- higher boundpublic Pattern substract(Pattern operand)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |