From a47ac94465d8fd8e30d65c5ef9d57b66046406bb Mon Sep 17 00:00:00 2001 From: Pierre Blanchard <pierre.blanchard@inria.fr> Date: Tue, 2 Feb 2016 11:27:46 +0100 Subject: [PATCH] hmat: minor fixes in datafile names and update tests. --- Addons/HMat/Src/Blocks/FACABlock.hpp | 4 +-- Addons/HMat/Src/Blocks/FSVDBlock.hpp | 2 +- .../HMat/Tests/testCompareClusteringRank.cpp | 34 ++++++++++++++----- Addons/HMat/Tests/testGraphTreshold.cpp | 15 +++++--- Addons/HMat/Tests/testSDBGemvFile.cpp | 7 ++-- 5 files changed, 43 insertions(+), 19 deletions(-) diff --git a/Addons/HMat/Src/Blocks/FACABlock.hpp b/Addons/HMat/Src/Blocks/FACABlock.hpp index 0ab918676..b9789c3b6 100644 --- a/Addons/HMat/Src/Blocks/FACABlock.hpp +++ b/Addons/HMat/Src/Blocks/FACABlock.hpp @@ -28,7 +28,7 @@ //#define PARTIALLY_PIVOTED_ACA /*! Choose \a RECOMPRESSED_ACA */ -//#define RECOMPRESSED_ACA +#define RECOMPRESSED_ACA template <class FReal, int ORDER = 14> @@ -48,7 +48,7 @@ protected: public: FACABlock() - : block(nullptr), U(nullptr), VT(nullptr), nbRows(0), nbCols(0), level(0), rank(0), accuracy(FMath::pow(10.0,static_cast<FReal>(-ORDER))) { + : block(nullptr), U(nullptr), VT(nullptr), nbRows(0), nbCols(0), level(0), rank(0), accuracy(FMath::pow(FReal(10.0),static_cast<FReal>(-ORDER))) { } // ctor diff --git a/Addons/HMat/Src/Blocks/FSVDBlock.hpp b/Addons/HMat/Src/Blocks/FSVDBlock.hpp index 76a330cd6..8500c2df3 100644 --- a/Addons/HMat/Src/Blocks/FSVDBlock.hpp +++ b/Addons/HMat/Src/Blocks/FSVDBlock.hpp @@ -110,7 +110,7 @@ protected: public: FSVDBlock() - : block(nullptr), U(nullptr), S(nullptr), VT(nullptr), nbRows(0), nbCols(0), level(0), rank(0), accuracy(FMath::pow(10.0,static_cast<FReal>(-ORDER))) { + : block(nullptr), U(nullptr), S(nullptr), VT(nullptr), nbRows(0), nbCols(0), level(0), rank(0), accuracy(FMath::pow(FReal(10.0),static_cast<FReal>(-ORDER))) { } // ctor diff --git a/Addons/HMat/Tests/testCompareClusteringRank.cpp b/Addons/HMat/Tests/testCompareClusteringRank.cpp index 2484442a6..cbedf4f7d 100644 --- a/Addons/HMat/Tests/testCompareClusteringRank.cpp +++ b/Addons/HMat/Tests/testCompareClusteringRank.cpp @@ -36,11 +36,11 @@ #include <memory> template <class FReal, class MatrixClass> -void CheckRank(const FClusterTree<double>& ctree, MatrixClass& matrix, +void CheckRank(const FClusterTree<FReal>& ctree, MatrixClass& matrix, const char outputdir[], const char configName[], const int height){ typedef FDenseBlock<FReal> LeafClass; - typedef FSVDBlock<FReal,7> CellClass; + typedef FACABlock<FReal,7> CellClass; typedef FStaticDiagonalBisection<FReal, LeafClass, CellClass> GridClass; const int dim = matrix.getDim(); @@ -94,13 +94,20 @@ int main(int argc, char** argv){ //////////////////////////////////////////////////////////////////// const char* outputdir = FParameters::getStr(argc, argv, SvgOutParam.options, "/tmp/"); - const char* distanceFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileOne.options, "../Addons/HMat/Data/unitCube1000.bin"); - const char* matrixFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileTwow.options, "../Addons/HMat/Data/unitCube1000_ONE_OVER_R.bin"); + //const char* distanceFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileOne.options, "../Addons/HMat/Data/unitCube1000.bin"); + //const char* matrixFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileTwow.options, "../Addons/HMat/Data/unitCube1000_ONE_OVER_R.bin"); + const char* distanceFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileOne.options, "../Addons/HMat/Data/unitSphere1000.bin"); + const char* matrixFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileTwow.options, "../Addons/HMat/Data/unitSphere1000_GAUSS100.bin"); + typedef double FReal; + + //const char* distanceFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileOne.options, "../Addons/HMat/Data/first_reads_1k-fmr-dissw.bin"); + //const char* matrixFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileTwow.options, "../Addons/HMat/Data/first_reads_1k-fmr-covar.bin"); + //typedef float FReal; + const int height = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 4); std::cout << "Check until height = " << height << "\n"; - typedef double FReal; typedef FMatDensePerm<FReal> MatrixClass; //////////////////////////////////////////////////////////////////// @@ -126,6 +133,17 @@ int main(int argc, char** argv){ MatrixClass matrix(matrixFilename); const int matrixDim = matrix.getDim(); + // Display covariance matrix + const FSize displaySize = 10; + std::cout<<"\nC=["<<std::endl; + for ( int i=0; i<displaySize; ++i) { + for ( int j=0; j<displaySize; ++j) + std::cout << matrix.getVal(i,j) << " "; + std::cout<< std::endl; + } + std::cout<<"]"<<std::endl; + + FAssertLF(distanceValuesDim == matrixDim); std::cout << "Matrices dim = " << matrixDim << "\n"; @@ -135,7 +153,7 @@ int main(int argc, char** argv){ std::cout << "Test FMaxDistCut\n"; FMaxDistCut<FReal> partitioner(matrixDim, distanceValues.get()); - FClusterTree<double> tclusters; + FClusterTree<FReal> tclusters; partitioner.fillClusterTree(&tclusters); tclusters.checkData(); CheckRank<FReal, MatrixClass>(tclusters, matrix, outputdir, "FMaxDistCut", height); @@ -145,7 +163,7 @@ int main(int argc, char** argv){ std::cout << "Test FGraphThreshold\n"; FGraphThreshold<FReal> partitioner(matrixDim, distanceValues.get(), FGraphThreshold<FReal>::GetDefaultRadius(matrixDim, distanceValues.get())); - FClusterTree<double> tclusters; + FClusterTree<FReal> tclusters; partitioner.fillClusterTree(&tclusters); tclusters.checkData(); CheckRank<FReal, MatrixClass>(tclusters, matrix, outputdir, "FGraphThreshold", height); @@ -153,7 +171,7 @@ int main(int argc, char** argv){ //////////////////////////////////////////////////////////////////// { std::cout << "Test FCCLTreeCluster\n"; - FCCLTreeCluster<FReal> partitioner(matrixDim, distanceValues.get(), CCL::CCL_TM_MAXIMUM); + FCCLTreeCluster<double> partitioner(matrixDim, distanceValues.get(), CCL::CCL_TM_MAXIMUM); FClusterTree<double> tclusters; partitioner.fillClusterTree(&tclusters); diff --git a/Addons/HMat/Tests/testGraphTreshold.cpp b/Addons/HMat/Tests/testGraphTreshold.cpp index 4e1cd9bb8..ec5cb015d 100644 --- a/Addons/HMat/Tests/testGraphTreshold.cpp +++ b/Addons/HMat/Tests/testGraphTreshold.cpp @@ -30,21 +30,26 @@ int main(int argc, char** argv){ FHelpDescribeAndExit(argc, argv,"Test the bisection.",SvgOutParam,DimParam,FParameterDefinitions::OctreeHeight); - const char* filename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFile.options, "../Addons/HMat/Data/unitCube1000.bin"); const int height = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 4); const char* outputdir = FParameters::getStr(argc, argv, SvgOutParam.options, "/tmp/"); + //const char* filename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFile.options, "../Addons/HMat/Data/unitCube1000.bin"); + //typedef double FReal; + + const char* filename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileOne.options, "../Addons/HMat/Data/first_reads_1k-fmr-dissw.bin"); + typedef float FReal; + int readNbRows = 0; int readNbCols = 0; // Read distances - double* distances = nullptr; + FReal* distances = nullptr; FAssertLF(FMatrixIO::read(filename, &distances, &readNbRows, &readNbCols)); FAssertLF(readNbRows == readNbCols); const int dim = readNbRows; - FGraphThreshold<double> partitioner(dim, distances, FGraphThreshold<double>::GetDefaultRadius(dim, distances)); + FGraphThreshold<FReal> partitioner(dim, distances, FGraphThreshold<FReal>::GetDefaultRadius(dim, distances)); - FClusterTree<double> tclusters; + FClusterTree<FReal> tclusters; partitioner.fillClusterTree(&tclusters); tclusters.checkData(); @@ -56,7 +61,7 @@ int main(int argc, char** argv){ tclusters.getPartitions(height, nbPartitions, partitions.get()); { - typedef double FReal; + //typedef double FReal; typedef FDenseBlock<FReal> LeafClass; typedef FDenseBlock<FReal> CellClass; typedef FStaticDiagonalBisection<FReal, LeafClass, CellClass> GridClass; diff --git a/Addons/HMat/Tests/testSDBGemvFile.cpp b/Addons/HMat/Tests/testSDBGemvFile.cpp index 0d757b8fd..6995a6822 100644 --- a/Addons/HMat/Tests/testSDBGemvFile.cpp +++ b/Addons/HMat/Tests/testSDBGemvFile.cpp @@ -38,7 +38,8 @@ int main(int argc, char** argv){ FTic time; time.tic(); - const char* filename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFile.options, "../Addons/HMat/Data/unitCube1000_ONE_OVER_R.bin"); + //const char* filename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFile.options, "../Addons/HMat/Data/unitCube1000_ONE_OVER_R.bin"); + const char* filename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFile.options, "../Addons/HMat/Data/unitSphere1000_GAUSS100.bin"); const int height = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 4); @@ -67,7 +68,7 @@ int main(int argc, char** argv){ } { - std::cout << "Test Dense:\n"; + std::cout << "Test Dense leaves + Low rank cells:\n"; typedef FDenseBlock<FReal> LeafClass; //typedef FDenseBlock<FReal> CellClass; typedef FSVDBlock<FReal,7> CellClass; @@ -98,7 +99,7 @@ int main(int argc, char** argv){ { - std::cout << "Test Dense with partitions:\n"; + std::cout << "Test Dense leaves + Low rank cells, with partitions:\n"; typedef FDenseBlock<FReal> LeafClass; //typedef FDenseBlock<FReal> CellClass; -- GitLab