ru.sscc.util
Class Reflection

java.lang.Object
  |
  +--ru.sscc.util.Reflection

public final class Reflection
extends java.lang.Object

The class performs operations with the Hausholder reflection transformation U=I-g-1vvT based on the specially constructed bearing vector v. The bearing vector is constructed to transform a specified vector u to the form (c,0,...,0)T, e.g. to annul all vector's entries expect the first one. The bearing vector of the Hausholder matrix is stored inplace of the transformed vector when constructed. The construction of the bearing vector is provided by the construct and constructAndReflect methods. So, the instance of the Reflection class may be reused many times for different reflections.


Constructor Summary
Reflection()
           
 
Method Summary
 double construct(RealPointer u, int count, double accuracy)
          Constructs the Hausholder bearing vector inplace of the vector to be transformed, prepares the instance for the transformation with the constructed vector, and returns the value c of the first vector's entry after the transformation.
 double constructAndReflect(RealContainer entries, int startIndex, int rowStep, int columnStep, int nRows, int nColumns, double accuracy)
          Constructs the Hausholder transform on the first column of the dense matrix, writes the bearing vector inplace of the first column, applies the transform to other columns of the matrix, and returns the value c of the first matrix entry after the transformation.
 void prepare(RealPointer u, int count)
          Prepares the Hausholder transform using already prepared bearing vector.
 void reflect(RealContainer entries, int startIndex, int rowStep, int columnStep, int count)
          Applies the Hausholder transform to columns of the dense matrix.
 void reflect(RealPointer u)
          Applies the Hausholder transform to a vector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reflection

public Reflection()
Method Detail

construct

public double construct(RealPointer u,
                        int count,
                        double accuracy)
Constructs the Hausholder bearing vector inplace of the vector to be transformed, prepares the instance for the transformation with the constructed vector, and returns the value c of the first vector's entry after the transformation. The method tests the squared euqlidian norm of the vector to be greater than the accuracy. If this inequality fails, the trivial reflection of the first vectors coordinate is prepared and the zero value is returned.
Parameters:
u - the pointer to the vector to be transformed
count - the vector length (the number of entries)
accuracy - the squared norm accuracy limit (must be non-negative)
Returns:
the value of first vector's entry after the transformation

prepare

public void prepare(RealPointer u,
                    int count)
Prepares the Hausholder transform using already prepared bearing vector.
Parameters:
u - the pointer to the bearing vector
count - the vector length (the number of entries)

constructAndReflect

public double constructAndReflect(RealContainer entries,
                                  int startIndex,
                                  int rowStep,
                                  int columnStep,
                                  int nRows,
                                  int nColumns,
                                  double accuracy)
Constructs the Hausholder transform on the first column of the dense matrix, writes the bearing vector inplace of the first column, applies the transform to other columns of the matrix, and returns the value c of the first matrix entry after the transformation. If the squared euqlidian norm of the first column is less than or equal to the accuracy, the matrix isn't changed and the zero value is returned.
Parameters:
entries - the matrix container
startIndex - the index of the (0,0)-th matrix entry in the container
rowStep - the distance between two neighbour entries of the same column
columnStep - the distance between two neighbour entries of the same row
nRows - the number of rows
nColumns - the number of columns
accuracy - the squared norm accuracy limit (must be non-negative)
Returns:
the value of the (0,0)-th matrix entry after the transformation

reflect

public void reflect(RealPointer u)
Applies the Hausholder transform to a vector.
Parameters:
u - the pointer to the vector to be transformed

reflect

public void reflect(RealContainer entries,
                    int startIndex,
                    int rowStep,
                    int columnStep,
                    int count)
Applies the Hausholder transform to columns of the dense matrix.
Parameters:
entries - the matrix container
startIndex - the index of the (0,0)-th matrix entry in the container
rowStep - the distance between two neighbour entries of the same column
columnStep - the distance between two neighbour entries of the same row
count - the number of columns