We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3a89daa commit 70564dfCopy full SHA for 70564df
1 file changed
src/lib.rs
@@ -161,6 +161,14 @@ impl<T: Clone + Signed> Complex<T> {
161
162
#[cfg(any(feature = "std", feature = "libm"))]
163
impl<T: Float> Complex<T> {
164
+ /// Create a new Complex with a given phase -- `exp(i * phase)`
165
+ ///
166
+ /// [cis (mathematics)]: https://en.wikipedia.org/wiki/Cis_(mathematics)
167
+ #[inline]
168
+ pub fn cis(phase: T) -> Self {
169
+ (Self::i() * phase).exp()
170
+ }
171
+
172
/// Calculate |self|
173
#[inline]
174
pub fn norm(self) -> T {
0 commit comments