de.jtem.jtao
Class TaoVec

java.lang.Object
  extended by de.jtem.jpetsc.PrimitivNative
      extended by de.jtem.jpetsc.Native
          extended by de.jtem.jtao.TaoVec

public class TaoVec
extends Native


Nested Class Summary
static class TaoVec.StepBoundInfoResult
          Result class for stepBoundInfo(de.jtem.jtao.TaoVec, de.jtem.jtao.TaoVec, de.jtem.jtao.TaoVec)
 
Field Summary
 
Fields inherited from class de.jtem.jpetsc.PrimitivNative
destroyNative
 
Constructor Summary
TaoVec(int n)
           
TaoVec(de.jtem.jtao.TaoVec.TaoVecTypes type, int n)
           
 
Method Summary
 void absoluteValue()
          Sets each element of this vector equal to its magnitude.
 void addConstant(double alpha)
          Adds a constant to each element of this vector.
 void axpby(double alpha, TaoVec xx, double beta)
          Adds a scalar multiple of a vector to a multiple of this vector.
 void axpy(double alpha, TaoVec xx)
          Adds a scalar multiple of a vector to this vector.
 void aypx(double alpha, TaoVec xx)
          Adds a vector to a scalar multiple of this vector.
 void boundGradientProjection(TaoVec GG, TaoVec XXL, TaoVec XX, TaoVec XXU)
          Projects this vector according to this definition.
 void copyFrom(TaoVec vv)
          Copies the contents of one vector into this vector.
 TaoVec destroyVecs(int nn)
          Destroys an array TaoVec objects.
 double dot(TaoVec vv)
          Computes the inner product of this vector with another vector.
 TaoVec duplicate()
          Creates a new TaoVec object with the same structure as this one.
 void fischer(TaoVec xx, TaoVec ff, TaoVec ll, TaoVec uu)
          Evaluates the Fischer-Burmeister function for complementarity
problems.
 java.nio.DoubleBuffer getArrayBuffer()
          Returns the buffer of the TaoVec, that can be read and written.
 double[] getArrayReadOnly()
          Returns an array containing the values of the TaoVec, that can only be read.
 int getDimension()
          Gets the dimension of the vector space where this vector belongs.
 void median(TaoVec vv, TaoVec ww, TaoVec xx)
          Computes the componentwise median of three vectors
and stores the result in this vector.
 double minElement()
          Finds the smallest element of this vector.
protected  void nativeCreate()
           
 void negate()
          Multiplies the elements of this vector by negative one.
 double norm1()
           
 double norm2()
          Compute the two-norm of this vector.
 double norm2squared()
          Computes the square of the two norm of this vector.
 double normInfinity()
          Computes the infinity norm of this vector.
 void pointwiseDivide(TaoVec vv, TaoVec ww)
          Computes the componentwise division of two vectors
and stores the result in this vector.
 void pointwiseMaximum(TaoVec vv, TaoVec ww)
          Computes the componentwise minimum of two vectors
and stores the result in this vector.
 void pointwiseMinimum(TaoVec vv, TaoVec ww)
          Computes the componentwise minimum of two vectors
and stores the result in this vector.
 void pointwiseMultiply(TaoVec vv, TaoVec ww)
          Computes the componentwise multiplication of two vectors
and stores the result in this vector.
 void pow(double p)
          Raises each element of this vector to a power.
 void reciprocal()
          Sets each element of this vector to its Reciprocal.
 void restoreArrayBuffer()
          Restores the buffer of the TaoVec gotten by getArrayBuffer().
 void scale(double alpha)
          Multiplies this vector by a scalar.
 void scaleCopyFrom(double a, TaoVec vv)
          Copies the contents of one vector into this vector and scales it.
 void setToConstant(double c)
          Sets each element of this vector equal to the specified constant.
 void setToZero()
          Sets each element of this vector equal to zero.
 void sFischer(TaoVec xx, TaoVec ff, TaoVec ll, TaoVec uu, double mu)
          Evaluates the Smoothed Fischer-Burmeister function for
complementarity problems.
 void sign()
          Replace each element of this vector with -1, 0, or 1, depending on its sign.
 void sqrt()
          Sets each element of this vector to its square root.
 TaoVec.StepBoundInfoResult stepBoundInfo(TaoVec txl, TaoVec txu, TaoVec tdx)
          Calculates the largest multiple of a vector that can be added to
this vector while keeping each element of this vector nonnegative.
 void stepMax(TaoVec vv, double[] step1)
          Calculates the largest multiple of a vector that can be added to
this vector while keeping each element of this vector nonnegative.
static void TaoVecDestroy(TaoVec vv)
          Destroys the TaoVec object.
 java.lang.String toString()
           
 void view()
          Views the contents of the vector.
 void waxpby(double a, TaoVec xx, double b, TaoVec yy)
          Sums two scaled vectors and stores the result in this vector.
 
Methods inherited from class de.jtem.jpetsc.PrimitivNative
finalize, getNativeObjectToString, load
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TaoVec

public TaoVec(de.jtem.jtao.TaoVec.TaoVecTypes type,
              int n)

TaoVec

public TaoVec(int n)
Method Detail

nativeCreate

protected void nativeCreate()
Specified by:
nativeCreate in class Native

getArrayBuffer

public java.nio.DoubleBuffer getArrayBuffer()
Returns the buffer of the TaoVec, that can be read and written. It is absolutely necessary to restore the buffer by calling restoreArrayBuffer(), even if it has only been read.

Throws:
PETScError
See Also:
getArrayReadOnly, restoreArrayBuffer

restoreArrayBuffer

public void restoreArrayBuffer()
Restores the buffer of the TaoVec gotten by getArrayBuffer(). After calling this function you must not use the buffer!!

Throws:
PETScError
See Also:
getArrayBuffer

getArrayReadOnly

public final double[] getArrayReadOnly()
Returns an array containing the values of the TaoVec, that can only be read.

Throws:
PETScError
See Also:
getArrayBuffer

toString

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

norm1

public double norm1()

TaoVecDestroy

public static void TaoVecDestroy(TaoVec vv)
Destroys the TaoVec object.

Parameters:
vv - the vector

destroyVecs

public TaoVec destroyVecs(int nn)
Destroys an array TaoVec objects.

Parameters:
nn - number of new vectors
See Also:
TaoVec, CloneVecs

duplicate

public TaoVec duplicate()
Creates a new TaoVec object with the same structure as this one. It does not
copy the value to the new vector.

Returns:
address of a pointer to new TaoVec object
See Also:
TaoVec, CloneVecs, TaoVec, CopyFrom

setToConstant

public void setToConstant(double c)
Sets each element of this vector equal to the specified constant.

Parameters:
c - a constant
See Also:
TaoVec, Scale

setToZero

public void setToZero()
Sets each element of this vector equal to zero.

See Also:
TaoVec, SetToConstant

copyFrom

public void copyFrom(TaoVec vv)
Copies the contents of one vector into this vector.

Parameters:
vv - A TaoVec from which the contents will be copied.
See Also:
TaoVec, Axpy, TaoVec, ScaleCopyFrom

scaleCopyFrom

public void scaleCopyFrom(double a,
                          TaoVec vv)
Copies the contents of one vector into this vector and scales it.

Parameters:
a - the scalar
vv - A TaoVec from which the contents will be copied.
See Also:
TaoVec, Axpy, TaoVec, Aypx

normInfinity

public double normInfinity()
Computes the infinity norm of this vector.

Returns:
the infinity norm of this vector
See Also:
TaoVec, Norm1, TaoVec, Norm2

norm2

public double norm2()
Compute the two-norm of this vector.

Returns:
the two-norm of this vector
See Also:
TaoVec, Norm1, TaoVec, NormInfinity, TaoVec, Norm2squared

norm2squared

public double norm2squared()
Computes the square of the two norm of this vector.

Returns:
the square of the two norm of this vector
See Also:
TaoVec, Norm2

scale

public void scale(double alpha)
Multiplies this vector by a scalar.

Parameters:
alpha - the scalar
See Also:
TaoVec, SetToConstant, TaoVec, Aypx

axpy

public void axpy(double alpha,
                 TaoVec xx)
Adds a scalar multiple of a vector to this vector. (this += alpha * xx)

Parameters:
alpha - the scalar
xx - the vector
See Also:
TaoVec, CopyFrom, TaoVec, Aypx

axpby

public void axpby(double alpha,
                  TaoVec xx,
                  double beta)
Adds a scalar multiple of a vector to a multiple of this vector. (this=alpha*xx + beta*this)

Parameters:
alpha - the scalar of tx
xx - the vector
beta - the scalar multiple of this vector
See Also:
TaoVec, Axpy, TaoVec, Aypx

aypx

public void aypx(double alpha,
                 TaoVec xx)
Adds a vector to a scalar multiple of this vector. (this=alpha*this+xx)

Parameters:
alpha - the scalar
xx - the vector
See Also:
TaoVec, Scale, TaoVec, Axpy

addConstant

public void addConstant(double alpha)
Adds a constant to each element of this vector.

Parameters:
alpha - the scalar
See Also:
TaoVec, SetToConstant, TaoVec, Axpy

dot

public double dot(TaoVec vv)
Computes the inner product of this vector with another vector.

Parameters:
vv - another TaoVec object
Returns:
the inner product of the two vectors
See Also:
TaoVec, Norm

negate

public void negate()
Multiplies the elements of this vector by negative one.

See Also:
TaoVec, Scale

reciprocal

public void reciprocal()
Sets each element of this vector to its Reciprocal.

See Also:
TaoVec, PointwiseDivide

sqrt

public void sqrt()
Sets each element of this vector to its square root.


pow

public void pow(double p)
Raises each element of this vector to a power.

Parameters:
p -

getDimension

public int getDimension()
Gets the dimension of the vector space where this vector belongs.

Returns:
the dimension of the vector space
See Also:
TaoVec, Compatible

pointwiseMultiply

public void pointwiseMultiply(TaoVec vv,
                              TaoVec ww)
Computes the componentwise multiplication of two vectors
and stores the result in this vector.

Parameters:
vv - the two vectors
ww - the two vectors
See Also:
TaoVec, PointwiseDivide

pointwiseDivide

public void pointwiseDivide(TaoVec vv,
                            TaoVec ww)
Computes the componentwise division of two vectors
and stores the result in this vector.

Parameters:
vv - the vector of numerators
ww - the vector of denominators
See Also:
TaoVec, PointwiseMultiply

median

public void median(TaoVec vv,
                   TaoVec ww,
                   TaoVec xx)
Computes the componentwise median of three vectors
and stores the result in this vector.

Parameters:
vv - the three vectors
ww - the three vectors
xx - the three vectors

pointwiseMinimum

public void pointwiseMinimum(TaoVec vv,
                             TaoVec ww)
Computes the componentwise minimum of two vectors
and stores the result in this vector.

Parameters:
vv - the two vectors
ww - the two vectors
See Also:
TaoVec, PointwiseMaximum

pointwiseMaximum

public void pointwiseMaximum(TaoVec vv,
                             TaoVec ww)
Computes the componentwise minimum of two vectors
and stores the result in this vector.

Parameters:
vv - the two vectors
ww - the two vectors
See Also:
TaoVec, PointwiseMinimum

waxpby

public void waxpby(double a,
                   TaoVec xx,
                   double b,
                   TaoVec yy)
Sums two scaled vectors and stores the result in this vector. (this=alpha*xx+beta*yy)

Parameters:
a - the multiple of the first vector
xx - the first vector
b - the multiple of the second vector
yy - the second vector
See Also:
TaoVec, Axpy, TaoVec, Axpby, TaoVec, Aypx, ;

absoluteValue

public void absoluteValue()
Sets each element of this vector equal to its magnitude.


minElement

public double minElement()
Finds the smallest element of this vector.

Returns:
the smallest value in the vector

sign

public void sign()
Replace each element of this vector with -1, 0, or 1, depending on its sign.


stepMax

public void stepMax(TaoVec vv,
                    double[] step1)
Calculates the largest multiple of a vector that can be added to
this vector while keeping each element of this vector nonnegative.

Parameters:
vv - the step direction
step1 - the maximum stepsize

stepBoundInfo

public TaoVec.StepBoundInfoResult stepBoundInfo(TaoVec txl,
                                                TaoVec txu,
                                                TaoVec tdx)
Calculates the largest multiple of a vector that can be added to
this vector while keeping each element of this vector nonnegative.

Parameters:
txl - the lower bounds on this vector
txu - the upper bounds on this vector
tdx - the step direction for this vector
Returns:
TaoVec.StepBoundInfoResult

view

public void view()
Views the contents of the vector.


boundGradientProjection

public void boundGradientProjection(TaoVec GG,
                                    TaoVec XXL,
                                    TaoVec XX,
                                    TaoVec XXU)
Projects this vector according to this definition.
If XX[i]==XXL[i], then this[i] = min(G[i],0);
If XX[i]==XXU[i], then this[i] = max(G[i],0);
else this[i] = G[i];

Parameters:
GG - the vectors.
XXL - the vectors.
XX - the vectors.
XXU - the vectors.

fischer

public void fischer(TaoVec xx,
                    TaoVec ff,
                    TaoVec ll,
                    TaoVec uu)
Evaluates the Fischer-Burmeister function for complementarity
problems.

Parameters:
xx - current point
ff - function evaluated at x
ll - lower bounds
uu - upper bounds
See Also:
TaoMat, DFischer

sFischer

public void sFischer(TaoVec xx,
                     TaoVec ff,
                     TaoVec ll,
                     TaoVec uu,
                     double mu)
Evaluates the Smoothed Fischer-Burmeister function for
complementarity problems.

Parameters:
xx - current point
ff - function evaluated at x
ll - lower bounds
uu - upper bounds
mu - smoothing parameter
See Also:
TaoMat, SDFischer