edu.mines.jtk.opt
Class ArrayVect1fs

java.lang.Object
  extended by edu.mines.jtk.opt.ArrayVect1fs
All Implemented Interfaces:
Vect, VectConst, java.io.Serializable, java.lang.Cloneable

public class ArrayVect1fs
extends java.lang.Object
implements Vect

Implements a Vect as a collection of ArrayVect1f's of fixed size.

Author:
W.S. Harlan
See Also:
Serialized Form

Field Summary
protected  ArrayVect1f[] _data
          Array of wrapped data
 
Constructor Summary
ArrayVect1fs()
          To be used with init()
ArrayVect1fs(ArrayVect1f[] data)
          Wrap an array of ArrayVect1f's
 
Method Summary
 void add(double scaleThis, double scaleOther, VectConst other)
          Add a scaled version of another vector to a scaled version of this vector.
 ArrayVect1fs clone()
           
 void constrain()
          Optionally apply a hard constraint (such as an inequality) to the current vector.
 void dispose()
          Optionally free any resources held by this object.
 double dot(VectConst other)
          Return the Cartesian dot product of this vector with another vector (not including any inverse covariance).
 ArrayVect1f[] getData()
          Get the embedded data
 int getSize()
          Return the size of the embedded array
 double magnitude()
          This is the dot product of the vector with itself premultiplied by the inverse covariance.
 void multiplyInverseCovariance()
          Optionally multiply a vector by the inverse covariance matrix.
 void postCondition()
          Apply a linear filter that enhances components that should be optimized first, and suppresses components of lesser importance.
 void project(double scaleThis, double scaleOther, VectConst other)
          Project another vector onto the space of this vector, then scale, and add to a scaled version of this vector.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_data

protected ArrayVect1f[] _data
Array of wrapped data

Constructor Detail

ArrayVect1fs

public ArrayVect1fs(ArrayVect1f[] data)
Wrap an array of ArrayVect1f's

Parameters:
data - Wrap this array of ArrayVect1f's.

ArrayVect1fs

public ArrayVect1fs()
To be used with init()

Method Detail

getSize

public int getSize()
Return the size of the embedded array

Returns:
size of embedded array

getData

public ArrayVect1f[] getData()
Get the embedded data

Returns:
Same array as passed to constructor.

clone

public ArrayVect1fs clone()
Specified by:
clone in interface Vect
Specified by:
clone in interface VectConst
Overrides:
clone in class java.lang.Object

dot

public double dot(VectConst other)
Description copied from interface: VectConst
Return the Cartesian dot product of this vector with another vector (not including any inverse covariance). [Feel free to normalize by the number of elements in the array, if the inverse convariance is defined consistently.]

Specified by:
dot in interface VectConst
Parameters:
other - The vector to be dotted.
Returns:
The dot product.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dispose

public void dispose()
Description copied from interface: Vect
Optionally free any resources held by this object. Will not be used again. This method can safely do nothing.

Specified by:
dispose in interface Vect

multiplyInverseCovariance

public void multiplyInverseCovariance()
Description copied from interface: Vect
Optionally multiply a vector by the inverse covariance matrix. Also called preconditioning. A method that does nothing is equivalent to an identity. [vect.magnitude() should return the same value as vect.dot(((Vect)vect.clone()).multiplyInverseCovariance()); This should enhance components that should be discouraged in the model and suppress components that are preferred. This operation slows convergence. This filter must be linear. For inversions, you should at least implement a scaling operation that correctly weights errors in the data versus the magnitude of the model.]

Specified by:
multiplyInverseCovariance in interface Vect

constrain

public void constrain()
Description copied from interface: Vect
Optionally apply a hard constraint (such as an inequality) to the current vector. This is used only by a non-linear optimization. This method can safely do nothing.

Specified by:
constrain in interface Vect

postCondition

public void postCondition()
Description copied from interface: Vect
Apply a linear filter that enhances components that should be optimized first, and suppresses components of lesser importance. Also called post-conditioning. This filter prefilters all perturbations of the model and speeds convergence on components of most importance in the model. The same result can be accomplished by Transform.inverseHessian(), but this location may be more convenient. Use this location if the conditioning is independent of the Transform and dependent on the implementation of the model. This method can safely do nothing.

Specified by:
postCondition in interface Vect

add

public void add(double scaleThis,
                double scaleOther,
                VectConst other)
Description copied from interface: Vect
Add a scaled version of another vector to a scaled version of this vector. [If this==other, then the result should be the same as scaling this by (scaleThis+scaleOther)]

Specified by:
add in interface Vect
Parameters:
scaleThis - Multiply this vector by this scalar before adding.
scaleOther - Multiply the other vector by this scalar before adding.
other - The other vector to be multiplied.

project

public void project(double scaleThis,
                    double scaleOther,
                    VectConst other)
Description copied from interface: Vect
Project another vector onto the space of this vector, then scale, and add to a scaled version of this vector. (Useful for perturbing one vector with a constrained subspace.) This method should give the same result as add(), if the other Vect is an instance of the same class as this Vect. This operation need not be supported for any any types other than this Vect.

Specified by:
project in interface Vect
Parameters:
scaleThis - Multiply this vector by this scalar before adding.
scaleOther - Multiply the other vector by this scalar before adding.
other - The other vector to be projected, scaled, and added.

magnitude

public double magnitude()
Description copied from interface: VectConst
This is the dot product of the vector with itself premultiplied by the inverse covariance. If the inverse covariance is an identity, then the result is just the dot product with itself. Equivalently,
      Vect vect = (Vect) this.clone();
      vect.multiplyInverseCovariance();
      return this.dot(vect);
      
But you can usually avoid the clone.

Specified by:
magnitude in interface VectConst
Returns:
magnitude of vector.