17faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// This file is part of Eigen, a lightweight C++ template library 27faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// for linear algebra. 37faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// 47faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// Copyright (C) 2013 Gauthier Brun <brun.gauthier@gmail.com> 57faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// Copyright (C) 2013 Nicolas Carre <nicolas.carre@ensimag.fr> 67faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// Copyright (C) 2013 Jean Ceccato <jean.ceccato@ensimag.fr> 77faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// Copyright (C) 2013 Pierre Zoppitelli <pierre.zoppitelli@ensimag.fr> 87faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// 97faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// This Source Code Form is subject to the terms of the Mozilla 107faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// Public License v. 2.0. If a copy of the MPL was not distributed 117faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// with this file, You can obtain one at http://mozilla.org/MPL/2.0/ 127faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 137faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez#include "svd_common.h" 147faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez#include <iostream> 157faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez#include <Eigen/LU> 167faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 177faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// check if "svd" is the good image of "m" 187faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 197faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd_check_full(const MatrixType& m, const BDCSVD<MatrixType>& svd) 207faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 217faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_check_full< MatrixType, BDCSVD< MatrixType > >(m, svd); 227faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} 237faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 247faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// Compare to a reference value 257faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 267faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd_compare_to_full(const MatrixType& m, 277faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez unsigned int computationOptions, 287faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez const BDCSVD<MatrixType>& referenceSvd) 297faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 307faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_compare_to_full< MatrixType, BDCSVD< MatrixType > >(m, computationOptions, referenceSvd); 317faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end bdcsvd_compare_to_full 327faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 337faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 347faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 357faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd_solve(const MatrixType& m, unsigned int computationOptions) 367faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 377faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_solve< MatrixType, BDCSVD< MatrixType > >(m, computationOptions); 387faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end template bdcsvd_solve 397faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 407faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 417faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// test the computations options 427faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 437faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd_test_all_computation_options(const MatrixType& m) 447faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 457faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez BDCSVD<MatrixType> fullSvd(m, ComputeFullU|ComputeFullV); 467faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_test_computation_options_1< MatrixType, BDCSVD< MatrixType > >(m, fullSvd); 477faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_test_computation_options_2< MatrixType, BDCSVD< MatrixType > >(m, fullSvd); 487faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end bdcsvd_test_all_computation_options 497faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 507faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 517faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// Call a test with all the computations options 527faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 537faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd(const MatrixType& a = MatrixType(), bool pickrandom = true) 547faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 557faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez MatrixType m = pickrandom ? MatrixType::Random(a.rows(), a.cols()) : a; 567faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez bdcsvd_test_all_computation_options<MatrixType>(m); 577faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end template bdcsvd 587faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 597faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 607faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// verify assert 617faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 627faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd_verify_assert(const MatrixType& m) 637faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 647faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_verify_assert< MatrixType, BDCSVD< MatrixType > >(m); 657faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez}// end template bdcsvd_verify_assert 667faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 677faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 687faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// test weird values 697faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 707faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd_inf_nan() 717faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 727faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_inf_nan< MatrixType, BDCSVD< MatrixType > >(); 737faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez}// end template bdcsvd_inf_nan 747faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 757faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 767faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 777faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid bdcsvd_preallocate() 787faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 797faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez svd_preallocate< BDCSVD< MatrixXf > >(); 807faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end bdcsvd_preallocate 817faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 827faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 837faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// compare the Singular values returned with Jacobi and Bdc 847faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandeztemplate<typename MatrixType> 857faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid compare_bdc_jacobi(const MatrixType& a = MatrixType(), unsigned int computationOptions = 0) 867faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 877faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez std::cout << "debut compare" << std::endl; 887faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez MatrixType m = MatrixType::Random(a.rows(), a.cols()); 897faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez BDCSVD<MatrixType> bdc_svd(m); 907faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez JacobiSVD<MatrixType> jacobi_svd(m); 917faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez VERIFY_IS_APPROX(bdc_svd.singularValues(), jacobi_svd.singularValues()); 927faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez if(computationOptions & ComputeFullU) 937faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez VERIFY_IS_APPROX(bdc_svd.matrixU(), jacobi_svd.matrixU()); 947faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez if(computationOptions & ComputeThinU) 957faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez VERIFY_IS_APPROX(bdc_svd.matrixU(), jacobi_svd.matrixU()); 967faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez if(computationOptions & ComputeFullV) 977faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez VERIFY_IS_APPROX(bdc_svd.matrixV(), jacobi_svd.matrixV()); 987faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez if(computationOptions & ComputeThinV) 997faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez VERIFY_IS_APPROX(bdc_svd.matrixV(), jacobi_svd.matrixV()); 1007faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez std::cout << "fin compare" << std::endl; 1017faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end template compare_bdc_jacobi 1027faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1037faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1047faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez// call the tests 1057faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandezvoid test_bdcsvd() 1067faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez{ 1077faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // test of Dynamic defined Matrix (42, 42) of float 1087faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_11(( bdcsvd_verify_assert<Matrix<float,Dynamic,Dynamic> > 1097faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<float,Dynamic,Dynamic>(42,42)) )); 1107faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_11(( compare_bdc_jacobi<Matrix<float,Dynamic,Dynamic> > 1117faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<float,Dynamic,Dynamic>(42,42), 0) )); 1127faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_11(( bdcsvd<Matrix<float,Dynamic,Dynamic> > 1137faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<float,Dynamic,Dynamic>(42,42)) )); 1147faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1157faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // test of Dynamic defined Matrix (50, 50) of double 1167faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_13(( bdcsvd_verify_assert<Matrix<double,Dynamic,Dynamic> > 1177faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(50,50)) )); 1187faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_13(( compare_bdc_jacobi<Matrix<double,Dynamic,Dynamic> > 1197faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(50,50), 0) )); 1207faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_13(( bdcsvd<Matrix<double,Dynamic,Dynamic> > 1217faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(50, 50)) )); 1227faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1237faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // test of Dynamic defined Matrix (22, 22) of complex double 1247faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_14(( bdcsvd_verify_assert<Matrix<std::complex<double>,Dynamic,Dynamic> > 1257faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<std::complex<double>,Dynamic,Dynamic>(22,22)) )); 1267faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_14(( compare_bdc_jacobi<Matrix<std::complex<double>,Dynamic,Dynamic> > 1277faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<std::complex<double>, Dynamic, Dynamic> (22,22), 0) )); 1287faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_14(( bdcsvd<Matrix<std::complex<double>,Dynamic,Dynamic> > 1297faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<std::complex<double>,Dynamic,Dynamic>(22, 22)) )); 1307faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1317faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // test of Dynamic defined Matrix (10, 10) of int 1327faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez //CALL_SUBTEST_15(( bdcsvd_verify_assert<Matrix<int,Dynamic,Dynamic> > 1337faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // (Matrix<int,Dynamic,Dynamic>(10,10)) )); 1347faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez //CALL_SUBTEST_15(( compare_bdc_jacobi<Matrix<int,Dynamic,Dynamic> > 1357faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // (Matrix<int,Dynamic,Dynamic>(10,10), 0) )); 1367faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez //CALL_SUBTEST_15(( bdcsvd<Matrix<int,Dynamic,Dynamic> > 1377faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // (Matrix<int,Dynamic,Dynamic>(10, 10)) )); 1387faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1397faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1407faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // test of Dynamic defined Matrix (8, 6) of double 1417faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1427faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_16(( bdcsvd_verify_assert<Matrix<double,Dynamic,Dynamic> > 1437faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(8,6)) )); 1447faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_16(( compare_bdc_jacobi<Matrix<double,Dynamic,Dynamic> > 1457faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(8, 6), 0) )); 1467faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_16(( bdcsvd<Matrix<double,Dynamic,Dynamic> > 1477faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(8, 6)) )); 1487faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1497faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1507faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1517faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // test of Dynamic defined Matrix (36, 12) of float 1527faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_17(( compare_bdc_jacobi<Matrix<float,Dynamic,Dynamic> > 1537faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<float,Dynamic,Dynamic>(36, 12), 0) )); 1547faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_17(( bdcsvd<Matrix<float,Dynamic,Dynamic> > 1557faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<float,Dynamic,Dynamic>(36, 12)) )); 1567faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1577faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // test of Dynamic defined Matrix (5, 8) of double 1587faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_18(( compare_bdc_jacobi<Matrix<double,Dynamic,Dynamic> > 1597faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(5, 8), 0) )); 1607faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_18(( bdcsvd<Matrix<double,Dynamic,Dynamic> > 1617faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (Matrix<double,Dynamic,Dynamic>(5, 8)) )); 1627faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1637faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1647faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // non regression tests 1657faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_3(( bdcsvd_verify_assert(Matrix3f()) )); 1667faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_4(( bdcsvd_verify_assert(Matrix4d()) )); 1677faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_7(( bdcsvd_verify_assert(MatrixXf(10,12)) )); 1687faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_8(( bdcsvd_verify_assert(MatrixXcd(7,5)) )); 1697faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1707faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // SUBTESTS 1 and 2 on specifics matrix 1717faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez for(int i = 0; i < g_repeat; i++) { 1727faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez Matrix2cd m; 1737faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez m << 0, 1, 1747faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 0, 1; 1757faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_1(( bdcsvd(m, false) )); 1767faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez m << 1, 0, 1777faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1, 0; 1787faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_1(( bdcsvd(m, false) )); 1797faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1807faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez Matrix2d n; 1817faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez n << 0, 0, 1827faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 0, 0; 1837faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_2(( bdcsvd(n, false) )); 1847faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez n << 0, 0, 1857faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 0, 1; 1867faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_2(( bdcsvd(n, false) )); 1877faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1887faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // Statics matrix don't work with BDSVD yet 1897faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // bdc algo on a random 3x3 float matrix 1907faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // CALL_SUBTEST_3(( bdcsvd<Matrix3f>() )); 1917faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // bdc algo on a random 4x4 double matrix 1927faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // CALL_SUBTEST_4(( bdcsvd<Matrix4d>() )); 1937faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // bdc algo on a random 3x5 float matrix 1947faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // CALL_SUBTEST_5(( bdcsvd<Matrix<float,3,5> >() )); 1957faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 1967faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez int r = internal::random<int>(1, 30), 1977faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez c = internal::random<int>(1, 30); 1987faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_7(( bdcsvd<MatrixXf>(MatrixXf(r,c)) )); 1997faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_8(( bdcsvd<MatrixXcd>(MatrixXcd(r,c)) )); 2007faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (void) r; 2017faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez (void) c; 2027faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 2037faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // Test on inf/nan matrix 2047faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_7( bdcsvd_inf_nan<MatrixXf>() ); 2057faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez } 2067faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 2077faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_7(( bdcsvd<MatrixXf>(MatrixXf(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); 2087faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_8(( bdcsvd<MatrixXcd>(MatrixXcd(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3))) )); 2097faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 2107faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez // Test problem size constructors 2117faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez CALL_SUBTEST_7( BDCSVD<MatrixXf>(10,10) ); 2127faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez 2137faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez} // end test_bdcsvd 214