This commit is contained in:
2025-03-26 16:37:33 +03:00
parent b3fb445557
commit 91477e2d53
2 changed files with 43 additions and 3 deletions

View File

@@ -55,6 +55,7 @@ template <traits::mcc_real_scalar_or_real_range_c ResT, traits::mcc_time_duratio
static int mcc_julday(traits::mcc_systime_c auto const& start_time,
ResT& mjd,
const DT& step = std::chrono::milliseconds(100))
requires(!std::is_pointer_v<std::decay_t<ResT>>)
{
size_t mjd_size = 0;
if constexpr (std::ranges::range<ResT>) {
@@ -101,7 +102,7 @@ static int mcc_julday(traits::mcc_systime_c auto const& start_time,
constexpr size_t reg_size = xsimd::batch<double>::size;
size_t vec_size = mjd_size - mjd_size % reg_size;
xsimd::batch<double> res_reg{mjd_float};
xsimd::batch<double> res_reg(mjd_float);
xsimd::batch<double> step_reg = [d_step]<size_t... Is>(std::index_sequence<Is...>) {
return xsimd::batch<double>{(Is * d_step)...};
}(std::make_index_sequence<reg_size>{});
@@ -111,7 +112,7 @@ static int mcc_julday(traits::mcc_systime_c auto const& start_time,
auto ptr = mjd.begin();
// vectorized part
for (; i < vec_size; i += vec_size) {
for (; i < vec_size; i += reg_size) {
res_reg += step_reg;
if constexpr (std::ranges::contiguous_range<ResT>) {
@@ -143,6 +144,18 @@ static int mcc_julday(traits::mcc_systime_c auto const& start_time,
return 0;
}
template <typename ResT, traits::mcc_time_duration_c DT = std::chrono::milliseconds>
static int mcc_julday(traits::mcc_systime_c auto const& start_time,
ResT& mjd,
const DT& step = std::chrono::milliseconds(100))
requires std::is_pointer_v<std::decay_t<ResT>>
{
auto sp = std::span(mjd);
int ret = mcc_julday(start_time, sp, step);
return ret;
}
/*
* angles are in degrees or sexagimal string form
* RA and DEC are apparent!