<commit_before># Stan Math Library Docs

The <b>Stan Math Library</b> is a BSD-3 licensed C++, reverse-mode automatic
differentiation library designed to facilitate the construction and utilization of algorithms
that utilize derivatives.

Required Libraries
------------------
Stan Math depends on four libraries:

- Boost (version 1.78.0): [Boost Home Page](https://www.boost.org)
- Eigen (version 3.3.9: [Eigen Home Page](https://eigen.tuxfamily.org/index.php?title=Main_Page)
- SUNDIALS (version 6.1.1): [Sundials Home Page](https://computing.llnl.gov/projects/sundials)
- Intel TBB (version 2020.3): [Intel TBB Home Page](https://www.threadingbuildingblocks.org)

These are distributed under the `lib/` subdirectory. Only these
versions of the dependent libraries have been tested with Stan Math.

Contributing
------------

We love contributions from everyone in the form of good discussions, issues, and pull requests.
If you are interested in contributing to Stan Math please check the Contributor Guide at [mc-stan.org/math](https://mc-stan.org/math/).

Installation
------------
The Stan Math Library is a C++ library which depends on the Intel TBB
library and requires the Sundials library for ordinary differential
equations and root solving. The build system is
the make facility, which is used to manage all dependencies.

A simple hello world program using Stan Math is as follows:

```cpp
#include <stan/math.hpp>
#include <iostream>

int main() {
  std::cout << "log normal(1 | 2, 3)="
            << stan::math::normal_lpdf(1, 2, 3)
            << std::endl;
}
```

If this is in the file `<path>/foo.cpp`, then you can compile
and run this with something like this with `<path>` replaced with the path to the file:

```bash
cd <path>/foo
make -j4 -f <path>/stan-math/make/standalone math-libs
make -f <path>/stan-math/make/standalone foo
./foo
log normal(1 | 2, 3)=-2.07311
```

The first make command with the `math-libs` target ensures that all
binary dependencies of Stan Math are built and ready to use. The `-j4`
instructs `make` to use 4 cores concurrently which should be adapted
to your needs. The second make command ensures that the Stan Math
sources and all of the dependencies are available to the compiler when
building `foo`.

An example of a real instantiation whenever the path to Stan Math is
`~/stan-dev/math/`:

```bash
> make -j4 -f ~/stan-dev/math/make/standalone math-libs
> make -f ~/stan-dev/math/make/standalone foo
```
The `math-libs` target has to be called only once, and can be omitted
for subsequent compilations.

The standalone makefile ensures that all the required `-I` include
statements are given to the compiler and the necessary libraries are
linked: `~/stan-dev/math` and `~/stan-dev/math/lib/eigen_3.3.9` and
`~/stan-dev/math/lib/boost_1.78.0` and
`~/stan-dev/math/lib/sundials_6.1.1/include` and
`~/stan-dev/math/lib/tbb_2020.3/include`. The
`~/stan-dev/math/lib/tbb` directory is created by the `math-libs`
makefile target automatically and contains the dynamically loaded
Intel TBB library. The flags `-Wl,-rpath,...` instruct the linker to
hard-code the path to the dynamically loaded Intel TBB library inside
the stan-math directory into the final binary. This way the Intel TBB
is found when executing the program.

Note for Windows users: On Windows the `-rpath` feature as used by
Stan Math to hardcode an absolute path to a dynamically loaded library
does not work. On Windows the Intel TBB dynamic library `tbb.dll` is<commit_msg>Update doxygen/README.md<commit_after># Stan Math Library Docs

The <b>Stan Math Library</b> is a BSD-3 licensed C++, reverse-mode automatic
differentiation library designed to facilitate the construction and utilization of algorithms
that utilize derivatives.

Required Libraries
------------------
Stan Math depends on four libraries:

- Boost (version 1.78.0): [Boost Home Page](https://www.boost.org)
- Eigen (version 3.3.9: [Eigen Home Page](https://eigen.tuxfamily.org/index.php?title=Main_Page)
- SUNDIALS (version 6.1.1): [Sundials Home Page](https://computing.llnl.gov/projects/sundials)
- Intel TBB (version 2020.3): [Intel TBB Home Page](https://www.threadingbuildingblocks.org)

These are distributed under the `lib/` subdirectory. Only these
versions of the dependent libraries have been tested with Stan Math.

Contributing
------------

We love contributions from everyone in the form of good discussions, issues, and pull requests.
If you are interested in contributing to Stan Math please check the Contributor Guide at [mc-stan.org/math](https://mc-stan.org/math/).

Installation
------------
The Stan Math Library is a C++ library which depends on the Intel TBB
library and requires the Sundials library for ordinary differential
equations and root solving. The build system is
the make facility, which is used to manage all dependencies.

A simple hello world program using Stan Math is as follows:

```cpp
#include <stan/math.hpp>
#include <iostream>

int main() {
  std::cout << "log normal(1 | 2, 3)="
            << stan::math::normal_lpdf(1, 2, 3)
            << std::endl;
}
```

If this is in the file `<path>/foo.cpp`, then you can compile
and run this with something like this with `<path>` replaced with the path to the file:

```bash
cd <path>/foo
make -j4 -f <path>/stan-math/make/standalone math-libs
make -f <path>/stan-math/make/standalone foo
./foo
log normal(1 | 2, 3)=-2.07311
```

The first make command with the `math-libs` target ensures that all
binary dependencies of Stan Math are built and ready to use. The `-j4`
instructs `make` to use 4 cores concurrently, which should be adapted
to your needs. The second `make` command ensures that the Stan Math
sources and all dependencies are available to the compiler when
building `foo`.

An example of a real instantiation whenever the path to Stan Math is
`~/stan-dev/math/`:

```bash
> make -j4 -f ~/stan-dev/math/make/standalone math-libs
> make -f ~/stan-dev/math/make/standalone foo
```
The `math-libs` target has to be called only once, and can be omitted
for subsequent compilations.

The standalone makefile ensures that all the required `-I` include
statements are given to the compiler and the necessary libraries are
linked: `~/stan-dev/math` and `~/stan-dev/math/lib/eigen_3.3.9` and
`~/stan-dev/math/lib/boost_1.78.0` and
`~/stan-dev/math/lib/sundials_6.1.1/include` and
`~/stan-dev/math/lib/tbb_2020.3/include`. The
`~/stan-dev/math/lib/tbb` directory is created by the `math-libs`
makefile target automatically and contains the dynamically loaded
Intel TBB library. The flags `-Wl,-rpath,...` instruct the linker to
hard-code the path to the dynamically loaded Intel TBB library inside
the stan-math directory into the final binary. This way the Intel TBB
is found when executing the program.

Note for Windows users: On Windows the `-rpath` feature as used by
Stan Math to hardcode an absolute path to a dynamically loaded library
does not work. On Windows the Intel TBB dynamic library `tbb.dll` is
{'fraction_non_alphanumeric': 0.10809653005854633, 'fraction_numerical': 0.01427959445951735, 'mean_word_length': 3.960339943342776, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 25, 'https://': 10, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6768164', 'n_tokens_mistral': 2155, 'n_tokens_neox': 2018, 'n_words': 902}