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.

eal matrix M + const real matrix& M1<br />

real matrix M − const real matrix& M1<br />

real matrix M ∗ const real matrix& M1<br />

real vector M ∗ const real vector& vec<br />

Addition.<br />

Precondition: M.dim1() == M1.dim1() and M.dim2()<br />

== M1.dim2().<br />

Subtraction.<br />

Precondition: M.dim1() == M1.dim1() and M.dim2()<br />

== M1.dim2().<br />

Multiplication.<br />

Precondition: M.dim2() == M1.dim1().<br />

Multiplication with vector.<br />

Precondition: M.dim2() == vec.dim().<br />

real matrix M ∗ real x Multiplication with real x.<br />

void M.print(ostream& O)<br />

void M.print( ) prints M cout.<br />

prints M row by row to ostream O.<br />

void M.read(istream& I) reads M.dim1( ) × M.dim2 ( ) numbers from input<br />

stream I and writes them row by row into matrix M.<br />

void M.read( ) prints M from cin.<br />

ostream&<br />

istream&<br />

ostream& O ≪ const real matrix& M<br />

istream& I ≫ real matrix& M<br />

writes matrix M row by row to the output stream O.<br />

reads a matrix row by row from the input stream I and<br />

assigns it to M.<br />

4. Implementation<br />

Data type real matrix is implemented by two-dimensional arrays of real numbers. Operations<br />

det, solve, and inv take time O(n 3 ) operations on reals, dim1, dim2, row, and col<br />

take constant time, all other operations perform O(nm) operations on reals. <strong>The</strong> space<br />

requirement is O(nm) plus the space for the nm entries of type real.

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

Saved successfully!

Ooh no, something went wrong!