Skip to content

Commit 33cb757

Browse files
AntoinePrvtdegeus
authored andcommitted
Add cross reference in usage documentation
1 parent 4d43375 commit 33cb757

30 files changed

+508
-462
lines changed

docs/source/adaptor.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ ownership of the array:
7676
// prints 0 2 (data is still available here)
7777
}
7878
79-
However if you replace ``xt::no_ownership`` with ``xt::acquire_ownership``, the adaptor will take
79+
However if you replace :cpp:enumerator:`xt::no_ownership` with :cpp:enumerator:`xt::acquire_ownership`, the adaptor will take
8080
the ownership of the array, meaning it will be deleted when the adaptor is destroyed:
8181

8282
.. code::
@@ -179,8 +179,8 @@ Adapting C++ smart pointers
179179
---------------------------
180180

181181
If you want to manage your data with shared or unique pointers, you can use the
182-
``adapt_smart_ptr`` function of xtensor. It will automatically increment the
183-
reference count of shared pointers upon creation, and decrement upon deletion.
182+
:cpp:func:`xt::adapt_smart_ptr` function of xtensor.
183+
It will automatically increment the reference count of shared pointers upon creation, and decrement upon deletion.
184184

185185
.. code::
186186

docs/source/api/container_index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Containers and views
88
====================
99

1010
Containers are in-memory expressions that share a common implementation of most of the methods of the xexpression API.
11-
The final container classes (``xarray``, ``xtensor``) mainly implement constructors and value semantic, most of the
11+
The final container classes (:cpp:type:`xt::xarray`, :cpp:type:`xt::xtensor`) mainly implement constructors and value semantic, most of the
1212
xexpression API is actually implemented in ``xstrided_container`` and ``xcontainer``.
1313

1414
.. toctree::

docs/source/api/expression_index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Expressions and semantic
88
========================
99

10-
``xexpression`` and the semantic classes contain all the methods required to perform evaluation and
10+
:cpp:type:`xt::xexpression` and the semantic classes contain all the methods required to perform evaluation and
1111
assignment of expressions. They define the computed assignment operators, the assignment methods for
1212
``noalias`` and the downcast methods.
1313

docs/source/api/xrandom.rst

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,84 +11,67 @@ Defined in ``xtensor/xrandom.hpp``
1111

1212
.. warning:: xtensor uses a lazy generator for random numbers. You need to assign them or use ``eval`` to keep the generated values consistent.
1313

14-
.. _random-get_default_random_engine-function-reference:
1514
.. doxygenfunction:: xt::random::get_default_random_engine
1615
:project: xtensor
1716

18-
.. _random-seed-function-reference:
1917
.. doxygenfunction:: xt::random::seed
2018
:project: xtensor
2119

22-
.. _random-rand-function-reference:
2320
.. doxygenfunction:: xt::random::rand(const S&, T, T, E&)
2421
:project: xtensor
2522

26-
.. _random-randint-function-reference:
2723
.. doxygenfunction:: xt::random::randint(const S&, T, T, E&)
2824
:project: xtensor
2925

30-
.. _random-randn-function-reference:
3126
.. doxygenfunction:: xt::random::randn(const S&, T, T, E&)
3227
:project: xtensor
3328

34-
.. _random-binomial-function-reference:
3529
.. doxygenfunction:: xt::random::binomial(const S&, T, D, E&)
3630
:project: xtensor
3731

38-
.. _random-geometric-function-reference:
3932
.. doxygenfunction:: xt::random::geometric(const S&, D, E&)
4033
:project: xtensor
4134

42-
.. _random-negative_binomial-function-reference:
4335
.. doxygenfunction:: xt::random::negative_binomial(const S&, T, D, E&)
4436
:project: xtensor
4537

46-
.. _random-poisson-function-reference:
4738
.. doxygenfunction:: xt::random::poisson(const S&, D, E&)
4839
:project: xtensor
4940

50-
.. _random-exponential-function-reference:
5141
.. doxygenfunction:: xt::random::exponential(const S&, T, E&)
5242
:project: xtensor
5343

54-
.. _random-gamma-function-reference:
5544
.. doxygenfunction:: xt::random::gamma(const S&, T, T, E&)
5645
:project: xtensor
5746

58-
.. _random-weibull-function-reference:
5947
.. doxygenfunction:: xt::random::weibull(const S&, T, T, E&)
6048
:project: xtensor
6149

62-
.. _random-extreme_value-function-reference:
6350
.. doxygenfunction:: xt::random::extreme_value(const S&, T, T, E&)
6451
:project: xtensor
6552

66-
.. _random-lognormal-function-reference:
6753
.. doxygenfunction:: xt::random::lognormal(const S&, T, T, E&)
6854
:project: xtensor
6955

70-
.. _random-cauchy-function-reference:
56+
.. doxygenfunction:: xt::random::chi_squared(const S&, T, E&)
57+
:project: xtensor
58+
7159
.. doxygenfunction:: xt::random::cauchy(const S&, T, T, E&)
7260
:project: xtensor
7361

74-
.. _random-fisher_f-function-reference:
7562
.. doxygenfunction:: xt::random::fisher_f(const S&, T, T, E&)
7663
:project: xtensor
7764

78-
.. _random-student_t-function-reference:
7965
.. doxygenfunction:: xt::random::student_t(const S&, T, E&)
8066
:project: xtensor
8167

82-
.. _random-choice-function-reference:
8368
.. doxygenfunction:: xt::random::choice(const xexpression<T>&, std::size_t, bool, E&)
8469
:project: xtensor
8570
.. doxygenfunction:: xt::random::choice(const xexpression<T>&, std::size_t, const xexpression<W>&, bool, E&)
8671
:project: xtensor
8772

88-
.. _random-shuffle-function-reference:
8973
.. doxygenfunction:: xt::random::shuffle
9074
:project: xtensor
9175

92-
.. _random-permutation-function-reference:
9376
.. doxygenfunction:: xt::random::permutation(T, E&)
9477
:project: xtensor

docs/source/build-options.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Build and configuration
1212
Configuration
1313
-------------
1414

15-
``xtensor`` can be configured via macros which must be defined *before* including
15+
`xtensor` can be configured via macros which must be defined *before* including
1616
any of its headers. This can be achieved the following ways:
1717

1818
- either define them in the CMakeLists of your project, with ``target_compile_definitions``
1919
cmake command.
2020
- or create a header where you define all the macros you want and then include the headers you
21-
need. Then include this header whenever you need ``xtensor`` in your project.
21+
need. Then include this header whenever you need `xtensor` in your project.
2222

23-
The following macros are already defined in ``xtensor`` but can be overwritten:
23+
The following macros are already defined in `xtensor` but can be overwritten:
2424

2525
- ``XTENSOR_DEFAULT_DATA_CONTAINER(T, A)``: defines the type used as the default data container for tensors and arrays. ``T``
2626
is the ``value_type`` of the container and ``A`` its ``allocator_type``.
@@ -35,8 +35,8 @@ The following macros are already defined in ``xtensor`` but can be overwritten:
3535

3636
The following macros are helpers for debugging, they are not defined by default:
3737

38-
- ``XTENSOR_ENABLE_ASSERT``: enables assertions in xtensor, such as bound check.
39-
- ``XTENSOR_ENABLE_CHECK_DIMENSION``: enables the dimensions check in ``xtensor``. Note that this option should not be turned
38+
- ``XTENSOR_ENABLE_ASSERT``: enables assertions in `xtensor`, such as bound check.
39+
- ``XTENSOR_ENABLE_CHECK_DIMENSION``: enables the dimensions check in `xtensor`. Note that this option should not be turned
4040
on if you expect ``operator()`` to perform broadcasting.
4141

4242
.. _external-dependencies:
@@ -47,14 +47,14 @@ External dependencies
4747
The last group of macros is for using external libraries to achieve maximum performance (see next section for additional
4848
requirements):
4949

50-
- ``XTENSOR_USE_XSIMD``: enables SIMD acceleration in ``xtensor``. This requires that you have xsimd_ installed
50+
- ``XTENSOR_USE_XSIMD``: enables SIMD acceleration in `xtensor`. This requires that you have xsimd_ installed
5151
on your system.
5252
- ``XTENSOR_USE_TBB``: enables parallel assignment loop. This requires that you have tbb_ installed
5353
on your system.
5454
- ``XTENSOR_DISABLE_EXCEPTIONS``: disables c++ exceptions.
5555
- ``XTENSOR_USE_OPENMP``: enables parallel assignment loop using OpenMP. This requires that OpenMP is available on your system.
5656

57-
Defining these macros in the CMakeLists of your project before searching for ``xtensor`` will trigger automatic finding
57+
Defining these macros in the CMakeLists of your project before searching for `xtensor` will trigger automatic finding
5858
of dependencies, so you don't have to include the ``find_package(xsimd)`` and ``find_package(TBB)`` commands in your
5959
CMakeLists:
6060

docs/source/builder.rst

Lines changed: 48 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,68 +14,70 @@ Values are computed upon request.
1414
Ones and zeros
1515
--------------
1616

17-
- ``zeros(shape)``: generates an expression containing zeros of the specified shape.
18-
- ``ones(shape)``: generates an expression containing ones of the specified shape.
19-
- ``eye(shape, k=0)``: generates an expression of the specified shape, with ones on the k-th diagonal.
20-
- ``eye(n, k = 0)``: generates an expression of shape ``(n, n)`` with ones on the k-th diagonal.
17+
- :cpp:func:`xt::zeros(shape) <xt::zeros>`: generates an expression containing zeros of the specified shape.
18+
- :cpp:func:`xt::ones(shape) <xt::ones>`: generates an expression containing ones of the specified shape.
19+
- :cpp:func:`xt::eye(shape, k=0) <xt::eye>`: generates an expression of the specified shape, with ones on the k-th diagonal.
20+
- :cpp:func:`xt::eye(n, k = 0) <xt::eye>`: generates an expression of shape ``(n, n)`` with ones on the k-th diagonal.
2121

2222
Numerical ranges
2323
----------------
2424

25-
- ``arange(start=0, stop, step=1)``: generates numbers evenly spaced within given half-open interval.
26-
- ``linspace(start, stop, num_samples)``: generates num_samples evenly spaced numbers over given interval.
27-
- ``logspace(start, stop, num_samples)``: generates num_samples evenly spaced on a log scale over given interval
25+
- :cpp:func:`xt::arange(start=0, stop, step=1) <xt::arange>`: generates numbers evenly spaced within given half-open interval.
26+
- :cpp:func:`xt::linspace(start, stop, num_samples) <xt::linspace>`: generates num_samples evenly spaced numbers over given interval.
27+
- :cpp:func:`xt::logspace(start, stop, num_samples) <xt::logspace>`: generates num_samples evenly spaced on a log scale over given interval
2828

2929
Joining expressions
3030
-------------------
3131

32-
- ``concatenate(tuple, axis=0)``: concatenates a list of expressions along the given axis.
33-
- ``stack(tuple, axis=0)``: stacks a list of expressions along the given axis.
34-
- ``hstack(tuple)``: stacks expressions in sequence horizontally (i.e. column-wise).
35-
- ``vstack(tuple)``: stacks expressions in sequence vertically (i.e. row wise).
32+
- :cpp:func:`xt::concatenate(tuple, axis=0) <xt::concatenate>`: concatenates a list of expressions along the given axis.
33+
- :cpp:func:`xt::stack(tuple, axis=0) <xt::stack>`: stacks a list of expressions along the given axis.
34+
- :cpp:func:`xt::hstack(tuple) <xt::hstack>`: stacks expressions in sequence horizontally (i.e. column-wise).
35+
- :cpp:func:`xt::vstack(tuple) <xt::vstack>`: stacks expressions in sequence vertically (i.e. row wise).
3636

3737
Random distributions
3838
--------------------
3939

40-
.. warning:: xtensor uses a lazy generator for random numbers. You need to assign them or use ``eval`` to keep the generated values consistent.
41-
42-
- ``rand(shape, lower, upper)``: generates an expression of the specified shape, containing uniformly
43-
distributed random numbers in the half-open interval [lower, upper).
44-
- ``randint(shape, lower, upper)``: generates an expression of the specified shape, containing uniformly
45-
distributed random integers in the half-open interval [lower, upper).
46-
- ``randn(shape, mean, std_dev)``: generates an expression of the specified shape, containing numbers
47-
sampled from the Normal random number distribution.
48-
- ``binomial(shape, trials, prob)``: generates an expression of the specified shape, containing numbers
49-
sampled from the binomial random number distribution.
50-
- ``geometric(shape, prob)``: generates an expression of the specified shape, containing numbers
51-
sampled from the geometric random number distribution.
52-
- ``negative_binomial(shape, k, prob)``: generates an expression of the specified shape, containing numbers
53-
sampled from the negative binomial random number distribution.
54-
- ``poisson(shape, rate)``: generates an expression of the specified shape, containing numbers
55-
sampled from the Poisson random number distribution.
56-
- ``exponential(shape, rate)``: generates an expression of the specified shape, containing numbers
57-
sampled from the exponential random number distribution.
58-
- ``gamma(shape, alpha, beta)``: generates an expression of the specified shape, containing numbers
59-
sampled from the gamma random number distribution.
60-
- ``weibull(shape, a, b)``: generates an expression of the specified shape, containing numbers
61-
sampled from the Weibull random number distribution.
62-
- ``extreme_value(shape, a, b)``: generates an expression of the specified shape, containing numbers
63-
sampled from the extreme value random number distribution.
64-
- ``lognormal(shape, a, b)``: generates an expression of the specified shape, containing numbers
65-
sampled from the Log-Normal random number distribution.
66-
- ``chi_squared(shape, a, b)``: generates an expression of the specified shape, containing numbers
67-
sampled from the chi-squared random number distribution.
68-
- ``cauchy(shape, a, b)``: generates an expression of the specified shape, containing numbers
69-
sampled from the Cauchy random number distribution.
70-
- ``fisher_f(shape, m, n)``: generates an expression of the specified shape, containing numbers
71-
sampled from the Fisher-f random number distribution.
72-
- ``student_t(shape, n)``: generates an expression of the specified shape, containing numbers
73-
sampled from the Student-t random number distribution.
40+
.. warning:: xtensor uses a lazy generator for random numbers.
41+
You need to assign them or use :cpp:func:`xt::eval` to keep the generated values consistent.
42+
43+
- :cpp:func:`xt::random::rand(shape, lower, upper) <xt::random::rand>`: generates an expression of the specified
44+
shape, containing uniformly distributed random numbers in the half-open interval [lower, upper).
45+
- :cpp:func:`xt::random::randint(shape, lower, upper) <xt::random::randint>`: generates an expression of the specified
46+
shape, containing uniformly distributed random integers in the half-open interval [lower, upper).
47+
- :cpp:func:`xt::random::randn(shape, mean, std_dev) <xt::random::randn>`: generates an expression of the specified
48+
shape, containing numbers sampled from the Normal random number distribution.
49+
- :cpp:func:`xt::random::binomial(shape, trials, prob) <xt::random::binomial>`: generates an expression of the specified
50+
shape, containing numbers sampled from the binomial random number distribution.
51+
- :cpp:func:`xt::random::geometric(shape, prob) <xt::random::geometric>`: generates an expression of the specified shape,
52+
containing numbers sampled from the geometric random number distribution.
53+
- :cpp:func:`xt::random::negative_binomial(shape, k, prob) <xt::random::negative_binomial>`: generates an expression
54+
of the specified shape, containing numbers sampled from the negative binomial random number distribution.
55+
- :cpp:func:`xt::random::poisson(shape, rate) <xt::random::poisson>`: generates an expression of the specified shape,
56+
containing numbers sampled from the Poisson random number distribution.
57+
- :cpp:func:`xt::random::exponential(shape, rate) <xt::random::exponential>`: generates an expression of the specified
58+
shape, containing numbers sampled from the exponential random number distribution.
59+
- :cpp:func:`xt::random::gamma(shape, alpha, beta) <xt::random::gamma>`: generates an expression of the specified shape,
60+
containing numbers sampled from the gamma random number distribution.
61+
- :cpp:func:`xt::random::weibull(shape, a, b) <xt::random::weibull>`: generates an expression of the specified shape,
62+
containing numbers sampled from the Weibull random number distribution.
63+
- :cpp:func:`xt::random::extreme_value(shape, a, b) <xt::random::extreme_value>`: generates an expression of the
64+
specified shape, containing numbers sampled from the extreme value random number distribution.
65+
- :cpp:func:`xt::random::lognormal(shape, a, b) <xt::random::lognormal>`: generates an expression of the specified
66+
shape, containing numbers sampled from the Log-Normal random number distribution.
67+
- :cpp:func:`xt::random::chi_squared(shape, a, b) <xt::random::chi_squared>`: generates an expression of the specified
68+
shape, containing numbers sampled from the chi-squared random number distribution.
69+
- :cpp:func:`xt::random::cauchy(shape, a, b) <xt::random::cauchy>`: generates an expression of the specified shape,
70+
containing numbers sampled from the Cauchy random number distribution.
71+
- :cpp:func:`xt::random::fisher_f(shape, m, n) <xt::random::fisher_f>`: generates an expression of the specified shape,
72+
containing numbers sampled from the Fisher-f random number distribution.
73+
- :cpp:func:`xt::random::student_t(shape, n) <xt::random::student_t>`: generates an expression of the specified shape,
74+
containing numbers sampled from the Student-t random number distribution.
7475

7576
Meshes
7677
------
7778

78-
- ``meshgrid(x1, x2,...)```: generates N-D coordinate expressions given one-dimensional coordinate arrays ``x1``, ``x2``...
79+
- :cpp:func:`xt::meshgrid(x1, x2,...) <xt::meshgrid>`: generates N-D coordinate expressions given
80+
one-dimensional coordinate arrays ``x1``, ``x2``...
7981
If specified vectors have lengths ``Ni = len(xi)``, meshgrid returns ``(N1, N2, N3,..., Nn)``-shaped arrays, with the elements
8082
of xi repeated to fill the matrix along the first dimension for x1, the second for x2 and so on.
8183

docs/source/closure-semantics.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Closure semantics
1212
The ``xtensor`` library is a tensor expression library implementing numpy-style broadcasting and universal functions but in a lazy fashion.
1313

1414
If ``x`` and ``y`` are two tensor expressions with compatible shapes, the result of ``x + y`` is not a tensor but an expression that does
15-
not hold any value. Values of ``x + y`` are computed upon access or when the result is assigned to a container such as ``xt::xtensor`` or
16-
``xt::xarray``. The same holds for most functions in xtensor, views, broadcasting views, etc.
15+
not hold any value. Values of ``x + y`` are computed upon access or when the result is assigned to a container such as :cpp:type:`xt::xtensor` or
16+
:cpp:type:`xt::xarray`. The same holds for most functions in xtensor, views, broadcasting views, etc.
1717

1818
In order to be able to perform the differed computation of ``x + y``, the returned expression must hold references, const references or
1919
copies of the members ``x`` and ``y``, depending on how arguments were passed to ``operator+``. The actual types held by the expressions

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,5 @@ def setup(app):
4646
"numpy": ("https://numpy.org/doc/stable/", None),
4747
"scipy": ("https://docs.scipy.org/doc/scipy/reference", None),
4848
"xtensor-blas": ("https://xtensor-blas.readthedocs.io/en/stable", None),
49+
"xtl": ("https://xtl.readthedocs.io/en/stable", None),
4950
}

0 commit comments

Comments
 (0)