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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

double v.zcoord( ) returns the second cartesian coordinate of v.<br />

int compare by angle(const vector& v1 , const vector& v2 )<br />

vector cross product(const vector& v1 , const vector& v2 )<br />

4. Implementation<br />

For a non-zero vector v let α(v) be the angle by<br />

which the positive x-axis has to be turned counterclockwise<br />

until it aligns with v. <strong>The</strong> function compares<br />

the angles defined by v1 and v2 , respectively.<br />

<strong>The</strong> zero-vector precedes all non-zero vectors in the<br />

angle-order.<br />

returns the cross product of the three-dimensional<br />

vectors v1 and v2 .<br />

Vectors are implemented by arrays of real numbers. All operations on a vector v take<br />

time O(v.dim()), except for dim and [ ] which take constant time. <strong>The</strong> space requirement<br />

is O(v.dim()).<br />

Be aware that the operations on vectors and matrices incur rounding errors and hence are<br />

not completely reliable. For example, if M is a matrix, b is a vector, and x is computed<br />

by x = M.solve(b) it is not necessarily true that the test b == M ∗ x evaluates to true.<br />

<strong>The</strong> types integer vector and integer matrix provide exact linear algebra.

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

Saved successfully!

Ooh no, something went wrong!