CGAL 5.2.1 - dD Geometry Kernel

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. More...
 
 Vector (int d, NT x)
 creates an instance v of type Vector. More...
 
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). More...
 

Operations

int dimension ()
 returns the dimension of v.
 
bool is_zero ()
 returns true iff v is the zero vector.
 
NToperator[] (int i)
 returns the \( i\)-th component of v. More...
 
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. More...
 
Vector operator- (const Vector &v1)
 Subtraction. More...
 
NT operator* (const Vector &v1)
 Inner Product. More...
 
Vector operator- ()
 Negation.
 
Vectoroperator+= (const Vector &v1)
 Addition plus assignment. More...
 
Vectoroperator-= (const Vector &v1)
 Subtraction plus assignment. More...
 
Vectoroperator*= (const NT &s)
 Scalar multiplication plus assignment.
 
Vectoroperator/= (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
ForwardIteratorhas 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\).