({{, ROT[x,y,c,s] 
applies a Givens rotation {{c,s},{-(RefLink[Conjugate, paclet:ref/Conjugate])[s],c}} to the vectors x and y.}})

OpenersNotesSection(Spacer1)Details

To use ROT, you first need to load the BLAS Package using (RefLink[Needs, paclet:ref/Needs])["LinearAlgebra`BLAS`"].

The following arguments must be given:

ROT[x,y,c,s] is equivalent to {x,y}={{c,s},{-(RefLink[Conjugate, paclet:ref/Conjugate])[s],c}}.{x,y} where x and y are row vectors.

The vector arguments must be of the same length.

OpenersPrimaryExamplesSection(Spacer1)Examples  (10)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Load the BLAS package:

Needs["LinearAlgebra`BLAS`"]

Apply a Givens rotation to two vectors:

x={1,2,3};
y={-1,2,1};
{c,s}={1,2}/Sqrt[5];
ROT[x,y,c,s];
{x,y}

OpenersExampleSection1(Spacer1)Scope  (4)

Real vectors:

x={1.2,3.2,6.7};
y={2.2,3.,4.5};
{c,s}={2.,1.}/Sqrt[5.];
ROT[x,y,c,s];
{x,y}

Complex vectors:

x={2.3-0.3I,2.I,3.};
y={-0.5I,2.3,4.1+I};
{c,s}={1.,2.+I}/Sqrt[{1.,2.+I}];
ROT[x,y,c,s];
{x,y}

Arbitrary-precision vectors:

x={1`20,2,3};
y={-1`20,2,1};
{c,s}={1,2}/Sqrt[5];
ROT[x,y,c,s];
{x,y}

Symbolic vectors:

x={x1,x2};
y={y1,y2};
Clear[c,s];
ROT[x,y,c,s];
{x,y}

OpenersExampleSection3(Spacer1)Properties & Relations  (1)

ROT[x,y,c,s] is equivalent to {x,y}={{c,s},{-(RefLink[Conjugate, paclet:ref/Conjugate])[s],c}}.{x,y}:

x=x1=RandomReal[1,{5}];
y=y1=RandomReal[1,{5}];
{c,s}=RandomReal[1,{2}];
{c,s}={c,s}/Norm[{c,s}];
ROT[x,y,c,s];
{x,y}=={{c,s},{-s,c}}.{x1,y1}

OpenersExampleSection4(Spacer1)Possible Issues  (4)

If the first or second argument are not symbols, an error message is issued:

x={1,2,3};
{c,s}={1,2}/Sqrt[5];
ROT[x,{-1,2,1},c,s]

If the first or second argument are not initialized, an error message is issued:

Clear[x,y];
{c,s}={1,2}/Sqrt[5];
ROT[x,y,c,s]

The third argument c should be real.

x={1.,2,3};
y={-1.,2,1};
{c,s}={1.+I,2.+I}/Norm[{1.+I,2.+I}];
ROT[x,y,c,s]

The third and fourth arguments c and s should satisfy the relation ((|c|)^2)+((|s|)^2)=1 to be a true Givens rotation. This condition is not checked.

x={1.,2,3};
y={-1.,2,1};
ROT[x,y,1.,2.]
{x,y}

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Basic Linear Algebra Subroutines, paclet:LowLevelLinearAlgebra/guide/BLASGuide])}})}})