GivensRotation::new() should default to (I, 0)

This commit is contained in:
Ilya Epifanov 2020-02-05 14:24:27 +01:00 committed by Sébastien Crozet
parent da23386beb
commit a62d9d1ad1

View File

@ -38,7 +38,8 @@ impl<N: ComplexField> GivensRotation<N> {
/// Initializes a Givens rotation from its non-normalized cosine an sine components. /// Initializes a Givens rotation from its non-normalized cosine an sine components.
pub fn new(c: N, s: N) -> (Self, N) { pub fn new(c: N, s: N) -> (Self, N) {
Self::try_new(c, s, N::RealField::zero()).unwrap() Self::try_new(c, s, N::RealField::zero())
.unwrap_or_else(|| (GivensRotation::identity(), N::zero()))
} }
/// Initializes a Givens rotation form its non-normalized cosine an sine components. /// Initializes a Givens rotation form its non-normalized cosine an sine components.