Tiny Vector Matrix library using Expression Templates | Sourceforge Project Page |
Certain items on this page are also covered by the Usage and Some Notes ... pages!
I have amended the LGPL to explicitly allow statically linking tvmet (or any modified version of tvmet) to your software. The LGPL is not clear on this and I definitely want to allow it.
TVMET_DEBUG
(e.g. index operators of Vector::operator(i)
and Matrix::operator(i,j)
). On defined TVMET_DEBUG a bounds checking is involved. Runtime errors are handled throwing an assertion failure using std::assert(). TVMET_DEBUG
is not enabled by defining DEBUG
. This behavior differs from release less than 0.6.0If you don't get the expected result on certain operations you can try the Expression printing feature to check that the expression is being evaluated as you expect.
TVMET_OPTIMIZE
.
If this is defined tvmet uses some compiler specific keywords. Mainly, this declares the functions using gcc's __attribute__((always_inline))
. This allows the compiler to produce high efficient code even on less optimization levels, like gcc's -O2 or even -O! This is known to work with gcc v3.3.3 (and higher). Using icc's v8 gnuc compatibility mode this may work, I've read that it's using as an hint, this means you can have static inline functions inside left so you can't get the full power of this feature for circumstances.
ambiguous overload for ... /usr/include/g++-3/stl_relops.h:42: candidates are: bool operator> ...
I haven't any solution for this--even if I don't use it in the tvmet library. A simple define __SGI_STL_INTERNAL_RELOPS in the config header doesn't solve the problem. The easiest way (brute force method) is to comment out all operators in stl_reops.h. (The better way is to use the gcc-3.0.x and later, see Compiler Support.)
conversion from `tvmet::XprVector< ... >, Sz>' to non-scalar type `tvmet::Vector<T, Sz>' requested
Please read about Construction and Initializing. You probably ignored or forgot the rules of using expression templates.
could not convert `tvmet::operator==( ... , ... )' to `bool'
In the example above, you did try (or hoped) to use a global operator== which doesn't return a bool. Please read Compare Vectors and Matrices.
no match for `tvmet::Vector<...>& /= tvmet::Vector<...>&' operator
For element-wise operations, you need to use the element_wise namespace (found within tvmet). As the name suggests, all these operators are performed in an element wise fashion. (e.g. division of two vectors--not allowed from a mathematical perspective--element by element.) The following code snippet shows how to use it:
using namespace tvmet; Vector<double,3> v1, v2; v1 = 1,2,3; v2 = v1; cout << v1 << endl; { using namespace tvmet::element_wise; v1 /= v2; } cout << v1 << endl;
In member function `tvmet::CommaInitializer<Obj, LEN>::Initializer<T, (N + 1)> .... storage size of `ERROR_CommaInitializerList_is_too_long' isn't known
You have caused a forced compile time error. tvmet prevents you from overwriting foreign memory! In other words, your comma separated initializer list is too long, e.g. you wrote something like:
using namespace tvmet;
Vector<double,3> v0;
v0 = 1,2,3,4,5,6,7,8,9;
You just tried to fill a Vector of length 3 with 9 values, which would normally result in values being written off the end of the vector. tvmet prevents this with the compile time error you just saw.
no match for `tvmet::Matrix<T, Sz, Sz>& * tvmet::XprVector<tvmet::MatrixColVectorReference<T, Sz, Sz>, Sz>' operator include/tvmet/xpr/VectorOperators.h:123: candidates are: // a lot of candidates....
Perhaps you wrote code like:
Matrix<float,3,3> eigenvecs; Matrix<float,3,3> M; ... Vector<float,3> ev0( M * col(eigenvecs, 0) );
Using tvmet prior to release 1.2.0 in this case: Obviously an operator is missing... but which one? Well, all arithmetic operators have a functional equivalent, in this case, prod(). Rewriting the code above using the function syntax will give you a more descriptive error message:
no matching function for call to `prod(tvmet::Matrix<float, 3, 3>&, tvmet::XprVector<tvmet::MatrixColVectorReference<float, 3, 3>, 3>)'
This says, I forgot to write a function with the appropriate operator. In this case, please give me a hint by writing a short example, used compiler and tvmet release.
no match for `tvmet::Matrix<double, 4, 4>& * tvmet::Vector<double, 3>&' operator candidates are: T tvmet::operator*(const T&, ...) ...
This is a feature of tvmet. The compiler detects a mathematical problem: You tried call an operator between tvmet objects which had incompatible dimensions. For example, you attempted to multiply a matrix of dimension 4x4 with a vector of size 3 - this isn't mathematically feasible.
I haven't found the reason yet, my knowledge of assembler and debugging is too limited.
got 6.17995e-17
on my Linux Mandrake 8.2/9.1 box. It makes no difference if I take the tan function from namespace std or from the global namespace. This is especially a problem for g++ v3.2 and prior. The Intel compiler v7.0 isn't affected.
Especially on VC++ 7.1 you will get 2 failed tests for complex Matrix and Vector. The error is about 8.88178e-016
and 1.77636e-015
.
Author: |