IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Real vector class. More...
Public Member Functions | |
Vector (IVector vec) | |
Constructs a vector from aanother array. | |
Vector (int n) | |
Constructs an n-dimensional vector of zeros. | |
Vector (int n, int which) | |
Constructs an n-dimensional unit vector for i'th coordinate. | |
Vector (int n, double value) | |
Constructs an n-dimensional constant vector with all components initialized to the specified value. | |
Vector (params double[] components) | |
Constructs a vector from a 1-D array, directly using the provided array as internal data structure. | |
Vector (VectorBase_MathNetNumerics vec) | |
Constructs a vector from a 1-D array, directly using the provided array as internal data structure. | |
Vector | GetCopyThis () |
Creates and returns a copy of the current vector, which is of the same type as the current vector. | |
override VectorBase | GetCopyBase () |
Creates and returns a copy of the current vector, which is of the same type as the current vector. | |
Vector | GetNewThis (int length) |
Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector. | |
override VectorBase | GetNewBase (int length) |
Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector. | |
Vector | GetNewThis () |
Creates and returns a new vector with the same dimension and of the same type as the current vector. | |
override VectorBase | GetNewBase () |
Creates and returns a new vector with the same dimension and of the same type as the current vector. | |
virtual Matrix | GetNewMatrixThis (int rowCount, int columnCount) |
Creates and returns a new matrix with the specified dimensona, and of a type that is consistent with the type of the current vector. | |
override MatrixBase | GetNewMatrixBase (int rowCount, int columnCount) |
Creates and returns a new matrix with the specified dimensona, and of a type that is consistent with the type of the current vector. | |
Matrix | GetNewMatrixThis () |
Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector. | |
override MatrixBase | GetNewMatrixBase () |
Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector. | |
override int | GetHashCode () |
Returns the hash code (hash function) of the current vector. | |
override bool | Equals (Object obj) |
Returns a value indicating whether the specified object is equal to the current vector. True is returned if the object is a non-null vector (i.e. it implements the IVector interface), and has the same dimension and equal elements as the current vector. | |
Static Public Member Functions | |
static Vector | Create (double[] components) |
Constructs a vector from a 1-D array. | |
static Vector | Create (VectorBase_MathNetNumerics vec) |
Constructs a vector as a copy of a MathNetVector object. | |
static Vector | Create (Vector vec) |
Constructs a vector as a copy of another Vector object. | |
static Vector | Random (int n) |
Generates vector with random elements uniformly distributed on [0, 1). | |
static Vector | Ones (int n) |
Generates an d2-dimensional vector filled with 1. | |
static Vector | Zeros (int n) |
Generates an d2-dimensional vector filled with 0. | |
static Vector | BasisVector (int n, int i) |
Generates an d2-dimensional unit vector for i-th coordinate. | |
Protected Member Functions | |
internal | Vector () |
void | CopyFromMatNetNumericsVector (Vector_MathNetNumerics v) |
Copies values from the specified MathNet Numerics vector. | |
Vector_MathNetNumerics | GetCopyMathNetNumerics () |
Creates and returns a newly allocated MathNet Numerics representation of the current vector. | |
Protected Attributes | |
double[] | _elements |
int | _length |
bool | _mathNetNumericsConsistent = false |
Properties | |
override int | Length [get] |
Gets dimension of the vector. | |
virtual int | LengthSetter [set] |
Sets the dimension of the current vector. This setter must be used very restrictively - only in setters that can change vector dimension. Setter is defined separately from getter because the base class' property does not define a getter. | |
override double | this [int i] [get, set] |
Gets or sets the element indexed by i in the Vector . | |
virtual bool | IsCopyMathNetNumericsConsistent [get, set] |
Tells whether the internal MathNet Numerics representation of the current vector is consistent with the current vector. The MathNet Numerics representation is used for operations that are used from that library such as different kinds of decompositions. | |
virtual Vector_MathNetNumerics | CopyMathNetNumerics [get] |
Gets the internal MathNet Numerics representation of the current vector. Representation is created on demand. However, the same copy is returned as long as it is consistent with the current matrix. Use GetCopyMathNet() to create a new copy each time. | |
Private Member Functions | |
object ICloneable. | Clone () |
Returns a deep copy of a vector. | |
Private Attributes | |
Vector_MathNetNumerics | _copyMathNetNumerics |
Real vector class.
$A Igor Jan08 Jul10 Nov10;
internal IG::Num::Vector::Vector | ( | ) | [inline, protected] |
IG::Num::Vector::Vector | ( | IVector | vec | ) | [inline] |
IG::Num::Vector::Vector | ( | int | n | ) | [inline] |
Constructs an n-dimensional vector of zeros.
n | Dimensionality of vector. |
IG::Num::Vector::Vector | ( | int | n, |
int | which | ||
) | [inline] |
Constructs an n-dimensional unit vector for i'th coordinate.
n | Dimensionality of vector. |
which | Specifies which unit vector is constructed (which components equals one). |
IG::Num::Vector::Vector | ( | int | n, |
double | value | ||
) | [inline] |
Constructs an n-dimensional constant vector with all components initialized to the specified value.
n | Dimensionality of vector. |
value | Value to which all components are set. |
IG::Num::Vector::Vector | ( | params double[] | components | ) | [inline] |
Constructs a vector from a 1-D array, directly using the provided array as internal data structure.
vec | One-dimensional array of doubles. |
IG::Num::Vector::Vector | ( | VectorBase_MathNetNumerics | vec | ) | [inline] |
Constructs a vector from a 1-D array, directly using the provided array as internal data structure.
vec | One-dimensional array of doubles. |
static Vector IG::Num::Vector::Create | ( | double[] | components | ) | [inline, static] |
Constructs a vector from a 1-D array.
static Vector IG::Num::Vector::Create | ( | VectorBase_MathNetNumerics | vec | ) | [inline, static] |
Constructs a vector as a copy of a MathNetVector object.
Constructs a vector as a copy of another Vector object.
static Vector IG::Num::Vector::Random | ( | int | n | ) | [inline, static] |
Generates vector with random elements uniformly distributed on [0, 1).
d2 | Dimensionality of vector. |
[0, 1)
interval.static Vector IG::Num::Vector::Ones | ( | int | n | ) | [inline, static] |
Generates an d2-dimensional vector filled with 1.
d2 | Dimensionality of vector. |
static Vector IG::Num::Vector::Zeros | ( | int | n | ) | [inline, static] |
Generates an d2-dimensional vector filled with 0.
d2 | Dimensionality of vector. |
static Vector IG::Num::Vector::BasisVector | ( | int | n, |
int | i | ||
) | [inline, static] |
Generates an d2-dimensional unit vector for i-th coordinate.
d2 | Dimensionality of vector. |
i | Coordinate index. |
void IG::Num::Vector::CopyFromMatNetNumericsVector | ( | Vector_MathNetNumerics | v | ) | [inline, protected] |
Copies values from the specified MathNet Numerics vector.
v | Vector from which elements are copied. |
Vector_MathNetNumerics IG::Num::Vector::GetCopyMathNetNumerics | ( | ) | [inline, protected] |
Creates and returns a newly allocated MathNet Numerics representation of the current vector.
Vector IG::Num::Vector::GetCopyThis | ( | ) | [inline] |
Creates and returns a copy of the current vector, which is of the same type as the current vector.
override VectorBase IG::Num::Vector::GetCopyBase | ( | ) | [inline, virtual] |
Creates and returns a copy of the current vector, which is of the same type as the current vector.
Implements IG::Num::VectorBase.
Vector IG::Num::Vector::GetNewThis | ( | int | length | ) | [inline] |
Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.
length | Dimension of the returned vector. |
override VectorBase IG::Num::Vector::GetNewBase | ( | int | length | ) | [inline, virtual] |
Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.
length | Dimension of the returned vector. |
Implements IG::Num::VectorBase.
Vector IG::Num::Vector::GetNewThis | ( | ) | [inline] |
Creates and returns a new vector with the same dimension and of the same type as the current vector.
override VectorBase IG::Num::Vector::GetNewBase | ( | ) | [inline, virtual] |
Creates and returns a new vector with the same dimension and of the same type as the current vector.
Implements IG::Num::VectorBase.
virtual Matrix IG::Num::Vector::GetNewMatrixThis | ( | int | rowCount, |
int | columnCount | ||
) | [inline, virtual] |
Creates and returns a new matrix with the specified dimensona, and of a type that is consistent with the type of the current vector.
rowCount | Number of rows of the returned matrix. |
columnCount | Number of rows of the returned matrix. |
override MatrixBase IG::Num::Vector::GetNewMatrixBase | ( | int | rowCount, |
int | columnCount | ||
) | [inline, virtual] |
Creates and returns a new matrix with the specified dimensona, and of a type that is consistent with the type of the current vector.
rowCount | Number of rows of the returned matrix. |
columnCount | Number of rows of the returned matrix. |
Implements IG::Num::VectorBase.
Matrix IG::Num::Vector::GetNewMatrixThis | ( | ) | [inline] |
Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.
override MatrixBase IG::Num::Vector::GetNewMatrixBase | ( | ) | [inline, virtual] |
Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.
Implements IG::Num::VectorBase.
object ICloneable. IG::Num::Vector::Clone | ( | ) | [inline, private] |
Returns a deep copy of a vector.
override int IG::Num::Vector::GetHashCode | ( | ) | [inline] |
Returns the hash code (hash function) of the current vector.
This method calls the VectorBase.GetHashCode to calculate the hash code, which is standard for all implementations of the IVector interface.
Two vectors that have the same dimensions and equal elements will produce the same hash codes.
Probability that two different vectors will produce the same hash code is small but it exists.
Overrides the object.GetHashCode method.
Reimplemented from IG::Num::VectorBase.
override bool IG::Num::Vector::Equals | ( | Object | obj | ) | [inline] |
Returns a value indicating whether the specified object is equal to the current vector. True is returned if the object is a non-null vector (i.e. it implements the IVector interface), and has the same dimension and equal elements as the current vector.
This method calls the VectorBase.Equals to obtain the returned value, which is standard for all implementations of the IVector interface.
Overrides the object.Equals method.
Reimplemented from IG::Num::VectorBase.
double [] IG::Num::Vector::_elements [protected] |
int IG::Num::Vector::_length [protected] |
Vector_MathNetNumerics IG::Num::Vector::_copyMathNetNumerics [private] |
bool IG::Num::Vector::_mathNetNumericsConsistent = false [protected] |
override int IG::Num::Vector::Length [get] |
Gets dimension of the vector.
Reimplemented from IG::Num::VectorBase.
virtual int IG::Num::Vector::LengthSetter [set, protected] |
Sets the dimension of the current vector. This setter must be used very restrictively - only in setters that can change vector dimension. Setter is defined separately from getter because the base class' property does not define a getter.
override double IG::Num::Vector::this[int i] [get, set] |
Gets or sets the element indexed by i
in the Vector
.
i | Element index, 0 - based. |
Reimplemented from IG::Num::VectorBase.
virtual bool IG::Num::Vector::IsCopyMathNetNumericsConsistent [get, set] |
Tells whether the internal MathNet Numerics representation of the current vector is consistent with the current vector. The MathNet Numerics representation is used for operations that are used from that library such as different kinds of decompositions.
Currrently, an internal flag indicating consistency of the MathNet matrix is not used. Every time this property is required, the consistence is actually verified by comparing values. There may be derived matrix classes where the falg is actually used. These must keep track when anything in the matrix changes and invalidate the flag on each such event.
virtual Vector_MathNetNumerics IG::Num::Vector::CopyMathNetNumerics [get] |
Gets the internal MathNet Numerics representation of the current vector. Representation is created on demand. However, the same copy is returned as long as it is consistent with the current matrix. Use GetCopyMathNet() to create a new copy each time.