The library uses a macro of the form `XERUS_LOG(level, msg)` to print messages to `cout`. It allows to use arbitrary log levels without any need to declare them beforehand
and to use typical piping syntax for the messages.
~~~.cpp
~~~cpp
XERUS_LOG(als_warning,"The ALS encountered a mishap "<<variable_1<<" <= "<<variable_2);
~~~
The following warning levels are predefined: `fatal`, `critical`, `error`, `warning`, `info`, `debug`. The default config file `config.mk.default` defines the preprocessor
...
...
@@ -32,16 +32,16 @@ in the `errors/` subfolder (if it exists) on any `error`, `critical` or `fatal`
The `XERUS_REQUIRE(condition, additional_msg)` macro replaces assertions in the `xerus` library. It uses above `XERUS_LOG` functionality and can thus use piping style messages just as the `XERUS_LOG`
macro. It is equivalent to the following definition
There is a large number of such checks in the library. All of them can be turned off by defining `DEBUG += -D XERUS_DISABLE_RUNTIME_CHECKS` in the `config.mk` file.
## UNIT_TEST
## Unit Tests
Compiling with `make test` creates an executable that includes all functions defined within `xerus::UnitTest` objects.
// likely includes (several) tests of the form TEST(condition);
...
...
@@ -65,7 +65,7 @@ The information of this callstack is only available if the application was compi
The exceptions used by `xerus` have the additional capability to accept piped information that will be included in the `.what()` string. To include a callstack it is thus possible to
@@ -57,14 +57,14 @@ but can become significant when very small tensors are being used and the time f
In such cases it can be useful to replace such equations (especially ones that are as simple as above) with the explicit statement
of contractions and reshuffels. For above equation that would simply be
~~~.cpp
~~~cpp
contract(A,B,false,C,false,1);
~~~
i.e. read as: contract two tensors and store the result in A, left hand side B, not transposed, right hand side C, not transposed, contract a single mode.
If it is necessary to reshuffle a tensor to be able to contract it in such a way, e.g. `A(i,j,k) = B(i,k,j)`, this can be done