Skip to main content

predict_ranges

Function predict_ranges 

Source
pub fn predict_ranges(
    source: &dyn ObservableEphemerisSource,
    requests: &[RangePredictionRequest],
    options: PredictOptions,
    out: &mut [RangePrediction],
) -> Result<(), ObservablesError>
Expand description

Predict geometric ranges for many (satellite, receiver, epoch) requests in one call, writing into a caller-provided out slice.

out[i] is filled from requests[i] by the range-only transmit-time kernel [range_prediction_at_rx]: the same light-time iteration and Sagnac transport as transmit_time_satellite_state, projected to the range geometry. It is therefore bit-identical to calling that predictor in a loop and reading its geometry fields, and the whole batch is one native call over the array (no per-request host-language dispatch).

Internally this is the vectorized hot path: it drops the finite-difference velocity evaluation that transmit_time_satellite_state performs and that a range consumer never uses, cutting the per-request ephemeris evaluations by a third (from 6 to 4), and writes each result in a single pass over out. The range values are unchanged to the bit, because the velocity term never entered a RangePrediction; only the discarded work is removed. options.carrier_hz is unused (ranges carry no Doppler); options.light_time / options.sagnac are honored.

Errors:

  • ObservablesError::InvalidInput with field out if out.len() differs from requests.len().
  • The first request error (invalid input or missing ephemeris) aborts the batch and is returned; out is then partially written.