31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

5.15 Real-Valued Vectors ( real vector )<br />

1. Definition<br />

An instance of data type real vector is a vector of variables of type real.<br />

#include < <strong>LEDA</strong>/numbers/real vector.h ><br />

2. Creation<br />

real vector v; creates an instance v of type real vector; v is initialized to the zerodimensional<br />

vector.<br />

real vector<br />

real vector<br />

real vector<br />

real vector<br />

real vector<br />

v(int d); creates an instance v of type real vector; v is initialized to the zero<br />

vector of dimension d.<br />

v(real a, real b);<br />

creates an instance v of type real vector; v is initialized to the twodimensional<br />

vector (a, b).<br />

v(real a, real b, real c);<br />

creates an instance v of type real vector; v is initialized to the threedimensional<br />

vector (a, b, c).<br />

v(double a, double b);<br />

creates an instance v of type real vector; v is initialized to the twodimensional<br />

vector (a, b).<br />

v(double a, double b, double c);<br />

creates an instance v of type real vector; v is initialized to the threedimensional<br />

vector (a, b, c).<br />

3. Operations<br />

int v.dim( ) returns the dimension of v.<br />

real& v[int i] returns i-th component of v.<br />

Precondition: 0 ≤ i ≤ v.dim()−1.<br />

real v.hcoord(int i) for compatibility with rat vector.<br />

real v.coord(int i) for compatibility with rat vector.<br />

real v.sqr length( ) returns the square of the Euclidean length of v.<br />

real v.length( ) returns the Euclidean length of v.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!