SymEngine is a fast symbolic manipulation library, written in C++

Overview

SymEngine

Build Status Build status codecov.io

SymEngine is a standalone fast C++ symbolic manipulation library. Optional thin wrappers allow usage of the library from other languages, e.g.:

Try SymEngine

Run an interactive C++ session with SymEngine using Binder.

License

All files are licensed under MIT license, see the LICENSE for more information. Third party code packaged are licensed under BSD 3-clause license (see the LICENSE file).

Mailinglist, Chat

SymEngine mailinglist: http://groups.google.com/group/symengine

Gitter

Installation

Conda package manager

conda install symengine -c conda-forge

Building from source

Install prerequisites. For Debian based systems (Ubuntu etc.):

apt-get install cmake libgmp-dev

For RPM based systems (Fedora etc.):

yum install cmake gmp-devel

Install SymEngine:

mkdir build && cd build
cmake ..
make
make install

This will configure and build SymEngine in the default Release mode with all code and compiler optimizations on and then install it on your system.

Run tests:

ctest

Development

The Travis-CI checks the code in both Release and Debug mode with all possible checks, so just sending a GitHub pull request is enough and you can use any mode you want to develop it. However, the best way to develop SymEngine on Linux is to use the Debug mode with BFD support on:

cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_BFD=yes ..

This BFD support turns on nice Python like stack traces on exceptions, assert errors or segfaults, and the Debug mode automatically turns on WITH_SYMENGINE_RCP=no (which uses Teuchos::RCP with full Debug time checking) and WITH_SYMENGINE_ASSERT=yes, so the code cannot segfault in Debug mode, as long as our style conventions (e.g. no raw pointers) are followed, which is easy to check by visual inspection of a given Pull Request. In Release mode, which is the default, the code is as performing as manual reference counting and raw pointers (and if there is a bug, it could segfault, in which case all you have to do is to turn Debug mode on and get a nice exception with a stack trace).

To make WITH_BFD=yes work, you need to install binutils-dev first, otherwise you will get a CMake error during configuring. For Debian based systems (Ubuntu etc.)

apt-get install binutils-dev

For RPM based systems (Fedora etc.)

yum install binutils-devel

On OpenSuSE you will additionally need glibc-devel.

CMake Options

Here are all the CMake options that you can use to configure the build, with their default values indicated below:

cmake -DCMAKE_INSTALL_PREFIX:PATH="/usr/local" \  # Installation prefix
    -DCMAKE_BUILD_TYPE:STRING="Release" \         # Type of build, one of: Debug or Release
    -DWITH_BFD:BOOL=OFF \                         # Install with BFD library (requires binutils-dev)s
    -DWITH_SYMENGINE_ASSERT:BOOL=OFF \            # Test all SYMENGINE_ASSERT statements in the code
    -DWITH_SYMENGINE_RCP:BOOL=ON \                # Use our faster special implementation of RCP
    -DWITH_SYMENGINE_THREAD_SAFE:BOOL=OFF \       # Build with thread safety
    -DWITH_ECM:BOOL=OFF \                         # Build with GMP-ECM library for integer factorization
    -DWITH_PRIMESIEVE:BOOL=OFF \                  # Install with Primesieve library
    -DWITH_FLINT:BOOL=OFF \                       # Install with Flint library
    -DWITH_ARB:BOOL=OFF \                         # Install with ARB library
    -DWITH_TCMALLOC:BOOL=OFF \                    # Install with TCMalloc linked
    -DWITH_OPENMP:BOOL=OFF \                      # Install with OpenMP enabled
    -DWITH_PIRANHA:BOOL=OFF \                     # Install with Piranha library
    -DWITH_MPFR:BOOL=OFF \                        # Install with MPFR library
    -DWITH_MPC:BOOL=OFF \                         # Install with MPC library
    -DWITH_LLVM:BOOL=OFF \                        # Build with LLVM libraries
    -DBUILD_TESTS:BOOL=ON \                       # Build with tests
    -DBUILD_BENCHMARKS:BOOL=ON \                  # Build with benchmarks
    -DBUILD_BENCHMARKS_NONIUS:BOOL=OFF \          # Build with Nonius benchmarks
    -DBUILD_BENCHMARKS_GOOGLE:BOOL=OFF \          # Build with Google Benchmark benchmarks
    -DINTEGER_CLASS:STRING=gmp \                  # Choose storage type for Integer. one of gmp, gmpxx,
                                                    flint, piranha, boostmp
    -DBUILD_SHARED_LIBS:BOOL=OFF \                # Build a shared library.
    -DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=OFF\ # Add dependencies to rpath when a shared lib is built
    ..

If OpenMP is enabled, then SYMENGINE_THREAD_SAFE is also enabled automatically irrespective of the user input for WITH_SYMENGINE_THREAD_SAFE.

CMake prints the value of its options at the end of the run. If you want to use a different compiler, do:

CC=clang CXX=clang++ cmake ..

If you want to set additional compilation flags, do:

CXXFLAGS="$CXXFLAGS -march=native" cmake ..

These environment variables are checked only in the first run of cmake and you have to delete the build directory or CMakeCache.txt file for these environment variables to be picked up in subsequent runs.

Using INTEGER_CLASS=boostmp would remove the dependency on gmp and use boost's multiprecision integer and rational classes. This would make boost, the only dependency and all the code would be under permissive licenses, namely, MIT, BSD 3-clause and Boost License.

The Nonius based benchmarks (BUILD_BENCHMARKS_NONIUS) and Piranha (WITH_PIRANHA) depend on Boost, so they are off by default. The benchmarked code (both with and without Nonius) seems to depend on the order of which you execute the benchmarks in a given executable, due to internal malloc implementation. We have found that this order dependence is reduced by enabling WITH_TCMALLOC=ON and since it also speeds the benchmarks up, we recommend to always use TCMalloc when benchmarking (and the Release mode of SymEngine, which is the default).

External Libraries

Use CMAKE_PREFIX_PATH to specify the prefixes of the external libraries.

cmake -DCMAKE_PREFIX_PATH=<prefix1>;<prefix2>

If the headers and libs are not in <prefix>/include and <prefix>/lib respectively, use CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH.

If CMake still cannot find the library, you can specify the path to the library by doing cmake -DPKG_LIBRARY=/path/libname.so ., where PKG should be replaced with the name of the external library (GMP, ARB, BFD, FLINT, MPFR, ...). Similarly, -DPKG_INCLUDE_DIR can be used for headers.

Recommended options to build

For package managers

For packaging symengine it is recommended to use GMP, MPFR, MPC, FLINT, LLVM as dependencies if they are available and build with thread safety on.

cmake -DWITH_GMP=on -DWITH_MPFR=on -DWITH_MPC=on -DINTEGER_CLASS=flint -DWITH_LLVM=on
-DWITH_SYMENGINE_THREAD_SAFE=on ..

Optimized build

To build with more optimizations, you can use the above dependencies and options and also,

CXXFLAGS="-march=native -O3" cmake -DWITH_TCMALLOC=on -DWITH_SYMENGINE_THREAD_SAFE=no ..

Developer Documentation

Please follow the C++ Style Guide when developing.

The design decisions are documented in Design.

Comments
  • Ruby wrappers initial file structure and Basic class

    Ruby wrappers initial file structure and Basic class

    Addresses issue #413. Most of the files are empty. I have tried to use the standard tools like RSpec and bundler which I am not very familiar with, but believe will prove to be very useful during the development. The main reason for choosing RSpec was because SciRuby prefers RSpec.

    TODO list before we can merge this PR:

    • [x] Build the wrappers with CMake
    • [x] Test the wrappers on Travis (building + running Ruby tests)
    • [x] Expose some minimal functionality and test it using Ruby tests (make sure they are run by Travis)
    • [x] Remove unnecessary things and files from the wrappers (e.g. src/ruby/bin/htmldiff is probably not needed)

    After this is merged, we will then expose more functionality of SymEngine (both in the C wrappers as well as the Ruby wrappers).

    opened by abinashmeher999 57
  • New MatchPyCpp package in utilities

    New MatchPyCpp package in utilities

    I think symengine/utilities is the optimal location for this package. A Python file is included, which acts as code generator for the SymEngine.

    • [ ] ~~move SymEnginePrinter to SymPy.~~
    • [x] optional wildcards testing.
    • [ ] ~~sequence-matching wildcard~~ ==> not urgent, open separate issue
    • [x] check var.find(...) == var.end() for optimizations.
    • [x] add more const ... & to function parameters.
    • [ ] ~~add typedef map<string, RCP<const Basic>> SubstitutionBasic ?~~ ==> open separate issue
    opened by Upabjojr 54
  • Implemented Quadratic residue function

    Implemented Quadratic residue function

    • [x] Quadratic Residue function
    • [x] is_quad_residue function
    • [x] is_nthroot_mod_prime_power function
    • [x] is_nthroot_mod1() function
    • [x] is_nth_power_residue() function

    @isuruf @Sumith1896 Could you please review this?

    PR needs review 
    opened by CodeMaxx 47
  • MultivariateIntPolynomial

    MultivariateIntPolynomial

    This code currently does not build. Currently compilation stops at

    [ 7%] Building CXX object symengine/CMakeFiles/symengine.dir/basic.cpp.o

    with the errors

    In file included from /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/basic.h:36:0, from /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/basic.cpp:1: /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/dict.h:30:38: error: invalid declarator before âumap_basic_numâ RCPBasicHash, RCPBasicKeyEq> umap_basic_num; ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/dict.h:202:62: error: âumap_basic_numâ in namespace âSymEngineâ does not name a type std::ostream& operator<<(std::ostream& out, const SymEngine::umap_basic_num& d); ^ In file included from /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/basic.cpp:3:0: /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/add.h:18:5: error: âumap_basic_numâ does not name a type umap_basic_num dict_; //! The dictionary of the rest (e.g. x+y in 2+x+y) ^ In file included from /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/basic.cpp:3:0: /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/add.h:25:40: error: âumap_basic_numâ has not been declared Add(const RCP &coef, umap_basic_num&& dict); ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/add.h:41:70: error: âumap_basic_numâ has not been declared static RCP from_dict(const RCP &coef, umap_basic_num &&d); ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/add.h:45:31: error: âumap_basic_numâ has not been declared static void dict_add_term(umap_basic_num &d, ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/add.h:51:72: error: âumap_basic_numâ has not been declared static void coef_dict_add_term(const Ptr<RCP> &coef, umap_basic_num &d, ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/add.h:61:19: error: âumap_basic_numâ does not name a type const umap_basic_num& dict) const; ^ In file included from /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/printer.h:4:0, from /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/basic.cpp:12: /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/visitor.h: In member function âvoid SymEngine::CoeffVisitor::bvisit(const SymEngine::Add&)â: /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/visitor.h:94:9: error: âumap_basic_numâ was not declared in this scope umap_basic_num dict; /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/visitor.h:94:9: error: âumap_basic_numâ was not declared in this scope umap_basic_num dict; ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/visitor.h:96:25: error: âconst class SymEngine::Addâ has no member named âdict_â for (auto &p: x.dict_) { ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/visitor.h:99:55: error: âdictâ was not declared in this scope Add::coef_dict_add_term(outArg(coef), dict, p.second, coeff_); ^ /home/myluszcz/ECS193/SYMENGINE/symengine/symengine/visitor.h:102:49: error: âdictâ was not declared in this scope coeff_ = Add::from_dict(coef, std::move(dict)); ^ symengine/CMakeFiles/symengine.dir/build.make:86: recipe for target 'symengine/CMakeFiles/symengine.dir/basic.cpp.o' failed make[2]: *** [symengine/CMakeFiles/symengine.dir/basic.cpp.o] Error 1 CMakeFiles/Makefile2:93: recipe for target 'symengine/CMakeFiles/symengine.dir/all' failed make[1]: *** [symengine/CMakeFiles/symengine.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

    Our current goal WRT to this branch is to get the MultivariatePolynomial object to compile. Once this occurs, we will write functions for performing addition, subtraction, negation, and multiplication, probably using the naive algorithms at first. After this we will write testers and benchmarks against which to compare future improvements.

    @shivamvats @certik @isuruf

    opened by char-chen 45
  • Refactor Arb `visit` functions

    Refactor Arb `visit` functions

    Refactor some of the visit functions according to comments from Fredrik Johansson, author of Arb.

    • Minimize usage of temporary variables
    • Clear temporary variables after they have been used.
    opened by thilinarmtb 38
  • [WIP] Initial implementation of single dispatch

    [WIP] Initial implementation of single dispatch

    This PR is to figure out the right approach (and for benchmarking various designs, as different commits). Once we settle on a design, we'll create a nice new polished PR and close this one.

    opened by certik 35
  • Fixed TODO: Implement binary search in sparse_matrix.cpp

    Fixed TODO: Implement binary search in sparse_matrix.cpp

    Fixed TODO in sparse_matrix.cpp but this commit seems to break tests. There are two more binary search implementation TODOs, if we can fix this so that tests pass we can implement the other two. cc @thilinarmtb

    opened by Sumith1896 33
  • Support for Symbol in ruby wrappers

    Support for Symbol in ruby wrappers

    I guess the files cwrapper.h had sufficient functions to create a Symbol class in module SymEngine and use the expand method. These just contain the Ruby wrappers but they don't build now. TODO:

    • [x] Add #free_symbols method to basic
    • [x] Add #args method to basic
    • [x] Write tests for both
    opened by abinashmeher999 31
  • UnivariateSeries

    UnivariateSeries

    Resuming the work from #810. A new UnivariateSeries that uses SeriesBase as its base. Without external dependencies, UnivariateSeries uses the existing generic interface implementation to match those of Piranha and Flint.

    @shivamvats @certik @isuruf @Sumith1896

    opened by char-chen 29
  • Fix for UnivariatePolynomial::__eq__

    Fix for UnivariatePolynomial::__eq__

    The current implementation of UnivariatePolynomial::__eq__ checks if the dictionaries of the two polynomials are exactly equal, and will return false if comparing polynomials with the dictionaries {{0,0},{1,2}} and {{1,2}} representing 0 + 2x and 2x respectively. Since addition does not remove the entries of a dictionary corresponding to terms that have zero coefficients, this can lead to a situation where SymEngine tells us that (x+1) + (x-1) != 2x, as shown below. test.zip

    My implementation replaces the call to map_uint_mpz_eq with a call to poly_dict_map_uint_mpz_eq, which returns true if two dictionaries are the same (excluding those entries where the coefficient is zero.)

    opened by myluszczak 28
  • Fix `pow` to handle negative exponents. Fix for #179

    Fix `pow` to handle negative exponents. Fix for #179

    @certik @thilinarmtb I've updated pow more or less the way it was in SymPy version, atleast for the case of Number However, in some cases Mul gets a negative pow. Currently in case of Mul we just call power_all_terms So I added a check in power_all_terms. Can you review if this is the right way to go about fixing it?

    opened by sushant-hiray 28
  • issue with integer_class not being recognized in c++ project use of symengine.

    issue with integer_class not being recognized in c++ project use of symengine.

    Hello,

    I am new to useing symengine and have set up the library to use in one of my c++ projects but when trying to use integer(15) I get error because in the integer.h file the use of integer_class is not recognized at all. Is there a way to fix this?

    opened by RyanZurrin 0
  • negate the value of a symbolic expression.

    negate the value of a symbolic expression.

    I have translated an equation from my book Analysis of Engineering Structures and Material Behavior:

            //#include "catch.hpp"
            #include <symengine/basic.h>
            #include <symengine/visitor.h>
           #include <symengine/eval_double.h>
           #include <symengine/derivative.h>
           #include <symengine/symengine_exception.h>
           #include <cstring>
    
        using namespace std;
    
        using SymEngine::Add;
        using SymEngine::atoms;
        using SymEngine::Basic;
        using SymEngine::coeff;
        using SymEngine::Complex;
        using SymEngine::complex_double;
        using SymEngine::ComplexInf;
        using SymEngine::diff;
        using SymEngine::down_cast;
        using SymEngine::EulerGamma;
        using SymEngine::free_symbols;
        using SymEngine::function_symbol;
        using SymEngine::FunctionSymbol;
        using SymEngine::has_symbol;
        using SymEngine::I;
        using SymEngine::Integer;
        using SymEngine::integer;
        using SymEngine::is_a;
        using SymEngine::make_rcp;
        using SymEngine::map_basic_basic;
        using SymEngine::map_basic_num;
        using SymEngine::map_int_Expr;
        using SymEngine::map_uint_mpz;
        using SymEngine::Mul;
        using SymEngine::multiset_basic;
        using SymEngine::Nan;
        using SymEngine::NotImplementedError;
        using SymEngine::Number;
        using SymEngine::one;
        using SymEngine::pi;
        using SymEngine::pow;
        using SymEngine::print_stack_on_segfault;
        using SymEngine::Rational;
        using SymEngine::rational_class;
        using SymEngine::RCP;
        using SymEngine::rcp_static_cast;
        using SymEngine::real_double;
        using SymEngine::sdiff;
        using SymEngine::set_basic;
        using SymEngine::Symbol;
        using SymEngine::symbol;
        using SymEngine::tribool;
        using SymEngine::umap_basic_basic;
        using SymEngine::umap_basic_num;
        using SymEngine::unified_compare;
        using SymEngine::vec_basic;
        using SymEngine::zero;
    
        using SymEngine::DenseMatrix;
        using SymEngine::Expression;
    
        vector<vec_basic> nodes;
    
        using namespace std;
    	
        int main(int argc, char** argv) {
    	
        vec_basic i;
        i.push_back(real_double(1.0));
        i.push_back(real_double(1.0));
        vec_basic j;
        j.push_back(real_double(2.0));
        j.push_back(real_double(2.0));
    
        vec_basic condensed;
        condensed.push_back(i.at(0));
        condensed.push_back(j.at(0));
    
        DenseMatrix matrix_global_uv = DenseMatrix(1,1,condensed);
    
        Expression phi("phi");
    
        auto m1 = cos(phi);
        auto m2 = sin(phi);
        auto m3 = sin(phi);
        auto m4 = cos(phi);
    
        DenseMatrix matrix_translate_local = DenseMatrix(2,2,{m1,m2,m3,m4});
    
        DenseMatrix matrix_result;
    
        matrix_translate_local.mul_matrix(matrix_global_uv, matrix_result);    
    
        cout << "Print values of matrix_result here and check them..." << std::endl;
        cout << "Done..." << std::endl;
        
        return 0;
    }
    
    

    Things are supposed to be: auto m3 = -sin(phi); or the negated value of -sin(phi). Somehow using the minus operator doesn't seem to work and I get an error about a missing minus operator. Is there a way maybe to accomplish the same thing some other way that the symbolic engine can interpret a negation?

    opened by prusso630 3
  • -DWITH_GMP does not work

    -DWITH_GMP does not work

    The README has an example using -DWITH_GMP=on, but this an error:

      Manually-specified variables were not used by the project:
    
        WITH_GMP
    
    

    Is this option removed? Should the README be updated?

    opened by rikardn 1
  • polynomial root solve

    polynomial root solve

    a friend of mine wants to solve the roots of a polynomial, which is computed from det() method of a dense matrix, which is the product of two matrix, one is symbolic, the other is just contants. When the solve() function is used, an exception of "Not implemented intersection set" is thrown. And I'm wandering is it really not implemented. His code is attached below.

    #include <symengine/basic.h>
    #include <symengine/matrix.h>
    #include <symengine/symbol.h>
    #include <symengine/pow.h>
    #include <symengine/integer.h>
    #include <symengine/symengine_exception.h>
    #include <symengine/complex_double.h>
    #include <symengine/rings.h>
    #include <symengine/monomials.h>
    #include <symengine/eval_double.h>
    #include <symengine/solve.h>
    #include <complex>
    #include <symengine/simplify.h>
    using SymEngine::Basic;
    using SymEngine::DenseMatrix;
    using SymEngine::RCP;
    using SymEngine::symbol;
    using SymEngine::integer;
    using SymEngine::pow;
    using SymEngine::complex_double;
    using SymEngine::umap_vec_mpz;
    using SymEngine::vec_int;
    using SymEngine::umap_basic_num;
    using SymEngine::expr2poly;
    using SymEngine::solve;
    using SymEngine::zero;
    using SymEngine::I;
    using SymEngine::eval_double;
    
    int main() 
    {
        // clang-format off
        RCP<const Symbol> z1 = symbol("z1"), z2 = symbol("z2");
        DenseMatrix temp1 = DenseMatrix(4, 16, 
            {
                pow(z1, integer(3)),integer(0),  integer(0),  integer(0),pow(z1, integer(2)), integer(0),  integer(0),  integer(0),z1, integer(0),  integer(0),  integer(0),integer(1), integer(0),  integer(0), integer(0),
    	    integer(0),  pow(z1, integer(3)),integer(0), integer(0),integer(0),pow(z1, integer(2)), integer(0), integer(0),integer(0), z1, integer(0), integer(0), integer(0),integer(1),integer(0),  integer(0),
    	    integer(0),  integer(0),pow(z1, integer(3)),integer(0),  integer(0),  integer(0),pow(z1, integer(2)),integer(0),  integer(0),  integer(0) ,z1,integer(0),  integer(0),  integer(0),integer(1),integer(0),
    	    integer(0),  integer(0),  integer(0),pow(z1, integer(3)),integer(0),  integer(0),  integer(0),pow(z1, integer(2)),integer(0),  integer(0),  integer(0),z1,integer(0),  integer(0),  integer(0),integer(1)
            });
    
        DenseMatrix temp2 = DenseMatrix(16, 4, 
            {
                integer(1),integer(0),  integer(0),  integer(0),
                integer(0),integer(1),  integer(0),  integer(0),
                integer(0),integer(0),  integer(1),  integer(0),
                integer(0),integer(0),  integer(0),  integer(1),
                z1,        integer(0),  integer(0),  integer(0),
                integer(0),z1,          integer(0),  integer(0),
                integer(0),integer(0),  z1,          integer(0),
                integer(0),integer(0),  integer(0),  z1,
                pow(z1, integer(2)),    integer(0),  integer(0), integer(0),
                integer(0),pow(z1, integer(2)),     integer(0),  integer(0),
                integer(0),integer(0),  pow(z1, integer(2)),     integer(0),
                integer(0),integer(0),  integer(0),              pow(z1, integer(2)),
                pow(z1, integer(3)),        integer(0),  integer(0),  integer(0),
                integer(0),pow(z1, integer(3)),          integer(0),  integer(0),
                integer(0),integer(0),  pow(z1, integer(3)),          integer(0),
                integer(0),integer(0),  integer(0),  pow(z1, integer(3))
            });
        
        DenseMatrix temp4 = DenseMatrix(4,16,
    	{
    	    pow(z2, integer(3)),pow(z2, integer(2)),  z2,  integer(1),integer(0),integer(0),  integer(0),  integer(0),integer(0),integer(0),  integer(0),  integer(0),integer(0),integer(0), integer(0),  integer(0),
                integer(0),integer(0),  integer(0),  integer(0),pow(z2, integer(3)),pow(z2, integer(2)),  z2,  integer(1),integer(0),integer(0),  integer(0),  integer(0),integer(0),integer(0),  integer(0),  integer(0),
                integer(0),integer(0),  integer(0),  integer(0),integer(0),integer(0),  integer(0),  integer(0),pow(z2, integer(3)),pow(z2, integer(2)),  z2,  integer(1),integer(0),integer(0),  integer(0),  integer(0),
                integer(0),integer(0),  integer(0),  integer(0),integer(0),integer(0),  integer(0),  integer(0),integer(0),integer(0),  integer(0),  integer(0),pow(z2, integer(3)),pow(z2, integer(2)),  z2,  integer(1)
            });
        DenseMatrix temp5 = DenseMatrix(16,4,
            {
                 integer(1),integer(0),  integer(0),integer(0),
                 pow(z2, integer(1)),integer(0),  integer(0),integer(0),
                 pow(z2, integer(2)),integer(0),  integer(0),integer(0),
                 pow(z2, integer(3)),integer(0),  integer(0),integer(0),
                 integer(0),integer(1),  integer(0),integer(0),
                 integer(0),pow(z2, integer(1)),  integer(0),integer(0),
                 integer(0),pow(z2, integer(2)),  integer(0),integer(0),
                 integer(0),pow(z2, integer(3)),  integer(0),integer(0),
                 integer(0),integer(0),  integer(1),integer(0),
                 integer(0),integer(0),  pow(z2, integer(1)),integer(0),
                 integer(0),integer(0),  pow(z2, integer(2)),integer(0),
                 integer(0),integer(0),  pow(z2, integer(3)),integer(0),
                 integer(0),integer(0),  integer(0),integer(1),
                 integer(0),integer(0),  integer(0),pow(z2, integer(1)),
                integer(0),integer(0),  integer(0),pow(z2, integer(2)),
                integer(0),integer(0),  integer(0),pow(z2, integer(3)),
             });
    	
    
        auto c1_1=complex_double(std::complex<double>(0.93829,0));
        auto c2_1=complex_double(std::complex<double>(-0.058946,-0.019517));
        auto c3_1=complex_double(std::complex<double>(-0.062113,0.0014363));
        auto c4_1=complex_double(std::complex<double>(-0.061953,0.0046716));
        auto c5_1=complex_double(std::complex<double>(-0.011639,-0.061032));
        auto c6_1=complex_double(std::complex<double>(-0.049353,-0.037756));
        auto c7_1=complex_double(std::complex<double>(-0.055657,-0.027629));
        auto c8_1=complex_double(std::complex<double>(-0.021821,-0.058163));
        auto c9_1=complex_double(std::complex<double>(0.057387,-0.023815));
        auto c10_1=complex_double(std::complex<double>(0.045385,-0.04244));
        auto c11_1=complex_double(std::complex<double>(-0.025132,-0.056818));
        auto c12_1=complex_double(std::complex<double>(0.020801,-0.058553));
        auto c13_1=complex_double(std::complex<double>(0.039455,0.047978));
        auto c14_1=complex_double(std::complex<double>(0.056784,0.025225));
        auto c15_1=complex_double(std::complex<double>(0.0522,0.033674));
        auto c16_1=complex_double(std::complex<double>(0.061757,-0.0067829));
    
        auto c1_2=complex_double(std::complex<double>(-0.058946,0.019517));
        auto c2_2=complex_double(std::complex<double>(0.93752,0));
        auto c3_2=complex_double(std::complex<double>(-0.058881,0.021017));
        auto c4_2=complex_double(std::complex<double>(-0.057705,0.024058));
        auto c5_2=complex_double(std::complex<double>(-0.030422,-0.054621));
        auto c6_2=complex_double(std::complex<double>(-0.059088,-0.020458));
        auto c7_2=complex_double(std::complex<double>(-0.061906,-0.0087896));
        auto c8_2=complex_double(std::complex<double>(-0.039242,-0.04866));
        auto c9_2=complex_double(std::complex<double>(0.047288,-0.0409));
        auto c10_2=complex_double(std::complex<double>(0.029932,-0.054897));
        auto c11_2=complex_double(std::complex<double>(-0.041979,-0.046329));
        auto c12_2=complex_double(std::complex<double>(0.0013511,-0.062513));
        auto c13_2=complex_double(std::complex<double>(0.052865,0.033354));
        auto c14_2=complex_double(std::complex<double>(0.062223,0.0061373));
        auto c15_2=complex_double(std::complex<double>(0.060516,0.015658));
        auto c16_2=complex_double(std::complex<double>(0.05685,-0.026013));
    
        auto c1_3=complex_double(std::complex<double>(-0.062113,-0.0014363));
        auto c2_3=complex_double(std::complex<double>(-0.058881,-0.021017));
        auto c3_3=complex_double(std::complex<double>(0.93744,0));
        auto c4_3=complex_double(std::complex<double>(-0.062471,0.0032604));
        auto c5_3=complex_double(std::complex<double>(-0.010295,-0.061706));
        auto c6_3=complex_double(std::complex<double>(-0.0488,-0.039154));
        auto c7_3=complex_double(std::complex<double>(-0.055381,-0.029106));
        auto c8_3=complex_double(std::complex<double>(-0.020612,-0.059055));
        auto c9_3=complex_double(std::complex<double>(0.05832,-0.022636));
        auto c10_3=complex_double(std::complex<double>(0.046672,-0.041664));
        auto c11_3=complex_double(std::complex<double>(-0.023975,-0.057779));
        auto c12_3=complex_double(std::complex<double>(0.022301,-0.058456));
        auto c13_3=complex_double(std::complex<double>(0.038599,0.049213));
        auto c14_3=complex_double(std::complex<double>(0.056572,0.026714));
        auto c15_3=complex_double(std::complex<double>(0.051761,0.035111));
        auto c16_3=complex_double(std::complex<double>(0.062323,-0.0053902));
    
        auto c1_4=complex_double(std::complex<double>(-0.061953,-0.0046716));
        auto c2_4=complex_double(std::complex<double>(-0.057705,-0.024058));
        auto c3_4=complex_double(std::complex<double>(-0.062471,-0.0032604));
        auto c4_4=complex_double(std::complex<double>(0.93744,0));
        auto c5_4=complex_double(std::complex<double>(-0.0070647,-0.062158));
        auto c6_4=complex_double(std::complex<double>(-0.046693,-0.041644));
        auto c7_4=complex_double(std::complex<double>(-0.053788,-0.031953));
        auto c8_4=complex_double(std::complex<double>(-0.017505,-0.060049));
        auto c9_4=complex_double(std::complex<double>(0.05942,-0.019566));
        auto c10_4=complex_double(std::complex<double>(0.04878,-0.039174));
        auto c11_4=complex_double(std::complex<double>(-0.020931,-0.058949));
        auto c12_4=complex_double(std::complex<double>(0.025317,-0.057213));
        auto c13_4=complex_double(std::complex<double>(0.035981,0.051158));
        auto c14_4=complex_double(std::complex<double>(0.055103,0.029626));
        auto c15_4=complex_double(std::complex<double>(0.04986,0.037761));
        auto c16_4=complex_double(std::complex<double>(0.062519,-0.0021346));
    
        auto c1_5=complex_double(std::complex<double>(-0.011639,0.061032));
        auto c2_5=complex_double(std::complex<double>(-0.030422,0.054621));
        auto c3_5=complex_double(std::complex<double>(-0.010295,0.061706));
        auto c4_5=complex_double(std::complex<double>(-0.0070647,0.062158));
        auto c5_5=complex_double(std::complex<double>(0.93744,0));
        auto c6_5=complex_double(std::complex<double>(-0.046653,0.041693));
        auto c7_5=complex_double(std::complex<double>(-0.037825,0.049838));
        auto c8_5=complex_double(std::complex<double>(-0.061644,0.010613));
        auto c9_5=complex_double(std::complex<double>(-0.012731,-0.061252));
        auto c10_5=complex_double(std::complex<double>(-0.033416,-0.052894));
        auto c11_5=complex_double(std::complex<double>(-0.060938,0.01414));
        auto c12_5=complex_double(std::complex<double>(-0.05399,-0.031618));
        auto c13_5=complex_double(std::complex<double>(0.054896,-0.029975));
        auto c14_5=complex_double(std::complex<double>(0.03566,-0.051406));
        auto c15_5=complex_double(std::complex<double>(0.043152,-0.045279));
        auto c16_5=complex_double(std::complex<double>(0.0049395,-0.062363));
    
        auto c1_6=complex_double(std::complex<double>(-0.049353,0.037756));
        auto c2_6=complex_double(std::complex<double>(-0.059088,0.020458));
        auto c3_6=complex_double(std::complex<double>(-0.0488,0.039154));
        auto c4_6=complex_double(std::complex<double>(-0.046693,0.041644));
        auto c5_6=complex_double(std::complex<double>(-0.046653,-0.041693));
        auto c6_6=complex_double(std::complex<double>(0.93742,0));
        auto c7_6=complex_double(std::complex<double>(-0.06142,0.011957));
        auto c8_6=complex_double(std::complex<double>(-0.053042,-0.033168));
        auto c9_6=complex_double(std::complex<double>(0.031327,-0.054161));
        auto c10_6=complex_double(std::complex<double>(0.010331,-0.061714));
        auto c11_6=complex_double(std::complex<double>(-0.054867,-0.030067));
        auto c12_6=complex_double(std::complex<double>(-0.01919,-0.059559));
        auto c13_6=complex_double(std::complex<double>(0.060913,0.014232));
        auto c14_6=complex_double(std::complex<double>(0.060852,-0.014569));
        auto c15_6=complex_double(std::complex<double>(0.062355,-0.0050072));
        auto c16_6=complex_double(std::complex<double>(0.045244,-0.043213));
    
        auto c1_7=complex_double(std::complex<double>(-0.055657,0.027629));
        auto c2_7=complex_double(std::complex<double>(-0.061906,0.0087896));
        auto c3_7=complex_double(std::complex<double>(-0.055381,0.029106));
        auto c4_7=complex_double(std::complex<double>(-0.053788,0.031953));
        auto c5_7=complex_double(std::complex<double>(-0.037825,-0.049838));
        auto c6_7=complex_double(std::complex<double>(-0.06142,-0.011957));
        auto c7_7=complex_double(std::complex<double>(0.93743,0));
        auto c8_7=complex_double(std::complex<double>(-0.045725,-0.042691));
        auto c9_7=complex_double(std::complex<double>(0.041098,-0.047175));
        auto c10_7=complex_double(std::complex<double>(0.021933,-0.058601));
        auto c11_7=complex_double(std::complex<double>(-0.048108,-0.039996));
        auto c12_7=complex_double(std::complex<double>(-0.0074552,-0.062127));
        auto c13_7=complex_double(std::complex<double>(0.05707,0.025609));
        auto c14_7=complex_double(std::complex<double>(0.062513,-0.0026724));
        auto c15_7=complex_double(std::complex<double>(0.062161,0.0070005));
        auto c16_7=complex_double(std::complex<double>(0.052667,-0.03377));
    
        auto c1_8=complex_double(std::complex<double>(-0.021821,0.058163));
        auto c2_8=complex_double(std::complex<double>(-0.039242,0.04866));
        auto c3_8=complex_double(std::complex<double>(-0.020612,0.059055));
        auto c4_8=complex_double(std::complex<double>(-0.017505,0.060049));
        auto c5_8=complex_double(std::complex<double>(-0.061644,-0.010613));
        auto c6_8=complex_double(std::complex<double>(-0.053042,0.033168));
        auto c7_8=complex_double(std::complex<double>(-0.045725,0.042691));
        auto c8_8=complex_double(std::complex<double>(0.93746,0));
        auto c9_8=complex_double(std::complex<double>(-0.0021538,-0.062514));
        auto c10_8=complex_double(std::complex<double>(-0.023954,-0.057788));
        auto c11_8=complex_double(std::complex<double>(-0.062444,0.003596));
        auto c12_8=complex_double(std::complex<double>(-0.047836,-0.040313));
        auto c13_8=complex_double(std::complex<double>(0.059177,-0.020223));
        auto c14_8=complex_double(std::complex<double>(0.043858,-0.044604));
        auto c15_8=complex_double(std::complex<double>(0.050201,-0.037295));
        auto c16_8=complex_double(std::complex<double>(0.015446,-0.060611));
    
        auto c1_9=complex_double(std::complex<double>(0.057387,0.023815));
        auto c2_9=complex_double(std::complex<double>(0.047288,0.0409));
        auto c3_9=complex_double(std::complex<double>(0.05832,0.022636));
        auto c4_9=complex_double(std::complex<double>(0.05942,0.019566));
        auto c5_9=complex_double(std::complex<double>(-0.012731,0.061252));
        auto c6_9=complex_double(std::complex<double>(0.031327,0.054161));
        auto c7_9=complex_double(std::complex<double>(0.041098,0.047175));
        auto c8_9=complex_double(std::complex<double>(-0.0021538,0.062514));
        auto c9_9=complex_double(std::complex<double>(0.93744,0));
        auto c10_9=complex_double(std::complex<double>(-0.058588,0.021954));
        auto c11_9=complex_double(std::complex<double>(0.0014439,0.062541));
        auto c12_9=complex_double(std::complex<double>(-0.041943,0.046427));
        auto c13_9=complex_double(std::complex<double>(-0.018177,-0.059848));
        auto c14_9=complex_double(std::complex<double>(-0.043074,-0.045375));
        auto c15_9=complex_double(std::complex<double>(-0.03555,-0.051463));
        auto c16_9=complex_double(std::complex<double>(-0.060053,-0.017527));
    
        auto c1_10=complex_double(std::complex<double>(0.045385,0.04244));
        auto c2_10=complex_double(std::complex<double>(0.029932,0.054897));
        auto c3_10=complex_double(std::complex<double>(0.046672,0.041664));
        auto c4_10=complex_double(std::complex<double>(0.04878,0.039174));
        auto c5_10=complex_double(std::complex<double>(-0.033416,0.052894));
        auto c6_10=complex_double(std::complex<double>(0.010331,0.061714));
        auto c7_10=complex_double(std::complex<double>(0.021933,0.058601));
        auto c8_10=complex_double(std::complex<double>(-0.023954,0.057788));
        auto c9_10=complex_double(std::complex<double>(-0.058588,-0.021954));
        auto c10_10=complex_double(std::complex<double>(0.93743,0));
        auto c11_10=complex_double(std::complex<double>(-0.020594,0.059075));
        auto c12_10=complex_double(std::complex<double>(-0.055571,0.02876));
        auto c13_10=complex_double(std::complex<double>(0.0039792,-0.062425));
        auto c14_10=complex_double(std::complex<double>(-0.024416,-0.057609));
        auto c15_10=complex_double(std::complex<double>(-0.015233,-0.06067));
        auto c16_10=complex_double(std::complex<double>(-0.050088,-0.037487));
    
        auto c1_11=complex_double(std::complex<double>(-0.025132,0.056818));
        auto c2_11=complex_double(std::complex<double>(-0.041979,0.046329));
        auto c3_11=complex_double(std::complex<double>(-0.023975,0.057779));
        auto c4_11=complex_double(std::complex<double>(-0.020931,0.058949));
        auto c5_11=complex_double(std::complex<double>(-0.060938,-0.01414));
        auto c6_11=complex_double(std::complex<double>(-0.054867,0.030067));
        auto c7_11=complex_double(std::complex<double>(-0.048108,0.039996));
        auto c8_11=complex_double(std::complex<double>(-0.062444,-0.003596));
        auto c9_11=complex_double(std::complex<double>(0.0014439,-0.062541));
        auto c10_11=complex_double(std::complex<double>(-0.020594,-0.059075));
        auto c11_11=complex_double(std::complex<double>(0.93745,0));
        auto c12_11=complex_double(std::complex<double>(-0.045444,-0.043001));
        auto c13_11=complex_double(std::complex<double>(0.060248,-0.016789));
        auto c14_11=complex_double(std::complex<double>(0.046355,-0.042013));
        auto c15_11=complex_double(std::complex<double>(0.052267,-0.034351));
        auto c16_11=complex_double(std::complex<double>(0.018907,-0.059629));
    
        auto c1_12=complex_double(std::complex<double>(0.020801,0.058553));
        auto c2_12=complex_double(std::complex<double>(0.0013511,0.062513));
        auto c3_12=complex_double(std::complex<double>(0.022301,0.058456));
        auto c4_12=complex_double(std::complex<double>(0.025317,0.057213));
        auto c5_12=complex_double(std::complex<double>(-0.05399,0.031618));
        auto c6_12=complex_double(std::complex<double>(-0.01919,0.059559));
        auto c7_12=complex_double(std::complex<double>(-0.0074552,0.062127));
        auto c8_12=complex_double(std::complex<double>(-0.047836,0.040313));
        auto c9_12=complex_double(std::complex<double>(-0.041943,-0.046427));
        auto c10_12=complex_double(std::complex<double>(-0.055571,-0.02876));
        auto c11_12=complex_double(std::complex<double>(-0.045444,0.043001));
        auto c12_12=complex_double(std::complex<double>(0.93743,0));
        auto c13_12=complex_double(std::complex<double>(0.032227,-0.053613));
        auto c14_12=complex_double(std::complex<double>(0.0047948,-0.062387));
        auto c15_12=complex_double(std::complex<double>(0.014357,-0.060885));
        auto c16_12=complex_double(std::complex<double>(-0.027255,-0.056316));
    
        auto c1_13=complex_double(std::complex<double>(0.039455,-0.047978));
        auto c2_13=complex_double(std::complex<double>(0.052865,-0.033354));
        auto c3_13=complex_double(std::complex<double>(0.038599,-0.049213));
        auto c4_13=complex_double(std::complex<double>(0.035981,-0.051158));
        auto c5_13=complex_double(std::complex<double>(0.054896,0.029975));
        auto c6_13=complex_double(std::complex<double>(0.060913,-0.014232));
        auto c7_13=complex_double(std::complex<double>(0.05707,-0.025609));
        auto c8_13=complex_double(std::complex<double>(0.059177,0.020223));
        auto c9_13=complex_double(std::complex<double>(-0.018177,0.059848));
        auto c10_13=complex_double(std::complex<double>(0.0039792,0.062425));
        auto c11_13=complex_double(std::complex<double>(0.060248,0.016789));
        auto c12_13=complex_double(std::complex<double>(0.032227,0.053613));
        auto c13_13=complex_double(std::complex<double>(0.93747,0));
        auto c14_13=complex_double(std::complex<double>(-0.055922,0.028023));
        auto c15_13=complex_double(std::complex<double>(-0.05956,0.019056));
        auto c16_13=complex_double(std::complex<double>(-0.034214,0.052356));
    
        auto c1_14=complex_double(std::complex<double>(0.056784,-0.025225));
        auto c2_14=complex_double(std::complex<double>(0.062223,-0.0061373));
        auto c3_14=complex_double(std::complex<double>(0.056572,-0.026714));
        auto c4_14=complex_double(std::complex<double>(0.055103,-0.029626));
        auto c5_14=complex_double(std::complex<double>(0.03566,0.051406));
        auto c6_14=complex_double(std::complex<double>(0.060852,0.014569));
        auto c7_14=complex_double(std::complex<double>(0.062513,0.0026724));
        auto c8_14=complex_double(std::complex<double>(0.043858,0.044604));
        auto c9_14=complex_double(std::complex<double>(-0.043074,0.045375));
        auto c10_14=complex_double(std::complex<double>(-0.024416,0.057609));
        auto c11_14=complex_double(std::complex<double>(0.046355,0.042013));
        auto c12_14=complex_double(std::complex<double>(0.0047948,0.062387));
        auto c13_14=complex_double(std::complex<double>(-0.055922,-0.028023));
        auto c14_14=complex_double(std::complex<double>(0.93743,0));
        auto c15_14=complex_double(std::complex<double>(-0.061803,-0.0096488));
        auto c16_14=complex_double(std::complex<double>(-0.054059,0.031489));
    
        auto c1_15=complex_double(std::complex<double>(0.0522,-0.033674));
        auto c2_15=complex_double(std::complex<double>(0.060516,-0.015658));
        auto c3_15=complex_double(std::complex<double>(0.051761,-0.035111));
        auto c4_15=complex_double(std::complex<double>(0.04986,-0.037761));
        auto c5_15=complex_double(std::complex<double>(0.043152,0.045279));
        auto c6_15=complex_double(std::complex<double>(0.062355,0.0050072));
        auto c7_15=complex_double(std::complex<double>(0.062161,-0.0070005));
        auto c8_15=complex_double(std::complex<double>(0.050201,0.037295));
        auto c9_15=complex_double(std::complex<double>(-0.03555,0.051463));
        auto c10_15=complex_double(std::complex<double>(-0.015233,0.06067));
        auto c11_15=complex_double(std::complex<double>(0.052267,0.034351));
        auto c12_15=complex_double(std::complex<double>(0.014357,0.060885));
        auto c13_15=complex_double(std::complex<double>(-0.05956,-0.019056));
        auto c14_15=complex_double(std::complex<double>(-0.061803,0.0096488));
        auto c15_15=complex_double(std::complex<double>(0.93746,0));
        auto c16_15=complex_double(std::complex<double>(-0.048543,0.03944));
    
        auto c1_16=complex_double(std::complex<double>(0.061757,0.0067829));
        auto c2_16=complex_double(std::complex<double>(0.05685,0.026013));
        auto c3_16=complex_double(std::complex<double>(0.062323,0.0053902));
        auto c4_16=complex_double(std::complex<double>(0.062519,0.0021346));
        auto c5_16=complex_double(std::complex<double>(0.0049395,0.062363));
        auto c6_16=complex_double(std::complex<double>(0.045244,0.043213));
        auto c7_16=complex_double(std::complex<double>(0.052667,0.03377));
        auto c8_16=complex_double(std::complex<double>(0.015446,0.060611));
        auto c9_16=complex_double(std::complex<double>(-0.060053,0.017527));
        auto c10_16=complex_double(std::complex<double>(-0.050088,0.037487));
        auto c11_16=complex_double(std::complex<double>(0.018907,0.059629));
        auto c12_16=complex_double(std::complex<double>(-0.027255,0.056316));
        auto c13_16=complex_double(std::complex<double>(-0.034214,-0.052356));
        auto c14_16=complex_double(std::complex<double>(-0.054059,-0.031489));
        auto c15_16=complex_double(std::complex<double>(-0.048543,-0.03944));
        auto c16_16=complex_double(std::complex<double>(0.93744,0));
    
        DenseMatrix Gn2 = DenseMatrix(16,16,{
    		c1_1,	c1_2,c1_3,c1_4,c1_5,c1_6,c1_7,c1_8,c1_9,c1_10,c1_11,c1_12,c1_13,c1_14,c1_15,c1_16,
    		c2_1,c2_2,c2_3,c2_4,c2_5,c2_6,c2_7,c2_8,c2_9,	c2_10,c2_11,c2_12,c2_13,c2_14,c2_15,c2_16,
    		c3_1,c3_2,c3_3,c3_4,c3_5,c3_6,c3_7,c3_8,c3_9,c3_10,c3_11,c3_12,c3_13,c3_14,c3_15,c3_16,
    		c4_1,	c4_2,c4_3,c4_4,c4_5,c4_6,c4_7,c4_8,c4_9,c4_10,c4_11,c4_12,c4_13,c4_14,c4_15,c4_16,
    		c5_1,c5_2,c5_3,c5_4,c5_5,c5_6,c5_7,c5_8,c5_9,c5_10,c5_11,c5_12,c5_13,c5_14,c5_15,c5_16,
    		c6_1,c6_2,c6_3,c6_4,c6_5,c6_6,c6_7,c6_8,c6_9,c6_10,c6_11,c6_12,c6_13,c6_14,c6_15,c6_16,
    		c7_1,c7_2,c7_3,	c7_4,c7_5,c7_6,c7_7,c7_8,c7_9,c7_10,c7_11,c7_12,c7_13,c7_14,c7_15,c7_16,
    		c8_1,c8_2,c8_3,c8_4,c8_5,c8_6,c8_7,c8_8,c8_9,c8_10,c8_11,c8_12,c8_13,c8_14,c8_15,c8_16,
    		c9_1,c9_2,c9_3,c9_4,c9_5,c9_6,c9_7,c9_8,c9_9,c9_10,c9_11,c9_12,c9_13,c9_14,c9_15,c9_16,
    		c10_1,c10_2,c10_3,c10_4,c10_5,c10_6,c10_7,c10_8,c10_9,c10_10,c10_11,c10_12,c10_13,c10_14,c10_15,c10_16,
    		c11_1,c11_2,c11_3,c11_4,c11_5,c11_6,c11_7,c11_8,c11_9,c11_10,c11_11,c11_12,c11_13,c11_14,c11_15,c11_16,
    		c12_1,c12_2,c12_3,c12_4,c12_5,c12_6,c12_7,c12_8,c12_9,c12_10,c12_11,c12_12,c12_13,c12_14,c12_15,c12_16,
    		c13_1,c13_2,c13_3,c13_4,c13_5,c13_6,c13_7,c13_8,c13_9,c13_10,c13_11,c13_12,c13_13,c13_14,c13_15,c13_16,
    		c14_1,c14_2,c14_3,c14_4,c14_5,c14_6,c14_7,c14_8,c14_9,c14_10,c14_11,c14_12,c14_13,c14_14,c14_15,c14_16,
    		c15_1,c15_2,c15_3,c15_4,c15_5,c15_6,c15_7,c15_8,c15_9,c15_10,c15_11,c15_12,c15_13,c15_14,c15_15,c15_16,
    		c16_1,c16_2,c16_3,c16_4,c16_5,c16_6,c16_7,c16_8,c16_9,c16_10,c16_11,c16_12,c16_13,c16_14,c16_15,c16_16
    		});
    
        DenseMatrix Qz2_1=DenseMatrix(4,16);
        DenseMatrix Qz2_2=DenseMatrix(4,4);
    
        DenseMatrix Qz1_1=DenseMatrix(4,16);
        DenseMatrix Qz1_2=DenseMatrix(4,4);
        mul_dense_dense(temp1,Gn2,Qz2_1);
        mul_dense_dense(Qz2_1,temp2,Qz2_2);
    
        mul_dense_dense(temp4,Gn2,Qz1_1);
        mul_dense_dense(Qz1_1,temp5,Qz1_2);
        std::cout << Qz2_2 << std::endl;
        auto detQz2=Qz2_2.det();
        std::cout<<*detQz2<<std::endl;
        auto detQz1=Qz1_2.det();
        std::cout << *detQz1 << std::endl;
    
        auto s1=solve(detQz2,z1);
        std::cout << *s1 << std::endl;
        auto s2=solve(detQz1,z2);
        std::cout<<*s1<<std::endl;
        std::cout<<*I<<std::endl;
        // clang-format on
    
        return 0;
    }
    
    opened by tsukurudesktop 0
  • Failing unit test in illumos (OpenIndiana)

    Failing unit test in illumos (OpenIndiana)

    The evaluation of log(exp(-1)*pi/sin(I*sqrt(5))) in test_eval_double.cpp fails in the illumos OpenIndiana distribution.

    The cause is a problem in the calculation of cpow in the illumos libc.

    I opened an issue for illumos here: https://www.illumos.org/issues/15015

    opened by rikardn 3
  • Null matrix can always be stacked

    Null matrix can always be stacked

    opened by TJStienstra 1
Releases(v0.9.0)
  • v0.9.0(Feb 16, 2022)

    Build system changes

    • Cereal is a hard dependency now. By default, the vendored copy is used, but cmake option WITH_SYSTEM_CEREAL can be turned on to use an external installation.

    New Features

    • Serialization using cereal - #1704, #1867, #1871
    • Support Piecewise in parser - #1882
    • Add sets Naturals and Naturals0 - #1874
    • Add Tuple class - #1873
    • Product of n terms in cwrapper - #1880
    • Refine x**n**k => x**(n*k) in certain cases - #1863
    • Support set of complex numbers by assumptions - #1841
    • Refine log of integers which are perfect powers - #1864
    • Add function to decompose perfect powers - #1862
    • Add logarithm power rule to refine - #1861
    • Add sets to cwrapper - #1845
    • Add is_algebraic and is_transcendental - #1819
    • First version of simplify - #1831
    • Add ceiling and floor to cwrapper - #1851
    • Add polygonal numbers and polygonal roots functions - #1688
    • sbml parser: add support for zero arg function symbols - #1844
    • Add boundary, closure and interior of Set - #1834

    Bug Fixes

    • Fix building docs - #1856
    • Fix unicode printer for windows - #1872
    • Return NaN when subs results in 0/0 - #1853
    • Fixes for "static initialization order fiasco" - #1849

    People who contributed to the release:

    • Isuru Fernando
    • Björn Dahlgren
    • Rikard Nordgren
    • Alec Edgington
    • Liam Keegan
    • Pieter Eendebak
    • Rohit Goswami
    • Zgoda Iu.N
    Source code(tar.gz)
    Source code(zip)
    symengine-0.9.0.tar.gz(857.98 KB)
  • v0.8.1(Sep 6, 2021)

  • v0.8.0(Sep 4, 2021)

    Breaking changes

    • Let 0 * real be exactly 0 (fix #1559) - #1769
    • Return SYMENGINE_NOT_IMPLEMENTED in basic_solve_poly - #1668

    New Features

    • Add SBML infix parsing and printing - #1785
    • Add refine function - #1800
    • Add unicode printer - #1782
    • Allow assumptions in is_positive etc - #1795, #1765, #1793
    • Add is_polynomial, is_complex, is_integer, is_finite, is_infinite, is_nonzero, is_odd, is_even, is_rational and is_irrational - #1747, #1753, #1775, #1764, #1776, #1817, #1818
    • Add optional local_parser_constants to Parser - #1773
    • Add primorial, primepi function - #1762, #1771
    • Add rewrite_as_sin - #1778
    • Add floor, ceiling functions to parser - #1783
    • Add logical operators to subs - #1797
    • Add sup and inf for sets - #1813
    • Add set of complex numbers - #1811
    • Wrap add(vector) in C - #1829

    Bug Fixes

    • Check for libflint-arb as well as libarb - #1749
    • Fixes segfault when parsing long expressions - #1805
    • Fix compatibility with newer boost versions - #1803
    • fix naming of llvm intrinsics - #1751
    • Mark some RCP functions as const - #1756
    • Support parsing unary plus (fixes #1720) - #1767
    • Simplify floor(constant + integer) to integer - #1763
    • Add Assumptions class - #1759
    • Better symbols for number sets in LaTeX printing - #1760
    • Fix rationals not being canonicalized with boost - #1788
    • LLVM intrinsics fixes for new LLVM versions - #1810, #1823
    • Use SymEngine exceptions in LLVMVisitor - #1824
    • Fix building with cotire - #1825
    • Fix exp(x + num)/exp(x) not evaluating - #1828
    • Fix exception handling for basic_diff - #1830

    People who contributed to the release:

    • Jialin Ma
    • Naveen Sai
    • Liam Keegan
    • Isuru Fernando
    • Peter Schmitteckert
    • Rikard Nordgren
    • Alec Edgington
    • Björn Dahlgren
    • Tom Barrett
    Source code(tar.gz)
    Source code(zip)
    symengine-0.8.0.tar.gz(715.61 KB)
  • v0.7.0(Mar 12, 2021)

    Breaking changes

    • Rename typeID enums to avoid conflicts - #1656

    Build system changes

    • Support LLVM 11 - #1678, - #1691
    • Support Apple Silicon - #1735
    • Allow using symengine as a subdirectory in other CMake projects - #1670
    • Partial support for Oracle Development Studio - #1657

    New Features

    • Add Float & LongDouble LLVMVisitors to cwrapper - #1645
    • Add is_positive_definite for DenseMatrix - #1710
    • Add set of Rationals - #1713
    • Add trace for DenseMatrix - #1706
    • Add tests for diagonal dominance for DenseMatrix - #1707
    • Add is_positive, is_nonpositive, is_negative and is_nonnegative - #1705
    • Add test methods for zero, real, diagonal, symmetric and hermitian matrices - #1703
    • Add tribool type and update is_zero to return tribool - #1698
    • Add elementwise_mul_matrix method for Dense and CSR matrices - #1693
    • Add Integers set - #1695
    • Add conjugate, conjugate_transpose and is_square for matrices - #1690
    • Add function_symbols() method to get all function_symbols - #1687
    • Add Reals set - #1686
    • Parse atan2 in the string parser - #1664
    • Add UnevaluatedExpr - #1641

    Bug Fixes

    • Fix a segfault in lambda_double.h - #1734
    • Fix LambdaRealDoubleVisitor use-after-free issue - #1722
    • Fix subs with coefficient in Mul - #1655
    • Fix union of FiniteSet containing symbols and Interval - #1650
    • Faster determinant and Eigen Value Calculation - #1651
    • Fix a crash in CSRMatrix - #1700
    • Fix checking for float zero in matrix operations - #1683
    • Fix some warnings on windows - #1663
    • Fix return value of basic_solve_poly - #1635
    • Add support for newer versions of binutils - #1714

    People who contributed to the release:

    • Jialin Ma
    • Isuru Fernando
    • Björn Dahlgren
    • Rikard Nordgren
    • Ondřej Čertík
    • Will Simmons
    • myd7349
    • Fabian Köhler
    Source code(tar.gz)
    Source code(zip)
    symengine-0.7.0.tar.gz(783.50 KB)
  • v0.6.0(Feb 10, 2020)

    Bug Fixes

    • Use opt_level in code generation - #1615
    • Add const qualifier to call method in LLVM visitors - #1619
    • Update license for Bison parser code and cotire code - #1627, #1628
    • Hide LLVM symbols in osx - #1629
    • Fix linsolve segfault - #1632

    Build system changes

    • Support for LLVM 10 - #1636

    New Functionality

    • Add cancel method - #1625
    • Add opt_level to some init calls - #1615
    • Add Julia specialization for print calls - #1616

    People who contributed to the release:

    • Simon Stelter
    • Isuru Fernando
    • Roger Luo
    • Björn Dahlgren
    • Jogi Miglani
    • Ondřej Čertík
    • Jialin Ma
    • Liam Keegan
    Source code(tar.gz)
    Source code(zip)
    symengine-0.6.0.tar.gz(745.58 KB)
  • v0.5.0(Sep 10, 2019)

    Bug Fixes

    • Fix LLVMDoubleVisitor save->load->save->load bug - #1549
    • Fix coeff(x+1, x, 0) - #1564
    • Fix finding LLVM in SymEngineConfig.cmake - #1553
    • Fix path prefix in Binder-based environments - #1554
    • Add a virtual destructor to Visitor - #1580

    Build system changes

    • Modified parser to use re2c and bison - #1588, #1591, #1593, #1594
    • LLVM 8 support - #1531
    • Removed -march=native from default flags - #1569
    • Versioned the DLL - #1604

    New Functionality

    • Multi precision support for upper and lower gamma using MPFR 4 - #1544, #1545
    • 32-bit and 80-bit floating point support to LLVMVisitor - #1606
    • Option to cache intermediate expression in diff and subs - #1592, #1582
    • Add loggamma function to C wrapper API - #1556
    • Add truncate function - #1555
    • Avoid revisit in CountOpsVisitor - #1557
    • Add mathml, latex, ccode, jscode to cwrapper - #1562
    • Add kronecker_delta, lowergamma, uppergamma, beta, polygamma to cwrapper - #1603
    • Allow symengine rcp even in debug mode - #1548

    People who contributed to the release:

    • Björn Dahlgren
    • Ondřej Čertík
    • Isuru Fernando
    • Connor Behan
    • Jialin Ma
    • Brandon Bocklund
    • Marcello Mansueto
    • Steven Lee
    Source code(tar.gz)
    Source code(zip)
    symengine-0.5.0.tar.gz(743.47 KB)
  • v0.4.1(Jul 27, 2019)

  • v0.4.0(Mar 28, 2019)

    New Functionality

    • New parser based on bison and flex
    • Initial support to generate symengine code for a matchpy expression
    • Supporting symbols in evalf
    • Reduced row echelon form
    • count_ops to count operations of an expression
    • Latex and MathML printing
    • Saving and loading LLVM compiled functions
    • Common subexpression elimination
    • xeus-cling and binder support
    • xreplace method
    • New functions dense_matrix_row_del, dense_matrix_col_del in C Wrappers and row_insert and col_insert in class DenseMatrix- #1313
    • expand_as_exp() member function is removed from derived classes of TrigFunction and HyperbolicFunction and implemented using visitor design pattern - #1309
    • as_real_imag- #1310
    • Polynomial Solvers - #1296
    • Floor and Ceiling classes - #1297 and #1290
    • Conjugate class - #1295
    • ConditionSet - #1291
    • Sign class - #1287
    • Vector-specific methods dot and cross - #1286
    • Dummy class - #1284
    • Relationals - #1276, #1279, #1280
    • Flint wrappers for factorization - #1274
    • New functions dense_matrix_row_join, dense_matrix_col_join in C Wrappers - #1273
    • Functions column_exchange_dense, row_join, col_join, row_del and col_del in class DenseMatrix - #1269
    • New functions vecbasic_set, vecbasic_erase, setbasic_erase in CWrappers - #1264, #1272
    • New functions number_is_zero, number_is_positive, number_is_negative, number_is_complex in CWrappers - #1256

    Breaking Changes

    • SONAME updated to 0.4 (SONAME will pin to . for major version 0.)
    • complex_*real_part, complex_*imaginary_part are replaced by methods complex_base_real_part and complex_base_imaginary_part - #1263
    • real_mpfr_is_zero, complex_mpc_is_zero is replaced by method number_is_zero - #1256
    • basic_number_sign is replaced by methods number_is_zero, number_is_positive, number_is_negative - #1256

    Bug Fixes

    • Additional comparison clause in Dummy::compare - #1304
    • Add oo and zoo to the parser - #1261
    • Fix segmentation fault in LLVMDoubleVisitor - #1260
    • NaN and infs in JuliaStrPrinter - #1258
    • The base classes for inverse trigonometric and inverse hyperbolic functions are now InverseTrigFunction and InverseHyperbolicFunction respectively. Base class for TrigFunction and InverseTrigFunction is TrigBase. Similarly, base class for HyperbolicFunction and InverseHyperbolicFunction is HyperbolicBase. #1309

    And many other changes, here is a list of merged PRs not mentioned above:

    • https://github.com/symengine/symengine/pulls?utf8=%E2%9C%93&q=is%3Apr+merged%3A2017-07-25..2019-03-28

    People who contributed to the release:

    • Srajan Garg
    • Dirk Reusch
    • Ranjith Kumar
    • Isuru Fernando
    • Jean-Paul Pelteret
    • Shikhar Jaiswal
    • Sumith Kulal
    • Ondřej Čertík
    • Jialin Ma
    • Gerrit Ansmann
    • Björn Dahlgren
    • Nilay Pochhi
    • Eeshan Gupta
    • Ziyi Yan
    • Andreas Humenberger
    • Kieran Kaempen
    • Clouds Flowing
    • Sylvain Corlay
    • Alan Hu
    • Rajiv Ranjan Singh
    • Francesco Bonazzi
    • Simon Stelter
    Source code(tar.gz)
    Source code(zip)
    symengine-0.4.0.tar.gz(736.00 KB)
  • v0.3.0(May 8, 2017)

    Major changes

    • Version libsymengine.so - #1239

    New Features

    • Use LLVM for compiling an expression to a function - #1094, #1220, #1242, #1244, #1245
    • Completely permissive licensed build using Boost.multiprecision - #1121
    • Macros and functions for checking version and features - #1135, #1114
    • Julia printer #1246
    • Support for NaN #1178
    • Error functions - #1097
    • More logic functions - #1206, #1102, #1098

    Improvements

    • Cwrappers wrap more functions #1249, #1143, #1123, #1110
    • Parser Allow unicode and implicit multiplication, - #1231, #1235
    • More functions now immediately evaluate with floats - #1205, #1202, #1192, #1189, #1185, #1177, #1172
    • More derivatives - #1199, #1166, #1152, #1151
    • Complex numbers inherit from ComplexBase - #1171

    Bug Fixes / Minor changes

    • Printing E**x is changed to exp(x) - #1136
    • Fix bug in trigonometric functions - #1051
    • Make hash function platform independent - #1233
    • Dividing by zero returns zoo - #1170
    • Fix double printing #1248
    • Fix bug in mpc evaluation #1210
    • Fix bug in gamma functions #1204
    • Fix bug in abs, sinh that lead to infinite recursion #1198
    • Fix bug in pow #1229, #1165

    People who contributed to the release

    • Isuru Fernando
    • Ralf Stephan
    • Akash Trehan
    • Ritesh Kumar
    • Shikhar Jaiswal
    • Srajan Garg
    • Vishu Sidana
    • Ondřej Čertík
    • Siddharth Bhat
    • Tao He
    • Chad Mills
    • Abhimanyu Siwach
    • Jean-Paul Pelteret
    • Ranjith Kumar
    • Kv Manohar
    • Sumith Kulal
    • Kanchana Ruwanpathirana
    • Melanka Saroad
    Source code(tar.gz)
    Source code(zip)
    binaries-msvc-x86.tar.bz2(5.46 MB)
    binaries-msvc-x86_64.tar.bz2(6.14 MB)
    symengine-0.3.0-binaries-msvc-x86.tar.bz2(5.47 MB)
    symengine-0.3.0-binaries-msvc-x86_64.tar.bz2(6.17 MB)
    symengine-0.3.0.tar.gz(615.05 KB)
  • v0.2.0(Sep 1, 2016)

  • v0.1.0(Aug 10, 2015)

Owner
SymEngine is a fast symbolic manipulation library, written in C++
null
Fast math tool written on asm/c

math_tool fast math tool written on asm/c This project was created for easy use of mathematical / geometric rules and operations. This project contain

portable executable 3 Mar 8, 2022
Blazing-fast Expression Templates Library (ETL) with GPU support, in C++

Expression Templates Library (ETL) 1.3.0 ETL is a header only library for C++ that provides vector and matrix classes with support for Expression Temp

Baptiste Wicht 202 Dec 3, 2022
Kraken is an open-source modern math library that comes with a fast-fixed matrix class and math-related functions.

Kraken ?? Table of Contents Introduction Requirement Contents Installation Introduction Kraken is a modern math library written in a way that gives ac

yahya mohammed 24 Nov 30, 2022
LibTomMath is a free open source portable number theoretic multiple-precision integer library written entirely in C.

libtommath This is the git repository for LibTomMath, a free open source portable number theoretic multiple-precision integer (MPI) library written en

libtom 543 Dec 27, 2022
nml is a simple matrix and linear algebra library written in standard C.

nml is a simple matrix and linear algebra library written in standard C.

Andrei Ciobanu 45 Dec 9, 2022
SIMD (SSE) implementation of the infamous Fast Inverse Square Root algorithm from Quake III Arena.

simd_fastinvsqrt SIMD (SSE) implementation of the infamous Fast Inverse Square Root algorithm from Quake III Arena. Why Why not. How This video explai

Liam 7 Oct 4, 2022
Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)

KFR - Fast, modern C++ DSP framework Compiler support: https://www.kfr.dev KFR is an open source C++ DSP framework that focuses on high performance (s

KFR 1.4k Jan 1, 2023
MIRACL Cryptographic SDK: Multiprecision Integer and Rational Arithmetic Cryptographic Library is a C software library that is widely regarded by developers as the gold standard open source SDK for elliptic curve cryptography (ECC).

MIRACL What is MIRACL? Multiprecision Integer and Rational Arithmetic Cryptographic Library – the MIRACL Crypto SDK – is a C software library that is

MIRACL 527 Jan 7, 2023
A C library for statistical and scientific computing

Apophenia is an open statistical library for working with data sets and statistical or simulation models. It provides functions on the same level as t

null 186 Sep 11, 2022
P(R*_{3, 0, 1}) specialized SIMD Geometric Algebra Library

Klein ?? ?? Project Site ?? ?? Description Do you need to do any of the following? Quickly? Really quickly even? Projecting points onto lines, lines t

Jeremy Ong 635 Dec 30, 2022
linalg.h is a single header, public domain, short vector math library for C++

linalg.h linalg.h is a single header, public domain, short vector math library for C++. It is inspired by the syntax of popular shading and compute la

Sterling Orsten 758 Jan 7, 2023
a lean linear math library, aimed at graphics programming. Supports vec3, vec4, mat4x4 and quaternions

linmath.h -- A small library for linear math as required for computer graphics linmath.h provides the most used types required for programming compute

datenwolf 729 Jan 9, 2023
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.

OpenBLAS Travis CI: AppVeyor: Drone CI: Introduction OpenBLAS is an optimized BLAS (Basic Linear Algebra Subprograms) library based on GotoBLAS2 1.13

Zhang Xianyi 4.9k Jan 5, 2023
The QuantLib C++ library

QuantLib: the free/open-source library for quantitative finance The QuantLib project (http://quantlib.org) is aimed at providing a comprehensive softw

Luigi Ballabio 3.6k Dec 30, 2022
A C++ header-only library of statistical distribution functions.

StatsLib StatsLib is a templated C++ library of statistical distribution functions, featuring unique compile-time computing capabilities and seamless

Keith O'Hara 423 Jan 3, 2023
RcppFastFloat: Rcpp Bindings for the fastfloat C++ Header-Only Library

Converting ascii text into (floating-point) numeric values is a very common problem. The fast_float header-only C++ library by Daniel Lemire does this very well, and very fast at up to or over to 1 gigabyte per second as described in more detail in a recent arXiv paper.

Dirk Eddelbuettel 18 Nov 15, 2022
📽 Highly optimized 2D|3D math library, also known as OpenGL Mathematics (glm) for `C

Highly optimized 2D|3D math library, also known as OpenGL Mathematics (glm) for `C`. cglm provides lot of utils to help math operations to be fast and quick to write. It is community friendly, feel free to bring any issues, bugs you faced.

Recep Aslantas 1.6k Jan 2, 2023
✨sigmatch - Modern C++ 20 Signature Match / Search Library

sigmatch Modern C++ 20 Signature Match / Search Library ✨ Features ?? Header-only, no dependencies, no exceptions. ☕ Compile-time literal signature st

Sprite 55 Dec 27, 2022
C++ library for solving large sparse linear systems with algebraic multigrid method

AMGCL AMGCL is a header-only C++ library for solving large sparse linear systems with algebraic multigrid (AMG) method. AMG is one of the most effecti

Denis Demidov 578 Dec 11, 2022