Miscellaneous helper routines.

Module Contents


_split_data(data: dict) → Tuple[List[str], List[float], List[Tuple[int, Ellipsis]], List[str], List[int], List[Tuple[int, Ellipsis]]]

Prepare data for use in an array_var_context constructor.

httpstan.utils._split_data(data: dict) Tuple[List[str], List[float], List[Tuple[int, Ellipsis]], List[str], List[int], List[Tuple[int, Ellipsis]]]

Prepare data for use in an array_var_context constructor.

array_var_context is a C++ class defined in Stan. See array_var_context.hpp for details.

The constructor signature is:

array_var_context(const std::vector<std::string>& names_r,
                  const std::vector<double>& values_r,
                  const std::vector<std::vector<size_t> >& dim_r,
                  const std::vector<std::string>& names_i,
                  const std::vector<int>& values_i,
                  const std::vector<std::vector<size_t> >& dim_i)

Multi-dimensional data is flattened using column-major order when passed to array_var_context. Stan uses column-major order. Numpy, by constrast, uses row-major order by default. To unravel a multi-dimensional array using column-major order using numpy indicate order F (‘F’ stands for Fortran).


data – Mapping of names to values (e.g., {‘y’: [0, 1, 2]}).


Arguments with types matching the signature of array_var_context.