Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 2260ad84 authored by hhakim's avatar hhakim
Browse files

Fix svdtj tests for complex<float> on macOS.

The faster heuristic doesn't work so well for complex<float>.
See macOS test errors: https://cdash-ci.inria.fr/test/2751663

Extract:
==================== test 2: rel. error
svdtj input conf:
 J1: 0
 J2: 0
 t1: -1
 t2: -1
 tol: 0.1
 relErr: 1
 order: -1
 enable_large_Faust: 0
 matrix norm: 7.59428
 err_period: 100
U factor : 99, relative err.: 9.60274e-07
V factor : 99, relative err.: 6.40183e-07
SVDTJ iteration: 100, singular values approximate square norm error: 8.92282e-06
U factor : 199, relative err.: 1.49376e-06
V factor : 199, relative err.: 1.17367e-06
Warning: U approximate accuracy is not increasing anymore, stopped eigtj tunning for U.
        U current error: 1.49376e-06, previous error: 9.60274e-07
Warning: V approximate accuracy is not increasing anymore, stopped eigtj tunning for V.
        V current error: 1.17367e-06, previous error: 6.40183e-07
U, V number of factors: 100, 100
U, V RCGs: 0.930909 0.46556
[...]
svdtj norm err: -6.2789e-08
svdtj square norm err: -7.62939e-06
Assertion failed: (norm_err <= tol), function auto_tests, file /Users/ci/builds/sonxyZB3/0/faustgrp/faust/build_FaustMacOSPythonMatlab/run_test/src/test_svdtj_complexfloat.cpp, line 146.
parent b612dbf1
No related branches found
No related tags found
No related merge requests found
#include "faust_TransformHelper.h" #include "faust_TransformHelper.h"
#include "faust_EigTJGen.h" #include "faust_EigTJGen.h"
#include "faust_SVDTJ.h" #include "faust_SVDTJ.h"
...@@ -133,7 +132,7 @@ void auto_tests() ...@@ -133,7 +132,7 @@ void auto_tests()
delete S_ delete S_
cout << string(20, '=') << " test 1: J limit" << endl; cout << string(20, '=') << " test 1: J limit" << endl;
auto norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); auto err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(U->size() == 16); // auto-computed t1 = t2 = 64 for U, 64 * 16 == 1024 == J assert(U->size() == 16); // auto-computed t1 = t2 = 64 for U, 64 * 16 == 1024 == J
delUSV(); delUSV();
...@@ -142,8 +141,8 @@ void auto_tests() ...@@ -142,8 +141,8 @@ void auto_tests()
J1 = J2 = 0; J1 = J2 = 0;
// tol = 1e-3; // tol = 1e-3;
tol = 1e-1; tol = 1e-1;
norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(norm_err <= tol); assert(err <= tol);
delUSV(); delUSV();
...@@ -152,8 +151,8 @@ void auto_tests() ...@@ -152,8 +151,8 @@ void auto_tests()
J1 = J2 = 0; J1 = J2 = 0;
tol = 1e-2; tol = 1e-2;
relErr = false; relErr = false;
norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(norm_err <= tol); assert(err <= tol);
delUSV(); delUSV();
...@@ -162,14 +161,14 @@ void auto_tests() ...@@ -162,14 +161,14 @@ void auto_tests()
J1 = J2 = 128; J1 = J2 = 128;
tol = 1e-3; tol = 1e-3;
relErr = true; relErr = true;
norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(norm_err <= tol || U->size() * m / 2 <= J1); //automatic t1 = m / 2 for U assert(err <= tol || U->size() * m / 2 <= J1); //automatic t1 = m / 2 for U
assert(norm_err <= tol || V->size() * n / 2 <= J2); //automatic t2 = n / 2 for V assert(err <= tol || V->size() * n / 2 <= J2); //automatic t2 = n / 2 for V
cout << string(20, '=') << " test 5: J limit, t=1" << endl; cout << string(20, '=') << " test 5: J limit, t=1" << endl;
t1 = t2 = 1; t1 = t2 = 1;
J1 = J2 = 100; J1 = J2 = 100;
norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(U->size() == J1); // auto-computed t1 = t2 = 1 assert(U->size() == J1); // auto-computed t1 = t2 = 1
t1 = t2 = -1; t1 = t2 = -1;
...@@ -180,8 +179,8 @@ void auto_tests() ...@@ -180,8 +179,8 @@ void auto_tests()
tol = 1e-3; tol = 1e-3;
relErr = true; relErr = true;
enable_large_Faust = true; //otherwise it doesn't work enable_large_Faust = true; //otherwise it doesn't work
norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(norm_err <= tol); assert(err <= tol);
delUSV(); delUSV();
...@@ -193,8 +192,8 @@ void auto_tests() ...@@ -193,8 +192,8 @@ void auto_tests()
tol = 1e-2; tol = 1e-2;
relErr = false; relErr = false;
enable_large_Faust = true; //otherwise it doesn't work enable_large_Faust = true; //otherwise it doesn't work
norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(norm_err <= tol); assert(err <= tol);
delUSV(); delUSV();
...@@ -203,8 +202,8 @@ void auto_tests() ...@@ -203,8 +202,8 @@ void auto_tests()
J1 = J2 = 128; J1 = J2 = 128;
tol = 1e-3; tol = 1e-3;
relErr = true; relErr = true;
norm_err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false); err = svdtj_and_error(A, J1, J2, t1, t2, tol, relErr, order, enable_large_Faust, verb, &U, &V, &S_, false);
assert(norm_err <= tol || U->size() == J1); //automatic t1 = t2 = m (or n) / 2 for U (resp V) assert(err <= tol || U->size() == J1); //automatic t1 = t2 = m (or n) / 2 for U (resp V)
delete sA; delete sA;
delete A; delete A;
...@@ -215,6 +214,15 @@ void auto_tests() ...@@ -215,6 +214,15 @@ void auto_tests()
*/ */
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
#ifdef __APPLE__
if(is_same<FPP, complex<float>>::value)
cerr << "Warning: macOS detected, complex<float> doesn't work well for these tests if SVDTJ error heuristic is used (compute true error)." << endl;
setenv("SVDTJ_ALL_TRUE_ERR", "1", true);
// TODO: why is it working well on Linux and Windows but not with macOS clang compiled svdtj (is it unstable?)
// no pb with complex<double>, float and double
#endif
// default input // default input
int m, n, min_mn; int m, n, min_mn;
m = 128; m = 128;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment