Commit 3c59d50d authored by Ben Huber's avatar Ben Huber
Browse files

Merge branch 'v3'

parents c250eff1 db438b85
Pipeline #745 canceled with stages
in 1 minute and 28 seconds
...@@ -5,7 +5,7 @@ CXX = clang++ ...@@ -5,7 +5,7 @@ CXX = clang++
DEBUG += -g # Adds debug symbols DEBUG += -g # Adds debug symbols
LOGGING += -D INFO_ # Information that is not linked to any unexpected behaviour but might nevertheless be of interest. LOGGING += -D XERUS_LOG_INFO # Information that is not linked to any unexpected behaviour but might
#================================================================================================= #=================================================================================================
# External libraries # External libraries
......
...@@ -7,8 +7,6 @@ STRICT_WARNINGS = TRUE ...@@ -7,8 +7,6 @@ STRICT_WARNINGS = TRUE
DEBUG += -g # Adds debug symbols DEBUG += -g # Adds debug symbols
LOGGING += -D INFO_ # Information that is not linked to any unexpected behaviour but might nevertheless be of interest.
#================================================================================================= #=================================================================================================
# External libraries # External libraries
#================================================================================================= #=================================================================================================
...@@ -16,7 +14,4 @@ BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial ...@@ -16,7 +14,4 @@ BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr SUITESPARSE = -lcholmod -lspqr
OTHER += -I /usr/include/python2.7/ -lboost_python -I/usr/lib64/python2.7/site-packages/numpy/core/include/ -lpython2.7 -fno-var-tracking-assignments
# custom include paths \ No newline at end of file
# OTHER += -I /path/to/include
...@@ -6,13 +6,13 @@ CXX = g++ ...@@ -6,13 +6,13 @@ CXX = g++
STRICT_WARNINGS = TRUE STRICT_WARNINGS = TRUE
HIGH_OPTIMIZATION = TRUE # Activates -O3 -march=native and some others HIGH_OPTIMIZATION = TRUE # Activates -O3 -march=native and some others
DEBUG += -D DISABLE_RUNTIME_CHECKS_ # Disable all runtime checks DEBUG += -D XERUS_DISABLE_RUNTIME_CHECKS # Disable all runtime checks
DEBUG += -D REPLACE_ALLOCATOR DEBUG += -D XERUS_REPLACE_ALLOCATOR
DEBUG += -g # Adds debug symbols DEBUG += -g # Adds debug symbols
LOGGING += -D INFO_ # Information that is not linked to any unexpected behaviour but might nevertheless be of interest. LOGGING += -D XERUS_LOG_INFO # Information that is not linked to any unexpected behaviour bu
#================================================================================================= #=================================================================================================
# External libraries # External libraries
......
...@@ -13,12 +13,19 @@ ...@@ -13,12 +13,19 @@
!*.mk !*.mk
!Makefile !Makefile
!.gitignore
!*.sh !*.sh
!*.rb
!*.py
!*.md !*.md
!*.xml !*.xml
!*.dox !*.dox
!*.css
!*.js
!*.yml
# ...even if they are in subdirectories # ...even if they are in subdirectories
!*/ !*/
...@@ -26,6 +33,5 @@ ...@@ -26,6 +33,5 @@
# However we really want to ignore # However we really want to ignore
lapacke/* lapacke/*
build/* build/*
doc/latex/*
doc/html/* doc/html/*
config.mk config.mk
...@@ -3,8 +3,10 @@ stages: ...@@ -3,8 +3,10 @@ stages:
- test_gcc - test_gcc
- build_gcc_nocheck - build_gcc_nocheck
- test_gcc_nocheck - test_gcc_nocheck
- build_python
- build_clang - build_clang
- test_clang - test_clang
- build_homepage
job_make_gcc: job_make_gcc:
stage: build_gcc stage: build_gcc
...@@ -23,6 +25,11 @@ job_test_gcc_nocheck: ...@@ -23,6 +25,11 @@ job_test_gcc_nocheck:
stage: test_gcc_nocheck stage: test_gcc_nocheck
script: "cp ../XerusTest .; ./XerusTest all" script: "cp ../XerusTest .; ./XerusTest all"
job_build_python:
stage: build_python
script: "g++ --version; cp .config.mk.ci.gcc config.mk; make python"
when: always
job_make_clang: job_make_clang:
stage: build_clang stage: build_clang
script: "clang++ --version; cp .config.mk.ci.clang config.mk; make XerusTest; cp XerusTest ../" script: "clang++ --version; cp .config.mk.ci.clang config.mk; make XerusTest; cp XerusTest ../"
...@@ -32,3 +39,10 @@ job_test_clang: ...@@ -32,3 +39,10 @@ job_test_clang:
stage: test_clang stage: test_clang
script: "cp ../XerusTest .; ./XerusTest all" script: "cp ../XerusTest .; ./XerusTest all"
job_build_homepage:
stage: build_homepage
script: "make doc; scp -rv doc/html xerusweb:libxerus.org-443/html"
when: always
only:
- master
allow_failure: true
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
Potentially breaking changes are marked with an exclamation point '!' at the begin of their description. Potentially breaking changes are marked with an exclamation point '!' at the begin of their description.
* 2017-05-29 v3.0.0
* Python wrapper now stable.
* ! REQUIRE macro now logs as error instead of fatal error.
* ! All macros and preprocessor defines now use the XERUS_ prefix. The config.mk file changed accordingly.
* ! TT::find_largest_entry and TT::dyadic_product left the TT scope.
* ! Tensor::modify_diag_elements renamed to Tensor::modify_diagonal_entries for naming consistency.
* Much faster solve of matrix equations Ax=b by exploiting symmetry and definiteness where possible. This directly speeds up the ALS as well.
* Added Tensor.one_norm() and one_norm(Tensor) to calculate the one norm of a Tensor.
* New documentation ('make doc') and homepage.
* Some minor bugfixes and performance improvements.
* 2016-06-23 v2.4.0 * 2016-06-23 v2.4.0
* Introduced nomeclature 'mode'. Marked all functions that will be renamed / removed in v3.0.0 as deprecated. * Introduced nomeclature 'mode'. Marked all functions that will be renamed / removed in v3.0.0 as deprecated.
* Added an experimental python wrapper when 'OTHER += -DXERUS_EXPERIMENTAL_PYTHON_WRAPPER' is defined in the config file. * Added an experimental python wrapper when 'OTHER += -DXERUS_EXPERIMENTAL_PYTHON_WRAPPER' is defined in the config file.
...@@ -18,7 +29,7 @@ Potentially breaking changes are marked with an exclamation point '!' at the beg ...@@ -18,7 +29,7 @@ Potentially breaking changes are marked with an exclamation point '!' at the beg
* Bug fix in the handling of fixed indices in TensorNetworks. * Bug fix in the handling of fixed indices in TensorNetworks.
* Several static member function now warn if their return type is not used. * Several static member function now warn if their return type is not used.
* Initial support for compilation with the intel ICC. * Initial support for compilation with the intel ICC.
* 2016-03-11 v2.2.1 * 2016-03-11 v2.2.1
* Added support for 32bit systems. * Added support for 32bit systems.
......
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
# Set the names of the resulting binary codes # Default rule should be the help message
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
help:
@printf "Possible make targets are:\n \
\t\tshared \t\t -- Build xerus as a shared library.\n \
\t\tstatic \t\t -- Build xerus as a static library.\n \
\t\tpython \t\t -- Build the xerus python wrappers.\n \
\t\tdoc \t\t -- Build the html documentation for the xerus library.\n \
\t\tinstall \t -- Install the shared library and header files (may require root).\n \
\t\ttest \t\t -- Build and run the xerus unit tests.\n \
\t\tclean \t\t -- Remove all object, library and executable files.\n"
# Names of the Library
LIB_NAME_SHARED = build/lib/libxerus.so # ------------------------------------------------------------------------------------------------------
LIB_NAME_STATIC = build/lib/libxerus.a # Set the names of the resulting binary codes
# ------------------------------------------------------------------------------------------------------
# Name of the test executable # Name of the test executable
TEST_NAME = XerusTest TEST_NAME = XerusTest
...@@ -35,22 +45,33 @@ DEBUG += -DXERUS_VERSION_COMMIT=$(XERUS_COMMIT_V) ...@@ -35,22 +45,33 @@ DEBUG += -DXERUS_VERSION_COMMIT=$(XERUS_COMMIT_V)
# Register source files for the xerus library # Register source files for the xerus library
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
# Register all library source files # Register the source files
LIB_SOURCES = $(wildcard src/xerus/*.cpp) XERUS_SOURCES = $(wildcard src/xerus/*.cpp)
LIB_SOURCES += $(wildcard src/xerus/*/*.cpp) XERUS_SOURCES += $(wildcard src/xerus/algorithms/*.cpp)
XERUS_SOURCES += $(wildcard src/xerus/examples/*.cpp)
MISC_SOURCES = $(wildcard src/xerus/misc/*.cpp)
PYTHON_SOURCES = $(wildcard src/xerus/python/*.cpp)
TEST_SOURCES = $(wildcard src/xerus/test/*.cpp)
# Register all unit test source files
UNIT_TEST_SOURCES = $(wildcard src/unitTests/*.cxx) UNIT_TEST_SOURCES = $(wildcard src/unitTests/*.cxx)
# Register all tutorial source files
TUTORIAL_SOURCES = $(wildcard tutorials/*.cpp) TUTORIAL_SOURCES = $(wildcard tutorials/*.cpp)
# Create lists of the corresponding objects and dependency files # Create lists of the corresponding objects and dependency files
LIB_OBJECTS = $(LIB_SOURCES:%.cpp=build/.libObjects/%.o) XERUS_OBJECTS = $(XERUS_SOURCES:%.cpp=build/.libObjects/%.o)
LIB_DEPS = $(LIB_SOURCES:%.cpp=build/.libObjects/%.d) XERUS_DEPS = $(XERUS_SOURCES:%.cpp=build/.libObjects/%.d)
TEST_OBJECTS = $(LIB_SOURCES:%.cpp=build/.testObjects/%.o) MISC_OBJECTS = $(MISC_SOURCES:%.cpp=build/.miscObjects/%.o)
TEST_DEPS = $(LIB_SOURCES:%.cpp=build/.testObjects/%.d) MISC_DEPS = $(MISC_SOURCES:%.cpp=build/.miscObjects/%.d)
PYTHON_OBJECTS = $(PYTHON_SOURCES:%.cpp=build/.pythonObjects/%.o)
PYTHON_DEPS = $(PYTHON_SOURCES:%.cpp=build/.pyhtonObjects/%.d)
TEST_OBJECTS = $(TEST_SOURCES:%.cpp=build/.testObjects/%.o)
TEST_DEPS = $(TEST_SOURCES:%.cpp=build/.testObjects/%.d)
UNIT_TEST_OBJECTS = $(UNIT_TEST_SOURCES:%.cxx=build/.unitTestObjects/%.o) UNIT_TEST_OBJECTS = $(UNIT_TEST_SOURCES:%.cxx=build/.unitTestObjects/%.o)
UNIT_TEST_DEPS = $(UNIT_TEST_SOURCES:%.cxx=build/.unitTestObjects/%.d) UNIT_TEST_DEPS = $(UNIT_TEST_SOURCES:%.cxx=build/.unitTestObjects/%.d)
...@@ -70,31 +91,14 @@ include makeIncludes/optimization.mk ...@@ -70,31 +91,14 @@ include makeIncludes/optimization.mk
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
# Set additional compiler options # Set additional compiler options
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
# SUGGEST_ATTRIBUTES = TRUE # Tell the compiler to suggest attributes
# OPTIMIZE += -fprofile-generate # Generate Profile output for optimization
# OPTIMIZE += -fprofile-use # Use a previously generated profile output
OTHER += -std=c++11 # Use the C++11 standard OTHER += -std=c++11 # Use the C++11 standard
OTHER += -D MISC_NAMESPACE=xerus # All misc function shall live in xerus namespace
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
# Load dependency files # Convinience variables
# ------------------------------------------------------------------------------------------------------
-include $(LIB_DEPS)
-include $(TEST_DEPS)
-include $(UNIT_TEST_DEPS)
-include $(TUTORIAL_DEPS)
-include build/.preCompileHeaders/xerus.h.d
# ------------------------------------------------------------------------------------------------------
# Make Rules
# ------------------------------------------------------------------------------------------------------ # ------------------------------------------------------------------------------------------------------
# Small hack to get newlines... # Small hack to get newlines...
...@@ -103,22 +107,26 @@ define \n ...@@ -103,22 +107,26 @@ define \n
endef endef
# Convinience variables
FLAGS = $(strip $(WARNINGS) $(OPTIMIZE) $(LOGGING) $(DEBUG) $(ADDITIONAL_INCLUDE) $(OTHER)) FLAGS = $(strip $(WARNINGS) $(OPTIMIZE) $(LOGGING) $(DEBUG) $(ADDITIONAL_INCLUDE) $(OTHER))
PYTHON_FLAGS = $(strip $(WARNINGS) $(LOGGING) $(DEBUG) $(ADDITIONAL_INCLUDE) $(OTHER) -fno-var-tracking-assignments)
MINIMAL_DEPS = Makefile config.mk makeIncludes/general.mk makeIncludes/warnings.mk makeIncludes/optimization.mk MINIMAL_DEPS = Makefile config.mk makeIncludes/general.mk makeIncludes/warnings.mk makeIncludes/optimization.mk
# ------------------------------------------------------------------------------------------------------
# Load dependency files
# ------------------------------------------------------------------------------------------------------
-include $(XERUS_DEPS)
-include $(MISC_DEPS)
-include $(TEST_DEPS)
-include $(UNIT_TEST_DEPS)
-include $(TUTORIAL_DEPS)
-include build/.preCompileHeaders/xerus.h.d
help:
@printf "Possible make targets are:\n \
\t\tall \t\t -- Build xerus both as a shared and a static library.\n \
\t\tshared \t\t -- Build xerus as a shared library.\n \
\t\tstatic \t\t -- Build xerus as a static library.\n \
\t\ttest \t\t -- Build and run the xerus unit tests.\n \
\t\tinstall \t -- Install the shared library and header files (may require root).\n \
\t\t$(TEST_NAME) \t -- Only build the xerus unit tests.\n \
\t\tclean \t\t -- Remove all object, library and executable files.\n"
# ------------------------------------------------------------------------------------------------------
# Make Rules
# ------------------------------------------------------------------------------------------------------
opt: opt:
$(CXX) $(FLAGS) -Q --help=optimizers $(CXX) $(FLAGS) -Q --help=optimizers
...@@ -130,57 +138,80 @@ warn: ...@@ -130,57 +138,80 @@ warn:
# Fake rule to create arbitary headers, to prevent errors if files are moved/renamed # Fake rule to create arbitary headers, to prevent errors if files are moved/renamed
%.h: %.h:
all: test $(LIB_NAME_SHARED) $(LIB_NAME_STATIC) ifdef BUILD_PYTHON_BINDINGS
mkdir -p build/include/ shared: build/libxerus_misc.so build/libxerus.so build/xerus.so
cp include/xerus.h build/include/ else
cp -r include/xerus build/include/ shared: build/libxerus_misc.so build/libxerus.so
endif
build/libxerus_misc.so: $(MINIMAL_DEPS) $(MISC_SOURCES)
mkdir -p $(dir $@)
$(CXX) -shared -fPIC -Wl,-soname,libxerus_misc.so $(FLAGS) -I include $(MISC_SOURCES) -Wl,--as-needed $(CALLSTACK_LIBS) -o build/libxerus_misc.so
shared: $(LIB_NAME_SHARED) build/libxerus.so: $(MINIMAL_DEPS) $(XERUS_SOURCES) build/libxerus_misc.so
mkdir -p $(dir $@)
$(CXX) -shared -fPIC -Wl,-soname,libxerus.so $(FLAGS) -I include $(XERUS_SOURCES) -L ./build/ -Wl,--as-needed -lxerus_misc $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) -o build/libxerus.so
$(LIB_NAME_SHARED): $(MINIMAL_DEPS) $(LIB_SOURCES) python: build/xerus.so
mkdir -p $(dir $@)
$(CXX) -shared -fPIC -Wl,-soname,libxerus.so $(FLAGS) -I include $(LIB_SOURCES) $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) -o $(LIB_NAME_SHARED)
build/xerus.so: $(MINIMAL_DEPS) $(PYTHON_SOURCES) build/libxerus.so
mkdir -p $(dir $@)
$(CXX) -shared -fPIC -Wl,-soname,xerus.so `python2-config --cflags --ldflags` $(PYTHON_FLAGS) -I include $(PYTHON_SOURCES) -L ./build/ -Wl,--as-needed -lxerus $(BOOST_PYTHON) -o build/xerus.so
static: $(LIB_NAME_STATIC)
static: build/libxerus_misc.a build/libxerus.a
# Support non lto build for outdated systems build/libxerus_misc.a: $(MINIMAL_DEPS) $(MISC_OBJECTS)
ifdef USE_LTO
$(LIB_NAME_STATIC): $(MINIMAL_DEPS) $(LIB_OBJECTS)
mkdir -p $(dir $@) mkdir -p $(dir $@)
gcc-ar rcs $(LIB_NAME_STATIC) $(LIB_OBJECTS) ifdef USE_LTO
else gcc-ar rcs ./build/libxerus_misc.a $(MISC_OBJECTS)
$(LIB_NAME_STATIC): $(MINIMAL_DEPS) $(LIB_OBJECTS) else
ar rcs ./build/libxerus_misc.a $(MISC_OBJECTS)
endif
build/libxerus.a: $(MINIMAL_DEPS) $(XERUS_OBJECTS)
mkdir -p $(dir $@) mkdir -p $(dir $@)
ar rcs $(LIB_NAME_STATIC) $(LIB_OBJECTS) ifdef USE_LTO
gcc-ar rcs ./build/libxerus.a $(XERUS_OBJECTS)
else
ar rcs ./build/libxerus.a $(XERUS_OBJECTS)
endif endif
ifdef DESTDIR
INSTALL_LIB_PATH = $(DESTDIR)/lib/
INSTALL_HEADER_PATH = $(DESTDIR)/include/
INSTALL_PYTHON_PATH = $(DESTDIR)/lib/python/site-packages/
endif
ifdef INSTALL_LIB_PATH ifdef INSTALL_LIB_PATH
ifdef INSTALL_HEADER_PATH ifdef INSTALL_HEADER_PATH
install: $(LIB_NAME_SHARED) install: shared
@printf "Installing libxerus.so to $(strip $(INSTALL_LIB_PATH)) and storing the header files in $(strip $(INSTALL_HEADER_PATH)).\n" @printf "Installing libxerus.so to $(strip $(INSTALL_LIB_PATH)) and storing the header files in $(strip $(INSTALL_HEADER_PATH)).\n"
mkdir -p $(INSTALL_LIB_PATH) mkdir -p $(INSTALL_LIB_PATH)
mkdir -p $(INSTALL_HEADER_PATH) mkdir -p $(INSTALL_HEADER_PATH)
cp $(LIB_NAME_SHARED) $(INSTALL_LIB_PATH)
cp include/xerus.h $(INSTALL_HEADER_PATH) cp include/xerus.h $(INSTALL_HEADER_PATH)
cp -r include/xerus $(INSTALL_HEADER_PATH) cp -r include/xerus $(INSTALL_HEADER_PATH)
cp build/libxerus_misc.so $(INSTALL_LIB_PATH)
cp build/libxerus.so $(INSTALL_LIB_PATH)
ifdef BUILD_PYTHON_BINDINGS
cp build/xerus.so $(INSTALL_PYTHON_PATH)
endif
else else
install: install:
@printf "INSTALL_HEADER_PATH not set correctly. Cannot install xerus.\n" @printf "Cannot install xerus: INSTALL_HEADER_PATH not set. Please set the path in config file.\n"
endif endif
else else
install: install:
@printf "INSTALL_LIB_PATH not set correctly. Cannot install xerus.\n" @printf "Cannot install xerus: INSTALL_LIB_PATH not set. Please set the path in config file.\n"
endif endif
$(TEST_NAME): $(MINIMAL_DEPS) $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS) $(TEST_NAME): $(MINIMAL_DEPS) $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS) build/libxerus.a build/libxerus_misc.a
$(CXX) -D TEST_ $(FLAGS) $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS) $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) -o $(TEST_NAME) $(CXX) -D XERUS_UNITTEST $(FLAGS) $(UNIT_TEST_OBJECTS) $(TEST_OBJECTS) build/libxerus.a build/libxerus_misc.a $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) -o $(TEST_NAME)
test: $(TEST_NAME) test: $(TEST_NAME)
...@@ -192,17 +223,29 @@ fullTest: $(TUTORIALS) $(TEST_NAME) ...@@ -192,17 +223,29 @@ fullTest: $(TUTORIALS) $(TEST_NAME)
./$(TEST_NAME) all ./$(TEST_NAME) all
.FORCE:
doc: .FORCE
make -C doc doc
clean: clean:
rm -fr build rm -fr build
-rm -f $(TEST_NAME) -rm -f $(TEST_NAME)
-rm -f include/xerus.h.gch -rm -f include/xerus.h.gch
-rm -r doc/html
benchmark: $(MINIMAL_DEPS) $(LOCAL_HEADERS) benchmark.cxx $(LIB_NAME_STATIC) benchmark: $(MINIMAL_DEPS) $(LOCAL_HEADERS) benchmark.cxx $(LIB_NAME_STATIC)
$(CXX) $(FLAGS) benchmark.cxx $(LIB_NAME_STATIC) $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) -lboost_filesystem -lboost_system -o Benchmark $(CXX) $(FLAGS) benchmark.cxx $(LIB_NAME_STATIC) $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) -lboost_filesystem -lboost_system -o Benchmark
# Build rule for normal misc objects
build/.miscObjects/%.o: %.cpp $(MINIMAL_DEPS)
mkdir -p $(dir $@)
$(CXX) -I include $< -c $(FLAGS) -MMD -o $@
# Build rule for normal lib objects # Build rule for normal lib objects
build/.libObjects/%.o: %.cpp $(MINIMAL_DEPS) build/.libObjects/%.o: %.cpp $(MINIMAL_DEPS)
mkdir -p $(dir $@) mkdir -p $(dir $@)
...@@ -212,37 +255,37 @@ build/.libObjects/%.o: %.cpp $(MINIMAL_DEPS) ...@@ -212,37 +255,37 @@ build/.libObjects/%.o: %.cpp $(MINIMAL_DEPS)
# Build rule for test lib objects # Build rule for test lib objects
build/.testObjects/%.o: %.cpp $(MINIMAL_DEPS) build/.testObjects/%.o: %.cpp $(MINIMAL_DEPS)
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CXX) -D TEST_ -I include $< -c $(FLAGS) -MMD -o $@ $(CXX) -D XERUS_UNITTEST -I include $< -c $(FLAGS) -MMD -o $@
# Build rule for benchmark objects # Build rule for benchmark objects
build/%.o: %.cpp $(MINIMAL_DEPS) build/%.o: %.cpp $(MINIMAL_DEPS)
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CXX) -D TEST_ -I include $< -c $(FLAGS) -MMD -o $@ $(CXX) -D XERUS_UNITTEST -I include $< -c $(FLAGS) -MMD -o $@
# Build rule for unit test objects # Build rule for unit test objects
ifdef USE_GCC ifdef USE_GCC
build/.unitTestObjects/%.o: %.cxx $(MINIMAL_DEPS) build/.preCompileHeaders/xerus.h.gch build/.unitTestObjects/%.o: %.cxx $(MINIMAL_DEPS) build/.preCompileHeaders/xerus.h.gch
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CXX) -D TEST_ -I build/.preCompileHeaders $< -c $(FLAGS) -MMD -o $@ $(CXX) -D XERUS_UNITTEST -I build/.preCompileHeaders $< -c $(FLAGS) -MMD -o $@
else else
build/.unitTestObjects/%.o: %.cxx $(MINIMAL_DEPS) build/.unitTestObjects/%.o: %.cxx $(MINIMAL_DEPS)
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CXX) -D TEST_ -I include $< -c $(FLAGS) -MMD -o $@ $(CXX) -D XERUS_UNITTEST -I include $< -c $(FLAGS) -MMD -o $@
endif endif
# Build and execution rules for tutorials # Build and execution rules for tutorials
build/.tutorialObjects/%: %.cpp $(MINIMAL_DEPS) $(LIB_NAME_STATIC) build/.tutorialObjects/%: %.cpp $(MINIMAL_DEPS) build/libxerus.a build/libxerus_misc.a
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CXX) -I include $< $(LIB_NAME_STATIC) $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) $(FLAGS) -MMD -o $@ $(CXX) -I include $< build/libxerus.a build/libxerus_misc.a $(SUITESPARSE) $(LAPACK_LIBRARIES) $(BLAS_LIBRARIES) $(CALLSTACK_LIBS) $(FLAGS) -MMD -o $@
# Build rule for the preCompileHeader # Build rule for the preCompileHeader
build/.preCompileHeaders/xerus.h.gch: include/xerus.h $(MINIMAL_DEPS) .git/ORIG_HEAD build/.preCompileHeaders/xerus.h.gch: include/xerus.h $(MINIMAL_DEPS) .git/ORIG_HEAD
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CXX) -D TEST_ $< -c $(FLAGS) -MMD -o $@ $(CXX) -D XERUS_UNITTEST $< -c $(FLAGS) -MMD -o $@
# dummy rule in case files were downloaded without git # dummy rule in case files were downloaded without git
......
// Xerus - A General Purpose Tensor Library // Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2016 Benjamin Huber and Sebastian Wolf. // Copyright (C) 2014-2017 Benjamin Huber and Sebastian Wolf.
// //
// Xerus is free software: you can redistribute it and/or modify // Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published // it under the terms of the GNU Affero General Public License as published
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
#include "include/xerus.h" #include "include/xerus.h"
std::random_device rd; std::mt19937_64 rnd = xerus::misc::randomEngine;
std::mt19937_64 rnd(rd());
std::normal_distribution<double> normalDist(0,1); std::normal_distribution<double> normalDist(0,1);
using namespace xerus; using namespace xerus;
...@@ -61,12 +60,12 @@ struct LeastSquaresProblem { ...@@ -61,12 +60,12 @@ struct LeastSquaresProblem {
return TTOperator::identity(dim); return TTOperator::identity(dim);
} }
virtual TTTensor get_x() const { virtual TTTensor get_x() const {
TTTensor x = TTTensor::random(dimensions, x_ranks, rnd, normalDist); TTTensor x = TTTensor::random(dimensions, x_ranks, normalDist);
x /= frob_norm(x); x /= frob_norm(x);
return x; return x;
}; };
virtual TTTensor get_b() const {