Added equinoctial elements. Also a little cleanup

This commit is contained in:
connor committed 2026-09-30 16:07:54 -04:00
1 parent b089b206f5
commit 1f02cac6a9
8 files changed
+654 -14

No files matched your search

+35 -1
View File
@@ -8,6 +8,7 @@ use std::hint::black_box;
use astrokit::body::Body;
use astrokit::cartesian::Cartesian;
use astrokit::equinoctial::Equinoctial;
use astrokit::frames::Frame;
use astrokit::kepler::{self, Degeneracy, Keplerian};
use criterion::{criterion_group, criterion_main, Criterion};
@@ -121,11 +122,44 @@ fn bench_invariants(c: &mut Criterion) {
group.finish();
}
/// Equinoctial against Keplerian on the same states.
///
/// The interesting comparison is GEO: Keplerian takes its doubly-degenerate
/// branch there and equinoctial takes no branch at all.
fn bench_equinoctial(c: &mut Criterion) {
let mut group = c.benchmark_group("equinoctial");
let leo = leo();
let geo = geo();
group.bench_function("from_cartesian/leo", |b| {
b.iter(|| Equinoctial::from_cartesian(&black_box(leo)))
});
group.bench_function("from_cartesian/geo", |b| {
b.iter(|| Equinoctial::from_cartesian(&black_box(geo)))
});
let elements = Equinoctial::from_cartesian(&leo);
group.bench_function("to_cartesian", |b| {
b.iter(|| black_box(elements).to_cartesian())
});
group.bench_function("round_trip", |b| {
b.iter(|| Equinoctial::from_cartesian(&black_box(leo)).to_cartesian())
});
let keplerian = leo.keplerian();
group.bench_function("from_keplerian", |b| {
b.iter(|| Equinoctial::from_keplerian(&black_box(keplerian)))
});
group.finish();
}
criterion_group!(
benches,
bench_scalar_relations,
bench_anomalies,
bench_conversions,
bench_invariants
bench_invariants,
bench_equinoctial
);
criterion_main!(benches);
+3 -3
View File
@@ -117,9 +117,9 @@ fn bench_one_period(c: &mut Criterion) {
/// The cost of a state transition matrix relative to a plain propagation.
///
/// Stage 1 measured 10.6x for a 6x6 on a two-body arc. Central differences would
/// need thirteen propagations and lose about half the digits, so anything near
/// that ratio is a win; this tracks it as the force models get heavier.
/// Central differences would need thirteen propagations for a 6x6 and lose about
/// half the available digits. This tracks the ratio as the force models get
/// heavier.
#[cfg(feature = "autodiff")]
fn bench_state_transition_matrix(c: &mut Criterion) {
use nalgebra::{Matrix6, Vector6};