59 {
63 int n;
64 int maxmn;
67 int gpass;
68 int pass;
69 bool waserrors;
70 bool wsorted;
71 bool wfailed;
78
79
82 materr = 0;
83 orterr = 0;
84 othererr = 0;
85 wsorted = true;
86 wfailed = false;
87 waserrors = false;
88 maxmn = 30;
92
93
94
95
96 for(gpass=1; gpass<=1; gpass++)
97 {
98
99
100
101
102 for(
i=0;
i<=maxmn-1;
i++)
103 {
104 for(
j=0;
j<=maxmn-1;
j++)
105 {
107 }
108 }
110 {
112 {
113 testsvdproblem<Precision>(a,
i,
j, materr, orterr, othererr, wsorted, wfailed);
114 }
115 }
116
117
118
119
120 for(
i=0;
i<=maxmn-1;
i++)
121 {
123 {
125 }
126 }
127 for(
i=1;
i<=maxmn;
i++)
128 {
130 {
131 testsvdproblem<Precision>(a,
i,
j, materr, orterr, othererr, wsorted, wfailed);
132 }
133 }
135 {
136 for(
j=0;
j<=maxmn-1;
j++)
137 {
139 }
140 }
142 {
143 for(
j=1;
j<=maxmn;
j++)
144 {
145 testsvdproblem<Precision>(a,
i,
j, materr, orterr, othererr, wsorted, wfailed);
146 }
147 }
148
149
150
151
153 {
155 {
156 for(
i=0;
i<=
m-1;
i++)
157 {
158 for(
j=0;
j<=n-1;
j++)
159 {
161 }
162 }
163 testsvdproblem<Precision>(a,
m, n, materr, orterr, othererr, wsorted, wfailed);
164 }
165 }
166
167
168
169
171 {
172 for(n=1; n<=10; n++)
173 {
174 for(pass=1; pass<=2; pass++)
175 {
177 testsvdproblem<Precision>(a,
m, n, materr, orterr, othererr, wsorted, wfailed);
179 testsvdproblem<Precision>(a,
m, n, materr, orterr, othererr, wsorted, wfailed);
181 testsvdproblem<Precision>(a,
m, n, materr, orterr, othererr, wsorted, wfailed);
182 }
183 }
184 }
185 }
186
187
188
189
191 waserrors = materr>threshold || orterr>threshold || othererr>threshold || !wsorted || failr>failthreshold;
192 if( !silent )
193 {
194 printf("TESTING SVD DECOMPOSITION\n");
195 printf("SVD decomposition error: %5.3le\n",
197 printf("SVD orthogonality error: %5.3le\n",
199 printf("SVD with different parameters error: %5.3le\n",
201 printf("Singular values order: ");
202 if( wsorted )
203 {
204 printf("OK\n");
205 }
206 else
207 {
208 printf("FAILED\n");
209 }
210 printf("Always converged: ");
211 if( !wfailed )
212 {
213 printf("YES\n");
214 }
215 else
216 {
217 printf("NO\n");
218 printf("Fail ratio: %5.3lf\n",
220 }
221 printf("Threshold: %5.3le\n",
223 if( waserrors )
224 {
225 printf("TEST FAILED\n");
226 }
227 else
228 {
229 printf("TEST PASSED\n");
230 }
231 printf("\n\n");
232 }
235 }
static const ampf getAlgoPascalEpsilon()
void setbounds(int iLow1, int iHigh1, int iLow2, int iHigh2)