CGAL 6.2 - dD Geometry Kernel: Vector Concept Reference

CGAL 6.2 - dD Geometry Kernel

Loading...
Searching...
No Matches
List of all members
Vector Concept Reference
Reference Manual » Linear Algebra Concepts

## Definition

An instance of data type `Vector` is a vector of variables of number type `NT`. Together with the type `Matrix` it realizes the basic operations of linear algebra.

## Types
typedef unspecified_type | NT
| the ring type of the components.
typedef unspecified_type | iterator
| the iterator type for accessing components.
typedef unspecified_type | const_iterator
| the const iterator type for accessing components.

## Creation
| Vector ()
| creates an instance `v` of type `Vector`.
| Vector (int d)
| creates an instance `v` of type `Vector`.
| Vector (int d, NT x)
| creates an instance `v` of type `Vector`.
template<class Forward_iterator >
| Vector (Forward_iterator first, Forward_iterator last)
| creates an instance `v` of type `Vector`; `v` is initialized to the vector with entries `set [first,last)`.

## Operations
int | dimension ()
| returns the dimension of `v`.
bool | is_zero ()
| returns true iff `v` is the zero vector.
NT & | operator[] (int i)
| returns the \( i\)-th component of `v`.
iterator | begin ()
| iterator to the first component.
iterator | end ()
| iterator beyond the last component.
const_iterator | begin () const
| iterator to the first component.
const_iterator | end () const
| iterator beyond the last component.
Vector | operator+ (const Vector &v1)
| Addition.
Vector | operator- (const Vector &v1)
| Subtraction.
NT | operator* (const Vector &v1)
| Inner Product.
Vector | operator- ()
| Negation.
Vector & | operator+= (const Vector &v1)
| Addition plus assignment.
Vector & | operator-= (const Vector &v1)
| Subtraction plus assignment.
Vector & | operator*= (const NT &s)
| Scalar multiplication plus assignment.
Vector & | operator/= (const NT &s)
| Scalar division plus assignment.
Vector | operator* (const NT &r, const Vector &v)
| Component-wise multiplication with number \( r\).
Vector | operator* (const Vector &v, const NT &r)
| Component-wise multiplication with number \( r\).

## Constructor & Destructor Documentation

## ◆ Vector() [1/3]

Vector::Vector | ( | int | d | ) |

creates an instance `v` of type `Vector`.

`v` is initialized to a vector of dimension \( d\).

## ◆ Vector() [2/3]

Vector::Vector | ( | int | d,
|  | NT | x
| ) |  |

creates an instance `v` of type `Vector`.

`v` is initialized to a vector of dimension \( d\) with entries `x`.

## ◆ Vector() [3/3]

template<class Forward_iterator >

Vector::Vector | ( | Forward_iterator | first,
|  | Forward_iterator | last
| ) |  |

creates an instance `v` of type `Vector`; `v` is initialized to the vector with entries `set [first,last)`.

Template Parameters

  ForwardIterator | has `NT` as value type.

## Member Function Documentation

## ◆ operator*()

NT Vector::operator* | ( | const Vector & | v1 | ) |

Inner Product.

Precondition
  `v.dimension() == v1.dimension()`.

## ◆ operator+()

Vector Vector::operator+ | ( | const Vector & | v1 | ) |

Addition.

Precondition
  `v.dimension() == v1.dimension()`.

## ◆ operator+=()

Vector & Vector::operator+= | ( | const Vector & | v1 | ) |

Addition plus assignment.

Precondition
  `v.dimension() == v1.dimension()`.

## ◆ operator-()

Vector Vector::operator- | ( | const Vector & | v1 | ) |

Subtraction.

Precondition
  `v.dimension() == v1.dimension()`.

## ◆ operator-=()

Vector & Vector::operator-= | ( | const Vector & | v1 | ) |

Subtraction plus assignment.

Precondition
  `v.dimension() == v1.dimension()`.

## ◆ operator[]()

NT & Vector::operator[] | ( | int | i | ) |

returns the \( i\)-th component of `v`.

Precondition
  \( 0\le i \le v.dimension()-1\).