Revision b574878c983651e9231d1251ee7cb1edc0762e0f authored by hariszaf on 06 August 2020, 12:41:15 UTC, committed by GitHub on 06 August 2020, 12:41:15 UTC
* Create setup_hz.py

* Create bindings_hz.cpp

* Create volestipy_hz.pyx

* Create bindings_hz.h

* Update bindings_hz.h

* Update bindings_hz.cpp

* Create volestipy_old.pyx

* Delete volestipy_hz.pyx

* Create bindings_old.cpp

* Delete bindings_hz.cpp

* Update bindings.cpp

* Create bindings_old.h

* Delete bindings_hz.h

* Create setup_old.py

* Delete setup_hz.py

* Update setup.py

* Update volestipy.pyx

* Update bindings.h

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update setup.py

* Update bindings.h

* Update setup.py

* Update setup_old.py

* Update bindings.cpp

* Update setup.py

* Update setup.py

* Update volestipy.pyx

* Update test1.py

* Create test1_old.py

* Update test1.py

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.h

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update bindings.h

* Update bindings.cpp

* Update bindings.h

* Update setup.py

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update volume_cb_hpolytope.cpp

* Update test1.py

* Update bindings.cpp

* Update test1.py

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Create .gitignore

* Delete test1_old.py

* Delete setup_old.py

* Delete bindings_old.h

* Delete bindings_old.cpp

* Delete volestipy_old.pyx

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update .gitignore

* Update volume_cb_hpolytope.cpp

* Update test1.py

* Update test2.py

* Update bindings.h

* Update setup.py

* Update credits.md

* on .gitignore: files on test/Testing/Temporary/ were removed from the .gitignore file

* first attempt - not working - for rounding

* rounding function: does not work; trying to figure it out

* round_val now works; still new_A and new_b need to be included

* Create metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update metabolic_net_pipeline.ipynb

* Update volestipy.pyx

* Update bindings.cpp

* Create test_rounding.py

* Create test1.py

* Create test2.py

* Delete test2.py

* Update test1.py

* Create metabolic_net_pipeline-checkpoint.ipynb

* Update setup.py

* Update .gitignore

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update bindings.h

* Update bindings.cpp

* Update bindings.cpp

* Update test1.py

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update test_rounding.py

* Create test_rounding.py

* Delete test1.py

* Update test_rounding.py

* Update test1.py

* Update bindings.cpp

* Update volestipy.pyx

* Update test_rounding.py

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update test_rounding.py

* Update bindings.h

* Update bindings.cpp

* Update volestipy.pyx

* Update test_rounding.py

* Update bindings.cpp

print all dimensions of the variables included in cpp

* Update volestipy.pyx

print all dimensions of the variables included in cython

* Update volestipy.pyx

* Update bindings.cpp

* Update bindings.h

* Update test_rounding.py

* Update bindings.cpp

* Update bindings.cpp

* Update volestipy.pyx

* Update volestipy.pyx

* Update bindings.cpp

correct the dimensions of the shift and the T_matrix; that was the cause of the strange memory errors we used to get (e.g free(): invalid pointer , Fatal Python error: GC object already tracked etc)

* Delete test_rounding.py

* Update test_rounding.py

* Update setup.py

* Update bindings.h

* Update bindings.cpp

remove print lines for checking dimensions

* Update volestipy.pyx

remove print lines for checking dimensions

* Update bindings.h

* Update bindings.cpp

better variable names

* Update volestipy.pyx

better variable names

* Update .gitignore

* Update test_rounding.py

* Update .gitignore

add .ipynb to the .gitignore of the branch

* Update .gitignore

* Update .gitignore

* Update .gitignore

* Delete metabolic_net_pipeline.ipynb

* Update bindings.cpp

change variables names

* Update bindings.cpp

change variable names - correct

* Delete metabolic_net_pipeline-checkpoint.ipynb

remove jupyter hidden directory

* Delete test1.py

* Delete test2.py

* Create test_compute_volume.py

test script for the compute_volume() function

* Create test_random_sampling.py

test script for the random_sampling() function

* Update test_rounding.py

test script for the rounding() function
1 parent dae7b62
Raw File
sphere.hpp
// VolEsti (volume computation and sampling library)

// Copyright (c) 2012-2020 Vissarion Fisikopoulos
// Copyright (c) 2018-2020 Apostolos Chalkis

//Contributed and/or modified by Repouskos Panagiotis, as part of Google Summer of Code 2019 program.

// Licensed under GNU LGPL.3, see LICENCE file


#ifndef SAMPLERS_SPHERE_HPP
#define SAMPLERS_SPHERE_HPP


template <typename Point>
struct GetDirection
{
    typedef typename Point::FT NT;

    template <typename RandomNumberGenerator>
    inline static Point apply(unsigned int const& dim,
                              RandomNumberGenerator &rng,
                              bool normalize=true)
    {
        NT normal = NT(0);
        Point p(dim);
        NT* data = p.pointerToData();

        for (unsigned int i=0; i<dim; ++i)
        {
            *data = rng.sample_ndist();
            normal += *data * *data;
            data++;
        }

        normal = NT(1)/std::sqrt(normal);
        if (normalize) p *= normal;

        return p;
    }
};

template <typename Point>
struct GetPointInDsphere
{
    template <typename NT, typename RandomNumberGenerator>
    inline static Point apply(unsigned int const& dim,
                              NT const& radius,
                              RandomNumberGenerator &rng)
    {
        Point p = GetDirection<Point>::apply(dim, rng);
        NT U = rng.sample_urdist();
        U = std::pow(U, NT(1)/(NT(dim)));
        p *= radius * U;
        return p;
    }
};

template <typename Point>
struct GetPointOnDsphere
{
    template <typename NT, typename RandomNumberGenerator>
    inline static Point apply(unsigned int const& dim,
                              NT const& radius,
                              RandomNumberGenerator &rng)
    {
        Point p = GetDirection<Point>::apply(dim, rng);
        if (radius != 0) p *= radius;
        return p;
    }
};



#endif // SPHERE_HPP
back to top