scijs/calculate-givens-rotation

Name: calculate-givens-rotation

Owner: scijs

Description: Compute the components of a Givens rotation matrix in order to zero an element

Created: 2015-06-24 14:58:43.0

Updated: 2015-11-04 12:55:12.0

Pushed: 2015-06-24 15:05:32.0

Homepage: null

Size: 120

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

calculate-givens-rotation

Build Status npm version

Compute the components of a Givens rotation matrix in order to zero an element

Introduction

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.

  s  ] T     [ a ]     [ r ]
     ]    *  [   ]  =  [   ]
  c  ]       [ b ]     [ 0 ]

Note that it also applies to the transposed case,

         [  c  s  ]
 b ]  *  [        ]  =  [ r  0 ]
         [ -s  c  ]

Sample usage:

givens = require('calculate-givens-rotation')

cs = givens(1,2)    //  --> cs = [ -0.4472135954999579, 0.8944271909999159 ]

lternate form:
output = []
ns( 1, 2, output )  //  --> output = [ -0.4472135954999579, 0.8944271909999159 ]
Install
m install calculate-givens-rotation
API
require('calculate-givens-rotation')( a, b )

Given two elements of a vector, compute the rotation matrix that zeros the second element.

Returns a two-element list [c,s] containing c and s as defined above.

require('calculate-givens-rotation')( a, b, output )

An alternate form that passes output values through array output

Returns output

Credits

(c) 2015 Ricky Reusser. MIT License


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.