Class Rn

All Implemented Interfaces:
Serializable, IArchive

public class Rn extends BaseVector<Rn>
Represents a vector of real numbers with arbitrary length.
Since:
Jul 22, 2015
Author:
Christopher K. Allen
See Also:
  • Constructor Details

    • Rn

      public Rn(int intSize)
      Zero matrix constructor for Rn. A new vector is created with the given dimension and all zero elements.
      Parameters:
      intSize - vector size
      Since:
      Jul 22, 2015 by Christopher K. Allen
    • Rn

      public Rn(int intSize, DataAdaptor daSource)
      Initializing constructor for Rn. The element values are loaded from the given data source.
      Parameters:
      intSize - size of the vector
      daSource - data source contains initial values for elements
      Since:
      Jul 22, 2015 by Christopher K. Allen
    • Rn

      public Rn(double[] arrVals)

      Initializing constructor for bases class Rn. Sets the entire vector to the values given in the Java primitive type double array. The argument itself remains unchanged.

      The dimensions of the new vector will be the length of the given Java double array.

      NOTE

      · The given array is set to the internal vector representation. Thus the given array should not be referenced afterwards!

      · This action is done for performance. If the given array is intended for further manipulation then a clone should be offered to this constructor.

      Parameters:
      arrVals - Java primitive array containing new vector values
      Since:
      Jul 22, 2015 by Christopher K. Allen
    • Rn

      public Rn(int intSize, String strTokens) throws IllegalArgumentException, NumberFormatException

      Parsing Constructor - creates an instance of the child class and initialize it according to a token string of element values.

      The token string argument is assumed to be one-dimensional and delimited by any of the characters " ,()[]{}" Repeated, contiguous delimiters are parsed together. This conditions allows a variety of parseable string representations. For example,

          { 1, 2, 3, 4 }

      and

          [1 2 3 4]

      would parse to the same real vector (1.0, 2.0, 3.0, 4.0).

      Parameters:
      intSize - the matrix size of this object
      strTokens - token vector of getSize() numeric values
      Throws:
      IllegalArgumentException - wrong number of token strings
      NumberFormatException - bad number format, unparseable
      Since:
      Jul 22, 2015 by Christopher K. Allen
    • Rn

      public Rn(Rn vecTemplate) throws UnsupportedOperationException
      Copy constructor. Creates a deep copy of the given argument.
      Parameters:
      vecTemplate - vector to be cloned
      Throws:
      UnsupportedOperationException
      Since:
      Jul 22, 2015 by Christopher K. Allen
  • Method Details

    • clone

      public Rn clone()
      Description copied from class: BaseVector
      Base classes must override the clone operation in order to make deep copies of the current object. This operation cannot be done without the exact type.
      Specified by:
      clone in class BaseVector<Rn>
      Since:
      Jul 22, 2015 by Christopher K. Allen
      See Also:
    • newInstance

      protected Rn newInstance(int intSize)
      Returns a new, zero element, instance of Rn which has the same size as this object. That is, the returned object is in the same equivalence class of vectors as this one.
      Specified by:
      newInstance in class BaseVector<Rn>
      Returns:
      uninitialized vector object of type V
      Since:
      Jul 22, 2015 by Christopher K. Allen
      See Also:
      • xal.tools.math.BaseVector#newInstance()
    • newInstance

      protected Rn newInstance(double[] arrVecInt)
      Description copied from class: BaseVector
      Creates a new instance of this vector type with the given Java array as the internal representation.
      Specified by:
      newInstance in class BaseVector<Rn>
      Parameters:
      arrVecInt - new vector's guts
      Returns:
      new instance of this vector type with the internal representation
      Since:
      Jul 24, 2015 by Christopher K. Allen
      See Also: