Skip to content

Commit ac62068

Browse files
committed
Provide multivector of numeric one.
1 parent 43c5c0c commit ac62068

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,12 @@ impl<B: Algebra> Multivector<B> {
591591
});
592592
self
593593
}
594+
/// The one.
595+
#[must_use]
596+
#[allow(clippy::missing_panics_doc)]
597+
pub fn one() -> Self {
598+
Self::new([(Symbol::NIL, B::basis().next().expect("empty basis"))])
599+
}
594600
/// The polarity.
595601
///
596602
/// ```
@@ -599,9 +605,9 @@ impl<B: Algebra> Multivector<B> {
599605
/// assert_eq!(Vee::plane().pol(), Vee::direction().swp());
600606
/// ```
601607
#[must_use]
602-
#[allow(clippy::missing_panics_doc)]
608+
#[inline]
603609
pub fn pol(self) -> Self {
604-
self * Self::new([(Symbol::NIL, B::basis().next_back().expect("empty basis"))])
610+
self * !Self::one()
605611
}
606612
/// The mixed-grade squared norm (i.e., a Study number).
607613
///

0 commit comments

Comments
 (0)