88 void svd22(
const double A[4],
double U[4],
double S[2],
double V[4])
95 double B0 = A00 + A11;
96 double B1 = A00 - A11;
97 double B2 = A01 + A10;
98 double B3 = A01 - A10;
100 double PminusT = atan2(B3, B0);
101 double PplusT = atan2(B2, B1);
103 double P = (PminusT + PplusT) / 2;
104 double T = (-PminusT + PplusT) / 2;
106 double CP = cos(P), SP = sin(P);
107 double CT = cos(T), ST = sin(T);
121 double CPmT = cos(P-T), SPmT = sin(P-T);
123 if (fabs(CPmT) > fabs(SPmT))
130 double CPpT = cos(P+T), SPpT = sin(P+T);
132 if (fabs(CPpT) > fabs(SPpT))
138 double e = (C0 + C1) / 2;
139 double f = (C0 - C1) / 2;
219 double *Lmin,
double *Lmax)
223 double B0 = A00 + A11;
224 double B1 = A00 - A11;
225 double B2 = A01 + A10;
226 double B3 = A01 - A10;
228 double PminusT = atan2(B3, B0);
229 double PplusT = atan2(B2, B1);
231 double P = (PminusT + PplusT) / 2;
232 double T = (-PminusT + PplusT) / 2;
236 double CPmT = cos(P-T), SPmT = sin(P-T);
238 if (fabs(CPmT) > fabs(SPmT))
245 double CPpT = cos(P+T), SPpT = sin(P+T);
247 if (fabs(CPpT) > fabs(SPpT))
253 double e = (C0 + C1) / 2;
254 double f = (C0 - C1) / 2;
void svd_sym_singular_values(double A00, double A01, double A11, double *Lmin, double *Lmax)
void svd22(const double A[4], double U[4], double S[2], double V[4])