Merge pull request #695 from ilya-epifanov/fix-givens-rotation-default

GivensRotation::new() should default to (I, 0)
This commit is contained in:
Sébastien Crozet 2020-02-05 21:22:48 +01:00
commit 52ca5c95ef
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.