rotg (Linear Algebra)


Import

#include <archr/algebra/rotg.h>
#include <archr/algebra/rotg.hpp>

Synopsis

 void archr_algebra_rotg_f32(float *a, float *b, float *c, float *s);
(1)
 void archr_algebra_rotg_f64(double *a, double *b, double *c, double *s);
(2)
 void rotg(float& a, float& b, float& c, float& s);
(1)
 void rotg(double& a, double& b, double& c, double& s);
(2)
subroutine archr_algebra_rotg_f32(real(4) :: a, real(4) :: b, real(4) :: c, real(4) :: s)
(1)
subroutine archr_algebra_rotg_f64(real(8) :: a, real(8) :: b, real(8) :: c, real(8) :: s)
(2)
function [c,s,r] = archr_algebra_rotg(a, b)
(1)

Description

This function compute the elements of a 2x2 matrix that performs a rotation bringing an arbitrary point onto the Y-axis so that the result c and s verify:

$$\begin{vmatrix} c & s \\ -s & c \end{vmatrix}\begin{vmatrix} a \\ b \end{vmatrix} = \begin{vmatrix} r \\ 0 \end{vmatrix}$$

Results are stored in-place inside c and s. The value of r overwrites a while the intermediate result of the computation overwrites b.

Parameters

a

First component of the original vector

b

Second component of the original vector

c

Output argument containing the cosine component of the rotation matrix.

s

Output argument containing the sine component of the rotation matrix.

Example

Possible Output

Possible Output

Possible Output