IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.
|
Base class for real vectors. More...
Public Member Functions | |
virtual double[] | ToArray () |
Copies the current vector to an array. | |
abstract VectorBase | GetCopyBase () |
Creates and returns a copy of the current vector. WARNING: This method should be overridden in the derived classes in such a way that the returned vector is of the same type as the current vector. | |
abstract 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 of the current vector. WARNING: This method should be overridden in all derived classes such that the returned vector type is the same as the type of the current vector. | |
abstract VectorBase | GetNewBase () |
Creates and returns a new vector with the same dimension and of the same type as the current vector. | |
abstract 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. | |
abstract 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. | |
virtual IVector | GetCopy () |
Returns a deep copy of the current object. | |
virtual IVector | GetNew (int length) |
Creates and returns a new vector with the specified dimension, and of the same type as the current vector. | |
virtual IVector | GetNew () |
Creates and returns a new vector with the same dimension and of the same type as the current vector. | |
virtual IMatrix | GetNewMatrix (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. | |
virtual IMatrix | GetNewMatrix () |
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. | |
virtual void | SetZero () |
Sets all components of the current vector to 0. | |
virtual void | SetConstant (double elementValue) |
Sets all components of the current vector to the specified value. | |
virtual void | SetUnit (int which) |
Sets the current vector to the specific unit vector (one component equals 1, others are 0). | |
virtual void | SetRandom () |
Sets the current vector such that it contains random elements on the interval (0,1]. | |
virtual void | SetRandom (IRandomGenerator rnd) |
Sets the current vector such that it contains random elements on the interval (0,1]. | |
virtual double | NormP (int p) |
p-norm, p-th root of sum of absolute values of components raised to the power of p. | |
IVector | Normalized () |
Returns a vector that equals a normalized current vector. | |
void | Normalize () |
Normalizes the current vector. | |
void | Negate () |
Changes the sign 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. | |
int | GetHashFunctionInt () |
Returns an integer valued hash function of the current vector object. The returned value is calculated by the Util.GetHashFunctionInt method. | |
string | GetHashFunctionString () |
Returns a string valued hash function of the current vector object. The returned value is calculated by the Util.GetHashFunctionString method. | |
override string | ToString () |
Returns a string representation of this vector in a standard IGLib form. | |
virtual string | ToStringMath () |
Returns a string representation of this vector in a standard IGLib form (Mathematica-like format but with C representation of numbers). | |
virtual string | ToString (string elementFormat) |
Returns a string representation of the current vector in a standard IGLib form, with the specified format for elements of the vector. | |
virtual string | ToStringMath (string elementFormat) |
Returns a string representation of the current vector in a standard IGLib form (Mathematica-like format but with C representation of numbers), with the specified format for elements of the vector. | |
Static Public Member Functions | |
static double | DistancePlain (IVector a, IVector b) |
Returns Euqlidean distance between the specified two vectors. WARNING: This is a plain version of the method that does not perform any consistency checks. | |
static double | Distance (IVector a, IVector b) |
Returns Euqlidean distance between the specified two vectors. WARNING: Dimensions must match, otherwise exception is thrown.. | |
static double | DistanceWeightedPlain (IVector a, IVector b, IVector characteristicLengths) |
Returns distance between the specified two vectors where vector elements are weighted by elements of another vector, which represent intervals of equal importance (thus the weighted sum is divided by their squares). Dw=Sqrt(Sum(((a_i-b_i)/l_i)^2))WARNING: This is a plain version of the method that does not perform any consistency checks. It assumes that all vector prarameters are allocated and of hte same dimension, and that all elements of characteristic lengths vector are non-zero. | |
static double | DistanceWeighted (IVector a, IVector b, IVector characteristicLengths) |
Returns distance between the specified two vectors where vector elements are weighted by elements of another vector, which represent intervals of equal importance (thus the weighted sum is divided by their squares). Dw=Sqrt(Sum(((a_i-b_i)/l_i)^2))WARNING: Dimensions of vector arguments must match, otherwise exceptin is thrown. Also if any element of characteristic lengths vector is zero, an exception is thrown, too. | |
static double | NormWeightedPlain (IVector a, IVector characteristicLengths) |
Returns weighted Euclidean norm of the specified vector. | |
static double | NormWeighted (IVector a, IVector characteristicLengths) |
Returns weighted Euclidean norm of the specified vector. | |
static void | SetZero (IVector vec) |
Sets all components of the current vector to 0. | |
static void | SetConstant (IVector vec, double elementValue) |
Sets all components of the current vector to the specified value. | |
static void | SetUnit (IVector vec, int which) |
Sets the current vector to the specific unit vector (one component equals 1, others are 0). | |
static void | SetRandom (IVector vec) |
Sets the current vector such that it contains random elements on the interval (0,1]. | |
static void | SetRandom (IVector vec, IRandomGenerator rnd) |
Sets the current vector such that it contains random elements on the interval (0,1]. | |
static int | Compare (IVector v1, IVector v2) |
Compares two vectors and returns -1 if the first vector is smaller than the second one, 0 if vectors are equal, and 1 if the first vector is greater. Vector that is null is considered smaller than a vector that is not null. Two null vectors are considered equal. Vector with smaller dimension is considered smaller than a vector with greater dimension. Vectors with equal dimensions ar compared by elements. The first element that is different decides which vector is considered greater. | |
static void | Resize (ref IVector vec, IVector template, int dimension) |
Resizes, if necessary, the specified vector according to the required dimension. If the vector is initially null then a new vector is created. If in this case a template vector is specified then the newly created vector will be of the same type as that template vector, because it is created by the GetNew() method on that vector. If dimension of the initial vector does not match the required dim., then vector is resized. If the specified vector dimension is less or equal to 0 then vector is resized with the same dimension as that of the template vector. If in this case the template vector is null, an exception is thrown. WARNINGS: Components are NOT preserved and have in general undefined values after operation is performed. If vector and template are null then the type of nawly created vector is Vector. | |
static void | Resize (ref IVector vec, int dimension) |
Resizes, if necessary, the specified vector according to the required dimension. If the vector is initially null then a new vector is created. If dimension of the initial vector does not match the required dimension, then vector is resized. Components are NOT preserved and have in general undefined values after operation is performed. WARNING: If the vector is initially null then the type of the newly created vector is Vector. | |
static void | Resize (ref IVector vec, IVector template) |
Resizes, if necessary, the specified vector according to the dimension of the specified template vector. If the vector is initially null then a new vector is created. In this case the newly created vector will be of the same type as that template vector, because it is created by the GetNew() method on that vector. If dimension of the initial vector does not match the dimension of the template vector, then vector is resized. If the template vector is null, then an exception is thrown. WARNINGS: Components are NOT preserved and have in general undefined values after operation is performed. If vector and template are null then the type of newly created vector is Vector. | |
static void | CopyPlain (IVector a, IVector result) |
Copies components of a vector to another vector. This is a plain version that does not perform any dimension checks. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Copy (IVector a, IVector result) |
Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Copy (IVector a, ref IVector result) |
Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary. | |
static void | CopyPlain (VectorBase_MathNetNumerics a, IVector result) |
Copies components of a vector to another vector. This is a plain version that does not perform any dimension checks. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Copy (VectorBase_MathNetNumerics a, IVector result) |
Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Copy (VectorBase_MathNetNumerics a, ref IVector result) |
Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary. | |
static void | CopyPlain (IVector a, Vector_MathNetNumerics result) |
Copies components of a vector to another vector. This is a plain version that does not perform any dimension checks. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Copy (IVector a, Vector_MathNetNumerics result) |
Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Copy (IVector a, ref Vector_MathNetNumerics result) |
Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary. | |
static void | NegatePlain (IVector a, IVector result) |
Stores a negative vector of the specified vector to another vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Negate (IVector a, IVector result) |
Stores a negative vector of the specified vector to another vector. WARNING: dimensions of the copied vector and result vector must match. | |
static void | Negate (IVector a, ref IVector result) |
Stores a negative vector of the specified vector to another vector. Resulting vector is allocated or reallocated if necessary. | |
static void | AddPlain (IVector a, IVector b, IVector result) |
Sums two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of vectors must match, otherwise an exception is thrown. | |
static void | Add (IVector a, IVector b, IVector result) |
Sums two vectors and stores the result in the specified result vector. WARNING: dimensions of vectors must match, otherwise an exception is thrown. | |
static void | Add (IVector a, IVector b, ref IVector result) |
Sums two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated. | |
static void | SubtractPlain (IVector a, IVector b, IVector result) |
Subtracts two vectors (a - b ) and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of vectors must match, otherwise an exception is thrown. | |
static void | Subtract (IVector a, IVector b, IVector result) |
Subtracts two vectors (a - b ) and stores the result in the specified result vector. WARNING: dimensions of vectors must match, otherwise an exception is thrown. | |
static void | Subtract (IVector a, IVector b, ref IVector result) |
Subtracts two vectors (a - b ) and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated. | |
static void | ArrayAddPlain (IVector a, double scal, IVector result) |
Addition of a scalar to all components of a vector. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null). | |
static void | ArrayAdd (IVector a, double scal, IVector result) |
Addition of a scalar to all components of a vector. Vector operand must be defined (non-null). | |
static void | ArrayAdd (IVector a, double scal, ref IVector result) |
Addition of a scalar to all components of a vector. Vector operand must be defined (non-null). | |
static void | ArraySubtractPlain (IVector a, double scal, IVector result) |
Subtraction of a scalar from all components of a vector. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null). | |
static void | ArraySubtract (IVector a, double scal, IVector result) |
Subtraction of a scalar from all components of a vector. Vector operand must be defined (non-null). | |
static void | ArraySubtract (IVector a, double scal, ref IVector result) |
Subtraction of a scalar to all components of a vector. Vector operand must be defined (non-null). | |
static void | MultiplyPlain (IVector a, double scal, IVector result) |
Multiplication of a vector by a scalar. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null). | |
static void | Multiply (IVector a, double scal, IVector result) |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null). | |
static void | Multiply (IVector a, double scal, ref IVector result) |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null). | |
static void | ScalePlain (IVector a, double scal, IVector result) |
Multiplication of a vector by a scalar. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null). | |
static void | Scale (IVector a, double scal, IVector result) |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null). | |
static void | Scale (IVector a, double scal, ref IVector result) |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null). | |
static void | DividePlain (IVector a, double scal, IVector result) |
Division of a vector by a scalar. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null). | |
static void | Divide (IVector a, double scal, IVector result) |
Division of a vector by a scalar. Vector operand must be defined (non-null). | |
static void | Divide (IVector a, double scal, ref IVector result) |
Division of a vector by a scalar. Vector operand must be defined (non-null). | |
static double | ScalarProductPlain (IVector a, IVector b) |
Scalar product of teo vectors. This is a plain version of the method that does not perform any consistency checks. | |
static double | ScalarProduct (IVector a, IVector b) |
Scalar product of teo vectors. | |
static void | DyadicProductPlain (IVector a, IVector b, IMatrix result) |
Calculates dyadic product of two vectors and stores the result in the specified result matrix. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions must match, otherwise an exception is thrown. | |
static void | DyadicProduct (IVector a, IVector b, IMatrix result) |
Calculates dyadic product of two vectors and stores the result in the specified result matrix. WARNING: dimensions must match, otherwise an exception is thrown. | |
static void | DyadicProduct (IVector a, IVector b, ref IMatrix result) |
Calculates dyadic product of two vectors and stores the result in the specified result matrix. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated. | |
static void | CrossProductPlain (IVector a, IVector b, IVector result) |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | CrossProduct (IVector a, IVector b, IVector result) |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | CrossProduct (IVector a, IVector b, ref IVector result) |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated. | |
static void | VectorProductPlain (IVector a, IVector b, IVector result) |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | VectorProduct (IVector a, IVector b, IVector result) |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | VectorProduct (IVector a, IVector b, ref IVector result) |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated. | |
static void | ArrayProductPlain (IVector a, IVector b, IVector result) |
Calculates array product (element-by-element product) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | ArrayProduct (IVector a, IVector b, IVector result) |
Calculates array product (element-by-element product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | ArrayProduct (IVector a, IVector b, ref IVector result) |
Calculates array product (element-by-element product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated. | |
static void | ArrayQuotientPlain (IVector a, IVector b, IVector result) |
Calculates array quotient (element-by-element division) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | ArrayQuotient (IVector a, IVector b, IVector result) |
Calculates array quotient (element-by-element division) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown. | |
static void | ArrayQuotient (IVector a, IVector b, ref IVector result) |
Calculates array quotient (element-by-element division) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated. | |
static int | GetHashCode (IVector vec) |
Returns hash code of the specified vector. | |
static bool | Equals (IVector v1, IVector v2) |
Returns true if the specified vectors are equal, false if not. | |
static int | GetHashFunctionInt (IVector vec) |
Returns an integer valued hash function of the specified vector object. The returned value is calculated by the Util.GetHashFunctionInt method. | |
static string | GetHashFunctionString (IVector vec) |
Returns a string valued hash function of the specified vector object. The returned value is calculated by the Util.GetHashFunctionString method. | |
static VectorBase | operator+ (VectorBase v) |
Unary plus, returns the operand. | |
static VectorBase | operator- (VectorBase v) |
Unary negation, returns the negative operand. | |
static VectorBase | operator+ (VectorBase a, VectorBase b) |
Vector addition. | |
static VectorBase | operator- (VectorBase a, VectorBase b) |
Vector subtraction. | |
static double | operator* (VectorBase a, VectorBase b) |
Scalar product of two vectors. | |
static VectorBase | operator* (VectorBase a, double b) |
Product of a vector by a scalar. | |
static VectorBase | operator* (double a, VectorBase b) |
Product of a vector by a scalar. | |
static VectorBase | operator/ (VectorBase a, double b) |
Vector subtraction. | |
static string | ToString (IVector vec) |
Returns a string representation of the specified vector in a standard IGLib form. | |
static string | ToStringMath (IVector vec) |
Returns a string representation of the specified vector in a standard IGLib form (Mathematica-like format but with C representation of numbers). | |
static string | ToString (IVector vec, string elementFormat) |
Returns a string representation of the specified vector in a standard IGLib form, with the specified format for elements of the vector. | |
static string | ToStringMath (IVector vec, string elementFormat) |
Returns a string representation of the specified vector in a standard IGLib form (Mathematica-like format but with C representation of numbers), with the specified format for elements of the vector. | |
static void | SaveJson (IVector vec, string filePath) |
Saves (serializes) the specified vector to the specified JSON file. File is owerwritten if it exists. | |
static void | SaveJson (IVector vec, string filePath, bool append) |
Saves (serializes) the specified vector to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag. | |
static void | LoadJson (string filePath, ref IVector vecRestored) |
Restores (deserializes) a vector from the specified file in JSON format. | |
static void | SaveCsv (IVector vec, string filePath) |
Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten. Constant UtilStr.DefaultCsvSeparator is used as separator. | |
static void | SaveCsv (IVector vec, string filePath, string separator) |
Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten. | |
static void | SaveCsv (IVector vec, string filePath, bool append) |
Saves the specified vector to a CSV file. Constant UtilStr.DefaultCsvSeparator is used as separator in CSV. | |
static void | SaveCsv (IVector vec, string filePath, string separator, bool append) |
Saves the specified vector to a CSV file. | |
static void | LoadCsv (string filePath, ref IVector vecRestored) |
Reads a vector from a CSV file. Constant Str.DefaultCsvSeparator is used as separator in CSV file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row. | |
static void | LoadCsv (string filePath, string separator, ref IVector vecRestored) |
Reads a vector written in CSV format from a file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row. | |
static void | LoadCsv (string filePath, int rowNum, ref IVector vecRestored) |
Reads a vector from the specified row of a CSV file. Constant UtilStr.DefaultCsvSeparator is used as CSV separator. If the specified row does not exisist in the file then exception is thrown. | |
static void | LoadCsv (string filePath, int rowNum, string separator, ref IVector vecRestored) |
Reads a vector from the specified row of a CSV file. If the specified row does not exisist in the file then exception is thrown. | |
Properties | |
abstract int | Length [get] |
Gets dimension of the vector. | |
abstract double | this [int i] [get, set] |
Gets or sets the element indexed by i in the Vector . | |
virtual double | Norm [get] |
Gets Euclidean norm of the vector. | |
virtual double | Norm2 [get] |
Gets Euclidean norm of the vector. | |
virtual double | NormEuclidean [get] |
Gets Euclidean norm of the vector. | |
virtual double | SquaredNorm [get] |
Squared Euclidean norm, sum of squared components. | |
virtual double | Norm1 [get] |
1-norm (Manhattan norm or Taxicab norm), sum of absolute values of components. | |
virtual double | NormInf [get] |
Infinity-norm, maximum absolute value of any component. | |
static VectorStore | VectorStore [get] |
Gets the matrix store for recycling auxiliary matrices. Matrix store is created only once, on the first access. | |
Static Private Attributes | |
static VectorStore | _matrixStore |
Base class for real vectors.
$A Igor Jan08 Jul10 Nov10;
virtual double [] IG::Num::VectorBase::ToArray | ( | ) | [inline, virtual] |
Copies the current vector to an array.
abstract VectorBase IG::Num::VectorBase::GetCopyBase | ( | ) | [pure virtual] |
Creates and returns a copy of the current vector. WARNING: This method should be overridden in the derived classes in such a way that the returned vector is of the same type as the current vector.
Implemented in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
abstract VectorBase IG::Num::VectorBase::GetNewBase | ( | int | length | ) | [pure 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 of the current vector. WARNING: This method should be overridden in all derived classes such that the returned vector type is the same as the type of the current vector.
length | Dimension of the returned vector. |
Implemented in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
abstract VectorBase IG::Num::VectorBase::GetNewBase | ( | ) | [pure virtual] |
Creates and returns a new vector with the same dimension and of the same type as the current vector.
Implemented in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
abstract MatrixBase IG::Num::VectorBase::GetNewMatrixBase | ( | int | rowCount, |
int | columnCount | ||
) | [pure 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. |
Implemented in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
abstract MatrixBase IG::Num::VectorBase::GetNewMatrixBase | ( | ) | [pure 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.
Implemented in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
virtual IVector IG::Num::VectorBase::GetCopy | ( | ) | [inline, virtual] |
Returns a deep copy of the current object.
Implements IG::Num::IVector.
virtual IVector IG::Num::VectorBase::GetNew | ( | int | length | ) | [inline, virtual] |
Creates and returns a new vector with the specified dimension, and of the same type as the current vector.
length | Dimension of the newly created vector. |
Implements IG::Num::IVector.
virtual IVector IG::Num::VectorBase::GetNew | ( | ) | [inline, virtual] |
Creates and returns a new vector with the same dimension and of the same type as the current vector.
Implements IG::Num::IVector.
virtual IMatrix IG::Num::VectorBase::GetNewMatrix | ( | 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::IVector.
virtual IMatrix IG::Num::VectorBase::GetNewMatrix | ( | ) | [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::IVector.
virtual void IG::Num::VectorBase::SetZero | ( | ) | [inline, virtual] |
Sets all components of the current vector to 0.
Implements IG::Num::IVector.
virtual void IG::Num::VectorBase::SetConstant | ( | double | elementValue | ) | [inline, virtual] |
Sets all components of the current vector to the specified value.
elementValue | Value to which vector elements are set. |
Implements IG::Num::IVector.
virtual void IG::Num::VectorBase::SetUnit | ( | int | which | ) | [inline, virtual] |
Sets the current vector to the specific unit vector (one component equals 1, others are 0).
which | Specifies which unit vector is set (i.e., which component equals 1). |
Implements IG::Num::IVector.
virtual void IG::Num::VectorBase::SetRandom | ( | ) | [inline, virtual] |
Sets the current vector such that it contains random elements on the interval (0,1].
Implements IG::Num::IVector.
virtual void IG::Num::VectorBase::SetRandom | ( | IRandomGenerator | rnd | ) | [inline, virtual] |
Sets the current vector such that it contains random elements on the interval (0,1].
rnd | Random generator used to generate vector elements. |
Implements IG::Num::IVector.
virtual double IG::Num::VectorBase::NormP | ( | int | p | ) | [inline, virtual] |
p-norm, p-th root of sum of absolute values of components raised to the power of p.
Returns Euqlidean distance between the specified two vectors. WARNING: This is a plain version of the method that does not perform any consistency checks.
a | First vector. |
b | Second vector. |
Returns Euqlidean distance between the specified two vectors. WARNING: Dimensions must match, otherwise exception is thrown..
a | First vector. |
b | Second vector. |
static double IG::Num::VectorBase::DistanceWeightedPlain | ( | IVector | a, |
IVector | b, | ||
IVector | characteristicLengths | ||
) | [inline, static] |
Returns distance between the specified two vectors where vector elements are weighted by elements of another vector, which represent intervals of equal importance (thus the weighted sum is divided by their squares). Dw=Sqrt(Sum(((a_i-b_i)/l_i)^2))WARNING: This is a plain version of the method that does not perform any consistency checks. It assumes that all vector prarameters are allocated and of hte same dimension, and that all elements of characteristic lengths vector are non-zero.
a | First vector. |
b | Second vector. |
characteristicLengths | Vector whose elements represent interval lenhth of equal importance in different coordinate direction. Used for calculation of weighted sum (terms are divided by squares of vector elements). |
static double IG::Num::VectorBase::DistanceWeighted | ( | IVector | a, |
IVector | b, | ||
IVector | characteristicLengths | ||
) | [inline, static] |
Returns distance between the specified two vectors where vector elements are weighted by elements of another vector, which represent intervals of equal importance (thus the weighted sum is divided by their squares). Dw=Sqrt(Sum(((a_i-b_i)/l_i)^2))WARNING: Dimensions of vector arguments must match, otherwise exceptin is thrown. Also if any element of characteristic lengths vector is zero, an exception is thrown, too.
a | First vector. |
b | Second vector. |
characteristicLengths | Vector whose elements represent interval lenhth of equal importance in different coordinate direction. Used for calculation of weighted sum (terms are divided by squares of vector elements). |
static double IG::Num::VectorBase::NormWeightedPlain | ( | IVector | a, |
IVector | characteristicLengths | ||
) | [inline, static] |
Returns weighted Euclidean norm of the specified vector.
static double IG::Num::VectorBase::NormWeighted | ( | IVector | a, |
IVector | characteristicLengths | ||
) | [inline, static] |
Returns weighted Euclidean norm of the specified vector.
IVector IG::Num::VectorBase::Normalized | ( | ) | [inline] |
Returns a vector that equals a normalized current vector.
Implements IG::Num::IVector.
Reimplemented in IG::Num::Vector2d, and IG::Num::Vector3d.
void IG::Num::VectorBase::Normalize | ( | ) | [inline] |
Normalizes the current vector.
void IG::Num::VectorBase::Negate | ( | ) | [inline] |
Changes the sign of the current vector.
override int IG::Num::VectorBase::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 in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
override bool IG::Num::VectorBase::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 in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
int IG::Num::VectorBase::GetHashFunctionInt | ( | ) | [inline] |
Returns an integer valued hash function of the current vector object. The returned value is calculated by the Util.GetHashFunctionInt method.
Implements IG::Num::IVector.
string IG::Num::VectorBase::GetHashFunctionString | ( | ) | [inline] |
Returns a string valued hash function of the current vector object. The returned value is calculated by the Util.GetHashFunctionString method.
The returned string is always on the same length, and is based on the ToString method. Therefore it is convenient for use in file or directory names that have one part related to a specific vector.
Implements IG::Num::IVector.
static void IG::Num::VectorBase::SetZero | ( | IVector | vec | ) | [inline, static] |
Sets all components of the current vector to 0.
vec | Vector whose components are set. |
static void IG::Num::VectorBase::SetConstant | ( | IVector | vec, |
double | elementValue | ||
) | [inline, static] |
Sets all components of the current vector to the specified value.
vec | Vector whose components are set. |
elementValue | Value to which vector elements are set. |
static void IG::Num::VectorBase::SetUnit | ( | IVector | vec, |
int | which | ||
) | [inline, static] |
Sets the current vector to the specific unit vector (one component equals 1, others are 0).
vec | Vector whose components are set. |
which | Specifies which unit vector is set (i.e., which component equals 1). |
static void IG::Num::VectorBase::SetRandom | ( | IVector | vec | ) | [inline, static] |
Sets the current vector such that it contains random elements on the interval (0,1].
vec | Vector whose components are set. |
static void IG::Num::VectorBase::SetRandom | ( | IVector | vec, |
IRandomGenerator | rnd | ||
) | [inline, static] |
Sets the current vector such that it contains random elements on the interval (0,1].
vec | Vector whose components are set. |
rnd | Random generator used to generate vector elements. |
Compares two vectors and returns -1 if the first vector is smaller than the second one, 0 if vectors are equal, and 1 if the first vector is greater. Vector that is null is considered smaller than a vector that is not null. Two null vectors are considered equal. Vector with smaller dimension is considered smaller than a vector with greater dimension. Vectors with equal dimensions ar compared by elements. The first element that is different decides which vector is considered greater.
v1 | First vector to be compared. |
v2 | Second vector to be compared. |
This comparison does not have any mathematical meaning. It is just used for sotting of vectors in data structures.
static void IG::Num::VectorBase::Resize | ( | ref IVector | vec, |
IVector | template, | ||
int | dimension | ||
) | [inline, static] |
Resizes, if necessary, the specified vector according to the required dimension. If the vector is initially null then a new vector is created. If in this case a template vector is specified then the newly created vector will be of the same type as that template vector, because it is created by the GetNew() method on that vector. If dimension of the initial vector does not match the required dim., then vector is resized. If the specified vector dimension is less or equal to 0 then vector is resized with the same dimension as that of the template vector. If in this case the template vector is null, an exception is thrown. WARNINGS: Components are NOT preserved and have in general undefined values after operation is performed. If vector and template are null then the type of nawly created vector is Vector.
static void IG::Num::VectorBase::Resize | ( | ref IVector | vec, |
int | dimension | ||
) | [inline, static] |
Resizes, if necessary, the specified vector according to the required dimension. If the vector is initially null then a new vector is created. If dimension of the initial vector does not match the required dimension, then vector is resized. Components are NOT preserved and have in general undefined values after operation is performed. WARNING: If the vector is initially null then the type of the newly created vector is Vector.
vec | Vector that is resized. |
dimenson | Dimension to which vector is resized (if less or equal to 0 then exception is thrown). |
Resizes, if necessary, the specified vector according to the dimension of the specified template vector. If the vector is initially null then a new vector is created. In this case the newly created vector will be of the same type as that template vector, because it is created by the GetNew() method on that vector. If dimension of the initial vector does not match the dimension of the template vector, then vector is resized. If the template vector is null, then an exception is thrown. WARNINGS: Components are NOT preserved and have in general undefined values after operation is performed. If vector and template are null then the type of newly created vector is Vector.
Copies components of a vector to another vector. This is a plain version that does not perform any dimension checks. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where copy will be stored. Dimensions must match dimensions of original. |
Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where copy will be stored. Dimensions must match dimensions of original. |
Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary.
a | Original vector. |
result | Vector where copy will be stored. |
static void IG::Num::VectorBase::CopyPlain | ( | VectorBase_MathNetNumerics | a, |
IVector | result | ||
) | [inline, static] |
Copies components of a vector to another vector. This is a plain version that does not perform any dimension checks. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where copy will be stored. Dimensions must match dimensions of original. |
static void IG::Num::VectorBase::Copy | ( | VectorBase_MathNetNumerics | a, |
IVector | result | ||
) | [inline, static] |
Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where copy will be stored. Dimensions must match dimensions of original. |
static void IG::Num::VectorBase::Copy | ( | VectorBase_MathNetNumerics | a, |
ref IVector | result | ||
) | [inline, static] |
Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary.
a | Original vector. |
result | Vector where copy will be stored. |
static void IG::Num::VectorBase::CopyPlain | ( | IVector | a, |
Vector_MathNetNumerics | result | ||
) | [inline, static] |
Copies components of a vector to another vector. This is a plain version that does not perform any dimension checks. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where copy will be stored. Dimensions must match dimensions of original. |
static void IG::Num::VectorBase::Copy | ( | IVector | a, |
Vector_MathNetNumerics | result | ||
) | [inline, static] |
Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where copy will be stored. Dimensions must match dimensions of original. |
static void IG::Num::VectorBase::Copy | ( | IVector | a, |
ref Vector_MathNetNumerics | result | ||
) | [inline, static] |
Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary.
a | Original vector. |
result | Vector where copy will be stored. |
Stores a negative vector of the specified vector to another vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where result is be stored. Dimensions must match dimensions of original. |
Stores a negative vector of the specified vector to another vector. WARNING: dimensions of the copied vector and result vector must match.
a | Original vector. |
result | Vector where result is be stored. Dimensions must match dimensions of original. |
Stores a negative vector of the specified vector to another vector. Resulting vector is allocated or reallocated if necessary.
a | Original vector. |
result | Vector where result is be stored. |
Sums two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of vectors must match, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
Sums two vectors and stores the result in the specified result vector. WARNING: dimensions of vectors must match, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
Sums two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated.
a | First operand. |
b | Second operand. |
result | Vector where copy will be stored. |
static void IG::Num::VectorBase::SubtractPlain | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Subtracts two vectors (a - b ) and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of vectors must match, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
Subtracts two vectors (a - b ) and stores the result in the specified result vector. WARNING: dimensions of vectors must match, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::Subtract | ( | IVector | a, |
IVector | b, | ||
ref IVector | result | ||
) | [inline, static] |
Subtracts two vectors (a - b ) and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated.
a | First operand. |
b | Second operand. |
result | Vector where copy will be stored. |
static void IG::Num::VectorBase::ArrayAddPlain | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Addition of a scalar to all components of a vector. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::ArrayAdd | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Addition of a scalar to all components of a vector. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::ArrayAdd | ( | IVector | a, |
double | scal, | ||
ref IVector | result | ||
) | [inline, static] |
Addition of a scalar to all components of a vector. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::ArraySubtractPlain | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Subtraction of a scalar from all components of a vector. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::ArraySubtract | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Subtraction of a scalar from all components of a vector. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::ArraySubtract | ( | IVector | a, |
double | scal, | ||
ref IVector | result | ||
) | [inline, static] |
Subtraction of a scalar to all components of a vector. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::MultiplyPlain | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Multiplication of a vector by a scalar. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::Multiply | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::Multiply | ( | IVector | a, |
double | scal, | ||
ref IVector | result | ||
) | [inline, static] |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::ScalePlain | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Multiplication of a vector by a scalar. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::Scale | ( | IVector | a, |
double | scal, | ||
ref IVector | result | ||
) | [inline, static] |
Multiplication of a vector by a scalar. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::DividePlain | ( | IVector | a, |
double | scal, | ||
IVector | result | ||
) | [inline, static] |
Division of a vector by a scalar. This is a plain version of the method that does not perform any consistency checks. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
Division of a vector by a scalar. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::Divide | ( | IVector | a, |
double | scal, | ||
ref IVector | result | ||
) | [inline, static] |
Division of a vector by a scalar. Vector operand must be defined (non-null).
v1 | First operand (vector). |
d | Second operand (scalar). |
result | Result. |
static void IG::Num::VectorBase::DyadicProductPlain | ( | IVector | a, |
IVector | b, | ||
IMatrix | result | ||
) | [inline, static] |
Calculates dyadic product of two vectors and stores the result in the specified result matrix. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions must match, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Matrix where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::DyadicProduct | ( | IVector | a, |
IVector | b, | ||
IMatrix | result | ||
) | [inline, static] |
Calculates dyadic product of two vectors and stores the result in the specified result matrix. WARNING: dimensions must match, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Matrix where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::DyadicProduct | ( | IVector | a, |
IVector | b, | ||
ref IMatrix | result | ||
) | [inline, static] |
Calculates dyadic product of two vectors and stores the result in the specified result matrix. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated.
a | First operand. |
b | Second operand. |
result | Matrix where copy will be stored. |
static void IG::Num::VectorBase::CrossProductPlain | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::CrossProduct | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::CrossProduct | ( | IVector | a, |
IVector | b, | ||
ref IVector | result | ||
) | [inline, static] |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated.
a | First operand. |
b | Second operand. |
result | Vector where copy will be stored. |
static void IG::Num::VectorBase::VectorProductPlain | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::VectorProduct | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::VectorProduct | ( | IVector | a, |
IVector | b, | ||
ref IVector | result | ||
) | [inline, static] |
Calculates a vector product (cross product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated.
a | First operand. |
b | Second operand. |
result | Vector where copy will be stored. |
static void IG::Num::VectorBase::ArrayProductPlain | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates array product (element-by-element product) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::ArrayProduct | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates array product (element-by-element product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::ArrayProduct | ( | IVector | a, |
IVector | b, | ||
ref IVector | result | ||
) | [inline, static] |
Calculates array product (element-by-element product) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated.
a | First operand. |
b | Second operand. |
result | Vector where copy will be stored. |
static void IG::Num::VectorBase::ArrayQuotientPlain | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates array quotient (element-by-element division) of two vectors and stores the result in the specified result vector. This is a plain version of the method that does not perform any consistency checks. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::ArrayQuotient | ( | IVector | a, |
IVector | b, | ||
IVector | result | ||
) | [inline, static] |
Calculates array quotient (element-by-element division) of two vectors and stores the result in the specified result vector. WARNING: dimensions of all vectors must be 3, otherwise an exception is thrown.
a | First operand. |
b | Second operand. |
result | Vector where result is stored. Dimension must match dimensions of operands. |
static void IG::Num::VectorBase::ArrayQuotient | ( | IVector | a, |
IVector | b, | ||
ref IVector | result | ||
) | [inline, static] |
Calculates array quotient (element-by-element division) of two vectors and stores the result in the specified result vector. WARNING: dimensions of operands must match, otherwise an exception is thrown. If dimensions of the result do not match then teh result is re-allocated.
a | First operand. |
b | Second operand. |
result | Vector where copy will be stored. |
static int IG::Num::VectorBase::GetHashCode | ( | IVector | vec | ) | [inline, static] |
Returns hash code of the specified vector.
vec | Vector whose hath code is returned. |
This method should be used when overriding the GetHashCode() in vector classes, in order to unify equality check over different vector classes.
Returns true if the specified vectors are equal, false if not.
v1 | The first of the two vectors that are checked for equality. |
v2 | The second of the two vectors that are checked for equality. |
This method should be used when overriding the Equals() method in vector classes, in order to unify calculation of hash code over different vector classes.
If both vectors are nulll or both have dimension less than 1 then vectors are considered equal.
This method is consistent with the VectorBase.Compare method, i.e. it returns the same value as the expression VectorBase.Compare(v1 , v2 ==0).
static int IG::Num::VectorBase::GetHashFunctionInt | ( | IVector | vec | ) | [inline, static] |
Returns an integer valued hash function of the specified vector object. The returned value is calculated by the Util.GetHashFunctionInt method.
<vec>Vector object whose hash function is calculated and returned.</vec>
static string IG::Num::VectorBase::GetHashFunctionString | ( | IVector | vec | ) | [inline, static] |
Returns a string valued hash function of the specified vector object. The returned value is calculated by the Util.GetHashFunctionString method.
<vec>Vector object whose hash function is calculated and returned.</vec>
static VectorBase IG::Num::VectorBase::operator+ | ( | VectorBase | v | ) | [inline, static] |
Unary plus, returns the operand.
static VectorBase IG::Num::VectorBase::operator- | ( | VectorBase | v | ) | [inline, static] |
Unary negation, returns the negative operand.
static VectorBase IG::Num::VectorBase::operator+ | ( | VectorBase | a, |
VectorBase | b | ||
) | [inline, static] |
Vector addition.
static VectorBase IG::Num::VectorBase::operator- | ( | VectorBase | a, |
VectorBase | b | ||
) | [inline, static] |
Vector subtraction.
static double IG::Num::VectorBase::operator* | ( | VectorBase | a, |
VectorBase | b | ||
) | [inline, static] |
Scalar product of two vectors.
static VectorBase IG::Num::VectorBase::operator* | ( | VectorBase | a, |
double | b | ||
) | [inline, static] |
Product of a vector by a scalar.
static VectorBase IG::Num::VectorBase::operator* | ( | double | a, |
VectorBase | b | ||
) | [inline, static] |
Product of a vector by a scalar.
static VectorBase IG::Num::VectorBase::operator/ | ( | VectorBase | a, |
double | b | ||
) | [inline, static] |
Vector subtraction.
static string IG::Num::VectorBase::ToString | ( | IVector | vec | ) | [inline, static] |
Returns a string representation of the specified vector in a standard IGLib form.
vec | Vector whose string representation is returned. |
static string IG::Num::VectorBase::ToStringMath | ( | IVector | vec | ) | [inline, static] |
Returns a string representation of the specified vector in a standard IGLib form (Mathematica-like format but with C representation of numbers).
vec | Vector whose string representation is returned. |
static string IG::Num::VectorBase::ToString | ( | IVector | vec, |
string | elementFormat | ||
) | [inline, static] |
Returns a string representation of the specified vector in a standard IGLib form, with the specified format for elements of the vector.
vec | Vector whose string representation is returned. |
elementFormat | Format specification for printing individual element. |
static string IG::Num::VectorBase::ToStringMath | ( | IVector | vec, |
string | elementFormat | ||
) | [inline, static] |
Returns a string representation of the specified vector in a standard IGLib form (Mathematica-like format but with C representation of numbers), with the specified format for elements of the vector.
vec | Vector whose string representation is returned. |
elementFormat | Format specification for printing individual element. |
static void IG::Num::VectorBase::SaveJson | ( | IVector | vec, |
string | filePath | ||
) | [inline, static] |
Saves (serializes) the specified vector to the specified JSON file. File is owerwritten if it exists.
vec | Object that is saved to a file. |
filePath | Path to the file in which object is is saved. |
static void IG::Num::VectorBase::SaveJson | ( | IVector | vec, |
string | filePath, | ||
bool | append | ||
) | [inline, static] |
Saves (serializes) the specified vector to the specified JSON file. If the file already exists, contents either overwrites the file or is appended at the end, dependent on the value of the append flag.
vec | Object that is saved to a file. |
filePath | Path to the file in which object is saved. |
append | Specifies whether serialized data is appended at the end of the file in the case that the file already exists. |
static void IG::Num::VectorBase::LoadJson | ( | string | filePath, |
ref IVector | vecRestored | ||
) | [inline, static] |
Restores (deserializes) a vector from the specified file in JSON format.
filePath | File from which object is restored. |
vecRestored | Object that is restored by deserialization. |
static void IG::Num::VectorBase::SaveCsv | ( | IVector | vec, |
string | filePath | ||
) | [inline, static] |
Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten. Constant UtilStr.DefaultCsvSeparator is used as separator.
vec | Vector to be stored to a file. |
filePath | Path of the file to which vector is stored. |
separator | Separator used in the CSV file. |
static void IG::Num::VectorBase::SaveCsv | ( | IVector | vec, |
string | filePath, | ||
string | separator | ||
) | [inline, static] |
Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten.
vec | Vector to be stored to a file. |
filePath | Path of the file to which vector is stored. |
separator | Separator used in the CSV file. |
static void IG::Num::VectorBase::SaveCsv | ( | IVector | vec, |
string | filePath, | ||
bool | append | ||
) | [inline, static] |
Saves the specified vector to a CSV file. Constant UtilStr.DefaultCsvSeparator is used as separator in CSV.
vec | Vector to be stored to a file. |
filePath | Path of the file to which vector is stored. |
append | Specifies whether the data is appended at the end of the file in the case that the ifle already exists. |
static void IG::Num::VectorBase::SaveCsv | ( | IVector | vec, |
string | filePath, | ||
string | separator, | ||
bool | append | ||
) | [inline, static] |
Saves the specified vector to a CSV file.
vec | Vector to be stored to a file. |
filePath | Path of the file to which vector is stored. |
separator | Separator used in the CSV file. |
append | Specifies whether the data is appended at the end of the file in the case that the ifle already exists. |
static void IG::Num::VectorBase::LoadCsv | ( | string | filePath, |
ref IVector | vecRestored | ||
) | [inline, static] |
Reads a vector from a CSV file. Constant Str.DefaultCsvSeparator is used as separator in CSV file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row.
filePath | Path to the file that contains a vector in CSV format.
|
static void IG::Num::VectorBase::LoadCsv | ( | string | filePath, |
string | separator, | ||
ref IVector | vecRestored | ||
) | [inline, static] |
Reads a vector written in CSV format from a file. If there are no components then a null vector is returned by this method (no exceptions thrown). If there are more than one rows in the CSV file then vector is read from the first row.
filePath | Path to the file that contains a vector in CSV format. |
separator | Separator that is used to separate values in a row in the CSV file. |
vecRestored | Vector object where the read-in vector is stored. |
static void IG::Num::VectorBase::LoadCsv | ( | string | filePath, |
int | rowNum, | ||
ref IVector | vecRestored | ||
) | [inline, static] |
Reads a vector from the specified row of a CSV file. Constant UtilStr.DefaultCsvSeparator is used as CSV separator. If the specified row does not exisist in the file then exception is thrown.
filePath | Path to the file that contains a vector in CSV format. |
rowNum | Number of the row from which the vector is read. |
vecRestored | Vector object where the read-in vector is stored. |
static void IG::Num::VectorBase::LoadCsv | ( | string | filePath, |
int | rowNum, | ||
string | separator, | ||
ref IVector | vecRestored | ||
) | [inline, static] |
Reads a vector from the specified row of a CSV file. If the specified row does not exisist in the file then exception is thrown.
filePath | Path to the file that contains a vector in CSV format. |
rowNum | Number of the row from which the vector is read. |
separator | Separator that is used to separate values in a row in the CSV file. |
vecRestored | Vector object where the read-in vector is stored. |
override string IG::Num::VectorBase::ToString | ( | ) | [inline] |
Returns a string representation of this vector in a standard IGLib form.
Implements IG::Num::IVector.
Reimplemented in IG::Num::Vector2d, and IG::Num::Vector3d.
virtual string IG::Num::VectorBase::ToStringMath | ( | ) | [inline, virtual] |
Returns a string representation of this vector in a standard IGLib form (Mathematica-like format but with C representation of numbers).
Implements IG::Num::IVector.
virtual string IG::Num::VectorBase::ToString | ( | string | elementFormat | ) | [inline, virtual] |
Returns a string representation of the current vector in a standard IGLib form, with the specified format for elements of the vector.
vec | Vector whose string representation is returned. |
elementFormat | Format specification for printing individual element. |
Implements IG::Num::IVector.
virtual string IG::Num::VectorBase::ToStringMath | ( | string | elementFormat | ) | [inline, virtual] |
Returns a string representation of the current vector in a standard IGLib form (Mathematica-like format but with C representation of numbers), with the specified format for elements of the vector.
vec | Vector whose string representation is returned. |
elementFormat | Format specification for printing individual element. |
Implements IG::Num::IVector.
VectorStore IG::Num::VectorBase::_matrixStore [static, private] |
abstract int IG::Num::VectorBase::Length [get] |
Gets dimension of the vector.
Reimplemented in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
abstract double IG::Num::VectorBase::this[int i] [get, set] |
Gets or sets the element indexed by i
in the Vector
.
i | Element index, 0 - based. |
Reimplemented in IG::Num::Vector2d, IG::Num::Vector3d, and IG::Num::Vector.
virtual double IG::Num::VectorBase::Norm [get] |
Gets Euclidean norm of the vector.
Reimplemented in IG::Num::Vector2d, and IG::Num::Vector3d.
virtual double IG::Num::VectorBase::Norm2 [get] |
Gets Euclidean norm of the vector.
Reimplemented in IG::Num::Vector2d, and IG::Num::Vector3d.
virtual double IG::Num::VectorBase::NormEuclidean [get] |
Gets Euclidean norm of the vector.
virtual double IG::Num::VectorBase::SquaredNorm [get] |
Squared Euclidean norm, sum of squared components.
virtual double IG::Num::VectorBase::Norm1 [get] |
1-norm (Manhattan norm or Taxicab norm), sum of absolute values of components.
Reimplemented in IG::Num::Vector2d, and IG::Num::Vector3d.
virtual double IG::Num::VectorBase::NormInf [get] |
Infinity-norm, maximum absolute value of any component.
Reimplemented in IG::Num::Vector2d, and IG::Num::Vector3d.
VectorStore IG::Num::VectorBase::VectorStore [static, get] |
Gets the matrix store for recycling auxiliary matrices. Matrix store is created only once, on the first access.