jlt lib is a C++ and Matlab library of various utility functions that I found useful over the years, and which are used in many of my other projects.
jlt lib was written and is maintained by Jean-Luc Thiffeault.
There isn't any. In fact this library should really not be used by anyone, and I've mostly uploaded it so I can easily include it in other projects. If you feel brave, many functions have comments documenting their use, and there are examples in the testsuite folder.
Here is a list of some of the more useful C++ functions and classes, in the folder jlt. They can be included as #include "jlt/<filename>.hpp"
, so the folder containing jlt
must be in the include files search path. The programs in testsuite are readily compiled with the SCONS build tool, but unless linking to external libraries is required g++ -O <prog>.cpp -o <prog> -I..
is usually sufficient.
-
jlt::vector
is derived fromstd::vector
. Bounds-checking can be turned on or off at compile time, and the vectors have aprintMatlabForm
member function to output to Matlab format (text or MAT file), and aprintMathematicaForm
to output in Mathematica text format. See alsojlt/matlab.hpp
below. -
jlt::matrix
is a matrix class for 2D data. It is fairly efficient and implements similar output functions described forjlt::vector
above. -
jlt::mathvector
andjlt::mathmatrix
implement vectors and matrices with mathematical operations. Many operations can then be performed, such as eigenvalues and eigenvectors (injlt/eigensystem.hpp
), LU and QR decomposition (jlt/matrixutil.hpp
), and SVD (jlt/svdecomp.hpp
). Many of these functions use LAPACK behind the scenes, so must be linked with-lblas -llapack
. See the testsuite programsmathvector_test.cpp
,eigensystem_test.cpp
,qrdecomp_test.cpp
, andsvdecomp_test.cpp
. -
jlt/csparse.hpp
provides wrappers for Timothy A. Davis's CSparse library, in particular conversion to and fromjlt::mathmatrix
, wrapping CSparse functions in a namespacecsparse
, and a typejlt::cs_unique_ptr
derived fromstd::unique_ptr
that deallocates pointers automatically. Link with-lcsparse
. See the testsuite programcsparse_test.cpp
. -
jlt/lapack.h
andjlt/lapack.hpp
are wrappers for selected functions in the Fortran LAPACK libraries. Link with-lblas -llapack
. -
jlt/matlab.hpp
providesprintMatlabForm
for exporting variables in Matlab MAT-file format or in formatted ASCII text. Some of this functionality is provided in-class byjlt::matrix
andjlt::vector
as well, and is compiled in ifJLT_MATLAB_LIB_SUPPORT
is defined. See the testsuite programmatlab_test.cpp
, which writes amathmatrix
andmathvector
to a MAT file. -
jlt/stlio.hpp
defines simple iostream printing for some STL containers. -
jlt::polynomial
is a polynomial class. See the testsuite programpolynomial_test.cpp
. -
jlt::reciprocal_polynomial
is specialized for monic reciprocal polynomials. -
jlt/prompt.hpp
is helpful for quick-and-dirty terminal prompts. -
jlt/exceptions.hpp
provides some exceptions tailored to numerical problems, such asstepsize_too_small
,failed_to_converge
,too_many_steps
. It also defines macros such asJLT_THROW
, etc, which can be selectively redefined to compile out exception testing. (In the old days exceptions were a much bigger performance hit than they are now, I suspect, so it made sense to test a code and then remove exceptions completely.) -
jlt::tictoc
works a bit like Matlab'stic
andtoc
to time programs. It usesboost/timer/timer.hpp
. See the testsuite programtictoc_test.cpp
. -
jlt/vcs.hpp
provides functions for extracting commit info from Version Control Systems, using Subversion keyword strings or dynamically in the case of Mercurial and Git. Seevcs_test.cpp
for an example. Note that this is a bit fragile: if you run a command from outside the repo then the version information won't be detected. In that caseprintVCSBanner
simply does nothing. -
Other
.hpp
files you might find in there are a bit dodgy and maybe haven't been tested in a while.
The folder matlab contains Matlab functions.
jlt lib is released under the MIT License. The Fourier differentiation matrix function fourdif.m was written by S. C. Reddy and J. A. C. Weideman.