| IGLib 1.6.0 The IGLib base library for development of numerical, technical and business applications.

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Public Member Functions | Static Public Member Functions | Properties | Private Member Functions | Private Attributes | List of all members
IG.Num.Vector2d Class Reference

Vector or point in a 2 dimensional space. More...

Inheritance diagram for IG.Num.Vector2d:
[legend]
Collaboration diagram for IG.Num.Vector2d:
[legend]

## Public Member Functions
Vector2d | GetCopyThis ()
| Creates and returns a copy of the current 2D vector, which is of the same type as the current vector. More...
override VectorBase | GetCopyBase ()
| Creates and returns a copy of the current vector, which is of the same type as the current vector. More...
Vector2d | GetNewThis (int length)
| Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector. More...
override VectorBase | GetNewBase (int length)
| Creates and returns a new 2D vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector. More...
Vector2d | GetNewThis ()
| Creates and returns a new vector with the same dimension and of the same type as the current vector. More...
override VectorBase | GetNewBase ()
| Creates and returns a new vector with the same dimension and of the same type as the current vector. More...
virtual Matrix2d | GetNewMatrixThis (int rowCount, int columnCount)
| Creates and returns a new matrix with the specified dimensona, and of a type that is consistent with the type of the current vector. More...
override MatrixBase | GetNewMatrixBase (int rowCount, int columnCount)
| Creates and returns a new matrix with the specified dimensona, and of a type that is consistent with the type of the current vector. More...
Matrix2d | GetNewMatrixThis ()
| Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector. More...
override MatrixBase | GetNewMatrixBase ()
| Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector. More...
| Vector2d (Vector2d v)
| Copy constructor. Initializes components of a 2D vector with components of the specified vector. More...
| Vector2d (vec2 v)
| Initializes components of a 2D vector with components of the specified vector. More...
| Vector2d (double x, double y)
| Initializes components of a 2D vector with the specified values. More...
| Vector2d (double comp)
| Initializes all component of a 2D vector with the specified value. More...
| Vector2d (double[] components)
| Constructs a vector from a 1-D array. More...
| Vector2d (IVector vec)
| Constructs a 2D vector from another 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...
new Vector2d | Normalized ()
| Normalizes this 2D vector. More...
Vector2d | Normalized1 ()
| Normalizes this 2D vector in 1 norm. More...
Vector2d | Normalized2 ()
| Normalizes this 2D vector in 2 norm. More...
Vector2d | NormalizedInfinity ()
| Normalizes this 2D vector in infinity norm. More...
double | ScalarProduct (Vector2d v)
| Returns scalar product of the current and the specified vector. More...
Vector2d | VectorProduct (Vector2d v)
| Returns vector product of the current and the specified vector. More...
Vector2d | CrossProduct (Vector2d v)
| Returns vector product of the current and the specified vector. More...
Vector2d | Cross (Vector2d v)
| Returns vector product of the current and the specified vector. More...
Matrix2d | DyadicProduct (Vector2d v)
| Returns dyadic product of the current and the specified vector. More...
Vector2d | Multiply (double k)
| Returns the current vector multiplied by the specified scalar. More...
Vector2d | Add (Vector2d a)
| Returns sum of the current vector and the specified vector. More...
Vector2d | Subtract (Vector2d a)
| Returns difference between the current vector and the specified vector. More...
override string | ToString ()
| Returns string representation of the 2D vector. More...
void | Read ()
| Reads 2D vector components from a console. More...
void | Read (string name)
| Reads 2D vector components from a console. More...
Public Member Functions inherited from IG.Num.VectorBase
virtual double[] | ToArray ()
| Copies the current vector to an array. 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 Vector2d | Create (double[] components)
| Constructs a vector from a 1-D array. More...
static Vector2d | Create (IVector vec)
| Constructs a 2D vector as a copy of another IVector object. More...
static Vector2d | Random (int n)
| Generates vector with random elements uniformly distributed on [0, 1). More...
static Vector2d | Ones (int n)
| Generates an d2-dimensional vector filled with 1. More...
static Vector2d | Zeros (int n)
| Generates an d2-dimensional vector filled with 0. More...
static Vector2d | BasisVector (int i)
| Generates an d2-dimensional unit vector for i-th coordinate. More...
static Vector2d | Copy (Vector2d v)
| Returns a copy of the specified 2D vector. More...
static void | Negate (Vector2d v, ref Vector2d res)
| Negates the specified vector and stores its copy in the resulting vector. More...
static Vector2d | operator+ (Vector2d v)
| Unary plus, returns the operand. More...
static Vector2d | operator- (Vector2d v)
| Unary negation, returns the negative operand. More...
static Vector2d | operator+ (Vector2d a, Vector2d b)
| Vector addition. More...
static Vector2d | operator- (Vector2d a, Vector2d b)
| Vector subtraction. More...
static double | operator* (Vector2d a, Vector2d b)
| Scalar product of two 2D vectors. More...
static Vector2d | operator* (Vector2d a, double b)
| Product of a 2D vector by a scalar. More...
static Vector2d | operator* (double a, Vector2d b)
| Product of a 2D vector by a scalar. More...
static Vector2d | operator/ (Vector2d a, double b)
| Vector subtraction. More...
Static Public Member Functions inherited from IG.Num.VectorBase
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
override int | Length`[get]`
| Gets dimension of the vector. More...
override double | this[int i]`[get, set]`
| Gets or sets the element indexed by `i` in the 2D `Vector`. More...
vec2 | Vec`[get, set]`
| Gets the struct representation of this 2D vector. More...
double | X`[get, set]`
| 1st component. More...
double | Y`[get, set]`
| 2nd component. More...
override double | Norm`[get]`
| Gets a 2 norm of the current 2D vector. More...
override double | Norm2`[get]`
| Gets a 2 norm of the current 2D vector. More...
override double | Norm1`[get]`
| Gets an 1 norm of the current 2D vector - sum of absolute values of components. More...
override double | NormInf`[get]`
| Gets an infinity norm of the current 2D vector - maximal absolute component value. More...
Properties inherited from IG.Num.VectorBase
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...

## Private Member Functions
object ICloneable. | Clone ()
| Returns a deep copy of a 2D vector. More...

## Private Attributes
vec2 | _v

## Detailed Description

Vector or point in a 2 dimensional space.

$A Igor Jul08; Oct10;

## Constructor & Destructor Documentation

IG.Num.Vector2d.Vector2d | ( | Vector2d | v | ) |
| inline

Copy constructor. Initializes components of a 2D vector with components of the specified vector.

Parameters

  v | Vectr whose components are copied to the initialized vector.

References IG.Num.Vector2d.X, and IG.Num.Vector2d.Y.

IG.Num.Vector2d.Vector2d | ( | vec2 | v | ) |
| inline

Initializes components of a 2D vector with components of the specified vector.

Parameters

  v | Vector whose components are copied to the initialized vector.

References IG.Num.vec2.x, and IG.Num.vec2.y.

IG.Num.Vector2d.Vector2d | ( | double | x,
|  | double | y
| ) |  |
| inline

Initializes components of a 2D vector with the specified values.

Parameters

  comp | Value assigned to all vector components.

IG.Num.Vector2d.Vector2d | ( | double | comp | ) |
| inline

Initializes all component of a 2D vector with the specified value.

Parameters

  comp | Value assigned to all vector components.

IG.Num.Vector2d.Vector2d | ( | double[] | components | ) |
| inline

Constructs a vector from a 1-D array.

Parameters

  vec | One-dimensional array of doubles.

See also
  Create

IG.Num.Vector2d.Vector2d | ( | IVector | vec | ) |
| inline

Constructs a 2D vector from another vector.

Parameters

  vec | Vector whose copy is created.

## Member Function Documentation

Vector2d IG.Num.Vector2d.GetCopyThis | ( |  | ) |
| inline

Creates and returns a copy of the current 2D vector, which is of the same type as the current vector.

override VectorBase IG.Num.Vector2d.GetCopyBase | ( |  | ) |
| inline virtual

Creates and returns a copy of the current vector, which is of the same type as the current vector.

Implements IG.Num.VectorBase.

Vector2d IG.Num.Vector2d.GetNewThis | ( | int | length | ) |
| inline

Creates and returns a new vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.

Parameters

  length | Dimension of the returned vector.

override VectorBase IG.Num.Vector2d.GetNewBase | ( | int | length | ) |
| inline virtual

Creates and returns a new 2D vector of the specified dimension in such a way that the type of the returned vector is the same as that of the current vector.

Parameters

  length | Dimension of the returned vector, must be 2.

Implements IG.Num.VectorBase.

Vector2d IG.Num.Vector2d.GetNewThis | ( |  | ) |
| inline

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

override VectorBase IG.Num.Vector2d.GetNewBase | ( |  | ) |
| inline virtual

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

Implements IG.Num.VectorBase.

virtual Matrix2d IG.Num.Vector2d.GetNewMatrixThis | ( | int | rowCount,
|  | int | columnCount
| ) |  |
| inline virtual

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

Parameters

  rowCount | Number of rows of the returned matrix.
  columnCount | Number of rows of the returned matrix.

Returns
  A matrix with specified dimensions, whose type is consistent with the type of the current vector.

override MatrixBase IG.Num.Vector2d.GetNewMatrixBase | ( | int | rowCount,
|  | int | columnCount
| ) |  |
| inline virtual

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

Parameters

  rowCount | Number of rows of the returned matrix.
  columnCount | Number 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.VectorBase.

Matrix2d IG.Num.Vector2d.GetNewMatrixThis | ( |  | ) |
| inline

Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.

override MatrixBase IG.Num.Vector2d.GetNewMatrixBase | ( |  | ) |
| inline virtual

Creates and returns a new matrix of a type that is consistent with the type of the current vector, and with both dimensions equal to the dimension of the current vector.

Implements IG.Num.VectorBase.

object ICloneable. IG.Num.Vector2d.Clone | ( |  | ) |
| inline private

Returns a deep copy of a 2D vector.

static Vector2d IG.Num.Vector2d.Create | ( | double[] | components | ) |
| inline static

Constructs a vector from a 1-D array.

static Vector2d IG.Num.Vector2d.Create | ( | IVector | vec | ) |
| inline static

Constructs a 2D vector as a copy of another IVector object.

static Vector2d IG.Num.Vector2d.Random | ( | int | n | ) |
| inline static

Generates vector with random elements uniformly distributed on [0, 1).

Parameters

  d2 | Dimensionality of vector.

Returns
  An d2-dimensional vector with uniformly distributedrandom elements in `[0, 1)` interval.

References IG.Num.VectorBase.SetRandom().

static Vector2d IG.Num.Vector2d.Ones | ( | int | n | ) |
| inline static

Generates an d2-dimensional vector filled with 1.

Parameters

  d2 | Dimensionality of vector.

static Vector2d IG.Num.Vector2d.Zeros | ( | int | n | ) |
| inline static

Generates an d2-dimensional vector filled with 0.

Parameters

  d2 | Dimensionality of vector.

static Vector2d IG.Num.Vector2d.BasisVector | ( | int | i | ) |
| inline static

Generates an d2-dimensional unit vector for i-th coordinate.

Parameters

  d2 | Dimensionality of vector.
  i | Coordinate index.

override int IG.Num.Vector2d.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().

override bool IG.Num.Vector2d.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), 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 function.

Overrides the object.Equals method.

References IG.Num.VectorBase.Equals().

new Vector2d IG.Num.Vector2d.Normalized | ( |  | ) |
| inline

Normalizes this 2D vector.

Implements IG.Num.IVector.

Vector2d IG.Num.Vector2d.Normalized1 | ( |  | ) |
| inline

Normalizes this 2D vector in 1 norm.

Vector2d IG.Num.Vector2d.Normalized2 | ( |  | ) |
| inline

Normalizes this 2D vector in 2 norm.

Vector2d IG.Num.Vector2d.NormalizedInfinity | ( |  | ) |
| inline

Normalizes this 2D vector in infinity norm.

double IG.Num.Vector2d.ScalarProduct | ( | Vector2d | v | ) |
| inline

Returns scalar product of the current and the specified vector.

References IG.Num.Vector2d.Vec.

Referenced by IG.Num.Vector2d.operator*().

Vector2d IG.Num.Vector2d.VectorProduct | ( | Vector2d | v | ) |
| inline

Returns vector product of the current and the specified vector.

References IG.Num.Vector2d.Vec.

Vector2d IG.Num.Vector2d.CrossProduct | ( | Vector2d | v | ) |
| inline

Returns vector product of the current and the specified vector.

Vector2d IG.Num.Vector2d.Cross | ( | Vector2d | v | ) |
| inline

Returns vector product of the current and the specified vector.

Matrix2d IG.Num.Vector2d.DyadicProduct | ( | Vector2d | v | ) |
| inline

Returns dyadic product of the current and the specified vector.

References IG.Num.Vector2d.Vec.

Vector2d IG.Num.Vector2d.Multiply | ( | double | k | ) |
| inline

Returns the current vector multiplied by the specified scalar.

Parameters

  k | Factor by which the current vector is multiplied.

Referenced by IG.Num.Vector2d.operator*().

Vector2d IG.Num.Vector2d.Add | ( | Vector2d | a | ) |
| inline

Returns sum of the current vector and the specified vector.

References IG.Num.Vector2d.Vec.

Referenced by IG.Num.Vector2d.operator+().

Vector2d IG.Num.Vector2d.Subtract | ( | Vector2d | a | ) |
| inline

Returns difference between the current vector and the specified vector.

References IG.Num.Vector2d.Vec.

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

static Vector2d IG.Num.Vector2d.Copy | ( | Vector2d | v | ) |
| inline static

Returns a copy of the specified 2D vector.

Parameters

  v | Vector whose copy is returned.

Referenced by IG.Num.Vector2d.operator+().

static void IG.Num.Vector2d.Negate | ( | Vector2d | v,
|  | ref Vector2d | res
| ) |  |
| inline static

Negates the specified vector and stores its copy in the resulting vector.

Parameters

  v | Vectr to be negated.
  res | Vector where the result is stored.

References IG.Num.Vector2d.X, and IG.Num.Vector2d.Y.

static Vector2d IG.Num.Vector2d.operator+ | ( | Vector2d | v | ) |
| inline static

Unary plus, returns the operand.

References IG.Num.Vector2d.Copy().

static Vector2d IG.Num.Vector2d.operator- | ( | Vector2d | v | ) |
| inline static

Unary negation, returns the negative operand.

References IG.Num.Vector2d.X, and IG.Num.Vector2d.Y.

static Vector2d IG.Num.Vector2d.operator+ | ( | Vector2d | a,
|  | Vector2d | b
| ) |  |
| inline static

Vector addition.

References IG.Num.Vector2d.Add().

static Vector2d IG.Num.Vector2d.operator- | ( | Vector2d | a,
|  | Vector2d | b
| ) |  |
| inline static

Vector subtraction.

References IG.Num.Vector2d.Subtract().

static double IG.Num.Vector2d.operator* | ( | Vector2d | a,
|  | Vector2d | b
| ) |  |
| inline static

Scalar product of two 2D vectors.

References IG.Num.Vector2d.ScalarProduct().

static Vector2d IG.Num.Vector2d.operator* | ( | Vector2d | a,
|  | double | b
| ) |  |
| inline static

Product of a 2D vector by a scalar.

References IG.Num.Vector2d.Multiply().

static Vector2d IG.Num.Vector2d.operator* | ( | double | a,
|  | Vector2d | b
| ) |  |
| inline static

Product of a 2D vector by a scalar.

References IG.Num.Vector2d.Multiply().

static Vector2d IG.Num.Vector2d.operator/ | ( | Vector2d | a,
|  | double | b
| ) |  |
| inline static

Vector subtraction.

References IG.Num.Vector2d.X, and IG.Num.Vector2d.Y.

override string IG.Num.Vector2d.ToString | ( |  | ) |
| inline

Returns string representation of the 2D vector.

Implements IG.Num.IVector.

void IG.Num.Vector2d.Read | ( |  | ) |
| inline

Reads 2D vector components from a console.

void IG.Num.Vector2d.Read | ( | string | name | ) |
| inline

Reads 2D vector components from a console.

Parameters

  name | Name of the vector to be read; it is written as orientation to the user and can be null.

## Member Data Documentation

vec2 IG.Num.Vector2d._v
| private

## Property Documentation

override int IG.Num.Vector2d.Length
| get

Gets dimension of the vector.

override double IG.Num.Vector2d.this[int i]
| get set

Gets or sets the element indexed by `i` in the 2D `Vector`.

Parameters

  i | Element index, 0 - based, must be between 0 and 1.

vec2 IG.Num.Vector2d.Vec
| get set

Gets the struct representation of this 2D vector.

Referenced by IG.Num.Vector2d.Add(), IG.Num.Vector2d.DyadicProduct(), IG.Num.Matrix2d.Multiply(), IG.Num.Vector2d.ScalarProduct(), IG.Num.Matrix2d.Solve(), IG.Num.Vector2d.Subtract(), and IG.Num.Vector2d.VectorProduct().

double IG.Num.Vector2d.X
| get set

1st component.

Referenced by IG.Num.Matrix2d.Matrix2d(), IG.Num.Vector2d.Negate(), IG.Num.Vector2d.operator-(), IG.Num.Vector2d.operator/(), IG.Num.BoundingBox2d.Update(), and IG.Num.Vector2d.Vector2d().

double IG.Num.Vector2d.Y
| get set

2nd component.

Referenced by IG.Num.Matrix2d.Matrix2d(), IG.Num.Vector2d.Negate(), IG.Num.Vector2d.operator-(), IG.Num.Vector2d.operator/(), IG.Num.BoundingBox2d.Update(), and IG.Num.Vector2d.Vector2d().

override double IG.Num.Vector2d.Norm
| get

Gets a 2 norm of the current 2D vector.

override double IG.Num.Vector2d.Norm2
| get

Gets a 2 norm of the current 2D vector.

override double IG.Num.Vector2d.Norm1
| get

Gets an 1 norm of the current 2D vector - sum of absolute values of components.

override double IG.Num.Vector2d.NormInf
| get

Gets an infinity norm of the current 2D vector - maximal absolute component value.

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

- igbase/numeric/geometry/Vector2Dclass.cs