示例#1
0
 /// <summary>
 /// Discards the direction vectors and any corresponding data of the oldest PCG iterations.
 /// </summary>
 /// <param name="numOldVectorsToRemove">
 /// The number of the oldest entries (direction vectors and corresponding data) to discard. If it exceeds the number of
 /// entries currently stored, they will all be discarded without throwing any exceptions.
 /// </param>
 public void RemoveOldDirectionVectorData(int numOldVectorsToRemove)
 {
     if (numOldVectorsToRemove > Directions.Count)
     {
         Directions.Clear();
         MatrixTimesDirections.Clear();
         DirectionsTimesMatrixTimesDirections.Clear();
     }
     else
     {
         Directions.RemoveRange(0, numOldVectorsToRemove);
         MatrixTimesDirections.RemoveRange(0, numOldVectorsToRemove);
         DirectionsTimesMatrixTimesDirections.RemoveRange(0, numOldVectorsToRemove);
     }
 }
示例#2
0
 /// <summary>
 /// Discards the direction vectors and any corresponding data of the newest PCG iterations.
 /// </summary>
 /// <param name="numOldVectorsToRemove">
 /// The number of the newest entries (direction vectors and corresponding data) to discard. If it exceeds the number of
 /// entries currently stored, they will all be discarded without throwing any exceptions.
 /// </param>
 public void RemoveNewDirectionVectorData(int numNewVectorsToRemove)
 {
     if (numNewVectorsToRemove > Directions.Count)
     {
         Directions.Clear();
         MatrixTimesDirections.Clear();
         DirectionsTimesMatrixTimesDirections.Clear();
     }
     else
     {
         int start = Directions.Count - numNewVectorsToRemove;
         Directions.RemoveRange(start, numNewVectorsToRemove);
         MatrixTimesDirections.RemoveRange(start, numNewVectorsToRemove);
         DirectionsTimesMatrixTimesDirections.RemoveRange(start, numNewVectorsToRemove);
     }
 }
示例#3
0
 /// <summary>
 /// Stores a new direction vector and other related data. The new entries will be regarded as latest.
 /// </summary>
 /// <param name="pcg">The Preconditioned Conjugate Gradient Aglorithm that uses this object.</param>
 public void StoreDirectionData(ReorthogonalizedPcg pcg)
 {
     Directions.Add(pcg.Direction.Copy());
     MatrixTimesDirections.Add(pcg.MatrixTimesDirection.Copy());
     DirectionsTimesMatrixTimesDirections.Add(pcg.DirectionTimesMatrixTimesDirection);
 }
示例#4
0
 public void Clear()
 {
     Directions.Clear();
     MatrixTimesDirections.Clear();
     DirectionsTimesMatrixTimesDirections.Clear();
 }