| |
| Home |
![]() |
support for VS.NET, Borland Delphi and C++ Builder statistical and DSP add-ons |
|
MtxVec
Screenshots
Applications
MtxVec for mission critical applications where complex real time data processing is needed. Ten times faster than conventional programming.
MtxVec applications Testimonials
"Using MtxVec 2, with its SSE2 support, I see about a x4 speed improvement over traditional x87 assembler when running on my Pentium 4 notebook!"
Matthew Wormington, Bede Corporation More Testimonials ![]() |
About
MtxVec for C++ Builder users
Introduction TVec and TMtx classes are written in Delphi and C++ Builder generates appropriate header files automatically. However C++ syntax allows more flexible language constructs than pascal. MtxVecCpp.h is designed to merge native C++ coding style and part of MtxVec library, which is coded in Delphi. C++ developers may easily declare vectors and matrices as local variables and enjoy the support for operator overloading. Extra features for C++ developers By analogy with smart pointers in C++, MtxVec library defines shell classes in MtxVecCpp.h – Vector and Matrix for TVec and TMtx classes respectively. Pascal style forces to declare variables as below:
try { C++ style looks much simpler: { Constructor creates actual object, destructor releases it and operator ->() provides access to actual TVec object. Vector and Matrix classes use reference counting mechanism to optimize assignment operations and when working with subranges. Classes Vector, Matrix, SparseMatrix are smart shells for classes TVec, TMtx, TSparseMtx respectively. Classes CVector and CMatrix are defined to allow a more comfortable access to complex elements via the [ ] operator, but are otherwise identical as Vector and Matrix. Examples of definitions: Vector v1(10); // real vector of ten elements Matrix m1(10,10); // real matrix 10x10 Classes Vector and Matrix overload many operators: +, -, *, /, =, etc. They enable the use of vectors and matrices in arithmetic expressions next to integers, doubles and complex numbers. Vector v(10); // vector of ten elements; To get access to elements of the vector we can use operator[](int): v[0] = v[1] + v[2]; or v.Values(0) = v.Values(1) + v.Values(2); Matrix requires the long form to access the elements: m.Values(0,0) = m.Values(1,1)+ m.Values(1,2); Differentiating between elements and objects All operators, which are defined for Vector and Matrix classes, work with elements. The next expression applies multiplication element by element instead of multiplying two matrices: Matrix a(2,2),b(2,2),c; c = a * b; To apply multiplication of two matrices it’s necessary to call method TMtx::Mul: c->Mul(a,b); MtxVec library allows the programmer to work with a selected range of the vector or matrix. For this purpose the following functions exist: SetSubrange / SetSubindex / SetFullRange. However, C++ syntax allows the use of more compact constructs. For example, operator()(int,int) of Vector represents a view of a part of the source vector: Vector v(6); The good thing about this is that subranges are implemented in a manner so efficient that the traditional loop based code will in most cases execute substantially slower. Another example is operator()(int) of Matrix, which obtains a vector view of a row of the matrix: Matrix m(3,3); // matrix 3x3 Operator ()(void) maps the whole matrix to vector: Matrix m(3,3); // matrix 3x3 Almost all methods can be replaced with functions. The next line: v->Sin(x); Is equivalent to: y = Sin(x); All standard function from <math> header file also defined in MtxVecCpp.h. y = sin(x); All Value access methods are range checked, when debugging is active. MtxVecCPP.h holds the following definition: #ifdef _DEBUG Active range checking can have a noticeable effect on performance |
Navigation
Home Page Special Offers News Products
InformationOrder Downloads Information
Product Support About us Site Map Resources Testimonials Customers Link Request |