awsteiner / o2scl Goto Github PK
View Code? Open in Web Editor NEWObject-oriented Scientific Computing Library
Home Page: https://awsteiner.org/code/o2scl
License: GNU General Public License v3.0
Object-oriented Scientific Computing Library
Home Page: https://awsteiner.org/code/o2scl
License: GNU General Public License v3.0
Good stuff! More happy to using this library than gsl in c-style , but three small questions:
1 ../../include/o2scl/hdf_file.h:31:18: fatal error: hdf5.h: No such file or directory
#include <hdf5.h>
In fact , I never use hdf5, so the add some condition compilings into conf?
2 No unit test?
3 chmod +x autogen.sh :)
I think most people would expect the abs()
function in the math parser to return the absolute value as double (c++ fabs
), not as integer as it is right now (c++ abs
).
When running make check
on some systems (specifically, building packages for openSUSE Leap 15.2 and older), the eos_nse_full_ts
test aborts with an overflow error:
[ 953s] terminate called after throwing an instance of 'o2scl::exc_overflow_error'
[ 953s] what(): Error eovrflw in file exp.c at line 542.
[ 953s] overflow
[ 953s] /bin/sh: line 1: 4179 Aborted ./eos_nse_full_ts > eos_nse_full.scr
I say some systems, because the test succeeds on a system with gcc 10.2
but gives the above error when using gcc 7
up to gcc 9
. You may find the build status for different versions of openSUSE here:
https://build.opensuse.org/package/show/home:badshah400:branches:science/o2scl.
The full build log from the system with the test error is attached:
_log.zip
Not seen with version 0.924 which builds successfully on all these systems.
Thanks.
The computer is ubuntu 18.40
g++ (Ubuntu 7.4.0-1ubuntu1~18.04.1) 7.4.0
with a GPU
These are the steps I followed:
download from https://github.com/awsteiner/o2scl
cd o2scl-master
./autgen.sh
make
The recursive make fails at html folder.
o2scl_Installation.txt
Please advise.
Dear Andrew,
Could you extend the documentation by providing a simple example for multidimensional interpolation on a regular grid, please. In particular, how to enter and allocate space for tensor elements and how to save/load them. I suppose, this is done in the third-party libraries, but a basic example will be very helpful anyway.
Would the interpolation work a bit outside the domain (as extrapolation)? This could have been a useful feature.
Thank you!
Sergey
When building o2scl 0.925
against GCC 11, which enforces -std=c++17
by default, the following error shows up during make check
. See here for full spec file. Full build log attached at the bottom.
[ 200s] g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include/ -DO2SCL_DATA_DIR=\"/usr/share/o2scl/\" -DO2SCL_PART -DO2SCL_EOS -DO2SCL_HDF -DO2SCL_EIGEN -DO2SCL_COND_FLAG -DO2SCL_PLAIN_HDF5_HEADER -DO2SCL_HDF5_PRE_1_12 -c -o inte_qags_gsl_ts.o inte_qags_gsl_ts.cpp
[ 203s] inte_qng_gsl_ts.cpp: In function 'int main()':
[ 203s] inte_qng_gsl_ts.cpp:90:24: error: no matching function for call to 'bind(<unresolved overloaded function type>, const std::_Placeholder<1>&, int&)'
[ 203s] 90 | funct f=std::bind(legendre,std::placeholders::_1,n);
[ 203s] | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 203s] In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
[ 203s] from /usr/include/c++/11/algorithm:74,
[ 203s] from /usr/include/boost/numeric/ublas/storage.hpp:16,
[ 203s] from /usr/include/boost/numeric/ublas/vector.hpp:21,
[ 203s] from ../../include/o2scl/table.h:41,
[ 203s] from ../../include/o2scl/table_units.h:30,
[ 203s] from ../../include/o2scl/test_mgr.h:38,
[ 203s] from inte_qng_gsl_ts.cpp:36:
[ 203s] /usr/include/c++/11/functional:789:5: note: candidate: 'template<class _Func, class ... _BoundArgs> typename std::_Bind_helper<std::__is_socketlike<_Func>::value, _Func, _BoundArgs ...>::type std::bind(_Func&&, _BoundArgs&& ...)'
[ 203s] 789 | bind(_Func&& __f, _BoundArgs&&... __args)
[ 203s] | ^~~~
[ 203s] /usr/include/c++/11/functional:789:5: note: template argument deduction/substitution failed:
[ 203s] inte_qng_gsl_ts.cpp:90:24: note: couldn't deduce template parameter '_Func'
[ 203s] 90 | funct f=std::bind(legendre,std::placeholders::_1,n);
[ 203s] | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 203s] In file included from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
[ 203s] from /usr/include/c++/11/algorithm:74,
[ 203s] from /usr/include/boost/numeric/ublas/storage.hpp:16,
[ 203s] from /usr/include/boost/numeric/ublas/vector.hpp:21,
[ 203s] from ../../include/o2scl/table.h:41,
[ 203s] from ../../include/o2scl/table_units.h:30,
[ 203s] from ../../include/o2scl/test_mgr.h:38,
[ 203s] from inte_qng_gsl_ts.cpp:36:
[ 203s] /usr/include/c++/11/functional:813:5: note: candidate: 'template<class _Result, class _Func, class ... _BoundArgs> typename std::_Bindres_helper<_Result, _Func, _BoundArgs>::type std::bind(_Func&&, _BoundArgs&& ...)'
[ 203s] 813 | bind(_Func&& __f, _BoundArgs&&... __args)
[ 203s] | ^~~~
[ 203s] /usr/include/c++/11/functional:813:5: note: template argument deduction/substitution failed:
[ 203s] inte_qng_gsl_ts.cpp:90:24: note: couldn't deduce template parameter '_Result'
[ 203s] 90 | funct f=std::bind(legendre,std::placeholders::_1,n);
[ 203s] | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 204s] make[3]: *** [Makefile:676: inte_qng_gsl_ts.o] Error 1
Full build log: _log.zip
Thanks.
Oddly LU decomposition tests fail on x86_64 architectures while passing on i586 (gcc 9.2.1, boost 1.69, armadillo 9.700.2):
[ 1354s] Some tests failed in file: lu.scr
[ 1354s] O2scl range checking on.
[ 1354s] FAIL: relative matrix max=1.240624e+01
[ 1354s] LU decomp
[ 1354s] FAIL: relative matrix max=1.240624e+01
[ 1354s] LU decomp
[ 1354s] FAIL: relative matrix max=1.000000e+00
[ 1354s] LU decomp
[ 1354s] FAIL: relative matrix max=1.032563e+01
[ 1354s] LU decomp
[ 1354s] FAIL: relative matrix max=1.240624e+01
[ 1354s] LU decomp
[ 1354s] FAIL: relative matrix max=4.505220e+00
[ 1354s] LU decomp
[ 1354s] FAIL: relative matrix max=3.671611e+00
[ 1354s] LU decomp
[ 1354s] 147 tests performed.
[ 1354s] At least one test failed.
[ 1354s] Last failed test: max=3.671611e+00
[ 1354s] LU decomp
[ 1354s] One or more O2scl tests failed.
Full build log here: https://paste.opensuse.org/78728641
Hi,
Many thanks for your library, which I have benefited from in my work. I also package your library for openSUSE, where it is available from the default repository.
However, it seems that on 32-bit machines the test fix_fit
, a part of make check
, is failing; while it is perfectly fine on 64-bit machines. Here is a snippet from the log file:
[ 302s] ./fit_fix_ts > fit_fix.scr
[ 302s] ./fit_nonlin_ts > fit_nonlin.scr
[ 311s] /bin/sh ../../libtool --tag=CXX --mode=link g++ -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -o fit_linear_ts fit_linear_ts.o ../hdf/libo2scl_hdf.la ../libo2scl.la -lhdf5_hl -lhdf5 -lreadline -lgsl -lgslcblas -lm
[ 311s] libtool: link: g++ -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -o .libs/fit_linear_ts fit_linear_ts.o ../hdf/.libs/libo2scl_hdf.so ../.libs/libo2scl.so -lhdf5_hl -lhdf5 -lreadline -lgsl -lgslcblas -lm
[ 311s] ./fit_linear_ts > fit_linear.scr
[ 311s] echo fit_base.scr fit_min.scr fit_fix.scr fit_linear.scr fit_nonlin.scr > testlist
[ 311s] ../internal/tsumm
[ 312s] Summarizing test results from files:
[ 312s] fit_base.scr
[ 312s] fit_min.scr
[ 312s] fit_fix.scr
[ 312s] fit_linear.scr
[ 312s] fit_nonlin.scr
[ 312s]
[ 312s] Some tests failed in file: fit_fix.scr
[ 312s] Normal fit_nonlin using normal function:
[ 312s]
[ 312s] Normal fit_nonlin fixing first parameter:
[ 312s]
[ 312s] Normal fit_nonlin fixing second parameter:
[ 312s]
[ 312s] Normal fit_nonlin fixing third parameter:
[ 312s]
[ 312s] Using fit_fix::fit() fitting all parameters:
[ 312s]
[ 312s] Using fit_fix::fit_fix() fitting all parameters:
[ 312s]
[ 312s] Using fit_fix and fixing first parameter:
[ 312s]
[ 312s]
[ 312s] Using fit_fix and fixing second parameter:
[ 312s]
[ 312s]
[ 312s] Using fit_fix and fixing third parameter:
[ 312s]
[ 312s] FAIL: relative matrix max=8.295997e-09
[ 312s] covar_31/32
[ 312s]
[ 312s] 27 tests performed.
[ 312s] At least one test failed.
[ 312s] Last failed test: max=8.295997e-09
[ 312s] covar_31/32
[ 312s] One or more O2scl tests failed.
Any help to fix this would be welcome.
I created a theory where the Universe is a Lightspeed Expanding Hyperspherical Hypersurface. At time zero the Universe had a 4D radius of 121.4 light-seconds. This is known because my theory can predict the maximum density in a Black Hole.
As the Black Hole expands, it make a phase transition into a Neutron Star. Because of the topology, Gravitation is irrelevant.
The energy from the Big Bang comes from the neutron decay when the density reaches 300 MeV/fm**3. That happens when the 4D radius is 804.9 light-seconds.
I need to calculate the value of x (fraction of proton) as the density decreases due to the inertial expansion.
The fraction of protons will define the available energy available to excite hyperspherical acoustic oscillations. The fast decay of the speed of sound inside the Neutronium works as a short-pass filter because longer wavelengths take longer to be recur. So, there is no adjustable parameters in my theory and my expectation is that I will get the observed CMB observed modulation.
I would like your advice on how to use o2scl to model the Big Bang process. My initial idea was just to make pressure equal to zero to get the value of x as the density decays in a known fashion.
Knowing the available energy at any given time, one would create a feedback loop to reproduce the fact that energy being released in a region makes that region less dense and that increases the local neutron decay rate.
Ideally, I would like to make the full simulation. That might be as easy as a single short python script.
Please advise.
When building o2scl on openSUSE Tumbleweed x86_64, the following test fails:
[ 505s] Some tests failed in file: eos_quark_cfl6.scr
[ 505s] FAIL: relative -3.464038e-03 vs. -3.465802e-03 : 5.091260e-04 > 1.000000e-06
[ 505s] dmuu
[ 505s] 8261 tests performed.
[ 505s] At least one test failed.
[ 505s] Last failed test: -3.464038e-03 vs. -3.465802e-03 : 5.091260e-04 > 1.000000e-06
[ 505s] dmuu
[ 505s] One or more O2scl tests failed.
This used to work with o2scl version v0.926, but with v0.927 using CXXFLAGS+=" -DO2SCL_PLAIN_HDF5_HEADER"
does not help compilations when hdf5 uses the plain header:
[ 24s] /usr/bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include/ -DO2SCL_DATA_DIR=\"/usr/share/o2scl/\" -DO2SCL_DOC_DIR=\"/usr/share/doc/o2scl/\" -DO2SCL_EIGEN -DO2SCL_COND_FLAG -DO2SCL_READLINE -DO2SCL_LINUX -I -DO2SCL_PLAIN_HDF5_HEADER -c -o cli.lo cli.cpp
[ 24s] libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include/ -DO2SCL_DATA_DIR=\"/usr/share/o2scl/\" -DO2SCL_DOC_DIR=\"/usr/share/doc/o2scl/\" -DO2SCL_EIGEN -DO2SCL_COND_FLAG -DO2SCL_READLINE -DO2SCL_LINUX -I -DO2SCL_PLAIN_HDF5_HEADER -c cli.cpp -fPIC -DPIC -o .libs/cli.o
[ 24s] In file included from cli.cpp:26:
[ 24s] ../../include/o2scl/hdf_file.h:35:10: fatal error: hdf5/serial/hdf5.h: No such file or directory
[ 24s] 35 | #include <hdf5/serial/hdf5.h>
[ 24s] | ^~~~~~~~~~~~~~~~~~~~
[ 24s] compilation terminated.
[ 24s] make[4]: *** [Makefile:1051: cli.lo] Error 1
[ 24s] make[4]: Leaving directory '/home/abuild/rpmbuild/BUILD/o2scl-0.927/src/base'
[ 24s] make[4]: *** Waiting for unfinished jobs....
[ 25s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/o2scl-0.927/src/base'
[ 25s] /usr/bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include/ -DO2SCL_DATA_DIR=\"/usr/share/o2scl/\" -DO2SCL_DOC_DIR=\"/usr/share/doc/o2scl/\" -DO2SCL_EIGEN -DO2SCL_COND_FLAG -DO2SCL_READLINE -DO2SCL_LINUX -I -DO2SCL_PLAIN_HDF5_HEADER -c -o lib_settings.lo lib_settings.cpp
[ 25s] libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include/ -DO2SCL_DATA_DIR=\"/usr/share/o2scl/\" -DO2SCL_DOC_DIR=\"/usr/share/doc/o2scl/\" -DO2SCL_EIGEN -DO2SCL_COND_FLAG -DO2SCL_READLINE -DO2SCL_LINUX -I -DO2SCL_PLAIN_HDF5_HEADER -c lib_settings.cpp -fPIC -DPIC -o .libs/lib_settings.o
[ 25s] lib_settings.cpp:38:10: fatal error: hdf5/serial/hdf5.h: No such file or directory
[ 25s] 38 | #include <hdf5/serial/hdf5.h>
[ 25s] | ^~~~~~~~~~~~~~~~~~~~
[ 25s] compilation terminated.
[ 25s] make[4]: *** [Makefile:1051: lib_settings.lo] Error 1
Specific library versions:
/usr/include/hdf5.h
, /usr/include/hdf5_hl.h
)Full build log attached for reference
_log.zip
Hi! I try to compile and make o2scl with gcc 4.8 on Linux Ubuntu 14.04 and get a error:
make[3]: Entering directory `/home/sergey/Downloads/o2scl-0.918/src/eos'
/bin/bash ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include/ -DO2SCL_DATA_DIR="/usr/local/share/o2scl/" -DO2SCL_PART -DO2SCL_EOS -DO2SCL_HDF -DO2SCL_COND_FLAG -g -O2 -std=gnu++11 -MT nstar_rot.lo -MD -MP -MF .deps/nstar_rot.Tpo -c -o nstar_rot.lo nstar_rot.cpp
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../.. -I../../include/ -DO2SCL_DATA_DIR="/usr/local/share/o2scl/" -DO2SCL_PART -DO2SCL_EOS -DO2SCL_HDF -DO2SCL_COND_FLAG -g -O2 -std=gnu++11 -MT nstar_rot.lo -MD -MP -MF .deps/nstar_rot.Tpo -c nstar_rot.cpp -fPIC -DPIC -o .libs/nstar_rot.o
In file included from nstar_rot.cpp:39:0:
/usr/local/include/gsl/gsl_sf_legendre.h:323:33: error: 'size_t' does not name a type
const size_t lmax, const double x,
^
I've the following error message when compiling a program that includes mroot_hybrids.h
to solve a system of equations.
In file included from /usr/local/include/o2scl/search_vec.h:34:0,
from /usr/local/include/o2scl/interp.h:59,
from /usr/local/include/o2scl/table.h:41,
from /usr/local/include/o2scl/table_units.h:30,
from /usr/local/include/o2scl/test_mgr.h:34,
from mix.cpp:22:
/usr/local/include/o2scl/vector.h: In function ‘void o2scl::vector_grid(o2scl::uniform_grid<data_t>, vec_t&)’:
/usr/local/include/o2scl/vector.h:2360:7: error: invalid use of ‘class std::vector<vec_t>’
g.template vector<vec_t>(v);
Line mix.cpp:22
is #include <o2scl/mroot_hybrids.h>
. The relevant code is just
template<size_t something>
using Vectord = Matrix<double, N, 1, 0>;
template<size_t N>
using Matrixd = Matrix<double, N, N, 0>;
// ...
typedef std::function<int(size_t, const Vectord<10>&, Vectord<10>&)> mm_funct_eigen;
typedef std::function<int(size_t, const Vectord<10>&, size_t, Vectord<10>&, Matrixd<10>&)> jac_funct_eigen;
mroot_hybrids<mm_funct_eigen, Vectord<10>, Matrixd<10>,jac_funct_eigen> cr;
int fail = cr.msolve(10, x, f);
I'm thinking this is a bug in the library. I built o2scl with --enable-eigen
. Can you comment? Thanks!
I installed the o2scl-0.923 version. the installation was fine. but when i started compiling the program files, it shows errors.
for example, i wanted to compile hdf_nucmass_io.cpp file:
g++ -Wall -c "hdf_nucmass_io.cpp" (in directory: /home/ishfaq/o2scl-0.924/src/nuclei)
In file included from hdf_nucmass_io.cpp:24:0:
/usr/local/include/o2scl/hdf_nucmass_io.h:35:10: fatal error: hdf5.h: No such file or directory
#include <hdf5.h>
^~~~~~~~
compilation terminated.
Compilation failed.
o2scl version: 0.922
When building on openSUSE, running make check results in one test failing: FAIL: general glob test
Here is the full output from the src/base/misc.scr
file in the build directory that shows this failing test:
test1 test_of_string4 test_of_string7 test_of_string10
test_of_string2 test5 test_of_string8
test_of_string3 test_of_string6 test_of_string9
PASS: general screenify
PASS: general count1
PASS: general count2
PASS: general count3
Whitespace characters: 9 10 11 12 13 32
4.69516e-18 0 3.84407e-18
0 -1.000000e+00
1 -9.975274e-01
2 -8.807971e-01
3 -1.192029e-01
4 -2.472623e-03
5 +0.000000e+00
6 +2.472623e-03
7 +1.192029e-01
8 +8.807971e-01
9 +1.000000e+00
10 -1.000000e+00
11 -9.975274e-01
12 -8.807971e-01
13 -1.192029e-01
14 -2.472623e-03
PASS: general remove_whitespace()
PASS: general remove_whitespace()
PASS: general vec_index 1
PASS: general vec_index 2
PASS: general vec_index 3
PASS: general vec_index 4
PASS: general vec_index 5
PASS: general vec_index 6
PASS: general vec_index 7
PASS: general vec_index 8
FAIL: general glob test
15 tests performed.
At least one test failed.
Last failed test: glob test
When building o2scl version 0.926 on openSUSE Tumbleweed, one of the tests fails on x86_64
(but not on 32 bit arch) due to tolerance issues:
[ 606s] Some tests failed in file: eos_quark_cfl6.scr
[ 606s] FAIL: relative -2.287555e-03 vs. -2.287281e-03 : 1.193674e-04 > 1.000000e-04
[ 606s] qqu
[ 606s] 8261 tests performed.
[ 606s] At least one test failed.
[ 606s] Last failed test: -2.287555e-03 vs. -2.287281e-03 : 1.193674e-04 > 1.000000e-04
[ 606s] qqu
[ 606s] One or more O2scl tests failed.
Some details about the system configuration and libraries used when building as follows:
Thanks again for the great library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.