Compute the components of a Givens rotation matrix in order to zero an element
This module implements Algorithm 5.1.3 of Golub and Van Loan's Matrix Computations, 4th Edition. The goal is to calculate the components of a rotation matrix that, when applied to vector
[a,b]^T, will zero out the second component.
[ c s ] T [ a ] [ r ][ ] * [ ] = [ ][ -s c ] [ b ] [ 0 ]
Note that it also applies to the transposed case,
[ c s ][ a b ] * [ ] = [ r 0 ][ -s c ]
var givens =var cs = // --> cs = [ -0.4472135954999579, 0.8944271909999159 ]// Alternate form:var output =// --> output = [ -0.4472135954999579, 0.8944271909999159 ]
$ npm install calculate-givens-rotation
Given two elements of a vector, compute the rotation matrix that zeros the second element.
b: the elements of the vector.
bis the element to be zeroed.
Returns a two-element list
[c,s] containing c and s as defined above.
An alternate form that passes output values through array
b: as specified previously
output: an array that receives the output values,
output = cand
output = s
(c) 2015 Ricky Reusser. MIT License