Commit 812a5a96 authored by Philipp  Trunschke's avatar Philipp Trunschke

Merge branch 'development' of git.hemio.de:xerus/xerus into development

parents dc15d95f 1e83f0bb
Pipeline #1103 passed with stages
in 16 minutes and 16 seconds
......@@ -3,10 +3,6 @@
#=================================================================================================
CXX = g++
COMPATIBILITY = -std=c++11
PYTHON2_CONFIG = `python2-config --cflags --ldflags`
PYTHON3_CONFIG = `python3-config --cflags --ldflags`
PYTEST2 = pytest2
PYTEST3 = pytest3
STRICT_WARNINGS = TRUE
DEBUG += -D XERUS_TEST_COVERAGE # Enable coverage tests
......@@ -23,6 +19,4 @@ BOOST_LIBS = -lboost_filesystem
OTHER += -I /usr/include/python2.7/ -lboost_python -I/usr/lib64/python2.7/site-packages/numpy/core/include/ -lpython2.7 -fno-var-tracking-assignments
BOOST_PYTHON2 = -lboost_python-py27
BOOST_PYTHON3 = -lboost_python-py35
#=================================================================================================
# Compiler Options
#=================================================================================================
CXX = g++
COMPATIBILITY = -std=c++11
PYTHON2_CONFIG = `python2-config --cflags --ldflags`
PYTHON3_CONFIG = `python3-config --cflags --ldflags`
PYTEST2 = pytest
PYTEST3 = pytest-3
STRICT_WARNINGS = TRUE
# DEBUG += -D XERUS_TEST_COVERAGE # Enable coverage tests
DEBUG += -g # Adds debug symbols
#=================================================================================================
# External libraries
#=================================================================================================
BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr
BOOST_LIBS = -lboost_filesystem
OTHER += -I /usr/include/python2.7/ -lboost_python -I/usr/lib64/python2.7/site-packages/numpy/core/include/ -lpython2.7 -fno-var-tracking-assignments
BOOST_PYTHON2 = -lboost_python-py27
BOOST_PYTHON3 = -lboost_python-py35
......@@ -20,6 +20,7 @@
!*.rb
!*.py
!.config.mk.*
!*.md
!*.xml
......
......@@ -4,7 +4,10 @@ stages:
- test_gcc
- build_gcc_nocheck
- test_gcc_nocheck
- build_python
- build_python2
- build_python3
- test_python2
- test_python3
- build_clang
- test_clang
......@@ -33,11 +36,26 @@ job_test_gcc_nocheck:
stage: test_gcc_nocheck
script: "cp ../XerusTest .; ./XerusTest all"
job_build_python:
stage: build_python
script: "g++ --version; cp .config.mk.ci.gcc config.mk; make python2"
job_build_python2:
stage: build_python2
script: "g++ --version; cp .config.mk.ci.gcc.python config.mk; make python2"
when: always
job_build_python3:
stage: build_python3
script: "g++ --version; cp .config.mk.ci.gcc.python config.mk; make python3"
when: always
job_test_python2:
stage: test_python2
script: "g++ --version; cp .config.mk.ci.gcc.python config.mk; make test_python2"
when: always
#job_test_python3:
# stage: test_python3
# script: "g++ --version; cp .config.mk.ci.gcc.python config.mk; make test_python3"
# when: always
job_make_clang:
stage: build_clang
script: "clang++ --version; cp .config.mk.ci.clang config.mk; make XerusTest; cp XerusTest ../"
......
......@@ -2,6 +2,15 @@
Potentially breaking changes are marked with an exclamation point '!' at the begin of their description.
* 2019-03-?? v4.0.0
* Added the HTTensor class for Hierarchical Tensor Decompositions with balanced trees.
* ! Changed the truncated SVD, TensorNetwork::round_edge and TT:round with epsilon to limit their respective relative errors to epsilon.
* ! Removed support for the replacement allocator.
* ! Changed some Makefile configs for more flexibility. See the new config.mk.default file and update your own config.
* ! Major rewrite of MeasurmentSets.
* Fixed minor rank reduction bug in TensorNetwork soft thresholding.
* 2017-05-31 v3.0.1
* Added TTNetwork::use_dense_representations() to convert all components to dense representation.
* Exporting Tensor::dense_copy() and Tensor::sparse_copy() to python.
......
......@@ -71,8 +71,8 @@ XERUS_DEPS = $(XERUS_SOURCES:%.cpp=build/.libObjects/%.d)
MISC_OBJECTS = $(MISC_SOURCES:%.cpp=build/.miscObjects/%.o)
MISC_DEPS = $(MISC_SOURCES:%.cpp=build/.miscObjects/%.d)
PYTHON_OBJECTS = $(PYTHON_SOURCES:%.cpp=build/.pythonObjects/%.o)
PYTHON_DEPS = $(PYTHON_SOURCES:%.cpp=build/.pyhtonObjects/%.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)
......
......@@ -68,13 +68,6 @@ COMPILE_THREADS = 8 # Number of threads to use during link t
# DEBUG += -D XERUS_TEST_COVERAGE # Enable coverage tests
# Xerus uses many small objects (Indices, vectors of dimensions etc.) for which the standard allocator
# is not very efficient. With the following option, an experimental replacement allocator will be
# included in the library, which will _globally_ replace the 'new' and 'delete' operators in your program.
# Note also, that the replacement allocator is not (yet) thread safe!
# DEBUG += -D XERUS_REPLACE_ALLOCATOR
# You can add all kind of debuging options. In the following are some examples
DEBUG += -g # Adds debug symbols
# DEBUG += -D _GLIBCXX_ASSERTIONS # Activate GLIBCXX assertions
......
......@@ -50,13 +50,12 @@ Should you have any problems with the library do not hesitate to contact us at [
The `xerus` library is published under the AGPL v3.0. With proper attribution you are thus allowed to freely use and modify the source code but if you distribute your software including the `xerus`
library (or you provide a service based on this library) you have to provide the full source code under a compatible licence. For more information see the [AGPL](http://www.gnu.org/licenses/agpl-3.0.html).
If this library proved useful in your scientific research we would be grateful for any contributions to the source code and citations. As there is no related article yet, a corresponding bibtex
entry might look as follows
If this library proved useful in your scientific research we would be grateful for any contributions to the source code and citations. A corresponding bibtex entry might look as follows
~~~
@Misc{xerus,
author = {Huber, Benjamin and Wolf, Sebastian},
title = {Xerus - A General Purpose Tensor Library},
howpublished = {\url{https://libxerus.org/}},
year = {2014--2018}
year = {2014--2019}
}
~~~
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
This diff is collapsed.
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -25,19 +25,14 @@
#pragma once
#include "optimizationAlgorithm.h"
#include "../ttNetwork.h"
#include "../performanceData.h"
#include "../measurments.h"
#include "../forwardDeclarations.h"
namespace xerus {
class ASDVariant : public OptimizationAlgorithm {
public:
double minRankEps = 1e-4;
// double maxRankEps = 1e-1;
double epsDecay = 1.1;
double controlSetFraction = 0.1;
......@@ -48,8 +43,10 @@ namespace xerus {
ASDVariant(const size_t _maxIterations, const double _targetRelativeResidual, const double _minimalResidualNormDecrease)
: OptimizationAlgorithm(0, _maxIterations, _targetRelativeResidual, _minimalResidualNormDecrease) { }
//TODO: Use OptimizationSolver for internal solver!
/**
* @brief Tries to reconstruct the (low rank) tensor _x from the given measurments.
* @brief Tries to reconstruct the (low rank) tensor @a _x from the given measurments.
* @param[in,out] _x On input: an initial guess of the solution, also defining the ranks. On output: The reconstruction found by the algorithm.
* @param _measurments the available measurments, can be either a SinglePointMeasurementSet or RankOneMeasurementSet.
* @param _perfData optinal performanceData object to be used.
......@@ -58,7 +55,7 @@ namespace xerus {
void operator()(TTTensor& _x, const RankOneMeasurementSet& _measurments, PerformanceData& _perfData) const;
/**
* @brief Tries to reconstruct the (low rank) tensor _x from the given measurments.
* @brief Tries to reconstruct the (low rank) tensor @a _x from the given measurments.
* @param[in,out] _x On input: an initial guess of the solution, may be of smaller rank. On output: The reconstruction found by the algorithm.
* @param _measurments the available measurments, can be either a SinglePointMeasurementSet or RankOneMeasurementSet.
* @param _maxRanks the maximal ranks the algorithm may use to decrease the resdiual.
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -85,7 +85,7 @@ namespace xerus {
* @param _A operator to solve for
* @param[in,out] _x in: initial guess, out: solution as found by the algorithm
* @param _b right-hand side of the equation to be solved
* @param _numHalfSweeps maximum number of half-sweeps to perform
* @param _numSteps maximum number of half-sweeps to perform
* @param _perfData vector of performance data (residuals after every microiteration)
* @returns the residual @f$|Ax-b|@f$ of the final @a _x
*/
......@@ -121,7 +121,7 @@ namespace xerus {
* call to minimze @f$ \|x - b\|^2 @f$ for @f$ x @f$
* @param[in,out] _x in: initial guess, out: solution as found by the algorithm
* @param _b right-hand side of the equation to be solved
* @param _numHalfSweeps maximum number of half-sweeps to perform
* @param _numSteps maximum number of half-sweeps to perform
* @param _perfData vector of performance data (residuals after every microiteration)
* @returns the residual @f$|x-b|@f$ of the final @a _x
*/
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -30,6 +30,7 @@ namespace xerus {
* @brief Finds the position of the approximately largest entry.
* @details Finds an entry that is at least of size @a _accuracy * X_max in absolute value,
* where X_max is the largest entry of the tensor. The smaller @a _accuracy, the faster the algorithm will work.
* @param _T TTNetwork to check for largest entry
* @param _accuracy factor that determains the maximal deviation of the returned entry from the true largest entry.
* @param _lowerBound a lower bound for the largest entry, i.e. there must be an entry in the tensor which is at least of
* this size (in absolute value). The algorithm may fail completely if this is not fullfilled, but will work using its own
......@@ -37,6 +38,6 @@ namespace xerus {
* @return the position of the entry found.
*/
template<bool isOperator>
size_t find_largest_entry(const TTNetwork<isOperator> &_T, double _accuracy, value_t _lowerBound = 0.0);
size_t find_largest_entry(const TTNetwork<isOperator> &_T, const double _accuracy, const value_t _lowerBound = 0.0);
}
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -24,32 +24,93 @@
#pragma once
#include "../performanceData.h"
#include "../basic.h"
#include "../forwardDeclarations.h"
#include <boost/circular_buffer.hpp>
namespace xerus {
/**
* @brief Base class for all xerus optimization algorithms, allowing a uniform set of settings
* @brief Base class for (in future) all xerus optimization algorithms, allowing a uniform set of settings.
*/
class OptimizationAlgorithm {
public:
///@brief Minimal number of iterations.
size_t minIterations;
///@brief Maximal allowed number of iterations.
///@brief Maximal allowed number of iterations. Zero for infinite.
size_t maxIterations;
///@brief The target residual norm at which the algorithm shall stop.
double targetRelativeResidual;
///@brief Minimal relative decrease of the residual norm ( newRes/oldRes ) until either the ranks are increased (if allowed) or the algorithm stops.
double minimalResidualNormDecrease;
///@brief Minimal decrease of the residual norm ( newRes/oldRes ) until either the ranks are increased (if allowed) or the algorithm stops.
double minimalResidualDecrease;
///@brief Number of iterations used to check for stopping criteria (e.g. residual[iterations] <= residual[iteration-tracking]*pow(minimalResidualNormDecrease, tracking) )
///@brief Number of iterations used to check for stopping criteria (e.g. residual[iterations] <= residual[iteration-tracking]*pow(minimalResidualDecrease, tracking) )
size_t tracking = 10;
protected:
OptimizationAlgorithm(const size_t _minIterations, const size_t _maxIterations, const double _targetRelativeResidual, const double _minimalResidualNormDecrease);
OptimizationAlgorithm(const size_t _minIterations, const size_t _maxIterations, const double _targetRelativeResidual, const double _minimalResidualDecrease);
};
} // namespace xerus
namespace internal {
class OptimizationSolver {
protected:
///@brief Minimal number of iterations.
const size_t minIterations;
///@brief Maximal allowed number of iterations. Zero for infinite.
const size_t maxIterations;
///@brief The target residual norm at which the algorithm shall stop.
const double targetRelativeResidual;
///@brief Minimal decrease of the residual norm ( newRes/oldRes ) until either the ranks are increased (if allowed) or the algorithm stops.
const double minimalResidualDecrease;
///@brief Number of iterations used to check for stopping criteria (e.g. residual[iterations] <= residual[iteration-tracking]*pow(minimalResidualDecrease, tracking) )
const size_t tracking;
///@brief Defined as pow(minimalResidualDecrease, tracking).
const double convergenceFactor;
private:
///@brief The current iteration.
size_t iteration = 0;
///@brief The last (tracking) residuals.
boost::circular_buffer<double> lastResiduals;
protected:
///@brief: Reference to the performanceData object (external ownership)
PerformanceData& perfData;
OptimizationSolver(const OptimizationAlgorithm& _optiAlgorithm, PerformanceData& _perfData);
///@brief Increased iteration by one and adds the residual to the circular buffer.
void make_step(const double _residual);
size_t current_iteration() const;
double current_residual() const;
///@brief True if either the maxIterations are reached or the targetRelativeResidual is reached.
bool reached_stopping_criteria() const;
///@brief True if either the minInterations are reached and convegence is reached (i.e. residual[iterations] <= residual[iteration-tracking]*pow(minimalResidualDecrease, tracking) ).
bool reached_convergence_criteria() const;
///@brief Resets the convergence buffer with max doubles. In particular at least tracking iterations are then nessecary the reach convergence.
void reset_convergence_buffer();
};
} // End namespace internal
} // End namespace xerus
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -85,7 +85,7 @@ namespace xerus {
* @param _A operator to solve for
* @param[in,out] _x in: initial guess, out: solution as found by the algorithm
* @param _b right-hand side of the equation to be solved
* @param _numHalfSweeps maximum number of half-sweeps to perform
* @param _numSteps maximum number of half-sweeps to perform
* @param _perfData vector of performance data (residuals after every microiteration)
* @returns the residual @f$|Ax-b|@f$ of the final @a _x
*/
......@@ -121,7 +121,7 @@ namespace xerus {
* call to minimze @f$ \|x - b\|^2 @f$ for @f$ x @f$
* @param[in,out] _x in: initial guess, out: solution as found by the algorithm
* @param _b right-hand side of the equation to be solved
* @param _numHalfSweeps maximum number of half-sweeps to perform
* @param _numSteps maximum number of half-sweeps to perform
* @param _perfData vector of performance data (residuals after every microiteration)
* @returns the residual @f$|x-b|@f$ of the final @a _x
*/
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -56,6 +56,9 @@ namespace xerus {namespace uq {
///@brief Evaluates the solution for the specified parameters
Tensor evaluate(const TTTensor& _x, const std::vector<double>& _parameters, const PolynomBasis _basisType);
///@brief Calculates the mean of all given samples.
Tensor sample_mean(const std::vector<Tensor>& _samples);
class UQMeasurementSet {
......@@ -74,11 +77,16 @@ namespace xerus {namespace uq {
void clear();
};
Tensor sample_mean(const std::vector<Tensor>& _samples);
TTTensor initial_guess(const Tensor& _mean, const UQMeasurementSet& _measurments, const PolynomBasis _polyBasis, const std::vector<size_t>& _dimensions);
/**
* @brief: Calculates an inital guess for the UQ solution using the mean an linear distortions.
* @param _mean An approximation for the mean (expectation value) of the solution, e.g. by calculating the mean of all samples (see sample_mean).
* @param _parameterVectors The parameterVectors for measurements corresponding to linear distortions, i.e. only one parameter should be non-zero (and small) for each measurement.
* @param _solutions The solutions corresponding to the @a _parameterVectors
* @param _polyBasis The PolynomBasis to use for the UQ formulation.
* @param _dimensions The dimensions of the solutions tensor.
*/
TTTensor initial_guess(const Tensor& _mean, const std::vector<std::vector<double>>& _parameterVectors, const std::vector<Tensor>& _solutions, const PolynomBasis _polyBasis, const std::vector<size_t>& _dimensions);
}}
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -29,17 +29,40 @@
namespace xerus { namespace uq {
void uq_adf(TTTensor& _x, const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0);
///@brief Inplace variant of the UQ ADF to find a solution @a _x (with the inital dimensions and rank) for a given set of @a _measurements.
void uq_adf(TTTensor& _x, const UQMeasurementSet& _measurements, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0);
TTTensor uq_adf(const UQMeasurementSet& _initalMeasurments, const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const std::vector<size_t>& _dimensions, const double _targetEps = 1e-8, const size_t _maxItr = 0);
///@brief Inplace variant of the rank-adaptive UQ ADF, to find a solution @a _x (with the inital dimensions) for a given set of @a _measurements.
void uq_ra_adf(TTTensor& _x, const UQMeasurementSet& _measurements, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0, const double _initalRankEps = 1e-2);
void uq_ra_adf(TTTensor& _x, const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0, const double _initalRankEps = 1e-2);
TTTensor uq_ra_adf(const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const std::vector<size_t>& _dimensions, const double _targetEps = 1e-8, const size_t _maxItr = 0);
///@brief Rank-adaptive UQ ADF to find a solution with given @a _dimensions for a given set of @a _measurements.
TTTensor uq_ra_adf(const UQMeasurementSet& _measurements, const PolynomBasis _basisType, const std::vector<size_t>& _dimensions, const double _targetEps = 1e-8, const size_t _maxItr = 0);
/**
* @brief Rank adaptive ADF to calculate the UQ solution for given measurements.
* @param _positions The positions of the measurements.
* @param _solutions The measured solutions corresponding to the @a _positions.
* @param _dimensions The dimensions of the final solution tensor.
* @param _targetEps TODO describe effect
* @param _maxItr Maximal number of iterations to perform.
*/
TTTensor uq_ra_adf(const std::vector<std::vector<Tensor>>& _positions, const std::vector<Tensor>& _solutions, const std::vector<size_t>& _dimensions, const double _targetEps = 1e-8, const size_t _maxItr = 0);
/**
* @brief Rank adaptive ADF to calculate the UQ solution for given weighted measurements.
* @param _positions The positions of the measurements.
* @param _solutions The measured solutions corresponding to the @a _positions.
* @param _weights Weights for the individual measurements.
* @param _dimensions The dimensions of the final solution tensor.
* @param _targetEps TODO describe effect
* @param _maxItr Maximal number of iterations to perform.
*/
TTTensor uq_ra_adf(const std::vector<std::vector<Tensor>>& _positions, const std::vector<Tensor>& _solutions, const std::vector<double>& _weights, const std::vector<size_t>& _dimensions, const double _targetEps = 1e-8, const size_t _maxItr = 0);
TTTensor uq_ra_adf_iv(TTTensor& _x, const UQMeasurementSet& _measurments, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0);
// TODO How is this different to the inplace variant? Also very confusing that it changes _x inplace AND returns it.
TTTensor uq_ra_adf_iv(TTTensor& _x, const UQMeasurementSet& _measurements, const PolynomBasis _basisType, const double _targetEps = 1e-8, const size_t _maxItr = 0);
}}
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -25,7 +25,6 @@
#pragma once
#include <stddef.h>
#include "misc/allocator.h"
#include "misc/standard.h"
#include "misc/namedLogger.h"
#include "tensorLogger.h"
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......@@ -39,24 +39,6 @@ namespace xerus {
namespace internal {
///@brief wrapper object for the cholmod_common struct to automatically call the constructor and destructor
struct CholmodCommon final {
struct RestrictedAccess final {
cholmod_common* const c;
std::mutex &lock;
RestrictedAccess(cholmod_common* const _c, std::mutex &_lock);
operator cholmod_common*() const;
~RestrictedAccess();
};
std::unique_ptr<cholmod_common> c;
std::mutex lock;
CholmodCommon();
~CholmodCommon();
RestrictedAccess get();
std::function<void(cholmod_sparse*)> get_deleter();
};
///@brief wrapper class for the cholmod sparse matrix objects
class CholmodSparse final {
public:
......@@ -137,8 +119,5 @@ namespace xerus {
bool _fullrank
);
};
extern thread_local CholmodCommon cholmodObject;
}
}
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2018 Benjamin Huber and Sebastian Wolf.
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
......
// Xerus - A General Purpose Tensor Library
// Copyright (C) 2014-2019 Benjamin Huber and Sebastian Wolf.
//
// Xerus is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License,
// or (at your option) any later version.
//
// Xerus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with Xerus. If not, see <http://www.gnu.org/licenses/>.
//
// For further information on Xerus visit https://libXerus.org
// or contact us at contact@libXerus.org.
/**
* @file
* @brief Header file containingt forward declarations for the most common types.
*/
#pragma once
namespace xerus {
class Tensor;
class TensorNetwork;
template<bool isOperator> class TTNetwork;
typedef TTNetwork<false> TTTensor;
typedef TTNetwork<true> TTOperator;
class SinglePointMeasurementSet;
class RankOneMeasurementSet;
class PerformanceData;