srotg.c
Go to the documentation of this file.
1 /* construct givens plane rotation
2  Ver.1.0 May 20,1988 */
3 
4 #include "arith.h"
5 
6 srotg(psa,psb,pc,ps)
7 REAL *psa,*psb,*pc,*ps;
8 {
9  REAL sa,sb,c,s;
10  REAL roe,scale,r,z;
11 
12  sa= *psa;
13  sb= *psb;
14  c= *pc;
15  s= *ps;
16 
17  roe=sb;
18  if(fabs(sa) > fabs(sb))
19  roe=sa;
20  scale=fabs(sa)+fabs(sb);
21 
22  if(scale == 0.0){
23  c=1.0;
24  s=0.0;
25  r=0.0;
26  }
27  else{
28  r=scale*sqrt((sa/scale)*(sa/scale)+(sb/scale)*(sb/scale));
29  r=copysign(1.0,roe)*r;
30  c=sa/r;
31  s=sb/r;
32  }
33  z=1.0;
34  if(fabs(sa)>fabs(sb))
35  z=s;
36  if((fabs(sb) >= fabs(sa)) && (c != 0.0e0))
37  z=1.0/c;
38  sa=r;
39  sb=z;
40 
41  *psa= sa;
42  *psb= sb;
43  *pc= c;
44  *ps= s;
45 }
srotg(REAL *psa, REAL *psb, REAL *pc, REAL *ps)
Definition: srotg.c:6
double REAL
Definition: arith.h:25
double sqrt()
short s
Definition: structsize.c:2


euslisp
Author(s): Toshihiro Matsui
autogenerated on Fri Feb 21 2020 03:20:54