Function lsst::utils::python::cppIndex(std::ptrdiff_t, std::ptrdiff_t, std::ptrdiff_t, std::ptrdiff_t)

Function Documentation

std::pair<std::size_t, std::size_t> lsst::utils::python::cppIndex(std::ptrdiff_t size_i, std::ptrdiff_t size_j, std::ptrdiff_t i, std::ptrdiff_t j)

Compute a pair of C++ indices from a pair of Python indices (negative values count from the end) and range-check.

Return

a std::pair of indices, each in the range [0, size - 1]

Parameters
  • [in] size_i: Number of elements along the first axis.

  • [in] size_j: Number of elements along the second axis.

  • [in] i: Index along first axis; negative values count from the end

  • [in] j: Index along second axis; negative values count from the end

Exceptions
  • Python: IndexError if either input index not in range [-size, size - 1]