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

Merge branch 'v3'

parents c250eff1 db438b85
Pipeline #745 canceled with stages
in 1 minute and 28 seconds
......@@ -5,7 +5,7 @@ CXX = clang++
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
......
......@@ -7,8 +7,6 @@ STRICT_WARNINGS = TRUE
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
#=================================================================================================
......@@ -16,7 +14,4 @@ BLAS_LIBRARIES = -lopenblas -lgfortran # Openblas, serial
LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke libraries
SUITESPARSE = -lcholmod -lspqr
# custom include paths
# OTHER += -I /path/to/include
OTHER += -I /usr/include/python2.7/ -lboost_python -I/usr/lib64/python2.7/site-packages/numpy/core/include/ -lpython2.7 -fno-var-tracking-assignments
\ No newline at end of file
......@@ -6,13 +6,13 @@ CXX = g++
STRICT_WARNINGS = TRUE
HIGH_OPTIMIZATION = TRUE # Activates -O3 -march=native and some others
DEBUG += -D DISABLE_RUNTIME_CHECKS_ # Disable all runtime checks
DEBUG += -D REPLACE_ALLOCATOR
DEBUG += -D XERUS_DISABLE_RUNTIME_CHECKS # Disable all runtime checks
DEBUG += -D XERUS_REPLACE_ALLOCATOR
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
......
......@@ -13,12 +13,19 @@
!*.mk
!Makefile
!.gitignore
!*.sh
!*.rb
!*.py
!*.md
!*.xml
!*.dox
!*.css
!*.js
!*.yml
# ...even if they are in subdirectories
!*/
......@@ -26,6 +33,5 @@
# However we really want to ignore
lapacke/*
build/*
doc/latex/*
doc/html/*
config.mk
......@@ -3,8 +3,10 @@ stages:
- test_gcc
- build_gcc_nocheck
- test_gcc_nocheck
- build_python
- build_clang
- test_clang
- build_homepage
job_make_gcc:
stage: build_gcc
......@@ -23,6 +25,11 @@ 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 python"
when: always
job_make_clang:
stage: build_clang
script: "clang++ --version; cp .config.mk.ci.clang config.mk; make XerusTest; cp XerusTest ../"
......@@ -32,3 +39,10 @@ job_test_clang:
stage: test_clang
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 @@
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
* 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.
......@@ -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.
* Several static member function now warn if their return type is not used.
* Initial support for compilation with the intel ICC.
* 2016-03-11 v2.2.1
* Added support for 32bit systems.
......
This diff is collapsed.
// 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
// it under the terms of the GNU Affero General Public License as published
......@@ -28,8 +28,7 @@
#include "include/xerus.h"
std::random_device rd;
std::mt19937_64 rnd(rd());
std::mt19937_64 rnd = xerus::misc::randomEngine;
std::normal_distribution<double> normalDist(0,1);
using namespace xerus;
......@@ -61,12 +60,12 @@ struct LeastSquaresProblem {
return TTOperator::identity(dim);
}
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);
return x;
};
virtual TTTensor get_b() const {
TTTensor b = TTTensor::random(dimensions, b_ranks, rnd, normalDist);
TTTensor b = TTTensor::random(dimensions, b_ranks, normalDist);
b /= frob_norm(b);
return b;
};
......@@ -98,7 +97,7 @@ namespace ls {
TTOperator get_a() const override {
std::vector<size_t> dim(dimensions);
dim.insert(dim.end(), dimensions.begin(), dimensions.end());
TTOperator A = TTOperator::random(dim, a_ranks, rnd, normalDist);
TTOperator A = TTOperator::random(dim, a_ranks, normalDist);
A /= frob_norm(A);
return A;
}
......@@ -119,7 +118,7 @@ namespace ls {
TTOperator get_a() const override {
std::vector<size_t> dim(dimensions);
dim.insert(dim.end(), dimensions.begin(), dimensions.end());
TTOperator A = TTOperator::random(dim, a_ranks, rnd, normalDist);
TTOperator A = TTOperator::random(dim, a_ranks, normalDist);
Index i,j,k;
A(i,j) = A(i,k) * A(j,k);
A /= frob_norm(A);
......@@ -175,7 +174,7 @@ std::vector<LeastSquaresProblem> leastSquaresProblems{
std::string generate_profile_name() {
std::string profileName;
#ifdef TEST_COVERAGE_
#ifdef XERUS_TEST_COVERAGE
static_assert(false, "test coverage checking nonsensical with benchmark run");
#endif
......@@ -200,13 +199,13 @@ std::string generate_profile_name() {
#ifdef USE_LTO
profileName += "_lto";
#endif
#ifdef DISABLE_RUNTIME_CHECKS_
#ifdef XERUS_DISABLE_RUNTIME_CHECKS
profileName += "_noChecks";
#endif
#ifdef REPLACE_ALLOCATOR
#ifdef XERUS_REPLACE_ALLOCATOR
profileName += "_replaceAlloc";
#endif
#ifdef PERFORMANCE_ANALYSIS
#ifdef XERUS_PERFORMANCE_ANALYSIS
profileName += "_perfAnalysis";
#endif
return profileName;
......
......@@ -7,6 +7,14 @@ CXX = g++
# CXX = clang++
#=================================================================================================
# Library Options
#=================================================================================================
# Xerus offers python bindings through boost python, which can be build in a seperate library object
# xerus.so
# BUILD_PYTHON_BINDINGS = TRUE
#=================================================================================================
# Optimization
#=================================================================================================
......@@ -35,62 +43,57 @@ COMPILE_THREADS = 8 # Number of threads to use during link time optimizatio
# The Xerus library performs a number of runtime checks to ensure a valid input to all routines.
# While not recommended these runtime checks can be completly disabled by uncommenting the following
# line. This slighlty improves the performance.
# DEBUG += -D DISABLE_RUNTIME_CHECKS_ # Disable all runtime checks
# In the default configuration xerus will throw exceptions if it encounters invalid inputs
# or (hopefully never) suffers an internal error. For some debugging purposes however it is
# more convinient to instruct xerus to directly exit in such cases.
# NO_XERUS_EXCEPTIONS = TRUE # Disable the use of exceptions by the xerus library
# DEBUG += -D XERUS_DISABLE_RUNTIME_CHECKS # Disable all runtime checks
# With the following option the callstack that is returned by get_call_stack (and thus all fatal errors)
# includes NO function names, source-filenames and line numbers.
# NOTE: activate this to remove the dependence on the binutils libraries -lbfd -liberty -lz and -ldl
# NO_FANCY_CALLSTACK = TRUE # Show simple callstacks only
# XERUS_NO_FANCY_CALLSTACK = TRUE # Show simple callstacks only
# When performing tests it is useful to ensure that all of the code in covered. This is ensured by
# a set of macros including REQUIRE_TEST to mark lines that need to be tested. With the following
# definition this coverage is tested.
# DEBUG += -D TEST_COVERAGE_ # Enable coverage tests
# 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 REPLACE_ALLOCATOR
# 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
# Sanitization
# DEBUG += -fsanitize=undefined # GCC only
# DEBUG += -fsanitize=memory # Clang only
# DEBUG += -fsanitize=address # find out of bounds access
# DEBUG += -pg # adds profiling code for the 'gprof' analyzer
# Xerus has a buildin logging system to provide runtime information. Here you can adjust the logging level used by the library.
# LOGGING += -D DEBUG_ # Debug infomation, can significantly slow down the library.
LOGGING += -D INFO_ # Information that is not linked to any unexpected behaviour but might nevertheless be of interest.
# LOGGING += -D WARNING_ # Informations that is linked to unexpected behaviour which indicates incorrect use of the library but are no errors as such.
# LOGGING += -D ERROR_ # Information about errors that occourt, assumedly by incorrect use of the library.
# LOGGING += -D CRITICAL_ # Information abount internal errors within the library.
# LOGGING += -D XERUS_LOG_DEBUG # Debug infomation, can significantly slow down the library.
LOGGING += -D XERUS_LOG_INFO # Information that is not linked to any unexpected behaviour but might nevertheless be of interest.
# LOGGING += -D XERUS_LOG_WARNING # Informations that is linked to unexpected behaviour which indicates incorrect use of the library but are no errors as such.
# LOGGING += -D XERUS_LOG_ERROR # Information about errors that occourt, assumedly by incorrect use of the library.
# Per default the logs are printed to cerr. Uncomment the following line to print the log messages to the file error.log instead.
# LOGGING += -D LOGFILE_ # Use error file instead of cerr
# LOGGING += -D XERUS_LOGFILE # Use error file instead of cerr
# Print absolute times instead of relative to program time
# LOGGING += -D LOG_ABSOLUTE_TIME
# LOGGING += -D XERUS_LOG_ABSOLUTE_TIME
# Uncomment the following line to save the last Logs in a circular buffer (without printing them) to allow detailed reports in case of errors.
# Note that this can significatly slow down the library.
# LOGGING += -D LOG_BUFFER_ # Activate the log buffer
# LOGGING += -D XERUS_LOG_BUFFER # Activate the log buffer
# Add time measurments for the relevant low level function calls. This allow to use get_analysis() to get a listing on all called low level fucntions and the time spend on them.
# LOGGING += -D PERFORMANCE_ANALYSIS # Enable performance analysis
# LOGGING += -D XERUS_PERFORMANCE_ANALYSIS # Enable performance analysis
#=================================================================================================
......@@ -98,8 +101,9 @@ LOGGING += -D INFO_ # Information that is not linked to any
#=================================================================================================
# Set the directories to install libxerus.
INSTALL_LIB_PATH = /usr/local/lib64/ # Path where to install the libxerus.so shared library.
INSTALL_HEADER_PATH = /usr/local/include/ # Path where to install the xerus header files.
#INSTALL_LIB_PATH = /usr/local/lib64/ # Path where to install the libxerus.so shared library.
#INSTALL_HEADER_PATH = /usr/local/include/ # Path where to install the xerus header files.
#INSTALL_PYTHON_PATH = /usr/local/lib64/python2.7/site-packages/ # Path for the installation of the python bindings.
#=================================================================================================
......@@ -124,6 +128,8 @@ LAPACK_LIBRARIES = -llapacke -llapack # Standard Lapack + Lapacke librarie
# Uncomment or add the appropriate CXSparse library
SUITESPARSE = -lcholmod -lspqr
# Uncomment or add the appropriate boost python library
BOOST_PYTHON = -lboost_python
# Custom include paths
# OTHER += -I /path/to/include
# ------------------------------------------------------------------------------------------------------
# Default rule should be the help message
# ------------------------------------------------------------------------------------------------------
help:
@printf "Possible make targets are:\n \
\t\thelp \t\t -- Print this help.\n \
\t\tdoc \t\t -- Build the html documentation for the xerus library.\n \
\t\tserve \t\t -- Build the html documentation for the xerus library and offer it via 'jekyll serve'.\n \
\t\tclean \t\t -- Remove all documentation files.\n"
doc:
-mkdir html
doxygen doxygen/Doxyfile
jekyll build --source jekyll/ --destination html/
clean:
-rm -r html
serve:
-mkdir html
doxygen doxygen/Doxyfile
jekyll serve --source jekyll/ --destination html/
# Notes for Advanced Users
## Multi-Threading
Please note, that `xerus` is only thread-safe up to 1024 threads at the time of this writing. This number is due to the internal handling of indices. To ensure that indices can
be compared and identified uniquely, they store a unique id of which the first 10 bits are reserved to denote the number of the current thread. With more than 1024 threads (when these
10 bits overflow) it can thus lead to collisions and indices that were shared between threads and were meant to be seperate suddenly evaluate to be equal to all algorithms.
......@@ -51,7 +51,7 @@ PROJECT_BRIEF = "a general purpose tensor library"
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO = xerus.svg
PROJECT_LOGO = doxygen/xerus.svg
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
......@@ -437,7 +437,7 @@ EXTRACT_PACKAGE = YES
# included in the documentation.
# The default value is: NO.
EXTRACT_STATIC = NO
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO,
......@@ -562,7 +562,7 @@ SORT_MEMBER_DOCS = YES
# this will also influence the order of the classes in the class list.
# The default value is: NO.
SORT_BRIEF_DOCS = NO
SORT_BRIEF_DOCS = YES
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
# (brief and detailed) documentation of class members so that constructors and
......@@ -574,7 +574,7 @@ SORT_BRIEF_DOCS = NO
# detailed member documentation.
# The default value is: NO.
SORT_MEMBERS_CTORS_1ST = NO
SORT_MEMBERS_CTORS_1ST = YES
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
# of group names into alphabetical order. If set to NO the group names will
......@@ -591,7 +591,7 @@ SORT_GROUP_NAMES = NO
# list.
# The default value is: NO.
SORT_BY_SCOPE_NAME = NO
SORT_BY_SCOPE_NAME = YES
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
# type resolution of all parameters of a function it will reject a match between
......@@ -687,7 +687,7 @@ FILE_VERSION_FILTER =
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
LAYOUT_FILE =
LAYOUT_FILE = doxygen/DoxygenLayout.xml
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
......@@ -708,7 +708,7 @@ CITE_BIB_FILES =
# messages are off.
# The default value is: NO.
QUIET = NO
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
......@@ -740,7 +740,7 @@ WARN_IF_DOC_ERROR = YES
# parameter documentation, but not about the absence of documentation.
# The default value is: NO.
WARN_NO_PARAMDOC = NO
WARN_NO_PARAMDOC = YES
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
......@@ -768,8 +768,7 @@ WARN_LOGFILE =
# spaces.
# Note: If this tag is empty the current directory is searched.
INPUT = . \
../tutorials/ \
INPUT = doxygen/ \
../include/ \
../include/xerus/ \
../include/xerus/algorithms/ \
......@@ -815,7 +814,7 @@ RECURSIVE = NO
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE = *.hxx
EXCLUDE = *.cxx
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
......@@ -848,14 +847,14 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).
EXAMPLE_PATH = ../tutorials/
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank all
# files are included.
EXAMPLE_PATTERNS = *
EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude commands
......@@ -916,7 +915,7 @@ FILTER_SOURCE_PATTERNS =
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
USE_MDFILE_AS_MAINPAGE = mainpage.md
USE_MDFILE_AS_MAINPAGE = doxygen/mainpage.md
#---------------------------------------------------------------------------
# Configuration options related to source browsing
......@@ -1045,7 +1044,7 @@ GENERATE_HTML = YES
# The default directory is: html.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_OUTPUT = html
HTML_OUTPUT = html/doxygen
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
# generated HTML page (for example: .htm, .php, .asp).
......@@ -1072,7 +1071,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER = header.html
HTML_HEADER = doxygen/header.html
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
......@@ -1082,7 +1081,7 @@ HTML_HEADER = header.html
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER = footer.html
HTML_FOOTER = doxygen/footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
......@@ -1094,7 +1093,7 @@ HTML_FOOTER = footer.html
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_STYLESHEET = stylesheet.css
HTML_STYLESHEET = doxygen/stylesheet.css
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
......@@ -1107,7 +1106,7 @@ HTML_STYLESHEET = stylesheet.css
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = DoxygenLayout.xml
HTML_EXTRA_STYLESHEET = doxygen/DoxygenLayout.xml
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
......@@ -1470,7 +1469,7 @@ MATHJAX_FORMAT = HTML-CSS
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = MathJax
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-MML-AM_CHTML
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
......@@ -1580,7 +1579,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = YES
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
......
......@@ -2,7 +2,8 @@
<!-- Generated by doxygen 1.8.3 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="user" url="/" title="Xerus"/>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="yes" title="" intro=""/>
<tab type="modules" visible="yes" title="" intro=""/>
<tab type="namespaces" visible="yes" title="">
......@@ -19,7 +20,8 @@
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
<tab type="user" url="/documentation.html" title="Documentation"/>
<tab type="user" url="/examples.html" title="Examples"/>
<tab type="user" url="https://git.hemio.de/xerus/xerus" title="Git"/>
<tab type="user" url="https://git.hemio.de/xerus/xerus/issues" title="Issue-Tracker"/>
</navindex>
......
# xerus - a general purpose tensor library {#mainpage}
## Doxygen Documentation
This is the (automatically generated) Doxygen documentation for the `xerus` library. It is the only complete documentation (ie.
mentioning all classes and functions with at least a one-line description) but far less accessible than the documents of the
[main documentation](/documentation.html) or even the [examples](/examples.html).
It is advisable to use a modern IDE when working with any c++ source code, but in particular when using the `xerus` library. In
which case all of the information of this documentation should also be available from within your IDE as mouse-over text or similar.
If your IDE does not provide this functionality consider switching to `kdevelop`, `clion` or a similarly advanced IDE.
# Jekyll configuration
name: Xerus Documentation
description: Documentation for the xerus library.
# baseurl will often be '', but for a project page on gh-pages, it needs to
# be the project name.
# *** IMPORTANT: If your local "jekyll serve" throws errors change this to '' or
# run it like so: jekyll serve --baseurl=''
baseurl: ''
permalink: /:title
# paginate: 3
highlighter: rouge
# highlighter: coderay
markdown: kramdown
# gems: ['TabsConverter']
# exclude: ['README.md', 'LICENSE']
keep_files: ['doxygen']
#include <xerus.h>
using namespace xerus;
class InternalSolver {
const size_t d;
std::vector<Tensor> leftAStack;
std::vector<Tensor> rightAStack;
std::vector<Tensor> leftBStack;
std::vector<Tensor> rightBStack;
TTTensor& x;
const TTOperator& A;
const TTTensor& b;
const double solutionsNorm;
public:
size_t maxIterations;
InternalSolver(const TTOperator& _A, TTTensor& _x, const TTTensor& _b)
: d(_x.degree()), x(_x), A(_A), b(_b), solutionsNorm(frob_norm(_b)), maxIterations(1000)
{
leftAStack.emplace_back(Tensor::ones({1,1,1}));
rightAStack.emplace_back(Tensor::ones({1,1,1}));
leftBStack.emplace_back(Tensor::ones({1,1}));
rightBStack.emplace_back(Tensor::ones({1,1}));
}
void push_left_stack(const size_t _position) {
Index i1, i2, i3, j1 , j2, j3, k1, k2;
const Tensor &xi = x.get_component(_position);
const Tensor &Ai = A.get_component(_position);
const Tensor &bi = b.get_component(_position);
Tensor tmpA, tmpB;
tmpA(i1, i2, i3) = leftAStack.back()(j1, j2, j3)
*xi(j1, k1, i1)*Ai(j2, k1, k2, i2)*xi(j3, k2, i3);
leftAStack.emplace_back(std::move(tmpA));
tmpB(i1, i2) = leftBStack.back()(j1, j2)
*xi(j1, k1, i1)*bi(j2, k1, i2);
leftBStack.emplace_back(std::move(tmpB));
}
void push_right_stack(const size_t _position) {
Index i1, i2, i3, j1 , j2, j3, k1, k2;
const Tensor &xi = x.get_component(_position);
const Tensor &Ai = A.get_component(_position);
const Tensor &bi = b.get_component(_position);
Tensor tmpA, tmpB;
tmpA(i1, i2, i3) = xi(i1, k1, j1)*Ai(i2, k1, k2, j2)*xi(i3, k2, j3)
*rightAStack.back()(j1, j2, j3);
rightAStack.emplace_back(std::move(tmpA));