diff --git a/misc/test/CMakeLists.txt b/misc/test/CMakeLists.txt index 4f8068a40edaecd773d9d5348ff973c970debf38..ea4dd73761372123b88105b9e00d5aaf46b314ab 100755 --- a/misc/test/CMakeLists.txt +++ b/misc/test/CMakeLists.txt @@ -178,14 +178,14 @@ endif(NOT NOCPPTESTS) ####### IF THE MATIO LIBRARY IS AVAILABLE ELSE WE USE TXT OR XML DATA ####### if(MATIO_LIB_FILE AND MATIO_INC_DIR AND BUILD_READ_MAT_FILE AND NOT NOCPPTESTS) # AND HDF5_LIB_FILE) include_directories(${FAUST_BIN_TEST_SRC_DIR}) - set(GIVENS_CLASS "GivensFGFTComplex<SCALAR,DEVICE,SCALAR2>") + set(GIVENS_CLASS "EigTJComplex<SCALAR,DEVICE,SCALAR2>") set(GIVENS_SCALAR "Complex") - configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/GivensFGFTUtil.h ${FAUST_BIN_TEST_SRC_DIR}/GivensFGFTUtilComplex.h @ONLY) - configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/GivensFGFTUtil.hpp ${FAUST_BIN_TEST_SRC_DIR}/GivensFGFTUtilComplex.hpp @ONLY) - set(GIVENS_CLASS "GivensFGFT<SCALAR,DEVICE,SCALAR2>") + configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/EigTJUtil.h ${FAUST_BIN_TEST_SRC_DIR}/EigTJUtilComplex.h @ONLY) + configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/EigTJUtil.hpp ${FAUST_BIN_TEST_SRC_DIR}/EigTJUtilComplex.hpp @ONLY) + set(GIVENS_CLASS "EigTJ<SCALAR,DEVICE,SCALAR2>") set(GIVENS_SCALAR "Real") - configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/GivensFGFTUtil.h ${FAUST_BIN_TEST_SRC_DIR}/GivensFGFTUtilReal.h @ONLY) - configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/GivensFGFTUtil.hpp ${FAUST_BIN_TEST_SRC_DIR}/GivensFGFTUtilReal.hpp @ONLY) + configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/EigTJUtil.h ${FAUST_BIN_TEST_SRC_DIR}/EigTJUtilReal.h @ONLY) + configure_file(${FAUST_SRC_TEST_SRC_CPP_DIR}/EigTJUtil.hpp ${FAUST_BIN_TEST_SRC_DIR}/EigTJUtilReal.hpp @ONLY) ### list of executable generated in double and simple precision # hierarchical_fact : test the hierarchical_fact algorithm @@ -193,7 +193,7 @@ if(MATIO_LIB_FILE AND MATIO_INC_DIR AND BUILD_READ_MAT_FILE AND NOT NOCPPTESTS) # faust_multiplication : time comparison between Faust-vector product and Dense matrix-vector product - list(APPEND tests hierarchicalFactorization hierarchicalFactorizationFFT test_palm4MSA test_palm4MSAFFT faust_multiplication faust_matdense_conjugate GivensFGFT GivensFGFTSparse GivensFGFTParallel GivensFGFTParallelSparse test_MatDiag faust_matsparse_mul faust_matsparse_index_op GivensFGFTComplex GivensFGFTComplexSparse GivensFGFTParallelComplex faust_toeplitz faust_circ faust_hankel faust_sparse_prox_sp palm4msa_2020 hierarchical2020 hierarchical2020Hadamard hierarchicalFactorizationHadamard hierarchicalFactorizationButterfly hierarchicalFactorizationButterflyBalanced test_MatBSR test_dynprog_mul_cpu faust_butterfly_transform faust_butterfly_transform2 faust_butterfly_mat faust_perm_mat test_svdtj) + list(APPEND tests hierarchicalFactorization hierarchicalFactorizationFFT test_palm4MSA test_palm4MSAFFT faust_multiplication faust_matdense_conjugate EigTJ EigTJSparse EigTJParallel EigTJParallelSparse test_MatDiag faust_matsparse_mul faust_matsparse_index_op EigTJComplex EigTJComplexSparse EigTJParallelComplex faust_toeplitz faust_circ faust_hankel faust_sparse_prox_sp palm4msa_2020 hierarchical2020 hierarchical2020Hadamard hierarchicalFactorizationHadamard hierarchicalFactorizationButterfly hierarchicalFactorizationButterflyBalanced test_MatBSR test_dynprog_mul_cpu faust_butterfly_transform faust_butterfly_transform2 faust_butterfly_mat faust_perm_mat test_svdtj) if(FAUST_TORCH) list(APPEND tests faust_torch) @@ -215,10 +215,10 @@ if(MATIO_LIB_FILE AND MATIO_INC_DIR AND BUILD_READ_MAT_FILE AND NOT NOCPPTESTS) endif() if(${TEST_FPP} MATCHES complex ) set(TEST_IS_COMPLEX 1) - if(${testin} MATCHES GivensFGFT OR ${testin} MATCHES palm4msa_2020 OR ${testin} MATCHES hierarchical2020.* OR ${testin} MATCHES hierarchicalFactorizationHadamard OR ${testin} MATCHES hierarchicalFactorizationButterfly) + if(${testin} MATCHES EigTJ OR ${testin} MATCHES palm4msa_2020 OR ${testin} MATCHES hierarchical2020.* OR ${testin} MATCHES hierarchicalFactorizationHadamard OR ${testin} MATCHES hierarchicalFactorizationButterfly) continue() endif() - # GivensFGFT doesn't handle complex matrices + # EigTJ doesn't handle complex matrices else() set(TEST_IS_COMPLEX 0) endif() diff --git a/misc/test/src/C++/GivensFGFT.cpp.in b/misc/test/src/C++/EigTJ.cpp.in similarity index 85% rename from misc/test/src/C++/GivensFGFT.cpp.in rename to misc/test/src/C++/EigTJ.cpp.in index 53870eaf610977887a6d1dfeef87fb5f97952086..49644b7d278a695fcc9247f25c994cccf41f13b2 100644 --- a/misc/test/src/C++/GivensFGFT.cpp.in +++ b/misc/test/src/C++/EigTJ.cpp.in @@ -1,11 +1,11 @@ #include "faust_constant.h" -#include "faust_GivensFGFT.h" +#include "faust_EigTJ.h" #include "faust_MatDense.h" #include "faust_init_from_matio_params.h" #include "faust_init_from_matio_core.h" #include "faust_init_from_matio.h" #include "faust_Transform.h" -#include "GivensFGFTUtilReal.h" +#include "EigTJUtilReal.h" #include <complex> @@ -28,7 +28,7 @@ int main() J = init_int_from_matio(conf_file, "J"); // Execute the algorithm - GivensFGFT<FPP,Cpu,FPP> algo(Lap, J, /*verbosity */ 0, /* stoppingError */ 0.0, /* errIsRel */ true, /* enable_large_Faust */ true); + EigTJ<FPP,Cpu,FPP> algo(Lap, J, /*verbosity */ 0, /* stoppingError */ 0.0, /* errIsRel */ true, /* enable_large_Faust */ true); algo.compute_facts(); // Compare pivot choices along the iterations (between matlab ref and C++ impl.) test_pivot_choices(&algo, conf_file); diff --git a/misc/test/src/C++/GivensFGFTComplex.cpp.in b/misc/test/src/C++/EigTJComplex.cpp.in similarity index 84% rename from misc/test/src/C++/GivensFGFTComplex.cpp.in rename to misc/test/src/C++/EigTJComplex.cpp.in index a8f785e09839d250ed21d4d2cf24c2f2209010bc..48ef035782dac3e4fbc7852b68249c7dc0dd0f02 100644 --- a/misc/test/src/C++/GivensFGFTComplex.cpp.in +++ b/misc/test/src/C++/EigTJComplex.cpp.in @@ -1,10 +1,10 @@ -#include "faust_GivensFGFTComplex.h" +#include "faust_EigTJComplex.h" #include "faust_MatDense.h" #include "faust_init_from_matio_params.h" #include "faust_init_from_matio_core.h" #include "faust_Transform.h" -#include "GivensFGFTUtilComplex.h" +#include "EigTJUtilComplex.h" #include <complex> @@ -28,7 +28,7 @@ int main() init_faust_mat_from_matio(Lap,conf_file,"Lap"); J = init_int_from_matio(conf_file, "J"); - GivensFGFTComplex<complex<FPP>,Cpu,FPP> algo(Lap,J, /*verbosity */ 0, /* stoppingError */ 0.0, /* errIsRel */ true, /* enable_large_Faust */ true); + EigTJComplex<complex<FPP>,Cpu,FPP> algo(Lap,J, /*verbosity */ 0, /* stoppingError */ 0.0, /* errIsRel */ true, /* enable_large_Faust */ true); algo.compute_facts(); diff --git a/misc/test/src/C++/GivensFGFTComplexSparse.cpp.in b/misc/test/src/C++/EigTJComplexSparse.cpp.in similarity index 90% rename from misc/test/src/C++/GivensFGFTComplexSparse.cpp.in rename to misc/test/src/C++/EigTJComplexSparse.cpp.in index 51b6b94f608f32a3ff3175c18ea1b6ee9416d270..c29045f271e650da2e0d275d7e2223801272d834 100644 --- a/misc/test/src/C++/GivensFGFTComplexSparse.cpp.in +++ b/misc/test/src/C++/EigTJComplexSparse.cpp.in @@ -1,11 +1,11 @@ -#include "faust_GivensFGFTComplex.h" +#include "faust_EigTJComplex.h" #include "faust_MatDense.h" #include "faust_MatSparse.h" #include "faust_init_from_matio_params.h" #include "faust_init_from_matio_core.h" #include "faust_Transform.h" -#include "GivensFGFTUtilComplex.h" +#include "EigTJUtilComplex.h" #include <complex> @@ -30,7 +30,7 @@ int main() J = init_int_from_matio(conf_file, "J"); Faust::MatSparse<complex<FPP>,Cpu> sLap(Lap); - GivensFGFTComplex<complex<FPP>,Cpu,FPP> algo(sLap,J); + EigTJComplex<complex<FPP>,Cpu,FPP> algo(sLap,J); algo.compute_facts(); diff --git a/misc/test/src/C++/GivensFGFTParallel.cpp.in b/misc/test/src/C++/EigTJParallel.cpp.in similarity index 87% rename from misc/test/src/C++/GivensFGFTParallel.cpp.in rename to misc/test/src/C++/EigTJParallel.cpp.in index 7e132252a2583857740578e63ad4b1507b91b31a..819d0df3f1b0f861a3341d296386a86bd6ed4bc8 100644 --- a/misc/test/src/C++/GivensFGFTParallel.cpp.in +++ b/misc/test/src/C++/EigTJParallel.cpp.in @@ -1,9 +1,9 @@ -#include "faust_GivensFGFTParallel.h" +#include "faust_EigTJParallel.h" #include "faust_MatDense.h" #include "faust_init_from_matio_params.h" #include "faust_init_from_matio_core.h" -#include "GivensFGFTUtilReal.h" +#include "EigTJUtilReal.h" using namespace Faust; @@ -25,7 +25,7 @@ int main() init_faust_mat_from_matio(Lap,conf_file, "Lap"); J = init_int_from_matio(conf_file, "J"); - GivensFGFTParallel<FPP,Cpu, FPP> algo(Lap, J,/*t=*/ Lap.getNbRow()/2, /*verbosity */ 0, + EigTJParallel<FPP,Cpu, FPP> algo(Lap, J,/*t=*/ Lap.getNbRow()/2, /*verbosity */ 0, /* stoppingError */ 0.0, /* errIsRel */ true, /* enable_large_Faust */ true); algo.compute_facts(); diff --git a/misc/test/src/C++/GivensFGFTParallelComplex.cpp.in b/misc/test/src/C++/EigTJParallelComplex.cpp.in similarity index 88% rename from misc/test/src/C++/GivensFGFTParallelComplex.cpp.in rename to misc/test/src/C++/EigTJParallelComplex.cpp.in index f57b0f9b0f9812beeddc4f8b463da4d92f9d5159..09c35d8526d8af168ee4bc170a9ab56b4931f4d6 100644 --- a/misc/test/src/C++/GivensFGFTParallelComplex.cpp.in +++ b/misc/test/src/C++/EigTJParallelComplex.cpp.in @@ -1,9 +1,9 @@ -#include "faust_GivensFGFTParallelComplex.h" +#include "faust_EigTJParallelComplex.h" #include "faust_MatDense.h" #include "faust_init_from_matio_params.h" #include "faust_init_from_matio_core.h" -#include "GivensFGFTUtilComplex.h" +#include "EigTJUtilComplex.h" #include <complex> @@ -26,7 +26,7 @@ int main() init_faust_mat_from_matio(Lap,conf_file, "Lap"); J = init_int_from_matio(conf_file, "J"); - GivensFGFTParallelComplex<complex<FPP>,Cpu, FPP> algo(Lap, J,/*t=*/ Lap.getNbRow()/2, + EigTJParallelComplex<complex<FPP>,Cpu, FPP> algo(Lap, J,/*t=*/ Lap.getNbRow()/2, /*verbosity */ 0, /* stoppingError */ 0.0, /* errIsRel */ true, /* enable_large_Faust */ true); algo.compute_facts(); diff --git a/misc/test/src/C++/GivensFGFTParallelSparse.cpp.in b/misc/test/src/C++/EigTJParallelSparse.cpp.in similarity index 97% rename from misc/test/src/C++/GivensFGFTParallelSparse.cpp.in rename to misc/test/src/C++/EigTJParallelSparse.cpp.in index 83783fe7e6156e46d6d1f787ad01943d06fe0e64..91fc1a03dbfe745b0d9b60be9a042c5984b2d390 100644 --- a/misc/test/src/C++/GivensFGFTParallelSparse.cpp.in +++ b/misc/test/src/C++/EigTJParallelSparse.cpp.in @@ -1,5 +1,5 @@ -#include "faust_GivensFGFTParallel.h" +#include "faust_EigTJParallel.h" #include "faust_MatDense.h" #include "faust_init_from_matio_params.h" #include "faust_init_from_matio_core.h" @@ -26,7 +26,7 @@ int main() sLap = Lap; int J = 5472; //TODO: should be retrieved from .mat file (not be a hard-coded value) - GivensFGFTParallel<FPP,Cpu, FPP> algo(sLap,J,/*t=*/ Lap.getNbRow()/2, + EigTJParallel<FPP,Cpu, FPP> algo(sLap,J,/*t=*/ Lap.getNbRow()/2, /*verbosity */ 0, /* stoppingError */ 0.0, /* errIsRel */ true, /* enable_large_Faust */ true); algo.compute_facts(); diff --git a/misc/test/src/C++/GivensFGFTSparse.cpp.in b/misc/test/src/C++/EigTJSparse.cpp.in similarity index 91% rename from misc/test/src/C++/GivensFGFTSparse.cpp.in rename to misc/test/src/C++/EigTJSparse.cpp.in index 438f380d52098c25648ada58bace08ee33642fcb..884f13f0ba819ec808129ad275e99014036c8b4f 100644 --- a/misc/test/src/C++/GivensFGFTSparse.cpp.in +++ b/misc/test/src/C++/EigTJSparse.cpp.in @@ -1,10 +1,10 @@ -#include "faust_GivensFGFT.h" +#include "faust_EigTJ.h" #include "faust_MatDense.h" #include "faust_init_from_matio_params.h" #include "faust_init_from_matio_core.h" #include "faust_Transform.h" #include "faust_MatSparse.h" -#include "GivensFGFTUtilReal.h" +#include "EigTJUtilReal.h" #include <complex> @@ -29,7 +29,7 @@ int main() Faust::MatSparse<FPP,Cpu> spLap(Lap); // Execute the algorithm - GivensFGFT<FPP,Cpu,FPP> algo(spLap, J); + EigTJ<FPP,Cpu,FPP> algo(spLap, J); algo.compute_facts(); // Compare pivot choices along the iterations (between matlab ref and C++ impl.) diff --git a/misc/test/src/C++/EigTJUtil.h b/misc/test/src/C++/EigTJUtil.h new file mode 100644 index 0000000000000000000000000000000000000000..e40290e0a86a485a760f78bd0731d78006f37877 --- /dev/null +++ b/misc/test/src/C++/EigTJUtil.h @@ -0,0 +1,28 @@ +#ifndef GIVENS_TEST_UTILITY_@GIVENS_SCALAR@ +#define GIVENS_TEST_UTILITY_@GIVENS_SCALAR@ +/** + * Tests iteration errors by comparing matlab and C++ impl. errors. + */ +template<typename SCALAR, FDevice DEVICE, typename SCALAR2> +void test_ite_errors(const @GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, int ref_ite_period = 0); + +/** + * Tests eigenvalues getting them in unordered or ordered sequence, comparing them to matlab ref. ones. + */ +template<typename SCALAR, FDevice DEVICE, typename SCALAR2> +void test_eigenvalues(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file); + +template<typename SCALAR, FDevice DEVICE, typename SCALAR2> +void test_eigentransform(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file); + +template<typename SCALAR, FDevice DEVICE, typename SCALAR2> +void test_err_against_Laplacian(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file); + +/** + * Tests that pivot choices made by the C++ impl. are sufficiently close to the ones made by matlab ref. + */ +template<typename SCALAR, FDevice DEVICE, typename SCALAR2> +void test_pivot_choices(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, const float same_pivot_target_rate=.99f, const int stop_count_ite = 57); + +#include "EigTJUtil@GIVENS_SCALAR@.hpp" +#endif diff --git a/misc/test/src/C++/GivensFGFTUtil.hpp b/misc/test/src/C++/EigTJUtil.hpp similarity index 90% rename from misc/test/src/C++/GivensFGFTUtil.hpp rename to misc/test/src/C++/EigTJUtil.hpp index 64faa5e34fc2ef60a9c4988afaa07bb02910ac85..97b6308eeaa54d196536e38e5d93bd2e4f85cc29 100644 --- a/misc/test/src/C++/GivensFGFTUtil.hpp +++ b/misc/test/src/C++/EigTJUtil.hpp @@ -3,7 +3,7 @@ cout << "VALIDATED ASSERTION: " << msg <<endl; template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_err_against_Laplacian(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file) +void test_err_against_Laplacian(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file) { Faust::MatDense<SCALAR,DEVICE> Lap, tmp; Faust::MatDense<SCALAR,DEVICE> ordered_Uhat; @@ -54,7 +54,7 @@ void test_err_against_Laplacian(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR } template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_eigentransform(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file) +void test_eigentransform(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file) { Faust::MatDense<SCALAR,DEVICE> U, tmp; SCALAR2 err1; @@ -101,7 +101,7 @@ void test_eigentransform(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or G } template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_pivot_choices(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, const float same_pivot_target_rate /* default to .99 */, const int stop_count_ite /*= 57*/) +void test_pivot_choices(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, const float same_pivot_target_rate /* default to .99 */, const int stop_count_ite /*= 57*/) { vector<pair<int,int>> coord_choices = algo->get_coord_choices(); int J = init_int_from_matio(conf_file, "J"); @@ -150,7 +150,7 @@ void test_pivot_choices(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or Gi } template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_eigenvalues(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file) +void test_eigenvalues(@GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file) { SCALAR2 ERR_OK_TRESHOLD = 1e-2; Faust::MatDense<SCALAR,DEVICE> tmp; @@ -203,7 +203,7 @@ void test_eigenvalues(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or Give template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_ite_errors(const @GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, int ref_ite_period /* default to 0 to use algo ERROR_CALC_PERIOD */) +void test_ite_errors(const @GIVENS_CLASS@ /*EigTJ<SCALAR,DEVICE,SCALAR2> or EigTJComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, int ref_ite_period /* default to 0 to use algo ERROR_CALC_PERIOD */) { // assert(algo->ERROR_CALC_PERIOD == 100); /** C++ impl. must calculate the error at the same rate than matlab */ diff --git a/misc/test/src/C++/GivensFGFTUtil.h b/misc/test/src/C++/GivensFGFTUtil.h deleted file mode 100644 index 7697582e39e5771a315c66a3785e6fa044c9ec3e..0000000000000000000000000000000000000000 --- a/misc/test/src/C++/GivensFGFTUtil.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef GIVENS_TEST_UTILITY_@GIVENS_SCALAR@ -#define GIVENS_TEST_UTILITY_@GIVENS_SCALAR@ -/** - * Tests iteration errors by comparing matlab and C++ impl. errors. - */ -template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_ite_errors(const @GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, int ref_ite_period = 0); - -/** - * Tests eigenvalues getting them in unordered or ordered sequence, comparing them to matlab ref. ones. - */ -template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_eigenvalues(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file); - -template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_eigentransform(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file); - -template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_err_against_Laplacian(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file); - -/** - * Tests that pivot choices made by the C++ impl. are sufficiently close to the ones made by matlab ref. - */ -template<typename SCALAR, FDevice DEVICE, typename SCALAR2> -void test_pivot_choices(@GIVENS_CLASS@ /*GivensFGFT<SCALAR,DEVICE,SCALAR2> or GivensFGFTComplex<SCALAR,DEVICE,SCALAR2> */ * algo, const char* conf_file, const float same_pivot_target_rate=.99f, const int stop_count_ite = 57); - -#include "GivensFGFTUtil@GIVENS_SCALAR@.hpp" -#endif diff --git a/misc/test/src/C++/test_svdtj.cpp.in b/misc/test/src/C++/test_svdtj.cpp.in index c381a43a2cb36d8f8b47277f3b244392aa34fbcc..d5c2edbd73d36f038cba04eaca0b0a26289a78df 100644 --- a/misc/test/src/C++/test_svdtj.cpp.in +++ b/misc/test/src/C++/test_svdtj.cpp.in @@ -1,6 +1,6 @@ #include "faust_TransformHelper.h" -#include "faust_GivensFGFTGen.h" +#include "faust_EigTJGen.h" #include "faust_SVDTJ.h" #include <cstdlib> #include <string> diff --git a/misc/test/src/Matlab/FaustFactoryTest.m b/misc/test/src/Matlab/FaustFactoryTest.m index d06f72cb92c5f7f3c1fdd844e95321d9bde4c408..96c8d2ad4abece8cd850df0b22c3c922d9c91714 100644 --- a/misc/test/src/Matlab/FaustFactoryTest.m +++ b/misc/test/src/Matlab/FaustFactoryTest.m @@ -352,7 +352,7 @@ classdef FaustFactoryTest < matlab.unittest.TestCase E = F*full(D)*F'-Lap; err = norm(E,'fro')/norm(Lap,'fro') % the error reference is from the C++ test, - % misc/test/src/C++/GivensFGFT.cpp.in + % misc/test/src/C++/EigTJ.cpp.in this.verifyEqual(err, 0.0326529, 'AbsTol', 0.00001) % verify it works the same using the eigtj() alias function [F2,D2] = matfaust.fact.eigtj(Lap, 'nGivens', J, 'enable_large_Faust', true, 'nGivens_per_fac', 1);%, 0, 'verbosity', 2); @@ -371,7 +371,7 @@ classdef FaustFactoryTest < matlab.unittest.TestCase E = F*full(D)*F'-Lap; err = norm(E,'fro')/norm(Lap,'fro') % the error reference is from the C++ test, - % misc/test/src/C++/GivensFGFT.cpp.in + % misc/test/src/C++/EigTJ.cpp.in this.verifyEqual(err, 0.0326529, 'AbsTol', 0.00001) % verify it works the same using the eigtj() alias function [F2,D2] = matfaust.fact.eigtj(Lap, 'nGivens', J, 'nGivens_per_fac', 1, 'enable_large_Faust', true);%, 0, 'verbosity', 2); @@ -391,7 +391,7 @@ classdef FaustFactoryTest < matlab.unittest.TestCase E = F*full(D)*F'-Lap; err = norm(E,'fro')/norm(Lap,'fro') % the error reference is from the C++ test, - % misc/test/src/C++/GivensFGFTParallel.cpp.in + % misc/test/src/C++/EigTJParallel.cpp.in this.verifyEqual(err,0.0398154, 'AbsTol', 0.00001) % verify it works the same using the eigtj() alias function [F2,D2] = matfaust.fact.eigtj(Lap, 'nGivens', J, 'nGivens_per_fac', t, 'enable_large_Faust', true); %, 'verbosity', 2); @@ -411,7 +411,7 @@ classdef FaustFactoryTest < matlab.unittest.TestCase E = F*full(D)*F'-Lap; err = norm(E,'fro')/norm(Lap,'fro') % the error reference is from the C++ test, - % misc/test/src/C++/GivensFGFTParallel.cpp.in + % misc/test/src/C++/EigTJParallel.cpp.in this.verifyEqual(err, 0.0398154, 'AbsTol', 0.00001) % verify it works the same using the eigtj() alias function [F2,D2] = matfaust.fact.eigtj(Lap, 'nGivens', J, 'nGivens_per_fac', t, 'enable_large_Faust', true); %, 'verbosity', 2); diff --git a/misc/test/src/Matlab/test_GivensDiag.m b/misc/test/src/Matlab/test_GivensDiag.m index 580dd47b6d580e489abde7dc8565457091ab66e0..88ef057e92a4195a1eb2f300c53dd88e172fe5a7 100644 --- a/misc/test/src/Matlab/test_GivensDiag.m +++ b/misc/test/src/Matlab/test_GivensDiag.m @@ -1,5 +1,5 @@ -% This matlab test is a reference for C++ port of GivensFGFT -% the C++ test in misc/test/src/C++/GivensFGFT.cpp.in is using the same file +% This matlab test is a reference for C++ port of EigTJ +% the C++ test in misc/test/src/C++/EigTJ.cpp.in is using the same file % so the results can be compared diff --git a/misc/test/src/Matlab/test_GivensDiagPar.m b/misc/test/src/Matlab/test_GivensDiagPar.m index 8ca88c5986e295443045794268fe06624ee48ce2..6f2e810a6e5e452fe42fac8e8e2f9a2306b2465b 100644 --- a/misc/test/src/Matlab/test_GivensDiagPar.m +++ b/misc/test/src/Matlab/test_GivensDiagPar.m @@ -1,5 +1,5 @@ -% This matlab test is a reference for C++ port of GivensFGFTParallel -% the C++ test in misc/test/src/C++/GivensFGFTParallel.cpp.in is using the same file +% This matlab test is a reference for C++ port of EigTJParallel +% the C++ test in misc/test/src/C++/EigTJParallel.cpp.in is using the same file % so the results can be compared p = mfilename('fullpath'); diff --git a/misc/test/src/Python/test_FaustPy.py b/misc/test/src/Python/test_FaustPy.py index 22325f4fc13de7042a81ae4ed5acb0f51a17f77b..89be364d64931d2968275e245730899981c672ca 100644 --- a/misc/test/src/Python/test_FaustPy.py +++ b/misc/test/src/Python/test_FaustPy.py @@ -1522,7 +1522,7 @@ class TestFaustFactory(unittest.TestCase): err = norm((F@D.toarray())@F.T.toarray()-L,"fro")/norm(L,"fro") print("err: ", err) # the error reference is from the C++ test, - # misc/test/src/C++/GivensFGFT.cpp.in + # misc/test/src/C++/EigTJ.cpp.in self.assertAlmostEqual(err, 0.0326529, places=7) # check nnz for the F.numfactors()-1 first factors for fac in [F.factors(i) for i in range(0,F.numfactors())]: @@ -1544,7 +1544,7 @@ class TestFaustFactory(unittest.TestCase): err = norm((F@D.toarray())@F.T.toarray()-L,"fro")/norm(L,"fro") print("err: ", err) # the error reference is from the C++ test, - # misc/test/src/C++/GivensFGFTParallel.cpp.in (_double version) + # misc/test/src/C++/EigTJParallel.cpp.in (_double version) self.assertAlmostEqual(err, 0.0398154, places=7) D2, F2 = eigtj(L, J, nGivens_per_fac=t, verbosity=0, enable_large_Faust=True) @@ -1553,7 +1553,7 @@ class TestFaustFactory(unittest.TestCase): err2 = norm((F2@D.toarray())@F2.T.toarray()-L,"fro")/norm(L,"fro") print("err2: ", err2) # the error reference is from the C++ test, - # misc/test/src/C++/GivensFGFTParallel.cpp.in + # misc/test/src/C++/EigTJParallel.cpp.in self.assertEqual(err, err2) # check nnz for the last factors (avoiding errors due to pivot image # near to zero in first factors) @@ -1577,7 +1577,7 @@ class TestFaustFactory(unittest.TestCase): err = norm((F@D.toarray())@F.T.toarray()-L,"fro")/norm(L,"fro") print("err: ", err) # the error reference is from the C++ test, - # misc/test/src/C++/GivensFGFT.cpp.in + # misc/test/src/C++/EigTJ.cpp.in self.assertAlmostEqual(err, 0.0326529, places=7) # check nnz for the F.numfactors()-1 first factors for fac in [F.factors(i) for i in range(0,F.numfactors())]: @@ -1599,7 +1599,7 @@ class TestFaustFactory(unittest.TestCase): err = norm((F@D.toarray())@F.T.toarray()-L,"fro")/norm(L,"fro") print("err: ", err) # the error reference is from the C++ test, - # misc/test/src/C++/GivensFGFTParallel.cpp.in (_double version) + # misc/test/src/C++/EigTJParallel.cpp.in (_double version) self.assertAlmostEqual(err, 0.0398154, places=7) D2, F2 = eigtj(csr_matrix(L), J, nGivens_per_fac=t, verbosity=0, enable_large_Faust=True) @@ -1608,7 +1608,7 @@ class TestFaustFactory(unittest.TestCase): err2 = norm((F2@D.toarray())@F2.T.toarray()-L,"fro")/norm(L,"fro") print("err2: ", err2) # the error reference is from the C++ test, - # misc/test/src/C++/GivensFGFTParallel.cpp.in + # misc/test/src/C++/EigTJParallel.cpp.in self.assertEqual(err, err2) # check nnz for the last factors for fac in [F2.factors(i) for i in range(F2.numfactors()-10, F2.numfactors())]: diff --git a/src/algorithm/factorization/faust_GivensFGFT.h b/src/algorithm/factorization/faust_EigTJ.h similarity index 81% rename from src/algorithm/factorization/faust_GivensFGFT.h rename to src/algorithm/factorization/faust_EigTJ.h index 3df6f05c146d18601f58cf90579f0ac96e507b40..c897115f8e558e02c2fcdd31dbdc5762f39c3a93 100644 --- a/src/algorithm/factorization/faust_GivensFGFT.h +++ b/src/algorithm/factorization/faust_EigTJ.h @@ -5,7 +5,7 @@ #include "faust_MatSparse.h" #include "faust_MatDense.h" #include "faust_Transform.h" -#include "faust_GivensFGFTGen.h" +#include "faust_EigTJGen.h" #include <cfloat> #include <vector> #include <cmath> @@ -18,14 +18,14 @@ namespace Faust template<typename FPP, FDevice DEVICE, typename FPP2 = Real<FPP>> - class GivensFGFT : public GivensFGFTGen<FPP, DEVICE, FPP2> { + class EigTJ : public EigTJGen<FPP, DEVICE, FPP2> { /** - * \class GivensFGFT + * \class EigTJ * * \brief This class implements the Givens FGFT algorithm. * This algorithm is based on the classical Jacobi eigenvalues algorithm. * - * See parent class GivensFGFTGen for documentation about members. + * See parent class EigTJGen for documentation about members. * * References: * @@ -44,13 +44,13 @@ namespace Faust /** \brief Rotation angle theta for the current iteration's Givens matrix. */ FPP2 theta; - /** \brief In calc_theta() two values are calculated for theta, this boolean is set to true to always choose theta2 (useful for GivensFGFTParallel). */ + /** \brief In calc_theta() two values are calculated for theta, this boolean is set to true to always choose theta2 (useful for EigTJParallel). */ bool always_theta2; /** * Function pointer to any step of the algorithm (internal purpose only). */ - typedef void (GivensFGFT<FPP,DEVICE,FPP2>::*substep_fun)(); + typedef void (EigTJ<FPP,DEVICE,FPP2>::*substep_fun)(); public: @@ -60,10 +60,10 @@ namespace Faust * \param Lap The Laplacian matrix to approximate/diagonalize. * \param J The number of iterations, Givens rotations factors. * */ - GivensFGFT(MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); - GivensFGFT(MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJ(MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJ(MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); /** Destructor */ - virtual ~GivensFGFT() {/*delete[] q_candidates; delete L;*/}; + virtual ~EigTJ() {/*delete[] q_candidates; delete L;*/}; /** * \brief Algo. main step. @@ -119,5 +119,5 @@ namespace Faust }; } -#include "faust_GivensFGFT.hpp" +#include "faust_EigTJ.hpp" #endif diff --git a/src/algorithm/factorization/faust_GivensFGFT.hpp b/src/algorithm/factorization/faust_EigTJ.hpp similarity index 75% rename from src/algorithm/factorization/faust_GivensFGFT.hpp rename to src/algorithm/factorization/faust_EigTJ.hpp index c1dd83c3a5e68eaa4519fa6f213022a7da1ce211..74795a66eb024f958049a607051b3e69ae65b55f 100644 --- a/src/algorithm/factorization/faust_GivensFGFT.hpp +++ b/src/algorithm/factorization/faust_EigTJ.hpp @@ -1,22 +1,22 @@ using namespace Faust; template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::next_step() +void EigTJ<FPP,DEVICE,FPP2>::next_step() { substep_fun substep[] = { - &GivensFGFT<FPP,DEVICE,FPP2>::max_L, - &GivensFGFT<FPP,DEVICE,FPP2>::choose_pivot, - &GivensFGFT<FPP,DEVICE,FPP2>::calc_theta, - &GivensFGFT<FPP,DEVICE,FPP2>::update_fact, - &GivensFGFT<FPP,DEVICE,FPP2>::update_L, - &GivensFGFT<FPP,DEVICE,FPP2>::update_D, - &GivensFGFT<FPP,DEVICE,FPP2>::update_err}; + &EigTJ<FPP,DEVICE,FPP2>::max_L, + &EigTJ<FPP,DEVICE,FPP2>::choose_pivot, + &EigTJ<FPP,DEVICE,FPP2>::calc_theta, + &EigTJ<FPP,DEVICE,FPP2>::update_fact, + &EigTJ<FPP,DEVICE,FPP2>::update_L, + &EigTJ<FPP,DEVICE,FPP2>::update_D, + &EigTJ<FPP,DEVICE,FPP2>::update_err}; for(int i=0;i<sizeof(substep)/sizeof(substep_fun);i++) { #ifdef DEBUG_GIVENS - cout << "GivensFGFT ite=" << ite << " substep i=" << i << endl; + cout << "EigTJ ite=" << ite << " substep i=" << i << endl; #endif (this->*substep[i])(); } @@ -24,7 +24,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::next_step() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::choose_pivot() +void EigTJ<FPP,DEVICE,FPP2>::choose_pivot() { //Matlab ref. code: // [~,p] = min(C_min_row); @@ -35,12 +35,12 @@ void GivensFGFT<FPP,DEVICE,FPP2>::choose_pivot() this->q = this->q_candidates[this->p]; this->coord_choices.push_back(pair<int,int>(this->p,this->q)); #ifdef DEBUG_GIVENS - cout << "GivensFGFT::choose_pivot() ite: " << ite << " p: " << this->p << " q: " << this->q << endl; + cout << "EigTJ::choose_pivot() ite: " << ite << " p: " << this->p << " q: " << this->q << endl; #endif } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::max_L() +void EigTJ<FPP,DEVICE,FPP2>::max_L() { // Matlab ref. code: //************** at initialization @@ -119,7 +119,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::max_L() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::calc_theta() +void EigTJ<FPP,DEVICE,FPP2>::calc_theta() { // Matlab ref. code: // theta1 = atan2(L(q,q) - L(p,p),2*L(p,q))/2 ; @@ -148,7 +148,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::calc_theta() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_fact() +void EigTJ<FPP,DEVICE,FPP2>::update_fact() { // Matlab ref. code: // S = eye(n); @@ -186,13 +186,13 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_fact() this->facts[this->ite] = MatSparse<FPP,DEVICE>(this->fact_mod_row_ids, this->fact_mod_col_ids, this->fact_mod_values, n, n); this->facts[this->ite].set_orthogonal(true); #ifdef DEBUG_GIVENS - cout << "GivensFGFT::update_fact() ite: " << ite << " fact norm: " << facts[this->ite].norm() << endl; + cout << "EigTJ::update_fact() ite: " << ite << " fact norm: " << facts[this->ite].norm() << endl; facts[this->ite].Display(); #endif } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) +void EigTJ<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) { // L = S'*L*S #ifdef DEBUG_GIVENS @@ -214,7 +214,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_L(Faust::MatSparse<FPP,Cpu> & L) +void EigTJ<FPP,DEVICE,FPP2>::update_L(Faust::MatSparse<FPP,Cpu> & L) { //#define OPT_UPDATE_SPARSE_L #undef OPT_UPDATE_SPARSE_L @@ -234,7 +234,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_L(Faust::MatSparse<FPP,Cpu> & L) } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_L() +void EigTJ<FPP,DEVICE,FPP2>::update_L() { MatSparse<FPP, DEVICE>* sL = dynamic_cast<MatSparse<FPP, DEVICE>*>(this->L); if(sL) update_L(*sL); @@ -242,7 +242,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_L() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_L_first(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatDense<FPP,DEVICE> & L) +void EigTJ<FPP,DEVICE,FPP2>::update_L_first(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatDense<FPP,DEVICE> & L) { #define copy_vec2Lrow(vec,rowi) \ for(int i=0;i<L.getNbCol();i++) L.getData()[L.getNbRow()*i+rowi] = tmp[i] @@ -268,7 +268,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_L_first(Faust::Vect<FPP,DEVICE>& L_vec_ } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_L_second(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatDense<FPP,DEVICE> & L) +void EigTJ<FPP,DEVICE,FPP2>::update_L_second(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatDense<FPP,DEVICE> & L) { Faust::Vect<FPP,DEVICE> tmp, tmp2; /*========== L *= S */ @@ -291,7 +291,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_L_second(Faust::Vect<FPP,DEVICE>& L_vec } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_L_second(Eigen::SparseMatrix<FPP,Eigen::RowMajor > & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) +void EigTJ<FPP,DEVICE,FPP2>::update_L_second(Eigen::SparseMatrix<FPP,Eigen::RowMajor > & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) { Eigen::SparseMatrix<FPP, Eigen::RowMajor> tmp, tmp2; /*========== L *= S */ @@ -316,7 +316,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_L_second(Eigen::SparseMatrix<FPP,Eigen: } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFT<FPP,DEVICE,FPP2>::update_L_first(Eigen::SparseMatrix<FPP, Eigen::RowMajor> & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) +void EigTJ<FPP,DEVICE,FPP2>::update_L_first(Eigen::SparseMatrix<FPP, Eigen::RowMajor> & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP2& c, const FPP2& s, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) { Eigen::SparseMatrix<FPP, Eigen::RowMajor> tmp, tmp2, tmp3; /*========== L = S'*L */ @@ -342,7 +342,7 @@ void GivensFGFT<FPP,DEVICE,FPP2>::update_L_first(Eigen::SparseMatrix<FPP, Eigen: } template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFT<FPP,DEVICE,FPP2>::GivensFGFT(Faust::MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError /* default to 0.0 */, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : GivensFGFTGen<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()), always_theta2(false) +EigTJ<FPP,DEVICE,FPP2>::EigTJ(Faust::MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError /* default to 0.0 */, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : EigTJGen<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()), always_theta2(false) { //see parent ctor C.setOnes(); @@ -350,7 +350,7 @@ GivensFGFT<FPP,DEVICE,FPP2>::GivensFGFT(Faust::MatSparse<FPP,DEVICE>& Lap, int J } template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFT<FPP,DEVICE,FPP2>::GivensFGFT(Faust::MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : GivensFGFTGen<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()), always_theta2(false) +EigTJ<FPP,DEVICE,FPP2>::EigTJ(Faust::MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : EigTJGen<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()), always_theta2(false) { // see parent ctor C.setOnes(); @@ -358,10 +358,10 @@ GivensFGFT<FPP,DEVICE,FPP2>::GivensFGFT(Faust::MatDense<FPP,DEVICE>& Lap, int J, } template<typename FPP, FDevice DEVICE, typename FPP2> -const Faust::MatSparse<FPP,DEVICE> GivensFGFT<FPP,DEVICE,FPP2>::get_Dspm(const bool ord /* default to false */) +const Faust::MatSparse<FPP,DEVICE> EigTJ<FPP,DEVICE,FPP2>::get_Dspm(const bool ord /* default to false */) { MatSparse <FPP,DEVICE> spD; - GivensFGFTGen<FPP,DEVICE,FPP2>::get_Dspm(spD, ord); + EigTJGen<FPP,DEVICE,FPP2>::get_Dspm(spD, ord); return spD; } diff --git a/src/algorithm/factorization/faust_GivensFGFTComplex.h b/src/algorithm/factorization/faust_EigTJComplex.h similarity index 81% rename from src/algorithm/factorization/faust_GivensFGFTComplex.h rename to src/algorithm/factorization/faust_EigTJComplex.h index 7f92263e4e9d7face5581a31afbc476b35007ea1..bf2ed64889a09b6fbfdae6663fb567cbc3d359a4 100644 --- a/src/algorithm/factorization/faust_GivensFGFTComplex.h +++ b/src/algorithm/factorization/faust_EigTJComplex.h @@ -6,7 +6,7 @@ #include "faust_MatSparse.h" #include "faust_MatDense.h" #include "faust_Transform.h" -#include "faust_GivensFGFTGen.h" +#include "faust_EigTJGen.h" #include <cfloat> #include <vector> @@ -14,14 +14,14 @@ namespace Faust { template<typename FPP, FDevice DEVICE, typename FPP2 = Real<FPP>> - class GivensFGFTComplex : public GivensFGFTGen<typename FPP::value_type, DEVICE, FPP2, FPP>{ + class EigTJComplex : public EigTJGen<typename FPP::value_type, DEVICE, FPP2, FPP>{ /** - * \class GivensFGFTComplex + * \class EigTJComplex * * \brief This class implements the Givens FGFT algorithm (Truncated Jacobi algorithm) for the complex matrix case (ideal case being the Hermitian matrix case). * This algorithm is based on the classical Jacobi eigenvalues algorithm. * - * See parent class GivensFGFTGen for documentation about members. + * See parent class EigTJGen for documentation about members. * * References: * @@ -48,14 +48,14 @@ namespace Faust /** * Function pointer to any step of the algorithm (internal purpose only). */ - typedef void (GivensFGFTComplex<FPP,DEVICE,FPP2>::*substep_fun)(); + typedef void (EigTJComplex<FPP,DEVICE,FPP2>::*substep_fun)(); public: const static unsigned int ERROR_CALC_PERIOD = 100; - GivensFGFTComplex(MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); - GivensFGFTComplex(MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJComplex(MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJComplex(MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity = 0, const double stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); virtual void next_step(); @@ -101,5 +101,5 @@ namespace Faust }; } -#include "faust_GivensFGFTComplex.hpp" +#include "faust_EigTJComplex.hpp" #endif diff --git a/src/algorithm/factorization/faust_GivensFGFTComplex.hpp b/src/algorithm/factorization/faust_EigTJComplex.hpp similarity index 76% rename from src/algorithm/factorization/faust_GivensFGFTComplex.hpp rename to src/algorithm/factorization/faust_EigTJComplex.hpp index 887cded1d8c1c2989045ee7d27e90c8f106a2549..8b9e6f4210db4e6c6039cee4a613489164c79876 100644 --- a/src/algorithm/factorization/faust_GivensFGFTComplex.hpp +++ b/src/algorithm/factorization/faust_EigTJComplex.hpp @@ -1,22 +1,22 @@ using namespace Faust; template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::next_step() +void EigTJComplex<FPP,DEVICE,FPP2>::next_step() { substep_fun substep[] = { - &GivensFGFTComplex<FPP,DEVICE,FPP2>::max_L, - &GivensFGFTComplex<FPP,DEVICE,FPP2>::choose_pivot, - &GivensFGFTComplex<FPP,DEVICE,FPP2>::calc_theta, - &GivensFGFTComplex<FPP,DEVICE,FPP2>::update_fact, - &GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L, - &GivensFGFTComplex<FPP,DEVICE,FPP2>::update_D, - &GivensFGFTComplex<FPP,DEVICE,FPP2>::update_err}; + &EigTJComplex<FPP,DEVICE,FPP2>::max_L, + &EigTJComplex<FPP,DEVICE,FPP2>::choose_pivot, + &EigTJComplex<FPP,DEVICE,FPP2>::calc_theta, + &EigTJComplex<FPP,DEVICE,FPP2>::update_fact, + &EigTJComplex<FPP,DEVICE,FPP2>::update_L, + &EigTJComplex<FPP,DEVICE,FPP2>::update_D, + &EigTJComplex<FPP,DEVICE,FPP2>::update_err}; for(int i=0;i<sizeof(substep)/sizeof(substep_fun);i++) { #ifdef DEBUG_GIVENS - cout << "GivensFGFTComplex ite=" << this->ite << " substep i=" << i << endl; + cout << "EigTJComplex ite=" << this->ite << " substep i=" << i << endl; #endif (this->*substep[i])(); } @@ -24,7 +24,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::next_step() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::choose_pivot() +void EigTJComplex<FPP,DEVICE,FPP2>::choose_pivot() { //Matlab ref. code: // [~,p] = min(C_min_row); @@ -35,12 +35,12 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::choose_pivot() this->q = this->q_candidates[this->p]; this->coord_choices.push_back(pair<int,int>(this->p,this->q)); #ifdef DEBUG_GIVENS - cout << "GivensFGFTComplex::choose_pivot() ite: " << this->ite << " p: " << this->p << " q: " << this->q << endl; + cout << "EigTJComplex::choose_pivot() ite: " << this->ite << " p: " << this->p << " q: " << this->q << endl; #endif } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::max_L() +void EigTJComplex<FPP,DEVICE,FPP2>::max_L() { // Matlab ref. code: //************** at initialization @@ -119,7 +119,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::max_L() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::calc_theta() +void EigTJComplex<FPP,DEVICE,FPP2>::calc_theta() { FPP phi1, phi2; @@ -135,7 +135,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::calc_theta() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::check_pivot_image(FPP& c_pp, FPP& c_pq, FPP& c_qp, FPP& c_qq) +void EigTJComplex<FPP,DEVICE,FPP2>::check_pivot_image(FPP& c_pp, FPP& c_pq, FPP& c_qp, FPP& c_qq) { FPP im_pivot_pq = (conj(c_pp)*(*this->L)(this->p,this->p)+conj(c_qp)*(*this->L)(this->q,this->p))*c_pq +(conj(c_pp)*(*this->L)(this->p,this->q)+conj(c_qp)*(*this->L)(this->q,this->q))*c_qq; @@ -150,7 +150,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::check_pivot_image(FPP& c_pp, FPP& c_pq, } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_fact() +void EigTJComplex<FPP,DEVICE,FPP2>::update_fact() { // Matlab ref. code: // S = eye(n); @@ -222,13 +222,13 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_fact() // cout << "ite=" << ite << "S*S'(" << j << "," << j << ")=" << test2(j,j) << endl; assert(Faust::abs(test2(j,j)-FPP(1,0)) < .01); } - cout << "GivensFGFTComplex::update_fact() ite: " << this->ite << " fact norm: " << this->facts[this->ite].norm() << endl; + cout << "EigTJComplex::update_fact() ite: " << this->ite << " fact norm: " << this->facts[this->ite].norm() << endl; this->facts[this->ite].Display(); #endif } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) +void EigTJComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) { // L = S'*L*S #ifdef DEBUG_GIVENS @@ -277,7 +277,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatSparse<FPP,Cpu> & L) +void EigTJComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatSparse<FPP,Cpu> & L) { //#define OPT_UPDATE_SPARSE_L #undef OPT_UPDATE_SPARSE_L @@ -300,7 +300,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatSparse<FPP,Cpu> & L) } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L() +void EigTJComplex<FPP,DEVICE,FPP2>::update_L() { MatSparse<FPP, DEVICE>* sL = dynamic_cast<MatSparse<FPP, DEVICE>*>(this->L); if(sL) update_L(*sL); @@ -308,7 +308,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_first(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatDense<FPP,DEVICE> & L) +void EigTJComplex<FPP,DEVICE,FPP2>::update_L_first(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatDense<FPP,DEVICE> & L) { #define copy_vec2Lrow(vec,rowi) \ for(int i=0;i<L.getNbCol();i++) L.getData()[L.getNbRow()*i+rowi] = tmp[i] @@ -334,7 +334,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_first(Faust::Vect<FPP,DEVICE>& } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_second(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatDense<FPP,DEVICE> & L) +void EigTJComplex<FPP,DEVICE,FPP2>::update_L_second(Faust::Vect<FPP,DEVICE>& L_vec_p, Faust::Vect<FPP,DEVICE>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatDense<FPP,DEVICE> & L) { Faust::Vect<FPP,DEVICE> tmp, tmp2; /*========== L *= S */ @@ -357,7 +357,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_second(Faust::Vect<FPP,DEVICE> } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_second(Eigen::SparseMatrix<FPP,Eigen::RowMajor > & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) +void EigTJComplex<FPP,DEVICE,FPP2>::update_L_second(Eigen::SparseMatrix<FPP,Eigen::RowMajor > & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) { Eigen::SparseMatrix<FPP, Eigen::RowMajor> tmp, tmp2; /*========== L *= S */ @@ -382,7 +382,7 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_second(Eigen::SparseMatrix<FPP } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_first(Eigen::SparseMatrix<FPP, Eigen::RowMajor> & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) +void EigTJComplex<FPP,DEVICE,FPP2>::update_L_first(Eigen::SparseMatrix<FPP, Eigen::RowMajor> & L_vec_p, Eigen::SparseMatrix<FPP, Eigen::RowMajor>& L_vec_q, const FPP& c_pp, const FPP& c_pq, const FPP& c_qp, const FPP& c_qq, int p, int q, Faust::MatSparse<FPP,DEVICE> & L) { Eigen::SparseMatrix<FPP, Eigen::RowMajor> tmp, tmp2, tmp3; /*========== L = S'*L */ @@ -408,24 +408,24 @@ void GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L_first(Eigen::SparseMatrix<FPP, } template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFTComplex<FPP,DEVICE,FPP2>::GivensFGFTComplex(Faust::MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError /* default to 0.0 */, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : Faust::GivensFGFTGen<typename FPP::value_type, DEVICE, FPP2, FPP>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()) +EigTJComplex<FPP,DEVICE,FPP2>::EigTJComplex(Faust::MatSparse<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError /* default to 0.0 */, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : Faust::EigTJGen<typename FPP::value_type, DEVICE, FPP2, FPP>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()) { //see parent ctor this->C.setZeros(); } template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFTComplex<FPP,DEVICE,FPP2>::GivensFGFTComplex(Faust::MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : Faust::GivensFGFTGen<typename FPP::value_type, DEVICE, FPP2, FPP>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()) +EigTJComplex<FPP,DEVICE,FPP2>::EigTJComplex(Faust::MatDense<FPP,DEVICE>& Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : Faust::EigTJGen<typename FPP::value_type, DEVICE, FPP2, FPP>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), C(Lap.getNbRow(), Lap.getNbCol()) { // see parent ctor this->C.setZeros(); } template<typename FPP, FDevice DEVICE, typename FPP2> -const Faust::MatSparse<FPP,DEVICE> GivensFGFTComplex<FPP,DEVICE,FPP2>::get_Dspm(const bool ord /* default to false*/) +const Faust::MatSparse<FPP,DEVICE> EigTJComplex<FPP,DEVICE,FPP2>::get_Dspm(const bool ord /* default to false*/) { MatSparse <FPP,DEVICE> spD; - GivensFGFTGen<typename FPP::value_type,DEVICE,FPP2,FPP>::get_Dspm(spD, ord); + EigTJGen<typename FPP::value_type,DEVICE,FPP2,FPP>::get_Dspm(spD, ord); return spD; } diff --git a/src/algorithm/factorization/faust_GivensFGFTGen.h b/src/algorithm/factorization/faust_EigTJGen.h similarity index 92% rename from src/algorithm/factorization/faust_GivensFGFTGen.h rename to src/algorithm/factorization/faust_EigTJGen.h index 90fe0ff7b6faf9ba9afb0569c0770861f33a2b4e..e9da93275d9b5da766fea8ffb736f78e98d3b66c 100644 --- a/src/algorithm/factorization/faust_GivensFGFTGen.h +++ b/src/algorithm/factorization/faust_EigTJGen.h @@ -13,12 +13,12 @@ namespace Faust { template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> - class GivensFGFTParallelGen; + class EigTJParallelGen; template<typename FPP, FDevice DEVICE, typename FPP2 = Real<FPP>, typename FPP4 = FPP> - class GivensFGFTGen { + class EigTJGen { /** - * \class GivensFGFTGen + * \class EigTJGen * * \brief This class implements the Givens FGFT algorithm. * This algorithm is based on the classical Jacobi eigenvalues algorithm. @@ -32,7 +32,7 @@ namespace Faust * <https://hal.inria.fr/hal-01416110> * */ - friend class GivensFGFTParallelGen<FPP, DEVICE, FPP2, FPP4>; + friend class EigTJParallelGen<FPP, DEVICE, FPP2, FPP4>; /** \brief Temporary storage matrix for maximization of L. */ // MatDense<FPP4,DEVICE> C; /** \brief Column vector for the rowwise minimization of C (i.e. maximization of L). */ @@ -126,13 +126,13 @@ namespace Faust * TODO: complete argument list * */ // the MatSparse/MatDense constructor rely on this one - GivensFGFTGen(MatGeneric<FPP4,DEVICE>* Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust = false, const int err_period=100); + EigTJGen(MatGeneric<FPP4,DEVICE>* Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust = false, const int err_period=100); - GivensFGFTGen(MatSparse<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust = false, const int err_period=100); - GivensFGFTGen(MatDense<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust = false, const int err_period=100); + EigTJGen(MatSparse<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust = false, const int err_period=100); + EigTJGen(MatDense<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust = false, const int err_period=100); /** Destructor */ - virtual ~GivensFGFTGen() {delete[] q_candidates; delete L;}; + virtual ~EigTJGen() {delete[] q_candidates; delete L;}; /** * \brief Algo. main step. @@ -364,5 +364,5 @@ namespace Faust }; } -#include "faust_GivensFGFTGen.hpp" +#include "faust_EigTJGen.hpp" #endif diff --git a/src/algorithm/factorization/faust_GivensFGFTGen.hpp b/src/algorithm/factorization/faust_EigTJGen.hpp similarity index 74% rename from src/algorithm/factorization/faust_GivensFGFTGen.hpp rename to src/algorithm/factorization/faust_EigTJGen.hpp index f617b6a8449eb6e6725181032c2bf0c4e335a61e..f86361dd025d3be4fd5fb00dabb76b281c8ce5f0 100644 --- a/src/algorithm/factorization/faust_GivensFGFTGen.hpp +++ b/src/algorithm/factorization/faust_EigTJGen.hpp @@ -9,7 +9,7 @@ using namespace Faust; template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::update_D() +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::update_D() { // D = spdiag(diag(L)) for(int i=0;i<D.size();i++) @@ -23,13 +23,13 @@ void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::update_D() } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::order_D() +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::order_D() { order_D(1); } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::order_D(const int order /* -1 for descending order, 1 for ascending order, 0 no order*/) +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::order_D(const int order /* -1 for descending order, 1 for ascending order, 0 no order*/) { ordered_D = Faust::Vect<FPP,DEVICE>(D.size()); ord_indices.resize(0); @@ -61,7 +61,7 @@ void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::order_D(const int order /* -1 for desc } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const vector<int>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_ord_indices(const int order/*=1*/) +const vector<int>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_ord_indices(const int order/*=1*/) { if(! is_D_ordered || D_order_dir != order) order_D(order); @@ -70,7 +70,7 @@ const vector<int>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_ord_indices(const in template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::compute_facts() +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::compute_facts() { @@ -95,7 +95,7 @@ void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::compute_facts() } if(verbosity > 1) { - std::cout << "GivensFGFTGen::compute_facts() end" << std::endl; + std::cout << "EigTJGen::compute_facts() end" << std::endl; std::cout << "J: " << J << std::endl; std::cout << "tol: " << stoppingError << std::endl; std::cout << "stopcrit is error: " << stoppingCritIsError << std::endl; @@ -107,13 +107,13 @@ void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::compute_facts() } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::GivensFGFTGen(MatGeneric<FPP4,DEVICE>* Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust /* deft to false */, const int err_period/*=100*/) : +EigTJGen<FPP,DEVICE,FPP2,FPP4>::EigTJGen(MatGeneric<FPP4,DEVICE>* Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust /* deft to false */, const int err_period/*=100*/) : facts(J>0?(J*4<Lap->getNbRow()*Lap->getNbRow()||enable_large_Faust?J:0):0 /* don't allocate if the complexity doesn't worth it and enable_large_Faust is false*/), q_candidates(new int[Lap->getNbRow()]), J(J), D(Lap->getNbRow()), errs(0), coord_choices(0), Lap(*Lap), dim_size(Lap->getNbRow()), Lap_squared_fro_norm(0), is_D_ordered(false), D_order_dir(0), verbosity(verbosity), stoppingCritIsError(stoppingError != 0.0), stoppingError(stoppingError), errIsRel(errIsRel), enable_large_Faust(enable_large_Faust), ite(0), err_period(err_period), tag("") { if(Lap->getNbCol() != Lap->getNbRow()) - handleError("Faust::GivensFGFTComplex", "Laplacian must be a square matrix."); + handleError("Faust::EigTJComplex", "Laplacian must be a square matrix."); - if(this->J == 0 && ! this->stoppingCritIsError) handleError("GivensFGFT", "Either J or stoppingError must be > 0"); + if(this->J == 0 && ! this->stoppingCritIsError) handleError("EigTJ", "Either J or stoppingError must be > 0"); // init the identity part of the factor buffer model // allocate the mem. space for the 4 additional rotation part coeffs for(int i=0;i<dim_size;i++) @@ -127,34 +127,34 @@ facts(J>0?(J*4<Lap->getNbRow()*Lap->getNbRow()||enable_large_Faust?J:0):0 /* don } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::GivensFGFTGen(Faust::MatSparse<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>(&Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period) +EigTJGen<FPP,DEVICE,FPP2,FPP4>::EigTJGen(Faust::MatSparse<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : EigTJGen<FPP,DEVICE,FPP2,FPP4>(&Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period) { L = new MatSparse<FPP4,DEVICE>(Lap); } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::GivensFGFTGen(Faust::MatDense<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>(&Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period) +EigTJGen<FPP,DEVICE,FPP2,FPP4>::EigTJGen(Faust::MatDense<FPP4, DEVICE> & Lap, int J, unsigned int verbosity /* deft val == 0 */, const double stoppingError, const bool errIsRel, const bool enable_large_Faust/* deft to false */, const int err_period/*=100*/) : EigTJGen<FPP,DEVICE,FPP2,FPP4>(&Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period) { L = new MatDense<FPP4,DEVICE>(Lap); } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -FPP2 GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_err(int j) const +FPP2 EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_err(int j) const { if(j > 0 && j < errs.size()) return errs[j]; else - throw out_of_range("GivensFGFTGen::get_err(j): j is out of range."); + throw out_of_range("EigTJGen::get_err(j): j is out of range."); } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const vector<FPP2>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_errs() const +const vector<FPP2>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_errs() const { return errs; } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const Faust::Vect<FPP,DEVICE>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_D(const bool ord /* default to false */) +const Faust::Vect<FPP,DEVICE>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_D(const bool ord /* default to false */) { if(ord) { @@ -166,7 +166,7 @@ const Faust::Vect<FPP,DEVICE>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_D(const } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const Faust::Vect<FPP,DEVICE>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_D(const int ord /* default to false */) +const Faust::Vect<FPP,DEVICE>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_D(const int ord /* default to false */) { if(ord != 0) { @@ -179,7 +179,7 @@ const Faust::Vect<FPP,DEVICE>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_D(const template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> template<typename FPP3> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_Dspm(Faust::MatSparse<FPP3,DEVICE> & spD, const bool ord /* default to false */) +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_Dspm(Faust::MatSparse<FPP3,DEVICE> & spD, const bool ord /* default to false */) { const Faust::Vect<FPP,DEVICE>& D_ = this->get_D(ord); vector<int> nat_ord_indices; @@ -193,13 +193,13 @@ void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_Dspm(Faust::MatSparse<FPP3,DEVICE> } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_D(FPP* diag_data, const bool ord /* default to false */) +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_D(FPP* diag_data, const bool ord /* default to false */) { get_D(diag_data, ord?1:0); } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_D(FPP* diag_data, const int ord /* default to false */) +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_D(FPP* diag_data, const int ord /* default to false */) { const Faust::Vect<FPP,DEVICE>& D_ = get_D(ord); const FPP* src_data_ptr = D_.getData(); @@ -207,7 +207,7 @@ void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_D(FPP* diag_data, const int ord /* } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const Faust::MatDense<FPP4,DEVICE> GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::compute_fourier(const bool ord /* default to false */) +const Faust::MatDense<FPP4,DEVICE> EigTJGen<FPP,DEVICE,FPP2,FPP4>::compute_fourier(const bool ord /* default to false */) { Faust::MatDense<FPP4,Cpu> fourier(L->getNbRow(), L->getNbCol()); Faust::MatDense<FPP4,Cpu>* ord_fourier; @@ -227,19 +227,19 @@ const Faust::MatDense<FPP4,DEVICE> GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::compute_ template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const Faust::MatGeneric<FPP,DEVICE>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_L() const +const Faust::MatGeneric<FPP,DEVICE>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_L() const { return *L; } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const vector<pair<int,int>>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_coord_choices() const +const vector<pair<int,int>>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_coord_choices() const { return coord_choices; } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_coord_choice(int j, int& p, int& q) const +void EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_coord_choice(int j, int& p, int& q) const { if(j > 0 && j < coord_choices.size()) { @@ -247,30 +247,30 @@ void GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_coord_choice(int j, int& p, int& q q = coord_choices[j].second; } else - throw out_of_range("GivensFGFTGen::get_coord_choice(j,p,q): j is out of range."); + throw out_of_range("EigTJGen::get_coord_choice(j,p,q): j is out of range."); } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const Faust::MatDense<FPP4,DEVICE>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_Lap() const +const Faust::MatDense<FPP4,DEVICE>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_Lap() const { return Lap; } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -const vector<Faust::MatSparse<FPP4,DEVICE>>& GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_facts() const +const vector<Faust::MatSparse<FPP4,DEVICE>>& EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_facts() const { return facts; } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -Faust::Transform<FPP4,DEVICE> GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_transform(const bool ord) +Faust::Transform<FPP4,DEVICE> EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_transform(const bool ord) { return get_transform(ord?1:0); } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -Faust::Transform<FPP4,DEVICE> GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_transform(const int ord, const bool copy/*=true*/, const int first_nfacts/*=-1*/) +Faust::Transform<FPP4,DEVICE> EigTJGen<FPP,DEVICE,FPP2,FPP4>::get_transform(const int ord, const bool copy/*=true*/, const int first_nfacts/*=-1*/) { //TODO: facts should be a Transform or a TransformHelper to avoid the risk of memory leak in caller code when ord == true and copy == false if(facts.size() == 0) @@ -325,7 +325,7 @@ Faust::Transform<FPP4,DEVICE> GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::get_transform template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -FPP2 GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::calc_err() +FPP2 EigTJGen<FPP,DEVICE,FPP2,FPP4>::calc_err() { // please read: https://gitlab.inria.fr/faustgrp/faust/-/issues/316 // for proofs that the function computes the squared absolute error @@ -349,7 +349,7 @@ FPP2 GivensFGFTGen<FPP,DEVICE,FPP2,FPP4>::calc_err() template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTGen<FPP, DEVICE, FPP2, FPP4>::update_err() +void EigTJGen<FPP, DEVICE, FPP2, FPP4>::update_err() { if(!((this->ite+1) % this->err_period) && this->stoppingCritIsError || this->verbosity > 1) { diff --git a/src/algorithm/factorization/faust_GivensFGFTParallel.h b/src/algorithm/factorization/faust_EigTJParallel.h similarity index 69% rename from src/algorithm/factorization/faust_GivensFGFTParallel.h rename to src/algorithm/factorization/faust_EigTJParallel.h index 5c9975d81235251bfc1cef4a64bad211986500ba..9f470ff9509311d334621d344de1406d27cc8481 100644 --- a/src/algorithm/factorization/faust_GivensFGFTParallel.h +++ b/src/algorithm/factorization/faust_EigTJParallel.h @@ -1,5 +1,5 @@ -#include "faust_GivensFGFT.h" -#include "faust_GivensFGFTParallelGen.h" +#include "faust_EigTJ.h" +#include "faust_EigTJParallelGen.h" #include <list> @@ -11,10 +11,10 @@ namespace Faust template<typename FPP, FDevice DEVICE, typename FPP2 = Real<FPP>> - class GivensFGFTParallel : public GivensFGFT<FPP,DEVICE,FPP2>, public GivensFGFTParallelGen<FPP, DEVICE, FPP2> + class EigTJParallel : public EigTJ<FPP,DEVICE,FPP2>, public EigTJParallelGen<FPP, DEVICE, FPP2> { /** - * \class GivensFGFTParallel + * \class EigTJParallel * * \brief This class implements the parallel version of Givens FGFT algorithm. * @@ -41,7 +41,7 @@ namespace Faust /** * Function pointer to any step of the algorithm. */ - typedef void (GivensFGFTParallel<FPP,DEVICE,FPP2>::*substep_fun)(); + typedef void (EigTJParallel<FPP,DEVICE,FPP2>::*substep_fun)(); void init_fact_nz_inds_sort_func(); public: @@ -58,12 +58,12 @@ namespace Faust * \param stoppingError defines a stopping criterion based on error (absolute relative error). * */ - GivensFGFTParallel(MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); - GivensFGFTParallel(MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJParallel(MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJParallel(MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); }; -#include "faust_GivensFGFTParallel.hpp" +#include "faust_EigTJParallel.hpp" } diff --git a/src/algorithm/factorization/faust_GivensFGFTParallel.hpp b/src/algorithm/factorization/faust_EigTJParallel.hpp similarity index 75% rename from src/algorithm/factorization/faust_GivensFGFTParallel.hpp rename to src/algorithm/factorization/faust_EigTJParallel.hpp index ee3adf6563f5db0e160c83bda1fe5b9c2759dd35..475731ed2c30953e5673562b81500a6b2508b76f 100644 --- a/src/algorithm/factorization/faust_GivensFGFTParallel.hpp +++ b/src/algorithm/factorization/faust_EigTJParallel.hpp @@ -1,7 +1,7 @@ using namespace Faust; //TODO: remove, not advisable in a header template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFTParallel<FPP,DEVICE,FPP2>::GivensFGFTParallel(Faust::MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : GivensFGFT<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), /*t(t), fact_nrots(0)*/ GivensFGFTParallelGen<FPP, DEVICE, FPP2>(t, *this) +EigTJParallel<FPP,DEVICE,FPP2>::EigTJParallel(Faust::MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : EigTJ<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), /*t(t), fact_nrots(0)*/ EigTJParallelGen<FPP, DEVICE, FPP2>(t, *this) { if(J > 0) this->facts.resize(round(J/(float)t)); this->always_theta2 = true; @@ -10,7 +10,7 @@ GivensFGFTParallel<FPP,DEVICE,FPP2>::GivensFGFTParallel(Faust::MatDense<FPP,DEVI } template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFTParallel<FPP,DEVICE,FPP2>::GivensFGFTParallel(Faust::MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : GivensFGFT<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period),/* t(t), fact_nrots(0)*/ GivensFGFTParallelGen<FPP, DEVICE, FPP2>(t, *this) +EigTJParallel<FPP,DEVICE,FPP2>::EigTJParallel(Faust::MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : EigTJ<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period),/* t(t), fact_nrots(0)*/ EigTJParallelGen<FPP, DEVICE, FPP2>(t, *this) { if(J > 0) this->facts.resize(round(J/(float)t)); this->always_theta2 = true; @@ -19,7 +19,7 @@ GivensFGFTParallel<FPP,DEVICE,FPP2>::GivensFGFTParallel(Faust::MatSparse<FPP,DEV } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallel<FPP,DEVICE,FPP2>::init_fact_nz_inds_sort_func() +void EigTJParallel<FPP,DEVICE,FPP2>::init_fact_nz_inds_sort_func() { this->fact_nz_inds_sort_func= [](const pair<int,int> &a, const pair<int,int> &b, Faust::MatDense<FPP,DEVICE> & L_low) { @@ -28,20 +28,20 @@ void GivensFGFTParallel<FPP,DEVICE,FPP2>::init_fact_nz_inds_sort_func() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallel<FPP,DEVICE,FPP2>::next_step() +void EigTJParallel<FPP,DEVICE,FPP2>::next_step() { substep_fun substep[] = { - &GivensFGFTParallelGen<FPP,DEVICE,FPP2>::max_L, - &GivensFGFTParallel<FPP,DEVICE,FPP2>::loop_update_fact, //responsible to call choose_pivot(), calc_theta() and update_fact() - &GivensFGFT<FPP,DEVICE,FPP2>::update_L, - &GivensFGFTParallel<FPP,DEVICE,FPP2>::update_D, - &GivensFGFTParallel<FPP,DEVICE,FPP2>::update_err}; + &EigTJParallelGen<FPP,DEVICE,FPP2>::max_L, + &EigTJParallel<FPP,DEVICE,FPP2>::loop_update_fact, //responsible to call choose_pivot(), calc_theta() and update_fact() + &EigTJ<FPP,DEVICE,FPP2>::update_L, + &EigTJParallel<FPP,DEVICE,FPP2>::update_D, + &EigTJParallel<FPP,DEVICE,FPP2>::update_err}; for(int i=0;i<sizeof(substep)/sizeof(substep_fun);i++) { #ifdef DEBUG_GIVENS - std::cout << "GivensFGFTParallel ite=" << this->ite << " substep i=" << i << std::endl; + std::cout << "EigTJParallel ite=" << this->ite << " substep i=" << i << std::endl; #endif (this->*substep[i])(); } @@ -49,7 +49,7 @@ void GivensFGFTParallel<FPP,DEVICE,FPP2>::next_step() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallel<FPP,DEVICE,FPP2>::update_fact() +void EigTJParallel<FPP,DEVICE,FPP2>::update_fact() { if(this->fact_nrots == 0){ int n = this->Lap.getNbRow(); @@ -80,7 +80,7 @@ void GivensFGFTParallel<FPP,DEVICE,FPP2>::update_fact() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallel<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) +void EigTJParallel<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) { // L = S'*L*S #ifdef NO_OPT_UPDATE_L diff --git a/src/algorithm/factorization/faust_GivensFGFTParallelComplex.h b/src/algorithm/factorization/faust_EigTJParallelComplex.h similarity index 69% rename from src/algorithm/factorization/faust_GivensFGFTParallelComplex.h rename to src/algorithm/factorization/faust_EigTJParallelComplex.h index fc0868d230d9abd9814cae5db014198c932b68c2..1f42cb5dcc03d4115e7a46678e21365e0f5c6d5d 100644 --- a/src/algorithm/factorization/faust_GivensFGFTParallelComplex.h +++ b/src/algorithm/factorization/faust_EigTJParallelComplex.h @@ -1,5 +1,5 @@ -#include "faust_GivensFGFTComplex.h" -#include "faust_GivensFGFTParallelGen.h" +#include "faust_EigTJComplex.h" +#include "faust_EigTJParallelGen.h" #include <list> @@ -11,10 +11,10 @@ namespace Faust template<typename FPP, FDevice DEVICE, typename FPP2 = Real<FPP>> - class GivensFGFTParallelComplex : public GivensFGFTComplex<FPP,DEVICE,FPP2>, public GivensFGFTParallelGen<typename FPP::value_type, DEVICE, FPP2, FPP> + class EigTJParallelComplex : public EigTJComplex<FPP,DEVICE,FPP2>, public EigTJParallelGen<typename FPP::value_type, DEVICE, FPP2, FPP> { /** - * \class GivensFGFTParallelComplex + * \class EigTJParallelComplex * * \brief This class implements the parallel version of Givens FGFT algorithm (for the complex case). * @@ -44,7 +44,7 @@ namespace Faust /** * Function pointer to any step of the algorithm. */ - typedef void (GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::*substep_fun)(); + typedef void (EigTJParallelComplex<FPP,DEVICE,FPP2>::*substep_fun)(); void init_fact_nz_inds_sort_func(); @@ -63,11 +63,11 @@ namespace Faust * \param stoppingError defines a stopping criterion based on error (absolute relative error). * */ - GivensFGFTParallelComplex(MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); - GivensFGFTParallelComplex(MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJParallelComplex(MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); + EigTJParallelComplex(MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity = 0, const double stoppingCritIsError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false, const int err_period=100); }; -#include "faust_GivensFGFTParallelComplex.hpp" +#include "faust_EigTJParallelComplex.hpp" } #endif diff --git a/src/algorithm/factorization/faust_GivensFGFTParallelComplex.hpp b/src/algorithm/factorization/faust_EigTJParallelComplex.hpp similarity index 77% rename from src/algorithm/factorization/faust_GivensFGFTParallelComplex.hpp rename to src/algorithm/factorization/faust_EigTJParallelComplex.hpp index 718835d95c92b67f27487b85ae76485862ca77e2..f21ca4963d36d050cd00cecc3dc808e95196f8e6 100644 --- a/src/algorithm/factorization/faust_GivensFGFTParallelComplex.hpp +++ b/src/algorithm/factorization/faust_EigTJParallelComplex.hpp @@ -1,7 +1,7 @@ using namespace Faust; //TODO: remove, not advisable in a header template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::GivensFGFTParallelComplex(Faust::MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : GivensFGFTComplex<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), /*t(t), fact_nrots(0)*/ GivensFGFTParallelGen<typename FPP::value_type, DEVICE, FPP2, FPP>(t, *this) +EigTJParallelComplex<FPP,DEVICE,FPP2>::EigTJParallelComplex(Faust::MatDense<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : EigTJComplex<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), /*t(t), fact_nrots(0)*/ EigTJParallelGen<typename FPP::value_type, DEVICE, FPP2, FPP>(t, *this) { if(J > 0) this->facts.resize(round(J/(float)t)); this->coord_choices.resize(0); @@ -9,7 +9,7 @@ GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::GivensFGFTParallelComplex(Faust::Mat } template<typename FPP, FDevice DEVICE, typename FPP2> -GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::GivensFGFTParallelComplex(Faust::MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : GivensFGFTComplex<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), /* t(t), fact_nrots(0) */ GivensFGFTParallelGen<typename FPP::value_type, DEVICE, FPP2, FPP>(t, *this) +EigTJParallelComplex<FPP,DEVICE,FPP2>::EigTJParallelComplex(Faust::MatSparse<FPP,DEVICE>& Lap, int J, int t, unsigned int verbosity, const double stoppingError, const bool errIsRel, const bool enable_large_Faust, const int err_period/*=100*/) : EigTJComplex<FPP,DEVICE,FPP2>(Lap, J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period), /* t(t), fact_nrots(0) */ EigTJParallelGen<typename FPP::value_type, DEVICE, FPP2, FPP>(t, *this) { if(J > 0) this->facts.resize(round(J/(float)t)); this->coord_choices.resize(0); @@ -17,7 +17,7 @@ GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::GivensFGFTParallelComplex(Faust::Mat } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::init_fact_nz_inds_sort_func() +void EigTJParallelComplex<FPP,DEVICE,FPP2>::init_fact_nz_inds_sort_func() { this->fact_nz_inds_sort_func= [](const pair<int,int> &a, const pair<int,int> &b, Faust::MatDense<FPP,DEVICE> & L_low) { @@ -30,20 +30,20 @@ void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::init_fact_nz_inds_sort_func() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::next_step() +void EigTJParallelComplex<FPP,DEVICE,FPP2>::next_step() { substep_fun substep[] = { - &GivensFGFTParallelGen<typename FPP::value_type,DEVICE,FPP2,FPP>::max_L, - &GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::loop_update_fact, //responsible to call choose_pivot(), calc_theta() and update_fact() - &GivensFGFTComplex<FPP,DEVICE,FPP2>::update_L, - &GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::update_D, - &GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::update_err}; + &EigTJParallelGen<typename FPP::value_type,DEVICE,FPP2,FPP>::max_L, + &EigTJParallelComplex<FPP,DEVICE,FPP2>::loop_update_fact, //responsible to call choose_pivot(), calc_theta() and update_fact() + &EigTJComplex<FPP,DEVICE,FPP2>::update_L, + &EigTJParallelComplex<FPP,DEVICE,FPP2>::update_D, + &EigTJParallelComplex<FPP,DEVICE,FPP2>::update_err}; for(int i=0;i<sizeof(substep)/sizeof(substep_fun);i++) { #ifdef DEBUG_GIVENS - cout << "GivensFGFTParallelComplex ite=" << this->ite << " substep i=" << i << endl; + cout << "EigTJParallelComplex ite=" << this->ite << " substep i=" << i << endl; #endif (this->*substep[i])(); } @@ -51,7 +51,7 @@ void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::next_step() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::update_fact() +void EigTJParallelComplex<FPP,DEVICE,FPP2>::update_fact() { FPP c_pp, c_pq, c_qp, c_qq; FPP i = complex<typename FPP::value_type>(0,1); @@ -102,7 +102,7 @@ void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::update_fact() } template<typename FPP, FDevice DEVICE, typename FPP2> -void GivensFGFTParallelComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) +void EigTJParallelComplex<FPP,DEVICE,FPP2>::update_L(Faust::MatDense<FPP,Cpu> & L) { // L = S'*L*S //#undef OPT_UPDATE_L diff --git a/src/algorithm/factorization/faust_GivensFGFTParallelGen.h b/src/algorithm/factorization/faust_EigTJParallelGen.h similarity index 85% rename from src/algorithm/factorization/faust_GivensFGFTParallelGen.h rename to src/algorithm/factorization/faust_EigTJParallelGen.h index f0901357aae6ba29b4000eb7c413ae82c38ab02d..fc28da33f2253670e298be3e42405ee1b847eb6e 100644 --- a/src/algorithm/factorization/faust_GivensFGFTParallelGen.h +++ b/src/algorithm/factorization/faust_EigTJParallelGen.h @@ -2,7 +2,7 @@ #ifndef __GIVENS_FGFT_PARALLEL_GEN__ #define __GIVENS_FGFT_PARALLEL_GEN__ -#include "faust_GivensFGFT.h" +#include "faust_EigTJ.h" #include "faust_MatSparse.h" #include <list> #include <functional> @@ -11,12 +11,12 @@ namespace Faust template<typename FPP, FDevice DEVICE, typename FPP2 = Real<FPP>, typename FPP4 = FPP> - class GivensFGFTParallelGen + class EigTJParallelGen { /** - * \class GivensFGFTParallelGen + * \class EigTJParallelGen * - * \brief This class represents the parallel version of Givens FGFT algorithm (for concrete implementations see subclasses: GivensFGFTParallelComplex and GivensFGFTParallel). + * \brief This class represents the parallel version of Givens FGFT algorithm (for concrete implementations see subclasses: EigTJParallelComplex and EigTJParallel). * * This variant of the parent class algorithm consists mainly to put t 2D rotation matrices in each iteration factor S (i.e. facts[ite]) when the basis version puts only a single rotation matrix into L. // * // * This algorithm is based on the classical Jacobi eigenvalues algorithm. // * // * References: * @@ -28,7 +28,7 @@ namespace Faust * */ - GivensFGFTGen<FPP, DEVICE, FPP2, FPP4> & alg; + EigTJGen<FPP, DEVICE, FPP2, FPP4> & alg; protected: /** Maximum number of rotations per factor @@ -77,12 +77,12 @@ namespace Faust * * * \param t the maximum number of 2D rotation matrices (Givens matrices) to insert in each factor. The effective number can be less than t if there is not enough pivot candidates left in the matrix L of the current iteration. - * \param algo instance of GivensFGFT or GivensFGFTComplex (subclasses of GivensFGFTGen). + * \param algo instance of EigTJ or EigTJComplex (subclasses of EigTJGen). */ - GivensFGFTParallelGen(int t, GivensFGFTGen<FPP, DEVICE, FPP2, FPP4> & alg); + EigTJParallelGen(int t, EigTJGen<FPP, DEVICE, FPP2, FPP4> & alg); }; -#include "faust_GivensFGFTParallelGen.hpp" +#include "faust_EigTJParallelGen.hpp" } diff --git a/src/algorithm/factorization/faust_GivensFGFTParallelGen.hpp b/src/algorithm/factorization/faust_EigTJParallelGen.hpp similarity index 85% rename from src/algorithm/factorization/faust_GivensFGFTParallelGen.hpp rename to src/algorithm/factorization/faust_EigTJParallelGen.hpp index 4907b90d0dc93c61cc56f5bedc973d3b9fbf39a5..c2b0ee38dd3ecacdc94e5a8c82358bc9c618d5a3 100644 --- a/src/algorithm/factorization/faust_GivensFGFTParallelGen.hpp +++ b/src/algorithm/factorization/faust_EigTJParallelGen.hpp @@ -5,12 +5,12 @@ #endif template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::GivensFGFTParallelGen(int t, Faust::GivensFGFTGen<FPP, DEVICE, FPP2, FPP4> & alg) : alg(alg), t(t), fact_nrots(0) +EigTJParallelGen<FPP,DEVICE,FPP2,FPP4>::EigTJParallelGen(int t, Faust::EigTJGen<FPP, DEVICE, FPP2, FPP4> & alg) : alg(alg), t(t), fact_nrots(0) { if(alg.verbosity > 1) { - std::cout << "GivensFGFTGenParallelGen ctor:" << std::endl; + std::cout << "EigTJGenParallelGen ctor:" << std::endl; std::cout << "J: " << alg.J << std::endl; std::cout << "tol: " << alg.stoppingError << std::endl; std::cout << "stopcrit is error: " << alg.stoppingCritIsError << std::endl; @@ -30,7 +30,7 @@ GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::GivensFGFTParallelGen(int t, Faust: } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::max_L() +void EigTJParallelGen<FPP,DEVICE,FPP2,FPP4>::max_L() { // matlab ref // L_low = abs(tril(L,-1)); @@ -56,7 +56,7 @@ void GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::max_L() #ifdef DEBUG_GIVENS for(auto &p : fact_nz_inds) - cout << "GivensFGFTParallel::max_L() before sort (" << p.first+1 << "," << p.second+1 << ") :" << L_low(p.first, p.second) << endl; + cout << "EigTJParallel::max_L() before sort (" << p.first+1 << "," << p.second+1 << ") :" << L_low(p.first, p.second) << endl; #endif //ENOTE: can't use sort(it,it, lambda) as vector because list doesn't provide random access it. @@ -66,12 +66,12 @@ void GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::max_L() }); #ifdef DEBUG_GIVENS for(auto &p : fact_nz_inds) - cout << "GivensFGFTParallel::max_L() after sort (" << p.first+1 << "," << p.second+1 << ") :" << L_low(p.first, p.second) << endl; + cout << "EigTJParallel::max_L() after sort (" << p.first+1 << "," << p.second+1 << ") :" << L_low(p.first, p.second) << endl; #endif } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTParallelGen<FPP,DEVICE,FPP2, FPP4>::update_fact_nz_inds(int p, int q) +void EigTJParallelGen<FPP,DEVICE,FPP2, FPP4>::update_fact_nz_inds(int p, int q) { // matlab ref // other = RSmat==p | RSmat==q; @@ -89,7 +89,7 @@ void GivensFGFTParallelGen<FPP,DEVICE,FPP2, FPP4>::update_fact_nz_inds(int p, in i++; } #ifdef DEBUG_GIVENS - std::cout << "GivensFGFTParallel::update_fact_nz_inds() after purge: "; + std::cout << "EigTJParallel::update_fact_nz_inds() after purge: "; for(auto &p_ : fact_nz_inds) std::cout << "(" << p_.first+1 << "," << p_.second+1 << ") :"; std::cout << std::endl; @@ -97,7 +97,7 @@ void GivensFGFTParallelGen<FPP,DEVICE,FPP2, FPP4>::update_fact_nz_inds(int p, in } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTParallelGen<FPP,DEVICE,FPP2, FPP4>::loop_update_fact() +void EigTJParallelGen<FPP,DEVICE,FPP2, FPP4>::loop_update_fact() { fact_nrots = 0; while(fact_nrots < t && 0 < fact_nz_inds.size()) @@ -112,7 +112,7 @@ void GivensFGFTParallelGen<FPP,DEVICE,FPP2, FPP4>::loop_update_fact() } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTParallelGen<FPP,DEVICE,FPP2, FPP4>::choose_pivot() +void EigTJParallelGen<FPP,DEVICE,FPP2, FPP4>::choose_pivot() { // fact_nz_inds is assumed to be sorted in max_L() // the first one in the list maps the biggest abs val in L @@ -126,7 +126,7 @@ void GivensFGFTParallelGen<FPP,DEVICE,FPP2, FPP4>::choose_pivot() } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::update_L(Faust::MatSparse<FPP,Cpu> & L) +void EigTJParallelGen<FPP,DEVICE,FPP2,FPP4>::update_L(Faust::MatSparse<FPP,Cpu> & L) { // L = S'*L*S #ifdef OPT_UPDATE__SPARSE_L @@ -198,13 +198,13 @@ void GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::update_L(Faust::MatSparse<FPP, } template<typename FPP, FDevice DEVICE, typename FPP2, typename FPP4> -void GivensFGFTParallelGen<FPP,DEVICE,FPP2,FPP4>::finish_fact() +void EigTJParallelGen<FPP,DEVICE,FPP2,FPP4>::finish_fact() { int n = alg.Lap.getNbRow(); alg.facts[alg.ite] = Faust::MatSparse<FPP4,DEVICE>(alg.fact_mod_row_ids, alg.fact_mod_col_ids, alg.fact_mod_values, n, n); alg.facts[alg.ite].set_orthogonal(true); #ifdef DEBUG_GIVENS - cout << "GivensFGFTParallel::finish_fact() ite: " << alg.ite << " fact norm: " << alg.facts[alg.ite].norm() << endl; + cout << "EigTJParallel::finish_fact() ite: " << alg.ite << " fact norm: " << alg.facts[alg.ite].norm() << endl; alg.facts[alg.ite].Display(); #endif } diff --git a/src/algorithm/factorization/faust_SVDTJ.cpp.in b/src/algorithm/factorization/faust_SVDTJ.cpp.in index 27d1669ad8f0f15636d0d79f7b9a117b9cbe0cce..c000ea763a9f6ae1573fca3757daaf7d1490db3f 100644 --- a/src/algorithm/factorization/faust_SVDTJ.cpp.in +++ b/src/algorithm/factorization/faust_SVDTJ.cpp.in @@ -1,7 +1,7 @@ -#include "faust_GivensFGFT.h" -#include "faust_GivensFGFTParallel.h" -#include "faust_GivensFGFTParallelComplex.h" -#include "faust_GivensFGFTComplex.h" +#include "faust_EigTJ.h" +#include "faust_EigTJParallel.h" +#include "faust_EigTJParallelComplex.h" +#include "faust_EigTJComplex.h" #include "faust_SVDTJ.h" #include "faust_TransformHelper.h" #include <complex> @@ -10,17 +10,17 @@ namespace Faust #if(@SVD_COMPLEX@==1) template<> - void instantiate_algos<complex<@REAL_TYPE@>, Cpu, @REAL_TYPE@>(GivensFGFTGen<Real<complex<@REAL_TYPE@>>, Cpu, @REAL_TYPE@, complex<@REAL_TYPE@>>** algoW1, GivensFGFTGen<Real<complex<@REAL_TYPE@>>, Cpu, @REAL_TYPE@, complex<@REAL_TYPE@>>** algoW2, Faust::MatDense<complex<@REAL_TYPE@>,Cpu> &dM_M, Faust::MatDense<complex<@REAL_TYPE@>,Cpu> &dMM_,int J1, int J2, int t1, int t2, unsigned int verbosity, @REAL_TYPE@ tol, bool relErr, bool enable_large_Faust, const int err_period) + void instantiate_algos<complex<@REAL_TYPE@>, Cpu, @REAL_TYPE@>(EigTJGen<Real<complex<@REAL_TYPE@>>, Cpu, @REAL_TYPE@, complex<@REAL_TYPE@>>** algoW1, EigTJGen<Real<complex<@REAL_TYPE@>>, Cpu, @REAL_TYPE@, complex<@REAL_TYPE@>>** algoW2, Faust::MatDense<complex<@REAL_TYPE@>,Cpu> &dM_M, Faust::MatDense<complex<@REAL_TYPE@>,Cpu> &dMM_,int J1, int J2, int t1, int t2, unsigned int verbosity, @REAL_TYPE@ tol, bool relErr, bool enable_large_Faust, const int err_period) { if(t1 <= 1) - *algoW1 = new GivensFGFTComplex<complex<@REAL_TYPE@>,Cpu,@REAL_TYPE@>(dMM_, J1, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW1 = new EigTJComplex<complex<@REAL_TYPE@>,Cpu,@REAL_TYPE@>(dMM_, J1, verbosity, tol, relErr, enable_large_Faust, err_period); else - *algoW1 = new GivensFGFTParallelComplex<complex<@REAL_TYPE@>, Cpu, @REAL_TYPE@>(dMM_, J1, t1, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW1 = new EigTJParallelComplex<complex<@REAL_TYPE@>, Cpu, @REAL_TYPE@>(dMM_, J1, t1, verbosity, tol, relErr, enable_large_Faust, err_period); if(t2 <= 1) - *algoW2 = new GivensFGFTComplex<complex<@REAL_TYPE@>,Cpu,@REAL_TYPE@>(dM_M, J2, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW2 = new EigTJComplex<complex<@REAL_TYPE@>,Cpu,@REAL_TYPE@>(dM_M, J2, verbosity, tol, relErr, enable_large_Faust, err_period); else - *algoW2 = new GivensFGFTParallelComplex<complex<@REAL_TYPE@>,Cpu,@REAL_TYPE@>(dM_M, J2, t2, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW2 = new EigTJParallelComplex<complex<@REAL_TYPE@>,Cpu,@REAL_TYPE@>(dM_M, J2, t2, verbosity, tol, relErr, enable_large_Faust, err_period); (*algoW1)->set_tag("U"); (*algoW2)->set_tag("V"); @@ -37,18 +37,18 @@ namespace Faust #endif template<> - void instantiate_algos<@REAL_TYPE@, Cpu, @REAL_TYPE@>(GivensFGFTGen<@REAL_TYPE@, Cpu, @REAL_TYPE@, @REAL_TYPE@>** algoW1, GivensFGFTGen<@REAL_TYPE@, Cpu, @REAL_TYPE@, @REAL_TYPE@>** algoW2, Faust::MatDense<@REAL_TYPE@,Cpu> &dM_M, Faust::MatDense<@REAL_TYPE@,Cpu> &dMM_,int J1, int J2, int t1, int t2, unsigned int verbosity, @REAL_TYPE@ tol, bool relErr, bool enable_large_Faust, const int err_period) + void instantiate_algos<@REAL_TYPE@, Cpu, @REAL_TYPE@>(EigTJGen<@REAL_TYPE@, Cpu, @REAL_TYPE@, @REAL_TYPE@>** algoW1, EigTJGen<@REAL_TYPE@, Cpu, @REAL_TYPE@, @REAL_TYPE@>** algoW2, Faust::MatDense<@REAL_TYPE@,Cpu> &dM_M, Faust::MatDense<@REAL_TYPE@,Cpu> &dMM_,int J1, int J2, int t1, int t2, unsigned int verbosity, @REAL_TYPE@ tol, bool relErr, bool enable_large_Faust, const int err_period) { if(t1 <= 1) - *algoW1 = new GivensFGFT<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dMM_, J1, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW1 = new EigTJ<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dMM_, J1, verbosity, tol, relErr, enable_large_Faust, err_period); else - *algoW1 = new GivensFGFTParallel<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dMM_, J1, t1, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW1 = new EigTJParallel<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dMM_, J1, t1, verbosity, tol, relErr, enable_large_Faust, err_period); if(t2 <= 1) - *algoW2 = new GivensFGFT<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dM_M, J2, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW2 = new EigTJ<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dM_M, J2, verbosity, tol, relErr, enable_large_Faust, err_period); else - *algoW2 = new GivensFGFTParallel<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dM_M, J2, t2, verbosity, tol, relErr, enable_large_Faust, err_period); + *algoW2 = new EigTJParallel<@REAL_TYPE@,Cpu,@REAL_TYPE@>(dM_M, J2, t2, verbosity, tol, relErr, enable_large_Faust, err_period); (*algoW1)->set_tag("U"); (*algoW2)->set_tag("V"); diff --git a/src/algorithm/factorization/faust_SVDTJ.h b/src/algorithm/factorization/faust_SVDTJ.h index 25ae971279154057ef2a5b3b1bb5a5fa9bc8ee4d..d5f0fae27a862b22aeb4c37694f39be3ae882029 100644 --- a/src/algorithm/factorization/faust_SVDTJ.h +++ b/src/algorithm/factorization/faust_SVDTJ.h @@ -43,7 +43,7 @@ namespace Faust * \return the USV' product as dense matrix. */ template<typename FPP, FDevice DEVICE, typename FPP2> - MatDense<FPP, DEVICE> calc_USV_(GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1, GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2, size_t nfacts_W1, size_t nfacts_W2, const Vect<FPP, DEVICE> & S); + MatDense<FPP, DEVICE> calc_USV_(EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1, EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2, size_t nfacts_W1, size_t nfacts_W2, const Vect<FPP, DEVICE> & S); /** @@ -53,7 +53,7 @@ namespace Faust void svdtj_core_gen_blind(MatGeneric<FPP,DEVICE>* M, MatDense<FPP,DEVICE> &dM, MatDense<FPP,DEVICE> &dM_M, MatDense<FPP,DEVICE> &dMM_, int J1, int J2, int t1, int t2, FPP2 tol, unsigned int verbosity, bool relErr, int order, const bool enable_large_Faust, TransformHelper<FPP,DEVICE> ** U, TransformHelper<FPP,DEVICE> **V, Vect<FPP,DEVICE> ** S_, const int err_period=100); template<typename FPP, FDevice DEVICE, typename FPP2> - void instantiate_algos(GivensFGFTGen<Real<FPP>, Cpu, FPP2, FPP>** algoW1, GivensFGFTGen<Real<FPP>, Cpu, FPP2, FPP>** algoW2, Faust::MatDense<FPP,DEVICE> &dM_M, Faust::MatDense<FPP,DEVICE> &dMM_, int J1, int J2, int t1, int t2, unsigned int verbosity, FPP2 tol, bool relErr, bool enable_large_Faust, const int err_period); + void instantiate_algos(EigTJGen<Real<FPP>, Cpu, FPP2, FPP>** algoW1, EigTJGen<Real<FPP>, Cpu, FPP2, FPP>** algoW2, Faust::MatDense<FPP,DEVICE> &dM_M, Faust::MatDense<FPP,DEVICE> &dMM_, int J1, int J2, int t1, int t2, unsigned int verbosity, FPP2 tol, bool relErr, bool enable_large_Faust, const int err_period); /** * \brief Move signs of S in matching singular vector of W1 (U). diff --git a/src/algorithm/factorization/faust_SVDTJ.hpp b/src/algorithm/factorization/faust_SVDTJ.hpp index 8d8c3aafff554d7cacada3c8d96c0d5c9f0c27d1..ef7d5d430e1e269cfa168d71ba14020150813c45 100644 --- a/src/algorithm/factorization/faust_SVDTJ.hpp +++ b/src/algorithm/factorization/faust_SVDTJ.hpp @@ -1,9 +1,9 @@ -#include "faust_GivensFGFT.h" -#include "faust_GivensFGFTParallel.h" -#include "faust_GivensFGFTParallelComplex.h" -#include "faust_GivensFGFTComplex.h" +#include "faust_EigTJ.h" +#include "faust_EigTJParallel.h" +#include "faust_EigTJParallelComplex.h" +#include "faust_EigTJComplex.h" #include "faust_constant.h" -#include "faust_GivensFGFTGen.h" +#include "faust_EigTJGen.h" #include <type_traits> namespace Faust @@ -75,8 +75,8 @@ namespace Faust assert(order != 0); // we need to use a specific order of singular values/vectors approximates to know where to get the singular values in W1' M W2 matrix - GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1; - GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2; + EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1; + EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2; if (t1 <= 0) //automatic t1 @@ -293,7 +293,7 @@ namespace Faust } template<typename FPP, FDevice DEVICE, typename FPP2> - MatDense<FPP, DEVICE> calc_USV_(GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1, GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2, size_t nfacts_W1, size_t nfacts_W2, const Vect<FPP, DEVICE> & S) + MatDense<FPP, DEVICE> calc_USV_(EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1, EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2, size_t nfacts_W1, size_t nfacts_W2, const Vect<FPP, DEVICE> & S) { auto order = -1; // otherwise dS won't be a diagonal matrix @@ -361,8 +361,8 @@ namespace Faust // algorithm main idea: run two eigtj for U and V step by step until the target error is verified or the limit number of Givens is reached assert(order != 0); // we need to use a specific order of singular values/vectors approximates to know where to get the singular values in W1' M W2 matrix - GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1; - GivensFGFTGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2; + EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW1; + EigTJGen<Real<FPP>, DEVICE, FPP2, FPP>* algoW2; if (t1 <= 0) //automatic t1 @@ -622,7 +622,7 @@ namespace Faust } prev_aerr = aerr; - // erase permuted factors because algoW1/W2 doesn't keep account for them (cf. GivensFGFTGen::get_transform with ord == true and copy == false + // erase permuted factors because algoW1/W2 doesn't keep account for them (cf. EigTJGen::get_transform with ord == true and copy == false } if(order) { diff --git a/src/faust_linear_operator/CPU/faust_MatSparse.h b/src/faust_linear_operator/CPU/faust_MatSparse.h index b2e2433107ebe5c8ac99d1d6c198146f4e1372bb..32ae0f5679e474c1154a01b4606e7a133fc20ae8 100644 --- a/src/faust_linear_operator/CPU/faust_MatSparse.h +++ b/src/faust_linear_operator/CPU/faust_MatSparse.h @@ -95,9 +95,9 @@ namespace Faust //! MatDense class template of dense matrix template<typename FPP,FDevice DEVICE> class MatDense; - template<typename FPP, FDevice DEVICE, typename FPP2> class GivensFGFT; - template<typename FPP, FDevice DEVICE, typename FPP2> class GivensFGFTParallel; - template<typename FPP, FDevice DEVICE, typename FPP2> class GivensFGFTComplex; + template<typename FPP, FDevice DEVICE, typename FPP2> class EigTJ; + template<typename FPP, FDevice DEVICE, typename FPP2> class EigTJParallel; + template<typename FPP, FDevice DEVICE, typename FPP2> class EigTJComplex; template<typename FPP> class TransformHelperPoly; template<typename FPP, FDevice DEV> class MatButterfly; //TODO: simplify/remove the friendship by adding/using a public setter to is_ortho @@ -111,12 +111,12 @@ namespace Faust { friend MatBSR<FPP, Cpu>; - friend GivensFGFT<FPP,Cpu, double>; - friend GivensFGFTParallel<FPP,Cpu, double>; - friend GivensFGFT<FPP,Cpu, float>; - friend GivensFGFTParallel<FPP,Cpu, float>; - friend GivensFGFTComplex<FPP,Cpu, double>; - friend GivensFGFTComplex<FPP,Cpu, float>; + friend EigTJ<FPP,Cpu, double>; + friend EigTJParallel<FPP,Cpu, double>; + friend EigTJ<FPP,Cpu, float>; + friend EigTJParallel<FPP,Cpu, float>; + friend EigTJComplex<FPP,Cpu, double>; + friend EigTJComplex<FPP,Cpu, float>; friend Transform<FPP,Cpu>; //TODO: limit to needed member functions only (multiply) friend TransformHelper<FPP,Cpu>; // TODO: limit to needed member functions only friend TransformHelperPoly<FPP>; // TODO: limit to needed member functions only diff --git a/wrapper/matlab/src/mexfgftgivens.cpp.in b/wrapper/matlab/src/mexfgftgivens.cpp.in index e48de9e8d2438de8a9725bc1c56abaf71ce78431..92bc9914749860fec0ea1d5b9b3d495a678e2099 100644 --- a/wrapper/matlab/src/mexfgftgivens.cpp.in +++ b/wrapper/matlab/src/mexfgftgivens.cpp.in @@ -33,10 +33,10 @@ #include "mex.h" -#include "faust_GivensFGFT.h" -#include "faust_GivensFGFTParallel.h" -#include "faust_GivensFGFTComplex.h" -#include "faust_GivensFGFTParallelComplex.h" +#include "faust_EigTJ.h" +#include "faust_EigTJParallel.h" +#include "faust_EigTJComplex.h" +#include "faust_EigTJParallelComplex.h" #include "faust_TransformHelper.h" #include "faust_linear_algebra.h" #include "class_handle.hpp" @@ -49,7 +49,7 @@ #include <stdexcept> //normally Givens is only for double, float scalars -// update: complex matrices are available with GivensFGFTComplex +// update: complex matrices are available with EigTJComplex typedef @FAUST_SCALAR@ SCALAR; typedef @FACT_FPP@ FPP2; @@ -108,7 +108,7 @@ void fgft_givens(const mxArray* matlab_matrix, int J, int t, Real<SCALAR> tol, u Faust::MatDense<SCALAR,Cpu> dLap; Faust::MatSparse<SCALAR,Cpu> sLap; - Faust::GivensFGFT<SCALAR, Cpu, FPP2>* algo; + Faust::EigTJ<SCALAR, Cpu, FPP2>* algo; try{ if (mxIsSparse(matlab_matrix)) @@ -116,18 +116,18 @@ void fgft_givens(const mxArray* matlab_matrix, int J, int t, Real<SCALAR> tol, u mxArray2FaustspMat(matlab_matrix,sLap); Lap = &sLap; if(t <= 1) - algo = new GivensFGFT<SCALAR,Cpu,FPP2>(sLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJ<SCALAR,Cpu,FPP2>(sLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); else - algo = new GivensFGFTParallel<SCALAR,Cpu,FPP2>(sLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJParallel<SCALAR,Cpu,FPP2>(sLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); }else { mxArray2FaustMat(matlab_matrix,dLap); Lap = &dLap; if(t <= 1) - algo = new GivensFGFT<SCALAR,Cpu,FPP2>(dLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJ<SCALAR,Cpu,FPP2>(dLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); else - algo = new GivensFGFTParallel<SCALAR,Cpu,FPP2>(dLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJParallel<SCALAR,Cpu,FPP2>(dLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); } @@ -163,7 +163,7 @@ void fgft_givens_cplx(const mxArray* matlab_matrix, int J, int t, double tol, un Faust::MatDense<complex<SCALAR>,Cpu> dLap; Faust::MatSparse<complex<SCALAR>,Cpu> sLap; - Faust::GivensFGFTComplex<complex<SCALAR>, Cpu, FPP2>* algo = nullptr; + Faust::EigTJComplex<complex<SCALAR>, Cpu, FPP2>* algo = nullptr; try{ if (mxIsSparse(matlab_matrix)) @@ -171,18 +171,18 @@ void fgft_givens_cplx(const mxArray* matlab_matrix, int J, int t, double tol, un mxArray2FaustspMat(matlab_matrix,sLap); Lap = &sLap; if(t <= 1) - algo = new GivensFGFTComplex<complex<SCALAR>,Cpu,FPP2>(sLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJComplex<complex<SCALAR>,Cpu,FPP2>(sLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); else - algo = new GivensFGFTParallelComplex<complex<SCALAR>,Cpu,FPP2>(sLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJParallelComplex<complex<SCALAR>,Cpu,FPP2>(sLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); }else { mxArray2FaustMat(matlab_matrix,dLap); Lap = &dLap; if(t <= 1) - algo = new GivensFGFTComplex<complex<SCALAR>,Cpu,FPP2>(dLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJComplex<complex<SCALAR>,Cpu,FPP2>(dLap, J, verbosity, tol, rel_err, enable_large_Faust, err_period); else - algo = new GivensFGFTParallelComplex<complex<SCALAR>,Cpu,FPP2>(dLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); + algo = new EigTJParallelComplex<complex<SCALAR>,Cpu,FPP2>(dLap, J, t, verbosity, tol, rel_err, enable_large_Faust, err_period); } algo->compute_facts(); diff --git a/wrapper/matlab/src/mexsvdtj.cpp.in b/wrapper/matlab/src/mexsvdtj.cpp.in index f40e8d81f17df8e7d9cbfda0e67621068d013774..72f86fd3a27cfb68747fc8506cf510e1ad05028a 100644 --- a/wrapper/matlab/src/mexsvdtj.cpp.in +++ b/wrapper/matlab/src/mexsvdtj.cpp.in @@ -33,10 +33,10 @@ #include "mex.h" -#include "faust_GivensFGFT.h" -#include "faust_GivensFGFTParallel.h" -#include "faust_GivensFGFTComplex.h" -#include "faust_GivensFGFTParallelComplex.h" +#include "faust_EigTJ.h" +#include "faust_EigTJParallel.h" +#include "faust_EigTJComplex.h" +#include "faust_EigTJParallelComplex.h" #include "faust_SVDTJ.h" #include "faust_TransformHelper.h" #include "faust_linear_algebra.h" diff --git a/wrapper/python/src/FaustAlgo.pxd b/wrapper/python/src/FaustAlgo.pxd index 83813c7356819b3f6a21bc0ee205a1e261f4fc94..3921b7e76c86c366eddd72fec3ff5e1e46a85c34 100644 --- a/wrapper/python/src/FaustAlgo.pxd +++ b/wrapper/python/src/FaustAlgo.pxd @@ -156,7 +156,7 @@ cdef extern from "FaustFact.h": mul_perm) -cdef extern from "FaustFactGivensFGFT.h": +cdef extern from "FaustFactEigTJ.h": cdef FaustCoreCppCPU[FPP]* fact_givens_fgft[FPP,FPP2](const FPP* Lap, unsigned int num_rows, unsigned int num_cols, unsigned int J, diff --git a/wrapper/python/src/FaustFactGivensFGFT.h b/wrapper/python/src/FaustFactEigTJ.h similarity index 91% rename from wrapper/python/src/FaustFactGivensFGFT.h rename to wrapper/python/src/FaustFactEigTJ.h index 6c42978fb6164ad4eee206d647c64530425066d1..9a61faa7d44ab682bc4270f6bddc9818a58439b7 100644 --- a/wrapper/python/src/FaustFactGivensFGFT.h +++ b/wrapper/python/src/FaustFactEigTJ.h @@ -1,6 +1,6 @@ -#ifndef FAUST_FACT_GIVENS_FGFT_H -#define FAUST_FACT_GIVENS_FGFT_H -#include "faust_GivensFGFT.h" +#ifndef FAUST_FACT_EIGTJ_H +#define FAUST_FACT_EIGTJ_H +#include "faust_EigTJ.h" template<typename FPP, typename FPP2 = float> FaustCoreCpp<FPP>* fact_givens_fgft(const FPP* Lap, unsigned int num_rows, unsigned int num_cols, unsigned int J, unsigned int t, FPP* D, unsigned int verbosity = 0, const FPP2 stoppingError = 0.0, const bool errIsRel = true, const int order = 1 /* ascendant order for eigenvalues */, const bool enable_large_Faust=false, const int err_period=100); @@ -11,7 +11,7 @@ FaustCoreCpp<FPP>* fact_givens_fgft_sparse(const FPP* data, int* row_ptr, int* i template<typename FPP, typename FPP2 = float> -FaustCoreCpp<FPP>* fact_givens_fgft_generic(GivensFGFT<FPP, Cpu, FPP2>* algo, FPP* D, const int order); +FaustCoreCpp<FPP>* fact_givens_fgft_generic(EigTJ<FPP, Cpu, FPP2>* algo, FPP* D, const int order); template<typename FPP, typename FPP2 = float> FaustCoreCpp<FPP>* fact_givens_fgft_cplx(const FPP* Lap, unsigned int num_rows, unsigned int num_cols, unsigned int J, unsigned int t, FPP2* D, unsigned int verbosity = 0, const FPP2 stoppingError = 0.0, const bool errIsRel = true, const int order = 1 /* ascendant order for eigenvalues */, const bool enable_large_Faust=false, const int err_period=100); @@ -22,7 +22,7 @@ FaustCoreCpp<FPP>* fact_givens_fgft_sparse_cplx(const FPP* data, int* row_ptr, i template<typename FPP, typename FPP2 = float> -FaustCoreCpp<FPP>* fact_givens_fgft_generic_cplx(GivensFGFTComplex<FPP, Cpu, FPP2>* algo, FPP2* D, const int order); +FaustCoreCpp<FPP>* fact_givens_fgft_generic_cplx(EigTJComplex<FPP, Cpu, FPP2>* algo, FPP2* D, const int order); template<typename FPP, typename FPP2 = float> void svdtj( FaustCoreCpp<FPP>** U, FaustCoreCpp<FPP> **V, FPP* S /** end of output parameters */, const FPP* M, unsigned int num_rows, unsigned int num_cols, unsigned int J1, unsigned int J2, unsigned int t1, unsigned int t2, unsigned int verbosity = 0, const FPP2 stoppingError = 0.0, const bool errIsRel = true, const bool enable_large_Faust = false /* end of input parameters*/, const int err_period=100); @@ -39,6 +39,6 @@ void svdtj_sparse_cplx(FaustCoreCpp<FPP>** U, FaustCoreCpp<FPP> **V, FPP* S, /*s template<typename FPP, typename FPP2 = float> void create_svdtj_output(TransformHelper<FPP,Cpu> *U_, TransformHelper<FPP,Cpu> *V_, FaustCoreCpp<FPP>** U, FaustCoreCpp<FPP> **V, FPP* S, Faust::Vect<FPP,Cpu> * S_); -#include "FaustFactGivensFGFT.hpp" +#include "FaustFactEigTJ.hpp" #endif diff --git a/wrapper/python/src/FaustFactGivensFGFT.hpp b/wrapper/python/src/FaustFactEigTJ.hpp similarity index 83% rename from wrapper/python/src/FaustFactGivensFGFT.hpp rename to wrapper/python/src/FaustFactEigTJ.hpp index a05cdbf74738e1eb748fcb9607a0ae321735733a..ad88aa35f22cdf73c2c0546d37455f11618472b2 100644 --- a/wrapper/python/src/FaustFactGivensFGFT.hpp +++ b/wrapper/python/src/FaustFactEigTJ.hpp @@ -1,8 +1,8 @@ #include "faust_MatDense.h" -#include "faust_GivensFGFTParallel.h" -#include "faust_GivensFGFT.h" -#include "faust_GivensFGFTComplex.h" -#include "faust_GivensFGFTParallelComplex.h" +#include "faust_EigTJParallel.h" +#include "faust_EigTJ.h" +#include "faust_EigTJComplex.h" +#include "faust_EigTJParallelComplex.h" #include "faust_SVDTJ.h" using namespace Faust; @@ -11,14 +11,14 @@ FaustCoreCpp<FPP>* fact_givens_fgft_sparse(FPP* data, int* row_ptr, int* id_col, unsigned int J, unsigned int t /* end of input parameters*/, FPP* D, unsigned int verbosity, const FPP2 stoppingError, const bool errIsRel, const int order, const bool enable_large_Faust, const int err_period) { Faust::MatSparse<FPP, Cpu> mat_Lap(nnz, nrows, ncols, data, id_col, row_ptr); - GivensFGFT<FPP, Cpu, FPP2>* algo; + EigTJ<FPP, Cpu, FPP2>* algo; if(t <= 1) { - algo = new GivensFGFT<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJ<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } else { - algo = new GivensFGFTParallel<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJParallel<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } return fact_givens_fgft_generic(algo, D, order); } @@ -30,20 +30,20 @@ FaustCoreCpp<FPP>* fact_givens_fgft(const FPP* Lap, unsigned int num_rows, unsig //just using the data in Lap as underlying pointer of MatDense) Faust::MatDense<FPP,Cpu> mat_Lap(Lap, num_rows, num_cols); - GivensFGFT<FPP, Cpu, FPP2>* algo; + EigTJ<FPP, Cpu, FPP2>* algo; if(t <= 1) { - algo = new GivensFGFT<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJ<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } else { - algo = new GivensFGFTParallel<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJParallel<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } return fact_givens_fgft_generic(algo, D, order); } template<typename FPP, typename FPP2> -FaustCoreCpp<FPP>* fact_givens_fgft_generic(GivensFGFT<FPP, Cpu, FPP2>* algo, FPP* D, const int order) +FaustCoreCpp<FPP>* fact_givens_fgft_generic(EigTJ<FPP, Cpu, FPP2>* algo, FPP* D, const int order) { FaustCoreCpp<FPP>* fc = nullptr; @@ -73,14 +73,14 @@ FaustCoreCpp<FPP>* fact_givens_fgft_sparse_cplx(FPP* data, int* row_ptr, int* id unsigned int J, unsigned int t /* end of input parameters*/, FPP2* D, unsigned int verbosity, const FPP2 stoppingError, const bool errIsRel, const int order, const bool enable_large_Faust, const int err_period) { Faust::MatSparse<FPP, Cpu> mat_Lap(nnz, nrows, ncols, data, id_col, row_ptr); - GivensFGFTComplex<FPP, Cpu, FPP2>* algo; + EigTJComplex<FPP, Cpu, FPP2>* algo; if(t <= 1) { - algo = new GivensFGFTComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } else { - algo = new GivensFGFTParallelComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJParallelComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } return fact_givens_fgft_generic_cplx(algo, D, order); } @@ -92,20 +92,20 @@ FaustCoreCpp<FPP>* fact_givens_fgft_cplx(const FPP* Lap, unsigned int num_rows, //just using the data in Lap as underlying pointer of MatDense) Faust::MatDense<FPP,Cpu> mat_Lap(Lap, num_rows, num_cols); - GivensFGFTComplex<FPP, Cpu, FPP2>* algo; + EigTJComplex<FPP, Cpu, FPP2>* algo; if(t <= 1) { - algo = new GivensFGFTComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } else { - algo = new GivensFGFTParallelComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); + algo = new EigTJParallelComplex<FPP, Cpu, FPP2>(mat_Lap, (int)J, (int) t, verbosity, stoppingError, errIsRel, enable_large_Faust, err_period); } return fact_givens_fgft_generic_cplx(algo, D, order); } template<typename FPP, typename FPP2> -FaustCoreCpp<FPP>* fact_givens_fgft_generic_cplx(GivensFGFTComplex<FPP, Cpu, FPP2>* algo, FPP2* D, const int order) +FaustCoreCpp<FPP>* fact_givens_fgft_generic_cplx(EigTJComplex<FPP, Cpu, FPP2>* algo, FPP2* D, const int order) { FaustCoreCpp<FPP>* fc = nullptr;