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
1 changed files with 2 additions and 1 deletions

View File

@ -38,7 +38,8 @@ impl<N: ComplexField> GivensRotation<N> {
/// Initializes a Givens rotation from its non-normalized cosine an sine components.
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.