module

Alea

Alea is a library for generating pseudo-random samples from most known probability distributions, written in pure Crystal.

Algorithms in this library are heavily derived from NumPy and Julia lang. Disclaimer in LICENSE file.

Constants

VERSION = "0.3.0"

Macros

param_check(x, op, y, param, caller)

Compile-time expansion for dist. definition checks over arguments.

@parameters:

  • {{x}}: parameter to check through {{op}} with {{y}}.
  • {{op}}: operator that performs the comparison.
  • {{y}}: parameter to check through {{op}} with {{x}}.
  • {{param}}: name of the parameter to display in exception messages.
  • {{caller}}: name of the method to display in exception messages.

@exceptions:

  • Alea::UndefinedError if {{x}} {{op}} {{y}} returns true.
Source
sanity_check(x, param, caller)

Compile-time expansion for sanity (NaN/Infinity) checks over arguments.

@parameters:

  • {{x}}: parameter to check.
  • {{param}}: name of the parameter to display in exception messages.
  • {{caller}}: name of the method to display in exception messages.

@exceptions:

  • Alea::NaNError if {{x}} is NaN.
  • Alea::InfinityError if {{x}} is Infinity.
Source

Nested types