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

- Main Page
- Namespaces
- Classes
- Files
- Directories

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

Public Member Functions | Static Public Member Functions | Properties | Private Member Functions | Private Attributes

# 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]

List of all members.

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

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.

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.

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.

Reimplemented from IG::Num::VectorBase.

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.

Reimplemented from IG::Num::VectorBase.

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.

Vector2d IG::Num::Vector2d::VectorProduct | ( | Vector2d | v | ) | `[inline]`

Returns vector product of the current and the specified vector.

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.

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.

Vector2d IG::Num::Vector2d::Add | ( | Vector2d | a | ) | `[inline]`

Returns sum of the current vector and the specified vector.

Vector2d IG::Num::Vector2d::Subtract | ( | Vector2d | a | ) | `[inline]`

Returns difference between the current vector and the specified vector.

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.

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.

static Vector2d IG::Num::Vector2d::operator+ | ( | Vector2d | v | ) | `[inline, static]`

Unary plus, returns the operand.

static Vector2d IG::Num::Vector2d::operator- | ( | Vector2d | v | ) | `[inline, static]`

Unary negation, returns the negative operand.

static Vector2d IG::Num::Vector2d::operator+ | ( | Vector2d | a,
|  | Vector2d | b
| ) |  | `[inline, static]`

Vector addition.

static Vector2d IG::Num::Vector2d::operator- | ( | Vector2d | a,
|  | Vector2d | b
| ) |  | `[inline, static]`

Vector subtraction.

static double IG::Num::Vector2d::operator* | ( | Vector2d | a,
|  | Vector2d | b
| ) |  | `[inline, static]`

Scalar product of two 2D vectors.

static Vector2d IG::Num::Vector2d::operator* | ( | Vector2d | a,
|  | double | b
| ) |  | `[inline, static]`

Product of a 2D vector by a scalar.

static Vector2d IG::Num::Vector2d::operator* | ( | double | a,
|  | Vector2d | b
| ) |  | `[inline, static]`

Product of a 2D vector by a scalar.

static Vector2d IG::Num::Vector2d::operator/ | ( | Vector2d | a,
|  | double | b
| ) |  | `[inline, static]`

Vector subtraction.

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.

Reimplemented from IG::Num::VectorBase.

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.

Reimplemented from IG::Num::VectorBase.

vec2 IG::Num::Vector2d::Vec`[get, set]`

Gets the struct representation of this 2D vector.

double IG::Num::Vector2d::X`[get, set]`

1st component.

double IG::Num::Vector2d::Y`[get, set]`

2nd component.

override double IG::Num::Vector2d::Norm`[get]`

Gets a 2 norm of the current 2D vector.

Reimplemented from IG::Num::VectorBase.

override double IG::Num::Vector2d::Norm2`[get]`

Gets a 2 norm of the current 2D vector.

Reimplemented from IG::Num::VectorBase.

override double IG::Num::Vector2d::Norm1`[get]`

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

Reimplemented from IG::Num::VectorBase.

override double IG::Num::Vector2d::NormInf`[get]`

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

Reimplemented from IG::Num::VectorBase.

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

- Vector2Dclass.cs

All Classes Namespaces Files Functions Variables Enumerations Properties Events