Class Rn
- All Implemented Interfaces:
Serializable
,IArchive
- Since:
- Jul 22, 2015
- Author:
- Christopher K. Allen
- See Also:
-
Field Summary
Fields inherited from class xal.tools.math.BaseVector
ATTR_DATA
-
Constructor Summary
ConstructorsConstructorDescriptionRn
(double[] arrVals) Initializing constructor for bases classRn
.Rn
(int intSize) Zero matrix constructor forRn
.Parsing Constructor - creates an instance of the child class and initialize it according to a token string of element values.Rn
(int intSize, DataAdaptor daSource) Initializing constructor forRn
.Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Base classes must override the clone operation in order to make deep copies of the current object.protected Rn
newInstance
(double[] arrVecInt) Creates a new instance of this vector type with the given Java array as the internal representation.protected Rn
newInstance
(int intSize) Returns a new, zero element, instance ofRn
which has the same size as this object.Methods inherited from class xal.tools.math.BaseVector
assignUnity, assignZero, copyVector, embedIn, equals, getArrayCopy, getElem, getElem, getSize, getVector, hashCode, innerProd, isEquivalentTo, leftMultiply, load, minus, minusEquals, negate, negateEquals, newInstance, norm1, norm2, normInf, plus, plusEquals, print, print, println, projectOnto, rightMultiply, save, setElem, setElem, setVector, setVector, setVector, times, timesEquals, toString
-
Constructor Details
-
Rn
public Rn(int intSize) Zero matrix constructor forRn
. 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
Initializing constructor forRn
. The element values are loaded from the given data source.- Parameters:
intSize
- size of the vectordaSource
- 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
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 objectstrTokens
- token vector of getSize() numeric values- Throws:
IllegalArgumentException
- wrong number of token stringsNumberFormatException
- bad number format, unparseable- Since:
- Jul 22, 2015 by Christopher K. Allen
-
Rn
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
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 classBaseVector<Rn>
- Since:
- Jul 22, 2015 by Christopher K. Allen
- See Also:
-
newInstance
Returns a new, zero element, instance ofRn
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 classBaseVector<Rn>
- Returns:
- uninitialized vector object of type
V
- Since:
- Jul 22, 2015 by Christopher K. Allen
- See Also:
-
xal.tools.math.BaseVector#newInstance()
-
newInstance
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 classBaseVector<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:
-