Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port potential Databox enhancements into Spiner from Singe -- transformations #95

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
216d115
Copy databox_wrapper.hpp from Singe as a starting point for discussion.
BrendanKKrueger Aug 26, 2024
ac86b2f
Notes
BrendanKKrueger Sep 3, 2024
7d0865a
Notes again
BrendanKKrueger Sep 3, 2024
f99c241
Start adding the transformations.
BrendanKKrueger Sep 13, 2024
e0e8b0a
Started writing the transformations.
BrendanKKrueger Sep 13, 2024
5ce03cb
Modify RegularGrid1D to allow for transformations.
BrendanKKrueger Sep 13, 2024
be1acd1
Forgot include
BrendanKKrueger Sep 13, 2024
fc0f83f
Forgot (a) some templates and (b) static.
BrendanKKrueger Sep 19, 2024
622c8fb
I removed dx() from RegularGrid1D, so update the tests.
BrendanKKrueger Sep 19, 2024
2eccab5
Tests for transformations.
BrendanKKrueger Sep 19, 2024
becaae9
Add Transform template to DataBox (currently doesn't do anything yet).
BrendanKKrueger Sep 19, 2024
18cd066
Update TODO items
BrendanKKrueger Sep 19, 2024
af53549
Add dependent variable transformation.
BrendanKKrueger Sep 19, 2024
4f8fbe2
Update TODO items
BrendanKKrueger Sep 19, 2024
6e292a0
Update TODO items
BrendanKKrueger Sep 19, 2024
fa2dd5b
Add GPU testing for transformations.
BrendanKKrueger Sep 19, 2024
c54a6a5
Delete a bunch of stuff we no longer need.
BrendanKKrueger Sep 19, 2024
15aa48a
Move existing RegularGrid1D test to a new file, so I can add new test…
BrendanKKrueger Sep 19, 2024
222bdae
Add some testing with transformations.
BrendanKKrueger Sep 19, 2024
0bc4e32
Add a TODO
BrendanKKrueger Sep 19, 2024
db0323c
test tags
BrendanKKrueger Sep 19, 2024
d45bcc6
Add tests for DataBox with transformations. The current results seem…
BrendanKKrueger Sep 19, 2024
37f3840
Starting to fix operator(). Mostly lots of stream-of-consciousness n…
BrendanKKrueger Sep 19, 2024
958062e
Fix some things about accessing the dependent variable values.
BrendanKKrueger Sep 30, 2024
57ddf50
Revise discussion of operator() and accessors.
BrendanKKrueger Sep 30, 2024
4734797
Remove long TODO discussion, because it's better as a comment on the PR.
BrendanKKrueger Sep 30, 2024
ed811b5
Add transformations to PiecewiseGrid1D.
BrendanKKrueger Sep 30, 2024
78594ea
We'll push extrapolations to another MR.
BrendanKKrueger Sep 30, 2024
cac4be1
Moving some TODO comments to MR discussion.
BrendanKKrueger Sep 30, 2024
8ab5205
Moving some TODO comments to MR discussion.
BrendanKKrueger Sep 30, 2024
a178359
Edit TODO.
BrendanKKrueger Sep 30, 2024
c7afa64
format
BrendanKKrueger Sep 30, 2024
28bcf26
missing header
BrendanKKrueger Sep 30, 2024
51d11c8
Update spiner/transformations.hpp
BrendanKKrueger Oct 2, 2024
df8f052
force inline
BrendanKKrueger Oct 2, 2024
2f39150
constexpr
BrendanKKrueger Oct 2, 2024
8d76c55
Documentation
BrendanKKrueger Oct 8, 2024
09c3aed
documentation again
BrendanKKrueger Oct 8, 2024
45fe193
Change logarithmic transform's epsilon value.
BrendanKKrueger Oct 9, 2024
8578f89
format
BrendanKKrueger Oct 9, 2024
9aaa291
Merge branch 'main' into bkk_wrapper
Yurlungur Oct 11, 2024
5942d20
Switch from SFINAE to static_assert so that we can give a better erro…
BrendanKKrueger Oct 14, 2024
624d244
x is the 'ground truth' representation, so fix the bounds.
BrendanKKrueger Oct 23, 2024
0486a9d
Cleaning up things that should (probably?) be private.
BrendanKKrueger Oct 23, 2024
aba2fd4
More cleanup
BrendanKKrueger Oct 23, 2024
82fe518
Expanded tests for RegularGrid1D.
BrendanKKrueger Oct 23, 2024
ab02e9f
Expand TODO comment.
BrendanKKrueger Oct 23, 2024
1955937
format
BrendanKKrueger Oct 23, 2024
fce0f56
format (again... doing it manually because clang-format here and on G…
BrendanKKrueger Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion doc/sphinx/src/databox.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ To use databox, simply include the relevant header:

#include <databox.hpp>

``DatBox`` is templated on underyling data type, which defaults to the
``DataBox`` Templates
^^^^^^^^^^^^^^^^^^^^^

Underlying Data Type
--------------------

``DataBox`` is templated on the underyling data type, which defaults to the
``Real`` type provided by ``ports-of-call``. (This is usually a
``double``.)

Expand All @@ -30,6 +36,9 @@ single type, you may wish to declare a type alias such as:

using DataBox = Spiner::DataBox<double>

Interpolation Gridding
----------------------

Spiner is also templated on how the interpolation gridding works. This
template parameter is called ``Grid_t``. The available options at this time are:

Expand All @@ -47,6 +56,46 @@ as, for example:
More detail on the interpolation gridding is available below and in
the interpolation section.

Transformations
---------------

Spiner performs linear interpolation of the data, but can apply transformations
to the data in order to enable interpolation methods like log-log, log-lin,
etc. Spiner will perform linear interpolation of the transformed variables.

When constructing the gridding, ``Spiner::RegularGrid1D<T>`` and
``Spiner::PiecewiseGrid1D<T>`` are templated on the independent variable
transformation. Note that all independent variables will use the same
transformation. ``DataBox`` is templated on the dependent variable
transformation. In all cases, the default is a linear "transformation" (no
transformation to the data), so if you do not specify the transformation then
you get linear interpolation. The available transformations are in
``spiner/transformations.hpp`` and users can write custom transformations
following the examples there.

For example, if the user wants to transform the independent variables with a
logarithm and the dependent variable with a custom arctangent transformation,
the declaration of the ``DataBox`` might look like

.. code-block:: cpp

using DataBox = Spiner::DataBox<double, Spiner::RegularGrid1D<double,
Spiner::TransformLogarithmic>, CustomArctanTransform>;

This would result in interpolation according to the equation

.. math::

v &= \arctan(y)

u_i &= \log(x_i)

v &= b + \sum m_i u_i

where :math:`x_i` are the independent variables. By convention, the Spiner
documentation uses :math:`u_i` as the transformed independent variables, and
:math:`v` as the transformed dependent variable.

.. note::
In C++17 and later, you can also get the default type specialization
by simply omitting the template arguments.
Expand Down
Loading
Loading