New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

calculate-givens-rotation

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calculate-givens-rotation

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

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

[  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  ]

Sample usage:

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

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

// Alternate form:
var output = []
givens( 1, 2, output )  //  --> output = [ -0.4472135954999579, 0.8944271909999159 ]

Install

$ npm 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.

  • a,b: the elements of the vector. b is the element to be zeroed.

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

  • a,b: as specified previously
  • output: an array that receives the output values, output[0] = c and output[1] = s

Returns output

Credits

(c) 2015 Ricky Reusser. MIT License

Keywords

FAQs

Package last updated on 24 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc