diff --git a/doc/functions.htm b/doc/functions.htm deleted file mode 100644 index 66d4370a..00000000 --- a/doc/functions.htm +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - -uBLAS functions overview - - -

c++boost.gif -Overview of Matrix and Vector Operations

- -
-
Contents:
-
Basic Linear Algebra
-
Advanced Functions
-
Submatrices, Subvectors
-
Speed Improvements
-
- -

Definitions:

- - - - - - - - - - - - - - -
A, B, C are matrices
u, v, ware vectors
i, j, kare integer values
t, t1, t2are scalar values
r, r1, r2are ranges, e.g. range(0, 3)
s, s1, s2are slices, e.g. slice(0, 1, 3)
- -

Basic Linear Algebra

- -

standard operations: addition, subtraction, multiplication by a -scalar

- -

-C = A + B; C = A - B; C = -A;
-w = u + v; w = u - v; w = -u;
-C = t * A; C = A * t; C = A / t;
-w = t * u; w = u * t; w = u / t;
-
- -

computed assignements

- -

-C += A; C -= A; 
-w += u; w -= u; 
-C *= t; C /= t; 
-w *= t; w /= t;
-
- -

inner, outer and other products

- -

-t = inner_prod(u, v);
-C = outer_prod(u, v);
-w = prod(A, u); w = prod(u, A); w = prec_prod(A, u); w = prec_prod(u, A);
-C = prod(A, B); C = prec_prod(A, B);
-w = element_prod(u, v); w = element_div(u, v);
-C = element_prod(A, B); C = element_div(A, B);
-
- -

transformations

- -

-w = conj(u); w = real(u); w = imag(u);
-C = trans(A); C = conj(A); C = herm(A); C = real(A); C = imag(A);
-
- -

Advanced functions

- -

norms

- -

-t = norm_inf(v); i = index_norm_inf(v);
-t = norm_1(v);   t = norm_2(v); 
-t = norm_inf(A); i = index_norm_inf(A);
-t = norm_1(A);   t = norm_frobenius(A); 
-
- -

products

- -

-axpy_prod(A, u, w, true);  // w = A * u
-axpy_prod(A, u, w, false); // w += A * u
-axpy_prod(u, A, w, true);  // w = trans(A) * u
-axpy_prod(u, A, w, false); // w += trans(A) * u
-axpy_prod(A, B, C, true);  // C = A * B
-axpy_prod(A, B, C, false); // C += A * B
-
-

Note: The last argument (bool init) of -axpy_prod is optional. Currently it defaults to -true, but this may change in the future. Set the -init to true is equivalent to call -w.clear() before axpy_prod. Up to now -there are some specialisation for compressed matrices that give a -large speed up compared to prod.

-

-w = block_prod<matrix_type, 64> (A, u); // w = A * u
-w = block_prod<matrix_type, 64> (u, A); // w = trans(A) * u
-C = block_prod<matrix_type, 64> (A, B); // w = A * B
-
-

Note: The blocksize can be any integer. However, the -total speed depends very strong on the combination of blocksize, -CPU and compiler. The function block_prod is designed -for large dense matrices.

-

rank-k updates

-

-opb_prod(A, B, C, true);  // C = A * B
-opb_prod(A, B, C, false); // C += A * B
-
-

Note: The last argument (bool init) of -opb_prod is optional. Currently it defaults to -true, but this may change in the future. This function -may give a speedup if A has less columns than rows, -because the product is computed as a sum of outer products.

- -

Submatrices, Subvectors

- -

Note: A range r = range(start, stop) -contains all indices i with start <= i < -stop. A slice is something more general. The slice -s = slice(start, stride, size) contains the indices -start, start+stride, ..., start+(size-1)*stride. The -stride can be 0 or negative! If start >= stop for a range -or size == 0 for a slice then it contains no elements.

-

-w = project(u, r);         // a subvector of u specifed by the index range r
-w = project(u, s);         // a subvector of u specifed by the index slice s
-C = project(A, r1, r2);    // a submatrix of A specified by the two index ranges r1 and r2
-C = project(A, s1, s2);    // a submatrix of A specified by the two index slices s1 and s2
-w = row(A, i); w = column(A, j);    // a row or column of matrix as a vector
-
-

There are to more ways to access some matrix elements as a -vector:

-
matrix_vector_range<matrix_type> (A, r1, r2);
-matrix_vector_slice<matrix_type> (A, s1, s2);
-
-

Note: These matrix proxies take a sequence of elements -of a matrix and allow you to access these as a vector. In -particular matrix_vector_slice can do this in a very -general way. matrix_vector_range is less useful as the -elements must lie along a diagonal.

-

Example: To access the first two elements of a sub -column of a matrix we access the row with a slice with stride 1 and -the column with a slice with stride 0 thus:
-matrix_vector_slice<matrix_type> (A, slice(0,1,2), -slice(0,0,2)); -

- -

Speed improvements

-

Matrix / Vector assignment

-

If you know for sure that the left hand expression and the right -hand expression have no common storage, then assignment has -no aliasing. A more efficient assignment can be specified -in this case:

-
noalias(C) = prod(A, B);
-
-

This avoids the creation of a temporary matrix that is required in a normal assignment. -'noalias' assignment requires that the left and right hand side be size conformant.

- -

Sparse element access

-

The matrix element access function A(i1,i2) or the equivalent vector -element access functions (v(i) or v[i]) usually create 'sparse element proxies' -when applied to a sparse matrix or vector. These proxies allow access to elements -without having to worry about nasty C++ issues where references are invalidated.

-

These 'sparse element proxies' can be implemented more efficiently when applied to const -objects. -Sadly in C++ there is no way to distinguish between an element access on the left and right hand side of -an assignment. Most often elements on the right hand side will not be changed and therefore it would -be better to use the const proxies. We can do this by making the matrix or vector -const before accessing it's elements. For example:

-
value = const_cast<const VEC&>(v)[i];   // VEC is the type of V
-
-

If more then one element needs to be accessed const_iterator's should be used -in preference to iterator's for the same reason. For the more daring 'sparse element proxies' -can be completely turned off in uBLAS by defining the configuration macro BOOST_UBLAS_NO_ELEMENT_PROXIES. -

- -
-

Copyright (©) 2000-2004 Joerg Walter, Mathias Koch, Gunter -Winkler, Michael Stevens
-Permission to copy, use, modify, sell and distribute this document -is granted provided this copyright notice appears in all copies. -This document is provided ``as is'' without express or implied -warranty, and with no claim as to its suitability for any -purpose.

-

Last revised: 2004-08-09

- - diff --git a/doc/readme.txt b/doc/readme.txt deleted file mode 100644 index 27224f7c..00000000 --- a/doc/readme.txt +++ /dev/null @@ -1,17 +0,0 @@ -Welcome to the evaluation of our C++ matrix library. - -Tests and benchmarks: -Test1 contains a couple of basic tests for dense vectors and matrices. -Test2 demonstrates how to emulate BLAS with this matrix library. -Test3 contains a couple of basic tests for sparse vectors and matrices. -Test4 contains a couple of basic tests for banded matrices. -Test5 contains a couple of basic tests for triangular matrices. -Test6 contains a couple of basic tests for symmetric matrices. -Test7 contains a couple of basic tests for dense vectors and matrices of -boost::numeric::interval(s). -Bench1 measures the abstraction penalty using certain dense matrix and vector -operations. -Bench2 measures the performance of sparse matrix and vector operations. -Bench3 measures the performance of vector and matrix proxy's operations. -Bench4 measures the abstraction penalty using certain dense matrix and vector -operations with boost::numeric::interval(s). diff --git a/doc/types.htm b/doc/types.htm deleted file mode 100644 index 2ad64866..00000000 --- a/doc/types.htm +++ /dev/null @@ -1,571 +0,0 @@ - - - - - - -Types Overview - - -

c++boost.gif -Overview of Matrix- and Vector-Types

- -
-
Contents:
-
Vectors
-
Vector Proxies
-
Matrices
-
Matrix Proxies
-
Special Storage Layouts
-
- - -

Notation:

- - - - - - - - - - - - - - - - - - - -
Tis the data type. For general linear algebra operations this will be a real type e.g. double, ...
Fis the orientation type (functor), either -row_major or column_major
A, IA, TA is an array storage type, e.g. std::vector, -bounded_array, unbounded_array, ...
TRIis a triangular functor: lower, -unit_lower, strict_lower, upper, unit_upper, -strict_upper
M, Nare unsigned integer sizes -(std::size_t)
IBis an index base -(std::size_t)
VECis any vector type
MAT is any matrix type
[...]denote optional arguments - for more details -look at the section "storage layout".
- -

Vectors

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DefinitionDescription
vector<T [, A]>
   v(size);
a dense vector of values of type T of variable -size. A storage type A can be specified -which defaults to unbounded_array. -Elements are zeroed by default.
bounded_vector<T, N>
   v;
a dense vector of values of type T of variable size but with maximum -N. The default constructor creates v -with size N. -Elements are zeroed by default.
c_vector<T, M>
   v(size);
a dense vector of values of type T with the given size. -The data is stored as an ordinary C++ array T -data_[M]
zero_vector<T>
   v(size);
the zero vector of type T with the given -size.
unit_vector<T>
   v(size, index);
the unit vector of type T with the given size. The -vector is zero other then a single specified element. -
index should be less than size.
sparse_vector<T [, S]>
   v(size);
a sparse vector of values of type T of variable -size. The sparse storage type S can be std::map<size_t, -T> or map_array<size_t, T>.
compressed_vector<T [,IB, IA, TA]>
   v(size);
a sparse vector of values of type T of variable -size. The non zero values are stored as two seperate arrays - an -index array and a value array. The index array is always sorted and -the is at most one entry for each index.
coordinate_vector<T [,IB, IA, TA]>
   v(size);
a sparse vector of values of type T of variable -size. The non zero values are stored as two seperate arrays - an -index array and a value array. The arrays may be out of order with -multiple entries for each vector element. If there are multiple -values for the same index the sum of these values is the real -value.
-

Note: the default types are defined in -boost/numeric/ublas/fwd.hpp.

- -

Vector Proxies

- - - - - - - - - - - - - - - - - - - - - - - - - - -
DefinitionDescription
vector_range<VEC>
   vr(v, range);
a vector referencing a continuous subvector of elements of -vector v containing all elements specified by -range.
vector_slice<VEC>
   vs(v, slice);
a vector referencing a non continuous subvector of elements of -vector v containing all elements specified by -slice.
matrix_row<MAT>
   vr(m, index);
a vector referencing the index-th row of matrix -m
matrix_column<MAT>
   vc(m, index);
a vector referencing the index-th column of matrix -m
- -

Matrices

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DefinitionDescription
matrix<T [, F, A]>
   m(size1, size2);
a dense matrix of values of type T of variable -size. A storage type A can be specified -which defaults to unbounded_array. -The orientation functor F defaults to -row_major. -Elements are zeroed by default.
bounded_matrix<T, M, N [, F]>
   m;
a dense matrix of type T with variable size with maximum M-by-N. The orientation functor F -defaults to row_major. The default constructor creates -m with size M-by-N. -Elements are zeroed by default.
c_matrix<T, M, N>
   m(size1, size2);
a dense matrix of values of type T with the given size. -The data is stored as an ordinary C++ array T -data_[N][M]
vector_of_vector<T [, F, A]>
   m(size1, -size2);
a dense matrix of values of type T with the given size. -The data is stored as a vector of vectors. The orientation -F defaults to row_major. The storage -type S defaults to -unbounded_array<unbounded_array<T> >
zero_matrix<T>
   m(size1, size2);
a zero matrix of type T with the given size.
identity_matrix<T>
   m(size1, size2);
an identity matrix of type T with the given size. -The values are v(i,j) = (i==j)?T(1):T().
scalar_matrix<T>
   m(size1, size2, -value);
a matrix of type T with the given size that has the -value value everywhere.
triangular_matrix<T [, TRI, F, A]>
   -m(size);
a triangular matrix of values of type T of -variable size. Only the nonzero elements are stored in the given -order F. ("triangular packed storage") The triangular -type F defaults to lower, the orientation -type F defaults to row_major.
banded_matrix<T [, F, A]>
   m(size1, size2, n_lower, -n_upper);
a banded matrix of values of type T of variable -size with n_lower sub diagonals and -n_upper super diagonals. Only the nonzero elements are -stored in the given order F. ("packed storage")
symmetric_matrix<T [, TRI, F, A]>
   -m(size);
a symmetric matrix of values of type T of -variable size. Only the given triangular matrix is stored in the -given order F.
hermitian_matrix<T [, TRI, F, A]>
   -m(size);
a hermitian matrix of values of type T of -variable size. Only the given triangular matrix is stored using -the order F.
sparse_matrix<T, [F, S]>
   m(size1, size2 [, -non_zeros]);
a sparse matrix of values of type T of variable -size. The sparse storage type S can be either std::map<size_t, -std::map<size_t, T> > or -map_array<size_t, map_array<size_t, -T> >.
sparse_vector_of_sparse_vector<T, [F, C]>
   m(size1, -size2 [, non_zeros]);
a sparse matrix of values of type T of variable -size.
compressed_matrix<T, [F, IB, IA, TA]>
   m(size1, -size2 [, non_zeros]);
a sparse matrix of values of type T of variable -size. The values are stored in compressed row/column storage.
coordinate_matrix<T, [F, IB, IA, TA]>
   m(size1, -size2 [, non_zeros]);
a sparse matrix of values of type T of variable -size. The values are stored in 3 parallel array as triples (i, j, -value). More than one value for each pair of indices is possible, -the real value is the sum of all.
generalized_vector_of_vector<T, F, A>
   m(size1, -size2 [, non_zeros]);
a sparse matrix of values of type T of variable -size. The values are stored as a vector of sparse vectors, e.g. -generalized_vector_of_vector<double, row_major, -unbounded_array<coordinate_vector<double> > >
-

Note: the default types are defined in -boost/numeric/ublas/fwd.hpp.

- -

Matrix Proxies

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DefinitionDescription
triangular_adaptor<MAT, TRI>
   ta(m);
a triangular matrix referencing a selection of elements of the -matrix m.
symmetric_adaptor<MAT, TRI>
   sa(m);
a symmetric matrix referencing a selection of elements of the -matrix m.
hermitian_adaptor<MAT, TRI>
   ha(m);
a hermitian matrix referencing a selection of elements of the -matrix m.
banded_adaptor<MAT>
   ba(m, n_lower, -n_upper);
a banded matrix referencing a selection of elements of the -matrix m.
matrix_range<MAT, TRI>
   mr(m, range1, -range2);
a matrix referencing a submatrix of elements in the matrix -m.
matrix_slice<MAT, TRI>
   ms(m, slice1, -slice2);
a matrix referencing a non continues submatrix of elements in -the matrix m.
- - - -

Special Storage Layouts

- - -

The library supports conventional dense, packed and basic sparse -vector and matrix storage layouts. The description of the most -common constructions of vectors and matrices comes next.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConstructionComment
vector<T,
- std::vector<T> >
-  v (size)
a dense vector, storage is provided by a standard -vector.
-The storage layout usually is BLAS compliant.
vector<T,
- unbounded_array<T> >
-  v (size)
a dense vector, storage is provided by a heap-based -array.
-The storage layout usually is BLAS compliant.
vector<T,
- bounded_array<T, N> >
-  v (size)
a dense vector, storage is provided by a stack-based -array.
-The storage layout usually is BLAS compliant.
sparse_vector<T,
- std::map<std::size_t, T> >
-  v (size, non_zeros)
a sparse vector, storage is provided by a standard -map.
sparse_vector<T,
- map_array<std::size_t, T> >
-  v (size, non_zeros)
a sparse vector, storage is provided by a map -array.
matrix<T,
- row_major,
- std::vector<T> >
-  m (size1, size2)
a dense matrix, orientation is row major, storage is -provided by a standard vector.
matrix<T,
- column_major,
- std::vector<T> >
-  m (size1, size2)
a dense matrix, orientation is column major, storage -is provided by a standard vector.
-The storage layout usually is BLAS compliant.
matrix<T,
- row_major,
- unbounded_array<T> >
-  m (size1, size2)
a dense matrix, orientation is row major, storage is -provided by a heap-based array.
matrix<T,
- column_major,
- unbounded_array<T> >
-  m (size1, size2)
a dense matrix, orientation is column major, storage -is provided by a heap-based array.
-The storage layout usually is BLAS compliant.
matrix<T,
- row_major,
- bounded_array<T, N1 * N2> >
-  m (size1, size2)
a dense matrix, orientation is row major, storage is -provided by a stack-based array.
matrix<T,
- column_major,
- bounded_array<T, N1 * N2> >
-  m (size1, size2)
a dense matrix, orientation is column major, storage -is provided by a stack-based array.
-The storage layout usually is BLAS compliant.
triangular_matrix<T,
- row_major, F, A>
-  m (size)
a packed triangular matrix, orientation is row -major.
triangular_matrix<T,
- column_major, F, A>
-  m (size)
a packed triangular matrix, orientation is column -major.
-The storage layout usually is BLAS compliant.
banded_matrix<T,
- row_major, A>
-  m (size1, size2, lower, upper)
a packed banded matrix, orientation is row -major.
banded_matrix<T,
- column_major, A>
-  m (size1, size2, lower, upper)
a packed banded matrix, orientation is column -major.
-The storage layout usually is BLAS compliant.
symmetric_matrix<T,
- row_major, F, A>
-  m (size)
a packed symmetric matrix, orientation is row -major.
symmetric_matrix<T,
- column_major, F, A>
-  m (size)
a packed symmetric matrix, orientation is column -major.
-The storage layout usually is BLAS compliant.
hermitian_matrix<T,
- row_major, F, A>
-  m (size)
a packed hermitian matrix, orientation is row -major.
hermitian_matrix<T,
- column_major, F, A>
-  m (size)
a packed hermitian matrix, orientation is column -major.
-The storage layout usually is BLAS compliant.
sparse_matrix<T,
- row_major,
- std::map<std::size_t, T> >
-  m (size1, size2, non_zeros)
a sparse matrix, orientation is row major, storage -is provided by a standard map.
sparse_matrix<T,
- column_major,
- std::map<std::size_t, T> >
-  m (size1, size2, non_zeros)
a sparse matrix, orientation is column major, -storage is provided by a standard map.
sparse_matrix<T,
- row_major,
- map_array<std::size_t, T> >
-  m (size1, size2, non_zeros)
a sparse matrix, orientation is row major, storage -is provided by a map array.
sparse_matrix<T,
- column_major,
- map_array<std::size_t, T> >
-  m (size1, size2, non_zeros)
a sparse matrix, orientation is column major, -storage is provided by a map array.
compressed_matrix<T,
- row_major>
-  m (size1, size2, non_zeros)
a compressed matrix, orientation is row major.
-The storage layout usually is BLAS compliant.
compressed_matrix<T,
- column_major>
-  m (size1, size2, non_zeros)
a compressed matrix, orientation is column -major.
-The storage layout usually is BLAS compliant.
coordinate_matrix<T,
- row_major>
-  m (size1, size2, non_zeros)
a coordinate matrix, orientation is row major.
-The storage layout usually is BLAS compliant.
coordinate_matrix<T,
- column_major>
-  m (size1, size2, non_zeros)
a coordinate matrix, orientation is column -major.
-The storage layout usually is BLAS compliant.
- -
-

Copyright (©) 2000-2004 Joerg Walter, Mathias Koch, Gunter -Winkler, Michael Stevens
-Permission to copy, use, modify, sell and distribute this document -is granted provided this copyright notice appears in all copies. -This document is provided ``as is'' without express or implied -warranty, and with no claim as to its suitability for any -purpose.

-

Last revised: 2004-08-08

- -