IGLib  1.5
The IGLib base library for development of numerical, technical and business applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
IG.Num.VectorBase Class Referenceabstract

Base class for real vectors. More...

+ Inheritance diagram for IG.Num.VectorBase:
+ Collaboration diagram for IG.Num.VectorBase:

Public Member Functions

virtual double[] ToArray ()
 Copies the current vector to an array. More...
 
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. More...
 
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. More...
 
abstract VectorBase GetNewBase ()
 Creates and returns a new vector with the same dimension and of the same type as the current vector. More...
 
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. More...
 
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. More...
 
virtual IVector GetCopy ()
 Returns a deep copy of the current object. More...
 
virtual IVector GetNew (int length)
 Creates and returns a new vector with the specified dimension, and of the same type as the current vector. More...
 
virtual IVector GetNew ()
 Creates and returns a new vector with the same dimension and of the same type as the current vector. More...
 
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. More...
 
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. More...
 
virtual void SetZero ()
 Sets all components of the current vector to 0. More...
 
virtual void SetConstant (double elementValue)
 Sets all components of the current vector to the specified value. More...
 
virtual void SetUnit (int which)
 Sets the current vector to the specific unit vector (one component equals 1, others are 0). More...
 
virtual void SetRandom ()
 Sets the current vector such that it contains random elements on the interval (0,1]. More...
 
virtual void SetRandom (IRandomGenerator rnd)
 Sets the current vector such that it contains random elements on the interval (0,1]. More...
 
virtual double NormP (double p)
 p-norm, p-th root of sum of absolute values of components raised to the power of p. More...
 
IVector Normalized ()
 Returns a vector that equals a normalized current vector. More...
 
void Normalize ()
 Normalizes the current vector. More...
 
void Negate ()
 Changes the sign of the current vector. More...
 
override int GetHashCode ()
 Returns the hash code (hash function) of the current vector. More...
 
override bool Equals (Object obj)
 Returns a value indicating whether the specified object is equal to the current vector. More...
 
int GetHashFunctionInt ()
 Returns an integer valued hash function of the current vector object. More...
 
string GetHashFunctionString ()
 Returns a string valued hash function of the current vector object. More...
 
override string ToString ()
 Returns a string representation of this vector in a standard IGLib form. More...
 
virtual string ToStringMath ()
 Returns a string representation of this vector in a standard IGLib form (Mathematica-like format but with C representation of numbers). More...
 
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. More...
 
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. More...
 

Static Public Member Functions

static double NormPlain (IVector a)
 Returns Euclidean norm of the specified vector. More...
 
static double NormStatic (IVector a)
 Returns Euclidean norm of the specified vector. More...
 
static double Norm2Plain (IVector a)
 Returns Euclidean norm of the specified vector. More...
 
static double Norm2Static (IVector a)
 Returns Euclidean norm of the specified vector. More...
 
static double Norm1Plain (Vector a)
 Returns the 1-norm (Manhattan or Taxicab norm, sum of element absolute values) of the specified vector. More...
 
static double Norm1Static (IVector a)
 Returns the 1-norm (Manhattan or Taxicab norm, sum of element absolute values) of the specified vector. More...
 
static double NormPPlain (Vector a, double p)
 Returns the p-norm (p-th root of sum of absolute values of components raised to the power of p) of the specified vector. More...
 
static double NormPStatic (IVector a, double p)
 Returns the p-norm (p-th root of sum of absolute values of components raised to the power of p) of the specified vector. More...
 
static double NormInfPlain (Vector a)
 Returns the Infinity-norm (maximum absolute value of any element) of the specified vector. More...
 
static double NormInfStatic (IVector a)
 Returns the Infinity-norm (maximum absolute value of any element) of the specified vector. More...
 
static double DistancePlain (IVector a, IVector b)
 Returns Euqlidean distance between the specified two vectors. More...
 
static double Distance (IVector a, IVector b)
 Returns Euqlidean distance between the specified two vectors. More...
 
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). More...
 
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). More...
 
static double NormWeightedPlain (IVector a, IVector characteristicLengths)
 Returns weighted Euclidean norm of the specified vector. More...
 
static double NormWeighted (IVector a, IVector characteristicLengths)
 Returns weighted Euclidean norm of the specified vector. More...
 
static void SetZero (IVector vec)
 Sets all components of the current vector to 0. More...
 
static void SetConstant (IVector vec, double elementValue)
 Sets all components of the current vector to the specified value. More...
 
static void SetUnit (IVector vec, int which)
 Sets the current vector to the specific unit vector (one component equals 1, others are 0). More...
 
static void SetRandom (IVector vec)
 Sets the current vector such that it contains random elements on the interval (0,1]. More...
 
static void SetRandom (IVector vec, IRandomGenerator rnd)
 Sets the current vector such that it contains random elements on the interval (0,1]. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static void Copy (IVector a, ref IVector result)
 Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static void OrthogonalProjectionPlain (IVector original, IVector onWhich, double onWhichProductSelf, IVector result, double tolerance=0.0)
 Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result, where the inner project of the vector to which projection is performed is specified. More...
 
static void OrthogonalProjectionPlain (IVector original, IVector onWhich, IVector result, double tolerance=0.0)
 Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result. More...
 
static void OrthogonalProjection (IVector original, IVector onWhich, double onWhichProductSelf, ref IVector result, double tolerance=0.0)
 Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result, where the inner project of the vector to which projection is performed is specified. More...
 
static void OrthogonalProjection (IVector original, IVector onWhich, ref IVector result, double tolerance=0.0)
 Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result. More...
 
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). More...
 
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). More...
 
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). More...
 
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). More...
 
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). More...
 
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). More...
 
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). More...
 
static void Multiply (IVector a, double scal, IVector result)
 Multiplication of a vector by a scalar. Vector operand must be defined (non-null). More...
 
static void Multiply (IVector a, double scal, ref IVector result)
 Multiplication of a vector by a scalar. Vector operand must be defined (non-null). More...
 
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). More...
 
static void Scale (IVector a, double scal, IVector result)
 Multiplication of a vector by a scalar. Vector operand must be defined (non-null). More...
 
static void Scale (IVector a, double scal, ref IVector result)
 Multiplication of a vector by a scalar. Vector operand must be defined (non-null). More...
 
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). More...
 
static void Divide (IVector a, double scal, IVector result)
 Division of a vector by a scalar. Vector operand must be defined (non-null). More...
 
static void Divide (IVector a, double scal, ref IVector result)
 Division of a vector by a scalar. Vector operand must be defined (non-null). More...
 
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. More...
 
static double ScalarProduct (IVector a, IVector b)
 Scalar product of teo vectors. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
static int GetHashCode (IVector vec)
 Returns hash code of the specified vector. More...
 
static bool Equals (IVector v1, IVector v2)
 Returns true if the specified vectors are equal, false if not. More...
 
static int GetHashFunctionInt (IVector vec)
 Returns an integer valued hash function of the specified vector object. More...
 
static string GetHashFunctionString (IVector vec)
 Returns a string valued hash function of the specified vector object. More...
 
static void OrthoNormalizeGramSchmidt (IList< IVector > original, ref IList< IVector > resOrthogonal, ref IVector resNorms, ref IVector auxProjection, double tolDependent=1e-10, bool normalize=false, int numRequestedVectors=0, IRandomGenerator rand=null, int maxExcessGenerated=5)
 Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthonormal vectors from the specified set of arbitrary independent vectors. More...
 
static int OrthogonalizeGramSchmidt (IList< IVector > original, ref IList< IVector > resOrthogonal, ref IVector resNorms, ref IVector auxProjection, double tolDependent=1e-10, bool normalize=false, int numRequestedVectors=0, IRandomGenerator rand=null, int maxExcessGenerated=5)
 Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthogonall vectors from the specified set of arbitrary independent vectors. More...
 
static void OrthoNormalizeGramSchmidtNonRobust (IList< IVector > original, ref IList< IVector > resOrthogonal, ref IVector resNorms, ref IVector auxProjection, double tolSize=0, bool normalize=false, bool modifiedGrammSchmidt=true)
 Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthonormal vectors from the specified set of arbitrary independent vectors. More...
 
static void OrthogonalizeGramSchmidtNonRobust (IList< IVector > original, ref IList< IVector > resOrthogonal, ref IVector resNorms, ref IVector auxProjection, double tolSize=0, bool normalize=false, bool modifiedGrammSchmidt=true)
 Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthogonall vectors from the specified set of arbitrary independent vectors. More...
 
static bool TestGramSchmidtOrthogonalization (int dim, int numRepetitions=1, double tol=1e-8, int outputLevel=0, IRandomGenerator randomGenerator=null, bool normalize=false, bool modifiedGrammSchmidt=true, bool nonRobust=false)
 Performs a test of Gramm-Schmidt orthogonalization on a set of random vectors. More...
 
static VectorBase operator+ (VectorBase v)
 Unary plus, returns the operand. More...
 
static VectorBase operator- (VectorBase v)
 Unary negation, returns the negative operand. More...
 
static VectorBase operator+ (VectorBase a, VectorBase b)
 Vector addition. More...
 
static VectorBase operator- (VectorBase a, VectorBase b)
 Vector subtraction. More...
 
static double operator* (VectorBase a, VectorBase b)
 Scalar product of two vectors. More...
 
static VectorBase operator* (VectorBase a, double b)
 Product of a vector by a scalar. More...
 
static VectorBase operator* (double a, VectorBase b)
 Product of a vector by a scalar. More...
 
static VectorBase operator/ (VectorBase a, double b)
 Vector subtraction. More...
 
static string ToString (IVector vec)
 Returns a string representation of the specified vector in a standard IGLib form. More...
 
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). More...
 
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. More...
 
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. More...
 
static void SaveJson (IVector vec, string filePath)
 Saves (serializes) the specified vector to the specified JSON file. File is owerwritten if it exists. More...
 
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. More...
 
static void LoadJson (string filePath, ref IVector vecRestored)
 Restores (deserializes) a vector from the specified file in JSON format. More...
 
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. More...
 
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. More...
 
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. More...
 
static void SaveCsv (IVector vec, string filePath, string separator, bool append)
 Saves the specified vector to a CSV file. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 

Properties

abstract int Length [get]
 Gets dimension of the vector. More...
 
abstract double this[int i] [get, set]
 Gets or sets the element indexed by i in the Vector. More...
 
virtual double Norm [get]
 Gets Euclidean norm of the vector. More...
 
virtual double Norm2 [get]
 Gets Euclidean norm of the vector. More...
 
virtual double NormEuclidean [get]
 Gets Euclidean norm of the vector. More...
 
virtual double SquaredNorm [get]
 Squared Euclidean norm, sum of squared components. More...
 
virtual double Norm1 [get]
 1-norm (Manhattan norm or Taxicab norm), sum of absolute values of components. More...
 
virtual double NormInf [get]
 Infinity-norm, maximum absolute value of any component. More...
 
static VectorStore VectorStore [get]
 Gets the matrix store for recycling auxiliary matrices. More...
 

Static Private Attributes

static VectorStore _matrixStore
 

Detailed Description

Base class for real vectors.

$A Igor Jan08 Jul10 Nov10;

Member Function Documentation

virtual double [] IG.Num.VectorBase.ToArray ( )
inlinevirtual

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.Vector, IG.Num.Vector3d, and IG.Num.Vector2d.

Referenced by IG.Num.VectorBase.operator+(), and IG.Num.VectorBase.operator-().

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.

Parameters
lengthDimension of the returned vector.

Implemented in IG.Num.Vector, IG.Num.Vector3d, and IG.Num.Vector2d.

Referenced by IG.Num.VectorBase.operator*(), IG.Num.MatrixBase.operator*(), IG.Num.VectorBase.operator+(), IG.Num.VectorBase.operator-(), and IG.Num.VectorBase.operator/().

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.Vector, IG.Num.Vector3d, and IG.Num.Vector2d.

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.

Parameters
rowCountNumber of rows of the returned matrix.
columnCountNumber of rows of the returned matrix.
Returns
A matrix with specified dimensions, whose type is consistent with the type of the current vector.

Implemented in IG.Num.Vector, IG.Num.Vector3d, and IG.Num.Vector2d.

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.Vector, IG.Num.Vector2d, and IG.Num.Vector3d.

virtual IVector IG.Num.VectorBase.GetCopy ( )
inlinevirtual

Returns a deep copy of the current object.

Implements IG.Num.IVector.

virtual IVector IG.Num.VectorBase.GetNew ( int  length)
inlinevirtual

Creates and returns a new vector with the specified dimension, and of the same type as the current vector.

Parameters
lengthDimension of the newly created vector.
Returns
A newly created vector of the specified dimension and of the same type as the current vector.

Implements IG.Num.IVector.

virtual IVector IG.Num.VectorBase.GetNew ( )
inlinevirtual

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 
)
inlinevirtual

Creates and returns a new matrix with the specified dimensona, and of a type that is consistent with the type of the current vector.

Parameters
rowCountNumber of rows of the returned matrix.
columnCountNumber of rows of the returned matrix.
Returns
A matrix with specified dimensions, whose type is consistent with the type of the current vector.

Implements IG.Num.IVector.

virtual IMatrix IG.Num.VectorBase.GetNewMatrix ( )
inlinevirtual

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 ( )
inlinevirtual

Sets all components of the current vector to 0.

Implements IG.Num.IVector.

virtual void IG.Num.VectorBase.SetConstant ( double  elementValue)
inlinevirtual

Sets all components of the current vector to the specified value.

Parameters
elementValueValue to which vector elements are set.

Implements IG.Num.IVector.

virtual void IG.Num.VectorBase.SetUnit ( int  which)
inlinevirtual

Sets the current vector to the specific unit vector (one component equals 1, others are 0).

Parameters
whichSpecifies which unit vector is set (i.e., which component equals 1).

Implements IG.Num.IVector.

virtual void IG.Num.VectorBase.SetRandom ( )
inlinevirtual
virtual void IG.Num.VectorBase.SetRandom ( IRandomGenerator  rnd)
inlinevirtual

Sets the current vector such that it contains random elements on the interval (0,1].

Parameters
rndRandom generator used to generate vector elements.

Implements IG.Num.IVector.

virtual double IG.Num.VectorBase.NormP ( double  p)
inlinevirtual

p-norm, p-th root of sum of absolute values of components raised to the power of p.

Parameters
pPower of the norm, must be greater or equal to 1.

For p = 1, we obtain taxicab norm, for p = 2 we obtain Euclidean norm, and as p approaches infinity, the result approaches the infinity norm (but beware of large numbers and numerical stability).

Exceptions
ArgumentExceptionIf p is less than 1.0.
static double IG.Num.VectorBase.NormPlain ( IVector  a)
inlinestatic

Returns Euclidean norm of the specified vector.

Vector can NOT be null (inthis case, exception is thrown).

static double IG.Num.VectorBase.NormStatic ( IVector  a)
inlinestatic

Returns Euclidean norm of the specified vector.

Vector can be null (0 is returned in this case).

static double IG.Num.VectorBase.Norm2Plain ( IVector  a)
inlinestatic

Returns Euclidean norm of the specified vector.

Vector can NOT be null (inthis case, exception is thrown).

Referenced by IG.Num.VectorBase.OrthogonalizeGramSchmidt(), and IG.Num.VectorBase.OrthogonalizeGramSchmidtNonRobust().

static double IG.Num.VectorBase.Norm2Static ( IVector  a)
inlinestatic

Returns Euclidean norm of the specified vector.

Vector can be null (0 is returned in this case).

static double IG.Num.VectorBase.Norm1Plain ( Vector  a)
inlinestatic

Returns the 1-norm (Manhattan or Taxicab norm, sum of element absolute values) of the specified vector.

Vector can NOT be null (inthis case, exception is thrown).

References IG.Num.Vector.Length.

static double IG.Num.VectorBase.Norm1Static ( IVector  a)
inlinestatic

Returns the 1-norm (Manhattan or Taxicab norm, sum of element absolute values) of the specified vector.

Vector can be null (0 is returned in this case).

static double IG.Num.VectorBase.NormPPlain ( Vector  a,
double  p 
)
inlinestatic

Returns the p-norm (p-th root of sum of absolute values of components raised to the power of p) of the specified vector.

Vector can NOT be null (inthis case, exception is thrown).

Parameters
aVector whose norm is calculated.
pPower of the norm, must be greater or equal to 1.

For p = 1, we obtain taxicab norm, for p = 2 we obtain Euclidean norm, and as p approaches infinity, the result approaches the infinity norm (but beware of large numbers and numerical stability).

Exceptions
ArgumentExceptionIf p is less than 1.0.

References IG.Num.Vector.Length.

static double IG.Num.VectorBase.NormPStatic ( IVector  a,
double  p 
)
inlinestatic

Returns the p-norm (p-th root of sum of absolute values of components raised to the power of p) of the specified vector.

Vector can be null (0 is returned in this case).

Parameters
aVector whose norm is calculated.
pPower of the norm, must be greater or equal to 1.

For p = 1, we obtain taxicab norm, for p = 2 we obtain Euclidean norm, and as p approaches infinity, the result approaches the infinity norm (but beware of large numbers and numerical stability).

Exceptions
ArgumentExceptionIf p is less than 1.0.
static double IG.Num.VectorBase.NormInfPlain ( Vector  a)
inlinestatic

Returns the Infinity-norm (maximum absolute value of any element) of the specified vector.

Vector can NOT be null (inthis case, exception is thrown).

References IG.Num.Vector.Length.

static double IG.Num.VectorBase.NormInfStatic ( IVector  a)
inlinestatic

Returns the Infinity-norm (maximum absolute value of any element) of the specified vector.

Vector can be null (0 is returned in this case).

static double IG.Num.VectorBase.DistancePlain ( IVector  a,
IVector  b 
)
inlinestatic

Returns Euqlidean distance between the specified two vectors.

WARNING: This is a plain version of the method that does not perform any consistency checks.

Parameters
aFirst vector.
bSecond vector.

Referenced by IG.Num.DistanceComparer< PointContainerType, PointType >.DefaultDistanceFunction(), and IG.Num.DistanceComparer< PointContainerType, PointType >.OutputDistance().

static double IG.Num.VectorBase.Distance ( IVector  a,
IVector  b 
)
inlinestatic

Returns Euqlidean distance between the specified two vectors.

WARNING: Dimensions must match, otherwise exception is thrown..

Parameters
aFirst vector.
bSecond vector.

Referenced by IG.Num.SampledDataSet.ComparerInputDistance.ComparerInputDistance(), IG.Num.SampledDataSet.ComparerOutputDistance.ComparerOutputDistance(), and IG.Num.PointCloud< PointLinkType, PointContainerType, PointType >.ExampleClosestPointsDummy().

static double IG.Num.VectorBase.DistanceWeightedPlain ( IVector  a,
IVector  b,
IVector  characteristicLengths 
)
inlinestatic

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.

Parameters
aFirst vector.
bSecond vector.
characteristicLengthsVector 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).

Referenced by IG.Num.DistanceComparer< PointContainerType, PointType >.DefaultDistanceFunction(), and IG.Num.DistanceComparer< PointContainerType, PointType >.OutputDistance().

static double IG.Num.VectorBase.DistanceWeighted ( IVector  a,
IVector  b,
IVector  characteristicLengths 
)
inlinestatic

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.

Parameters
aFirst vector.
bSecond vector.
characteristicLengthsVector 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 
)
inlinestatic

Returns weighted Euclidean norm of the specified vector.

Parameters
aVector whose weighter Euclidean norm is returned.
characteristicLengthsVector 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).

Referenced by IG.Num.NeuralTrainingParameters.ComparerBase.OutputNorm().

static double IG.Num.VectorBase.NormWeighted ( IVector  a,
IVector  characteristicLengths 
)
inlinestatic

Returns weighted Euclidean norm of the specified vector.

Parameters
aVector whose weighter Euclidean norm is returned.
characteristicLengthsVector whose elements represent interval lengths of equal importance in different coordinate direction. Used for calculation of weighted sum (terms are divided by squares of vector elements).

Referenced by IG.Num.NeuralTrainingParameters.ErrorAverageCalc().

IVector IG.Num.VectorBase.Normalized ( )
inline

Returns a vector that equals a normalized current vector.

Implements IG.Num.IVector.

void IG.Num.VectorBase.Normalize ( )
inline

Normalizes the current vector.

Returns
void IG.Num.VectorBase.Negate ( )
inline

Changes the sign of the current vector.

Returns

Referenced by IG.Num.VectorBase.operator-().

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.

References IG.Num.VectorBase.GetHashCode().

Referenced by IG.Num.Vector2d.GetHashCode(), IG.Num.Vector3d.GetHashCode(), IG.Num.Vector.GetHashCode(), and IG.Num.VectorBase.GetHashCode().

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.

References IG.Num.VectorBase.Equals().

Referenced by IG.Num.Vector2d.Equals(), IG.Num.Vector3d.Equals(), IG.Num.Vector.Equals(), and IG.Num.VectorBase.Equals().

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.

See also
Util.GetHashFunctionInt

Implements IG.Num.IVector.

References IG.Lib.Util.GetHashFunctionInt().

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.

See also
Util.GetHashFunctionString

Implements IG.Num.IVector.

References IG.Lib.Util.GetHashFunctionString().

static void IG.Num.VectorBase.SetZero ( IVector  vec)
inlinestatic

Sets all components of the current vector to 0.

Parameters
vecVector whose components are set.
static void IG.Num.VectorBase.SetConstant ( IVector  vec,
double  elementValue 
)
inlinestatic

Sets all components of the current vector to the specified value.

Parameters
vecVector whose components are set.
elementValueValue to which vector elements are set.
static void IG.Num.VectorBase.SetUnit ( IVector  vec,
int  which 
)
inlinestatic

Sets the current vector to the specific unit vector (one component equals 1, others are 0).

Parameters
vecVector whose components are set.
whichSpecifies which unit vector is set (i.e., which component equals 1).
static void IG.Num.VectorBase.SetRandom ( IVector  vec)
inlinestatic

Sets the current vector such that it contains random elements on the interval (0,1].

Parameters
vecVector whose components are set.

References IG.Num.IRandomGenerator.NextDouble().

static void IG.Num.VectorBase.SetRandom ( IVector  vec,
IRandomGenerator  rnd 
)
inlinestatic

Sets the current vector such that it contains random elements on the interval (0,1].

Parameters
vecVector whose components are set.
rndRandom generator used to generate vector elements.

References IG.Num.IRandomGenerator.NextDouble().

static int IG.Num.VectorBase.Compare ( IVector  v1,
IVector  v2 
)
inlinestatic

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.

Parameters
v1First vector to be compared.
v2Second vector to be compared.
Returns
-1 if the first vector is smaller than the second one, 0 if vectors are equal, and 1 if the second is greater.

This comparison does not have any mathematical meaning. It is just used for sotting of vectors in data structures.

Referenced by IG.Num.VectorApproximatorBase.CalculateOutput(), IG.Num.SampledDataSet.GetNumInputDuplicates(), and IG.Num.SampledDataSet.RemoveInputDuplicates().

static void IG.Num.VectorBase.Resize ( ref IVector  vec,
IVector  template,
int  dimension 
)
inlinestatic

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.

Parameters
vecVector that is resized.
templateVector that is taken as template (for type of a newly created vector or for dimension if it is not specified).
dimensonIf greater than 0 then it specifies the dimension to which vector is resized.

Referenced by IG.Num.NeuralApproximatorBase.CalculateErrorsMax(), IG.Num.NeuralApproximatorBase.CalculateErrorsMeanAbs(), IG.Num.NeuralApproximatorBase.CalculateErrorsRms(), IG.Num.VectorApproximatorBase.CalculateOutput(), IG.Num.NeuralApproximatorBase.CalculateOutput(), IG.Num.InputOutputDataDefiniton.CopyDefaultInputTo(), IG.Num.BoundingBoxBase.GetAbsoluteCoordinates(), IG.Num.BoundingBoxBase.GetIntervalLengths(), IG.Num.BoundingBoxBase.GetMax(), IG.Num.BoundingBoxBase.GetMin(), IG.Num.BoundingBoxBase.GetRandomPoint(), IG.Num.BoundingBoxBase.GetRelativeCoordinates(), IG.Num.VectorBase.LoadCsv(), IG.Num.BoundingBoxBase.Map(), IG.Num.VectorBase.OrthogonalizeGramSchmidt(), IG.Num.VectorBase.OrthogonalizeGramSchmidtNonRobust(), IG.Num.VectorBase.OrthogonalProjection(), IG.Num.AnalysisResults.PrepareResultStorage(), IG.Lib.UtilConsole.Read(), and IG.Num.SimKosecFileManagerBase.ReadInputParameters().

static void IG.Num.VectorBase.Resize ( ref IVector  vec,
int  dimension 
)
inlinestatic

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.

Parameters
vecVector that is resized.
dimensonDimension to which vector is resized (if less or equal to 0 then exception is thrown).
static void IG.Num.VectorBase.Resize ( ref IVector  vec,
IVector  template 
)
inlinestatic

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.

Parameters
vecVector that is resized.
templateVector that is taken as template (for type of a newly created vector or for dimension).
static void IG.Num.VectorBase.CopyPlain ( IVector  a,
IVector  result 
)
inlinestatic

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.

Parameters
aOriginal vector.
resultVector where copy will be stored. Dimensions must match dimensions of original.

Referenced by IG.Num.ScalarFunctionRadialUntransformed.GradientPlain(), IG.Num.MatrixBase.LuSolveNoPermutationsPlain(), IG.Num.ScalarFunctionRadial.ReferenceGradientPlain(), IG.Num.AffineTransformationSquare.TransformBackCoordinatesPlain(), IG.Num.AffineTransformationSquare.TransformBackGradientPlain(), IG.Num.AffineTransformationSquare.TransformCoordinatesPlain(), and IG.Num.AffineTransformationSquare.TransformGradientPlain().

static void IG.Num.VectorBase.Copy ( IVector  a,
ref IVector  result 
)
inlinestatic

Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary.

Parameters
aOriginal vector.
resultVector where copy will be stored.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.CopyPlain ( VectorBase_MathNetNumerics  a,
IVector  result 
)
inlinestatic

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.

Parameters
aOriginal vector.
resultVector where copy will be stored. Dimensions must match dimensions of original.
static void IG.Num.VectorBase.Copy ( VectorBase_MathNetNumerics  a,
IVector  result 
)
inlinestatic

Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match.

Parameters
aOriginal vector.
resultVector where copy will be stored. Dimensions must match dimensions of original.
static void IG.Num.VectorBase.Copy ( VectorBase_MathNetNumerics  a,
ref IVector  result 
)
inlinestatic

Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary.

Parameters
aOriginal vector.
resultVector where copy will be stored.
static void IG.Num.VectorBase.CopyPlain ( IVector  a,
Vector_MathNetNumerics  result 
)
inlinestatic

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.

Parameters
aOriginal vector.
resultVector where copy will be stored. Dimensions must match dimensions of original.
static void IG.Num.VectorBase.Copy ( IVector  a,
Vector_MathNetNumerics  result 
)
inlinestatic

Copies components of a vector to another vector. WARNING: dimensions of the copied vector and result vector must match.

Parameters
aOriginal vector.
resultVector where copy will be stored. Dimensions must match dimensions of original.
static void IG.Num.VectorBase.Copy ( IVector  a,
ref Vector_MathNetNumerics  result 
)
inlinestatic

Copies components of a vectr to another vector. Resulting vector is allocated or reallocated if necessary.

Parameters
aOriginal vector.
resultVector where copy will be stored.
static void IG.Num.VectorBase.NegatePlain ( IVector  a,
IVector  result 
)
inlinestatic

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.

Parameters
aOriginal vector.
resultVector where result is be stored. Dimensions must match dimensions of original.
static void IG.Num.VectorBase.Negate ( IVector  a,
IVector  result 
)
inlinestatic

Stores a negative vector of the specified vector to another vector. WARNING: dimensions of the copied vector and result vector must match.

Parameters
aOriginal vector.
resultVector where result is be stored. Dimensions must match dimensions of original.
static void IG.Num.VectorBase.Negate ( IVector  a,
ref IVector  result 
)
inlinestatic

Stores a negative vector of the specified vector to another vector. Resulting vector is allocated or reallocated if necessary.

Parameters
aOriginal vector.
resultVector where result is be stored.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.AddPlain ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.

Referenced by IG.Num.AffineTransformationSquare.TransformCoordinatesPlain().

static void IG.Num.VectorBase.Add ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

Sums two vectors and stores the result in the specified result vector. WARNING: dimensions of vectors must match, otherwise an exception is thrown.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.

Referenced by IG.Num.AnalysisResults.CreateExample(), IG.Num.ScalarFunctionLinear.GradientPlain(), IG.Num.ScalarFunctionQuadratic.GradientPlain(), IG.Num.ScalarFunctionUntransformedBase.Test(), and IG.Num.VectorBase.TestGramSchmidtOrthogonalization().

static void IG.Num.VectorBase.Add ( IVector  a,
IVector  b,
ref IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where copy will be stored.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.SubtractPlain ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.

Referenced by IG.Num.VectorBase.OrthogonalizeGramSchmidt(), IG.Num.VectorBase.OrthogonalizeGramSchmidtNonRobust(), and IG.Num.AffineTransformationSquare.TransformBackCoordinatesPlain().

static void IG.Num.VectorBase.Subtract ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic
static void IG.Num.VectorBase.Subtract ( IVector  a,
IVector  b,
ref IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where copy will be stored.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.OrthogonalProjectionPlain ( IVector  original,
IVector  onWhich,
double  onWhichProductSelf,
IVector  result,
double  tolerance = 0.0 
)
inlinestatic

Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result, where the inner project of the vector to which projection is performed is specified.

The dot product is used as inner product of the vector space.

No checks are performed (e.g. dimension checks or whether references are non-null).

Parameters
originalThe vector that is orthogonally projected to another vector.
onWhichVector on which the original vector is projected. It must be allocated with the same dimension as original .
onWhichProductSelfThe specified inner product of onWhich by itself.

WARNING: this is square of the norm of vector corresponding to the specified dot product.

Parameters
resultVector where result is storeb. It must be allocated with the same dimension as input vectors.
toleranceTolerance for the projust of projection vector by itself. Shoulld be greater or equal to 0.

Referenced by IG.Num.VectorBase.OrthogonalizeGramSchmidt(), and IG.Num.VectorBase.OrthogonalizeGramSchmidtNonRobust().

static void IG.Num.VectorBase.OrthogonalProjectionPlain ( IVector  original,
IVector  onWhich,
IVector  result,
double  tolerance = 0.0 
)
inlinestatic

Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result.

The dot product is used as inner product of the vector space.

No checks are performed (e.g. dimension checks or whether references are non-null).

Parameters
originalThe vector that is orthogonally projected to another vector.
onWhichVector on which the original vector is projected. It must be allocated with the same dimension as original .
resultVector where result is storeb. It must be allocated with the same dimension as input vectors.
toleranceTolerance for the projust of projection vector by itself. Shoulld be greater or equal to 0.
static void IG.Num.VectorBase.OrthogonalProjection ( IVector  original,
IVector  onWhich,
double  onWhichProductSelf,
ref IVector  result,
double  tolerance = 0.0 
)
inlinestatic

Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result, where the inner project of the vector to which projection is performed is specified.

The dot product is used as inner product of the vector space.

No checks are performed (e.g. dimension checks or whether references are non-null).

Parameters
originalThe vector that is orthogonally projected to another vector.
onWhichVector on which the original vector is projected. It must be allocated with the same dimension as original .
onWhichProductSelfThe specified inner product of onWhich by itself.
resultVector where result is storeb. It must be allocated with the same dimension as input vectors.
toleranceTolerance for the projust of projection vector by itself. Shoulld be greater or equal to 0.

References IG.Num.IVector.GetNew(), and IG.Num.VectorBase.Resize().

static void IG.Num.VectorBase.OrthogonalProjection ( IVector  original,
IVector  onWhich,
ref IVector  result,
double  tolerance = 0.0 
)
inlinestatic

Calculates orthogonal projection of the original vector on the specified vector, and stores the projection in the specified result.

The dot product is used as inner product of the vector space.

No checks are performed (e.g. dimension checks or whether references are non-null).

Parameters
originalThe vector that is orthogonally projected to another vector.
onWhichVector on which the original vector is projected. It must be allocated with the same dimension as original .
resultVector where result is storeb. It must be allocated with the same dimension as input vectors.
toleranceTolerance for the projust of projection vector by itself. Shoulld be greater or equal to 0.

References IG.Num.IVector.GetNew(), and IG.Num.VectorBase.Resize().

static void IG.Num.VectorBase.ArrayAddPlain ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

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).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.
static void IG.Num.VectorBase.ArrayAdd ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

Addition of a scalar to all components of a vector. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.
static void IG.Num.VectorBase.ArrayAdd ( IVector  a,
double  scal,
ref IVector  result 
)
inlinestatic

Addition of a scalar to all components of a vector. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.ArraySubtractPlain ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

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).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.
static void IG.Num.VectorBase.ArraySubtract ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

Subtraction of a scalar from all components of a vector. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.
static void IG.Num.VectorBase.ArraySubtract ( IVector  a,
double  scal,
ref IVector  result 
)
inlinestatic

Subtraction of a scalar to all components of a vector. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.MultiplyPlain ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

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).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

Referenced by IG.Num.ScalarFunctionRadialUntransformed.GradientPlain(), IG.Num.VectorBase.OrthogonalizeGramSchmidt(), IG.Num.VectorBase.OrthogonalizeGramSchmidtNonRobust(), and IG.Num.ScalarFunctionRadial.ReferenceGradientPlain().

static void IG.Num.VectorBase.Multiply ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

Multiplication of a vector by a scalar. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

Referenced by IG.Num.ScalarFunctionUntransformedBase.Test(), IG.Num.ScalarFunctionUntransformedBase.TestGradient(), IG.Num.ScalarFunctionUntransformedBase.TestHessian(), and IG.Num.ScalarFunctionUntransformedBase.TestSpeed().

static void IG.Num.VectorBase.Multiply ( IVector  a,
double  scal,
ref IVector  result 
)
inlinestatic

Multiplication of a vector by a scalar. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.ScalePlain ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

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).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.
static void IG.Num.VectorBase.Scale ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

Multiplication of a vector by a scalar. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.
static void IG.Num.VectorBase.Scale ( IVector  a,
double  scal,
ref IVector  result 
)
inlinestatic

Multiplication of a vector by a scalar. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.DividePlain ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

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).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.
static void IG.Num.VectorBase.Divide ( IVector  a,
double  scal,
IVector  result 
)
inlinestatic

Division of a vector by a scalar. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

Referenced by IG.Num.ScalarFunctionUntransformedBase.Test().

static void IG.Num.VectorBase.Divide ( IVector  a,
double  scal,
ref IVector  result 
)
inlinestatic

Division of a vector by a scalar. Vector operand must be defined (non-null).

Parameters
v1First operand (vector).
dSecond operand (scalar).
resultResult.

References IG.Num.IVector.GetNew().

static double IG.Num.VectorBase.ScalarProductPlain ( IVector  a,
IVector  b 
)
inlinestatic

Scalar product of teo vectors. This is a plain version of the method that does not perform any consistency checks.

Parameters
aFirst operand (vector).
bSecond operand (vector).
Returns
Scalar product of operands.
static double IG.Num.VectorBase.ScalarProduct ( IVector  a,
IVector  b 
)
inlinestatic

Scalar product of teo vectors.

Parameters
aFirst operand (vector).
bSecond operand (vector).
Returns
Scalar product of operands.

Referenced by IG.Num.VectorBase.TestGramSchmidtOrthogonalization(), IG.Num.ScalarFunctionLinear.Value(), and IG.Num.ScalarFunctionQuadratic.Value().

static void IG.Num.VectorBase.DyadicProductPlain ( IVector  a,
IVector  b,
IMatrix  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultMatrix where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.DyadicProduct ( IVector  a,
IVector  b,
IMatrix  result 
)
inlinestatic

Calculates dyadic product of two vectors and stores the result in the specified result matrix. WARNING: dimensions must match, otherwise an exception is thrown.

Parameters
aFirst operand.
bSecond operand.
resultMatrix where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.DyadicProduct ( IVector  a,
IVector  b,
ref IMatrix  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultMatrix where copy will be stored.

References IG.Num.IVector.GetNewMatrix().

static void IG.Num.VectorBase.CrossProductPlain ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.CrossProduct ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.CrossProduct ( IVector  a,
IVector  b,
ref IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where copy will be stored.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.VectorProductPlain ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.VectorProduct ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.VectorProduct ( IVector  a,
IVector  b,
ref IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where copy will be stored.
static void IG.Num.VectorBase.ArrayProductPlain ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.

Referenced by IG.Num.NeuralApproximatorBase.SetMaxToleranceRelstiveToRange(), and IG.Num.NeuralApproximatorBase.SetRmsToleranceRelstiveToRange().

static void IG.Num.VectorBase.ArrayProduct ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.ArrayProduct ( IVector  a,
IVector  b,
ref IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where copy will be stored.

References IG.Num.IVector.GetNew().

static void IG.Num.VectorBase.ArrayQuotientPlain ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.ArrayQuotient ( IVector  a,
IVector  b,
IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where result is stored. Dimension must match dimensions of operands.
static void IG.Num.VectorBase.ArrayQuotient ( IVector  a,
IVector  b,
ref IVector  result 
)
inlinestatic

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.

Parameters
aFirst operand.
bSecond operand.
resultVector where copy will be stored.

References IG.Num.IVector.GetNew().

static int IG.Num.VectorBase.GetHashCode ( IVector  vec)
inlinestatic

Returns hash code of the specified vector.

Parameters
vecVector 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.

static bool IG.Num.VectorBase.Equals ( IVector  v1,
IVector  v2 
)
inlinestatic

Returns true if the specified vectors are equal, false if not.

Parameters
v1The first of the two vectors that are checked for equality.
v2The 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)
inlinestatic

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>

See also
Util.GetHashFunctionInt

References IG.Lib.Util.GetHashFunctionInt().

static string IG.Num.VectorBase.GetHashFunctionString ( IVector  vec)
inlinestatic

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>

See also
Util.GetHashFunctionString

References IG.Lib.Util.GetHashFunctionString().

static void IG.Num.VectorBase.OrthoNormalizeGramSchmidt ( IList< IVector original,
ref IList< IVector resOrthogonal,
ref IVector  resNorms,
ref IVector  auxProjection,
double  tolDependent = 1e-10,
bool  normalize = false,
int  numRequestedVectors = 0,
IRandomGenerator  rand = null,
int  maxExcessGenerated = 5 
)
inlinestatic

Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthonormal vectors from the specified set of arbitrary independent vectors.

This method is robust, it fails if input vectors are almost linearly dependent (limited by tolerance).

Parameters
originalA set of original vectors, must be of the same dimensiions.
resOrthogonalResulting list where a set of orthogonal vectors is stored.
resNormsA vector where norms of the resulting orthogonal vectors are stored. Its dimension must be at least equal to the number of original vectors, otherwise it is resized to the dimension of the original vectors.
auxProjectionAuxiliary vector used in computatioin.
tolDependentTolerance on the size of the vector after subtracting all projections, divided by original size.
normalizeIf true then the resulting vectors are normalized, otherwise they are not.
numRequestedVectorsNumber of requested normal vectors. If 0 then the number is the same as vector dimension.
randRandom number generator used for generation of random original vectors when this is necessary (i.e., when the number of provided linnearly independent original vector is smaller than the requested number of calculated vectors). If not specified then the global random number generator is taken.
maxExcessGeneratedMaximal number of excessive original vectors that are randomly generated, to compensate for linearly dependent input vectors. This is the number of randomly generated input vectors above those eventually needed because of linear dependency or insufficient number of provided input vectors.

If 0 then only the minimal number of generated vectors is allowed in order to compensate for insufficient number of procided input vectors (i.e. less than the number of requested v.) o for linear dependency upon them. If any generated input vector is dependent on input and previously generated vectors then the operation will fail with exception thrown.

If -1 then generation of additional input vectors is not allowed at all, and in the case of insufficiency of input vectors (too few linearly independent vectors) operation will fail with exception thrown.

If positive, this number tells how many additional input vectors can be generated because other generated vectors (including the necessary ones - due to insufficiency of input vectors) suffered for linear dependency.

Returns
The number of orthogonal vectors that were actually calculated from the specified original vectors. This coincides with the dimension of the space spanned by the provided original vectors.
static int IG.Num.VectorBase.OrthogonalizeGramSchmidt ( IList< IVector original,
ref IList< IVector resOrthogonal,
ref IVector  resNorms,
ref IVector  auxProjection,
double  tolDependent = 1e-10,
bool  normalize = false,
int  numRequestedVectors = 0,
IRandomGenerator  rand = null,
int  maxExcessGenerated = 5 
)
inlinestatic

Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthogonall vectors from the specified set of arbitrary independent vectors.

This method is robust, if input vectors are almost linearly dependent (limited by tolerance) then random iput vectors are generated and replace the original ones, until the orthogonal set is finally created..

Parameters
originalA set of original vectors, must be of the same dimensiions.
resOrthogonalResulting list where a set of orthogonal vectors is stored.
resNormsA vector where norms of the resulting orthogonal vectors are stored. Its dimension must be at least equal to the number of original vectors, otherwise it is resized to the dimension of the original vectors.
auxProjectionAuxiliary vector used in computatiioin.
tolDependentTolerance on the size of the vector after subtracting all projections, divided by original size..
normalizeIf true then the resulting vectors are normalized, otherwise they are not.
numRequestedVectorsNumber of orthogonal vectors to be calculated. If 0 then the number is the same as vector dimension. If larger than dimension then exception is thrown.
randRandom number generator used for generation of random original vectors when this is necessary (i.e., when the number of provided linnearly independent original vector is smaller than the requested number of calculated vectors). If not specified then the global random number generator is taken.
maxExcessGeneratedMaximal number of excessive original vectors that are randomly generated, to compensate for linearly dependent input vectors. This is the number of randomly generated input vectors above those eventually needed because of linear dependency or insufficient number of provided input vectors.

If 0 then only the minimal number of generated vectors is allowed in order to compensate for insufficient number of procided input vectors (i.e. less than the number of requested v.) o for linear dependency upon them. If any generated input vector is dependent on input and previously generated vectors then the operation will fail with exception thrown.

If -1 then generation of additional input vectors is not allowed at all, and in the case of insufficiency of input vectors (too few linearly independent vectors) operation will fail with exception thrown. This effectively means that the we have nonrobust procedure.

If positive, this number tells how many additional input vectors can be generated because other generated vectors (including the necessary ones - due to insufficiency of input vectors) suffered for linear dependency.

Returns
The number of orthogonal vectors that were actually calculated from the specified original vectors. This coincides with the dimension of the space spanned by the provided original vectors.

References IG.Num.VectorBase.Copy(), IG.Num.IVector.GetNew(), IG.Num.RandomGenerator.Global, IG.Num.VectorBase.MultiplyPlain(), IG.Num.VectorBase.Norm2Plain(), IG.Num.VectorBase.OrthogonalProjectionPlain(), IG.Num.VectorBase.Resize(), IG.Num.VectorBase.SetRandom(), and IG.Num.VectorBase.SubtractPlain().

static void IG.Num.VectorBase.OrthoNormalizeGramSchmidtNonRobust ( IList< IVector original,
ref IList< IVector resOrthogonal,
ref IVector  resNorms,
ref IVector  auxProjection,
double  tolSize = 0,
bool  normalize = false,
bool  modifiedGrammSchmidt = true 
)
inlinestatic

Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthonormal vectors from the specified set of arbitrary independent vectors.

This method is not robust, it fails if input vectors are almost linearly dependent (limited by tolerance).

Parameters
originalA set of original vectors, must be of the same dimensiions.
resOrthogonalResulting list where a set of orthogonal vectors is stored.
resNormsA vector where norms of the resulting orthogonal vectors are stored. Its dimension must be at least equal to the number of original vectors, otherwise it is resized to the dimension of the original vectors.
auxProjectionAuxiliary vector used in computatioin.
tolSizeTolerance on the size of the vector after subtracting all projections.
normalizeIf true then the resulting vectors are normalized, otherwise they are not.
modifiedGrammSchmidtIf true (which is default) then a more stable modification is used.
static void IG.Num.VectorBase.OrthogonalizeGramSchmidtNonRobust ( IList< IVector original,
ref IList< IVector resOrthogonal,
ref IVector  resNorms,
ref IVector  auxProjection,
double  tolSize = 0,
bool  normalize = false,
bool  modifiedGrammSchmidt = true 
)
inlinestatic

Performs the Gramm-Schmidt orthogonalization procedure in order to calculate a set of orthogonall vectors from the specified set of arbitrary independent vectors.

This method is not robust, it fails if input vectors are almost linearly dependent (limited by tolerance).

Parameters
originalA set of original vectors, must be of the same dimensiions.
resOrthogonalResulting list where a set of orthogonal vectors is stored.
resNormsA vector where norms of the resulting orthogonal vectors are stored. Its dimension must be at least equal to the number of original vectors, otherwise it is resized to the dimension of the original vectors.
auxProjectionAuxiliary vector used in computatiioin.
tolSizeTolerance on the size of the vector after subtracting all projections.
normalizeIf true then the resulting vectors are normalized, otherwise they are not.
modifiedGrammSchmidtIf true (which is default) then a more stable modification is used.

References IG.Num.VectorBase.Copy(), IG.Num.VectorBase.MultiplyPlain(), IG.Num.VectorBase.Norm2Plain(), IG.Num.VectorBase.OrthogonalProjectionPlain(), IG.Num.VectorBase.Resize(), and IG.Num.VectorBase.SubtractPlain().

static bool IG.Num.VectorBase.TestGramSchmidtOrthogonalization ( int  dim,
int  numRepetitions = 1,
double  tol = 1e-8,
int  outputLevel = 0,
IRandomGenerator  randomGenerator = null,
bool  normalize = false,
bool  modifiedGrammSchmidt = true,
bool  nonRobust = false 
)
inlinestatic

Performs a test of Gramm-Schmidt orthogonalization on a set of random vectors.

Parameters
dimdimension of vectors to be orthogonalized.
numRepetitionsNomber of repetitions (how many times the procedure is repeated).
tolTolerance for zero length of resulting vectors.
outputLevelLevel of output.
randomGeneratorRandom generator used.
normalizeWhether resulting vectors are normalized.
modifiedGrammSchmidtWhether a modified gramm-schmidt algorithm is used.
nonRobustIf true then non - robust algorithm is tested. Otherwise, the default robust algorithm is tested (which produces the required number of orthogonal vectors even if the dimension of the subspace spanned by the original vectors is smaller than dimension of the original vector space).
Returns
True if the test completes successfully, false otherwise.

References IG.Num.VectorBase.Add(), IG.Lib.StopWatch.CpuTime, IG.Num.RandomGenerator.Global, IG.Num.Vector.Random(), IG.Num.VectorBase.ScalarProduct(), IG.Lib.StopWatch.Start(), IG.Lib.StopWatch.Stop(), IG.Lib.StopWatch.Time, and IG.Num.VectorBase.ToStringMath().

static VectorBase IG.Num.VectorBase.operator+ ( VectorBase  v)
inlinestatic

Unary plus, returns the operand.

References IG.Num.VectorBase.GetCopyBase().

static VectorBase IG.Num.VectorBase.operator- ( VectorBase  v)
inlinestatic

Unary negation, returns the negative operand.

References IG.Num.VectorBase.GetCopyBase(), and IG.Num.VectorBase.Negate().

static VectorBase IG.Num.VectorBase.operator+ ( VectorBase  a,
VectorBase  b 
)
inlinestatic

Vector addition.

References IG.Num.VectorBase.GetNewBase().

static VectorBase IG.Num.VectorBase.operator- ( VectorBase  a,
VectorBase  b 
)
inlinestatic

Vector subtraction.

References IG.Num.VectorBase.GetNewBase().

static double IG.Num.VectorBase.operator* ( VectorBase  a,
VectorBase  b 
)
inlinestatic

Scalar product of two vectors.

static VectorBase IG.Num.VectorBase.operator* ( VectorBase  a,
double  b 
)
inlinestatic

Product of a vector by a scalar.

References IG.Num.VectorBase.GetNewBase().

static VectorBase IG.Num.VectorBase.operator* ( double  a,
VectorBase  b 
)
inlinestatic

Product of a vector by a scalar.

References IG.Num.VectorBase.GetNewBase().

static VectorBase IG.Num.VectorBase.operator/ ( VectorBase  a,
double  b 
)
inlinestatic

Vector subtraction.

References IG.Num.VectorBase.GetNewBase().

static string IG.Num.VectorBase.ToString ( IVector  vec)
inlinestatic

Returns a string representation of the specified vector in a standard IGLib form.

Parameters
vecVector whose string representation is returned.

References IG.Lib.Util.NullRepresentationString.

Referenced by IG.Num.VectorExtensions.ToString().

static string IG.Num.VectorBase.ToStringMath ( IVector  vec)
inlinestatic

Returns a string representation of the specified vector in a standard IGLib form (Mathematica-like format but with C representation of numbers).

Parameters
vecVector whose string representation is returned.

References IG.Num.IVector.ToString().

Referenced by IG.Num.VectorBase.TestGramSchmidtOrthogonalization(), IG.Num.VectorExtensions.ToStringMath(), IG.Num.AnalysisResults.ToStringMath(), and IG.Num.AnalysisResults.ToStringRequestMath().

static string IG.Num.VectorBase.ToString ( IVector  vec,
string  elementFormat 
)
inlinestatic

Returns a string representation of the specified vector in a standard IGLib form, with the specified format for elements of the vector.

Parameters
vecVector whose string representation is returned.
elementFormatFormat specification for printing individual element.

References IG.Lib.Util.NullRepresentationString.

static string IG.Num.VectorBase.ToStringMath ( IVector  vec,
string  elementFormat 
)
inlinestatic

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.

Parameters
vecVector whose string representation is returned.
elementFormatFormat specification for printing individual element.

References IG.Num.IVector.ToString().

static void IG.Num.VectorBase.SaveJson ( IVector  vec,
string  filePath 
)
inlinestatic
static void IG.Num.VectorBase.SaveJson ( IVector  vec,
string  filePath,
bool  append 
)
inlinestatic

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.

Parameters
vecObject that is saved to a file.
filePathPath to the file in which object is saved.
appendSpecifies whether serialized data is appended at the end of the file in the case that the file already exists.
static void IG.Num.VectorBase.SaveCsv ( IVector  vec,
string  filePath 
)
inlinestatic

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.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.
separatorSeparator used in the CSV file.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

Referenced by IG.Num.SimKosecFileManagerBase.WriteOutputValues().

static void IG.Num.VectorBase.SaveCsv ( IVector  vec,
string  filePath,
string  separator 
)
inlinestatic

Saves the specified vector to a CSV file. It the specified file already exists then it is overwritten.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.
separatorSeparator used in the CSV file.
static void IG.Num.VectorBase.SaveCsv ( IVector  vec,
string  filePath,
bool  append 
)
inlinestatic

Saves the specified vector to a CSV file. Constant UtilStr.DefaultCsvSeparator is used as separator in CSV.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.
appendSpecifies whether the data is appended at the end of the file in the case that the ifle already exists.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

static void IG.Num.VectorBase.SaveCsv ( IVector  vec,
string  filePath,
string  separator,
bool  append 
)
inlinestatic

Saves the specified vector to a CSV file.

Parameters
vecVector to be stored to a file.
filePathPath of the file to which vector is stored.
separatorSeparator used in the CSV file.
appendSpecifies whether the data is appended at the end of the file in the case that the ifle already exists.

References IG.Lib.UtilCsv.SaveCsv().

static void IG.Num.VectorBase.LoadCsv ( string  filePath,
ref IVector  vecRestored 
)
inlinestatic

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.

Parameters
filePathPath to the file that contains a vector in CSV format.
Parameters
filePathPath to the file that vector is read form.
vecRestoredVector object where the read-in vector is stored.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

Referenced by IG.Num.SimKosecFileManagerBase.ReadOutputValues().

static void IG.Num.VectorBase.LoadCsv ( string  filePath,
string  separator,
ref IVector  vecRestored 
)
inlinestatic

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.

Parameters
filePathPath to the file that contains a vector in CSV format.
separatorSeparator that is used to separate values in a row in the CSV file.
vecRestoredVector object where the read-in vector is stored.

References IG.Lib.UtilCsv.LoadCsv(), and IG.Num.VectorBase.Resize().

static void IG.Num.VectorBase.LoadCsv ( string  filePath,
int  rowNum,
ref IVector  vecRestored 
)
inlinestatic

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.

Parameters
filePathPath to the file that contains a vector in CSV format.
rowNumNumber of the row from which the vector is read.
vecRestoredVector object where the read-in vector is stored.

References IG.Lib.UtilCsv.DefaultCsvSeparator.

static void IG.Num.VectorBase.LoadCsv ( string  filePath,
int  rowNum,
string  separator,
ref IVector  vecRestored 
)
inlinestatic

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.

Parameters
filePathPath to the file that contains a vector in CSV format.
rowNumNumber of the row from which the vector is read.
separatorSeparator that is used to separate values in a row in the CSV file.
vecRestoredVector object where the read-in vector is stored.

References IG.Lib.UtilCsv.LoadCsv(), and IG.Num.VectorBase.Resize().

override string IG.Num.VectorBase.ToString ( )
inline

Returns a string representation of this vector in a standard IGLib form.

Implements IG.Num.IVector.

virtual string IG.Num.VectorBase.ToStringMath ( )
inlinevirtual

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)
inlinevirtual

Returns a string representation of the current vector in a standard IGLib form, with the specified format for elements of the vector.

Parameters
vecVector whose string representation is returned.
elementFormatFormat specification for printing individual element.

Implements IG.Num.IVector.

virtual string IG.Num.VectorBase.ToStringMath ( string  elementFormat)
inlinevirtual

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.

Parameters
vecVector whose string representation is returned.
elementFormatFormat specification for printing individual element.

Implements IG.Num.IVector.

Member Data Documentation

VectorStore IG.Num.VectorBase._matrixStore
staticprivate

Property Documentation

abstract int IG.Num.VectorBase.Length
get

Gets dimension of the vector.

abstract double IG.Num.VectorBase.this[int i]
getset

Gets or sets the element indexed by i in the Vector.

Parameters
iElement index, 0 - based.
virtual double IG.Num.VectorBase.Norm
get

Gets Euclidean norm of the vector.

virtual double IG.Num.VectorBase.Norm2
get

Gets Euclidean norm of the vector.

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.

virtual double IG.Num.VectorBase.NormInf
get

Infinity-norm, maximum absolute value of any component.

VectorStore IG.Num.VectorBase.VectorStore
staticget

Gets the matrix store for recycling auxiliary matrices.

Matrix store is created only once, on the first access.


The documentation for this class was generated from the following file: