Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
impl from_real
  • Loading branch information
PaulXiCao committed Oct 25, 2025
commit e03807f296f23ccf091831797f474fa006d55856
8 changes: 8 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ impl<T> Complex<T> {
}
}

impl<T: Zero> Complex<T> {
/// Create a new `Complex` from a real number.
#[inline]
pub fn from_real(re: T) -> Self {
Self::new(re, T::zero())
}
}

impl<T: Clone + Num> Complex<T> {
/// Returns the imaginary unit.
///
Expand Down