Git Product home page Git Product logo

glucat's People

Contributors

drewitz avatar penguian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

glucat's Issues

Support Intel OneAPI compilers

Intel now has an icpx C++ compiler based on Clang, as well as icpc, which it now calls "Classic". Bring the configuration and build system up to date to support these as well as current GCC and Clang compilers. Check backward compatibility.

Use current toolchains

Make minimal changes to the code, and some changes to the configuration, so that Glucat and PyClical compile and work with current Boost, Numeric Bindings, and QD, and compile with current GCC, Clang and Intel compilers.

Bring up to date

Ensure that the C++ code, Python, Markdown and Doxygen documentation work with current versions of these tools.

Add multivector isinf to match isnan

The clifford_algebra template class has an isnan member function, which returns true if the coefficient of any term is NaN as per traits_t::isNaN. Add the corresponding isinf member function using traits_t::isInf.

Migrate PyClical to Python 3

PyClical and its tutorials and demonstrations currently target Python 2.7. Python 2 is no longer supported. Use all necessary tools to migrate all Cython and Python files and associated setup, build, make files, etc. to Python 3.

Make promotion monotonic

Ensure that numeric_traits<Scalar_T>::promoted::type always has at least as many mantissa bits as Scalar_T, and numeric_traits<Scalar_T>::demoted::type has at most as many mantissa bits as Scalar_T.

See https://en.cppreference.com/w/cpp/language/types . The C++ float and double types are usually based on the IEEE 754 32 bit and 64 bit floating point standards. In contrast, the long double type can be anywhere from 64 bits (as IEEE 754 64 bit floating point) to 128 bits (as IEEE 754 128 bit floating point). The 128 bit format has a precision of 113 bits, but the dd_real format has a precision of only 106 bits.

If long double has the same number of mantissa bits as double, promote as: float -> double -> dd_real -> qd_real, long double -> dd_real, and demote as: qd_real -> dd_real -> double -> float, long double -> float.

If long double has more mantissa bits than dd_real, promote as: float -> double -> dd_real -> long double -> qd_real, and demote as: qd_real -> long double -> dd_real -> double -> float.

Otherwise, continue to promote as: float -> double -> long double -> dd_real -> qd_real, and demote as: qd_real -> dd_real -> long double -> double -> float.

Make default truncation depend on scalar type

Rather than having a single default truncation for all multivector classes, make it depend on the scalar type. Specifically, set the default truncation as follows:

default_truncation = std::numeric_limits<Scalar_T>::epsilon()

Use truncation in transforms and printing

  • In the transform from framed_multi to matrix_multi, use default truncation on the framed_multi input.
  • In the inverse transform from matrix_multi to framed_multi, use default truncation on the framed_multi output.
  • When printing, truncate appropriate to precision.

Port linear algebra from uBLAS to Armadillo

GluCat uses uBLAS for linear algebra, except for finding eigenvalues, where it uses Boost Bindings. The two different libraries uses different matrix formats. Also, uBLAS is quite slow, especially for algorithms such as the addition of compressed matrices. Perhaps Armadillo would be better?

Port linear algebra from uBLAS to Blaze

GluCat uses uBLAS for linear algebra, except for finding eigenvalues, where it uses Boost Bindings. The two different libraries use different matrix formats. Also, uBLAS is quite slow, especially for algorithms such as the addition of compressed matrices. Perhaps Blaze would be better?

Deprecate some configuration options

The following options to ./configure are essentially superceded and should be deprecated for the next release (0.10.1 ?) and removed in the following release, with an accompanying simplification of the source code.

  --enable-check-isnan    check for NaN values at various places in the code [default=yes]

In practice, this type of checking has not slowed execution speed by much. Also, the code now also checks for Inf in various places and it its not clear how this option should be changed to cope with check for Inf. The option should be removed, and the checks for Inf and NaN should always be performed.

  --with-stdlib[=ARG]     C++ standard library to use
                          (libcxx|libstdcxx)
                          [default=libstdcxx]

This option is currently applied only to Clang++ and only when the option libcxx is chosen. The default for recent Clang++ versions is to use libc++ rather than libstdc++. In other words, contrary to the INSTALL documentation, this option has no effect. It is not clear at this stage what value would be added by allowing Clang++ to use libstdc++. The option should be removed, since it has no effect anyway.

  --with-map[=ARG]        type of map to use
                          (map|stdunordered)
                          [default=stdunordered]

In practice, the hash function used with famed_multi has worked reasonably well, and has been asymptotically faster than just using std::map. The option should be removed, and std::unordered_map should always be used, with the exception of cases where ordering is needed, such as printing.

  --with-pool-alloc       use Boost Pool allocator
                          [default=no]

The use of the Boost pool allocator only affects std::map, and the code performs adequately without it. The option should be removed, and the Boost pool allocator should no longer be used.

  --with-dense-mat        uses dense matrices [default=yes]

While the code works with sparse matrices, in practice the uBLAS sparse implementation is too slow for general arithmetic operations, while multi-gigabyte memory spaces are now common. The option should be removed, and matrices should be dense, with the exception of the matrices used for the basis element cache.

  --with-random[=ARG]     type of random number generator to use
                          (std|gsl) [default=std]

The C++11 standard random number generators essentially supercede the GSL random number generators. The option should be removed, and the standard random number generators should always be used.

Fix clang-tidy bugprone issues

Running clang-tidy with bugprone-* checks, except for bugprone-reserved-identifier and `bugprone-easily-swappable-parameters' results in:

leopardi@pensieri:~/sync/src/glucat/git/glucat$ clang-tidy.sh 'bugprone-*,-bugprone-reserved-identifier,-bugprone-easily-swappable-parameters'
245 warnings generated.
./glucat/framed_multi_imp.h:297:9: warning: repeated branch in conditional chain [bugprone-branch-clone]
        return false;
        ^
./glucat/framed_multi_imp.h:297:21: note: end of the original
        return false;
                    ^
./glucat/framed_multi_imp.h:299:9: note: clone 1 starts here
        return false;
        ^
./glucat/index_set_imp.h:71:38: warning: either cast from 'int' to 'glucat::set_value_t' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
    if (!prechecked && folded_val >= set_value_t(1 << frm.count()))
                                     ^
./glucat/index_set_imp.h:1007:3: warning: operator=() does not handle self-assignment properly [bugprone-unhandled-self-assignment]
  operator= (const reference& j) -> reference&
  ^
Suppressed 232 warnings (232 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

Fix these issues.

Make headers more self-contained

Some of the Glucat headers are not self-contained. For example, compiling the following code in framed_multi.cpp:

#include "glucat/framed_multi.h"
int main(int argc, char ** argv)
{ return 0; }

using

g++ -std=c++11 -std=c++11 -DHAVE_CONFIG_H -I. -I..  -I. -I..     -Wall -g -O3  -march=native -finline-limit=8000 --param large-function-insns=8000 --param max-inline-insns-auto=8000 --param max-inline-insns-single=8000 --param inline-unit-growth=200 --param large-function-growth=200 -funroll-loops -fvariable-expansion-in-unroller -DNDEBUG -D_GLUCAT_USE_STD_UNORDERED_MAP -D_GLUCAT_USE_DENSE_MATRICES -D_GLUCAT_CHECK_ISNAN -Wno-unused-local-typedefs -Wno-deprecated-register -fno-check-new -DHAVE_BITS_WORDSIZE_H -D_GLUCAT_HAVE_BOOST_SERIALIZATION_ARRAY_WRAPPER_H -fexceptions -MT framed_multi.o -MD -MP -MF .deps/framed_multi.Tpo -c -o framed_multi.o framed_multi.cpp

results in

In file included from framed_multi.cpp:32:
../glucat/framed_multi.h:118:56: error: ISO C++ forbids declaration of ‘type name’ with no type [-fpermissive]
  118 |   operator<< (std::ostream& os, const std::pair< const index_set<LO,HI>, Scalar_T >& term) -> std::ostream&;
      |                                                        ^~~~~~~~~
../glucat/framed_multi.h:118:83: error: wrong number of template arguments (1, should be 2)
  118 |   operator<< (std::ostream& os, const std::pair< const index_set<LO,HI>, Scalar_T >& term) -> std::ostream&;
      |                                                                                   ^
In file included from /usr/include/c++/11/bits/stl_algobase.h:64,
                 from /usr/include/c++/11/bits/char_traits.h:39,
                 from /usr/include/c++/11/string:40,
                 from ../glucat/errors.h:34,
                 from ../glucat/framed_multi.h:35,
                 from framed_multi.cpp:32:
/usr/include/c++/11/bits/stl_pair.h:211:12: note: provided for ‘template<class _T1, class _T2> struct std::pair’
  211 |     struct pair
      |            ^~~~
[...]

See (e.g.) https://www.modernescpp.com/index.php/c-core-guidelines-the-remaining-rules-to-source-files

For now, the headers that use Tune_P will still need to depend on the user or tests defining this type. This will be treated in a separate issue.

Internationalize

The current code is entirely written and documented in English. It needs an internationalization framework and translations if it is ever to be available in other languages.

Properly cope with missing Cython

Some related issues:

  1. The check for Cython in ./configure should check for the Python 3 version of Cython, independently the of Linux distribution.
  2. When Cython is not available, building pyclical relies on the existence of pyclical/PyClical_nocython.cpp, but this file is not in the Git repository. Therefore building from a Git clone depends on Cython being available, and fails otherwise.
  3. Running make dist can fail if pyclical/PyClical_nocython.cpp does not already exist, even if Cython is available. Instead, it should create pyclical/PyClical_nocython.cpp.

Add Blaze as an option for finding eigenvalues

GluCat uses uBLAS for linear algebra, except for finding eigenvalues, where it uses Boost Bindings. The two different libraries use different matrix formats. Also, uBLAS is quite slow, especially for algorithms such as the addition of compressed matrices. Perhaps Blaze would be better for finding eigenvalues? First step is to add it as an option alongside Boost Bindings.

Port build system from Autotools to CMake

Even though the build system of GluCat has recently been overhauled, it still uses Autotools. Since (as a separate issue) a port from uBLAS to Armadillo is being considered, this could be an opportunity to port the build system to CMake. This could have other advantages, including an opportunity to refactor the test and example programs. Another possible longer term advantage would be to enable a port to Windows.

See: StackOverflow: "Tutorial for converting autotools to cmake", StackOverflow: "Linking to Armadillo libraries with CMake".

Remove deprecated configuration options

Following on from Issue #40 , remove the configuration options that are now deprecated, remove the associated tests, and remove the associated #define macro names and #if defined branches, to declutter the configuration, code, and tests.

Update test results and documentation for version 0.9.0

The test results and documentation need to be updated to reflect current compilers, tools, etc. in preparation for the release of version 0.9.0.

Testing should use as many compilers and versions as is feasible, since the C++ header code now needs C++11.

Write a user manual

The code has INSTALL, README and TODO files, as well as Doxygen documentation, programming examples, and Python help and tutorials. One thing that is still missing is a manual written from a user's perspective. The existing documentation, examples and tutorials provide good starting materials for such a manual. My Masters thesis from UNSW in 2002 could also provide introductory and supporting material.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.