Commit a9f4b02a authored by BLANCHARD Pierre's avatar BLANCHARD Pierre

HMat: ACA does not seem to work on 1/R matrix (TODO try different LRA...

HMat: ACA does not seem to work on 1/R matrix (TODO try different LRA techniques); Use SVD for now; Fixed default distance filename in testCompare...
parent 112121f9
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
#endif #endif
// display rank // display rank
std::cout << "rank after ACA=" << rank << std::endl; std::cout << "rank after ACA=" << rank << " (" << nbRows << "," << nbCols << ")" << std::endl;
#if (defined RECOMPRESSED_ACA) #if (defined RECOMPRESSED_ACA)
...@@ -173,6 +173,9 @@ public: ...@@ -173,6 +173,9 @@ public:
} }
int getRank() const{
return rank;
}
}; };
......
...@@ -48,7 +48,7 @@ static void computeSVD(const FSize nbRows, const FSize nbCols, const FReal* A, F ...@@ -48,7 +48,7 @@ static void computeSVD(const FSize nbRows, const FSize nbCols, const FReal* A, F
// nothing means OS (the opposite of SO, A=USVT) // nothing means OS (the opposite of SO, A=USVT)
//is_int(size); is_int(LWORK); //is_int(size); is_int(LWORK);
const unsigned int INFOSVD const unsigned int INFOSVD
= FBlas::gesvd(int(nbRows), int(nbCols), U, S, VT, int(minMN), = FBlas::gesvd(int(nbRows), int(nbCols), U, S, VT, int(minMN)/*ldVT*/,
int(LWORK), WORK); int(LWORK), WORK);
if(verbose) { if(verbose) {
if(INFOSVD!=0) {std::cout << " failed!" << std::endl;} if(INFOSVD!=0) {std::cout << " failed!" << std::endl;}
...@@ -132,7 +132,7 @@ public: ...@@ -132,7 +132,7 @@ public:
// SVD specific (col major) // SVD specific (col major)
rank = std::min(nbRows,nbCols); rank = std::min(nbRows,nbCols);
S = new FReal[rank]; S = new FReal[rank];
FReal* _U = new FReal[nbRows*nbCols]; // Call to computeSVD() copies block into U FReal* _U = new FReal[nbRows*nbCols]; // Call to computeSVD() copies block MxN into _U and stores first min(M,N) cols of U into _U
FReal* _VT = new FReal[rank*nbCols]; FReal* _VT = new FReal[rank*nbCols];
FBlas::setzero(int(rank), S); FBlas::setzero(int(rank), S);
FBlas::setzero(int(rank*nbCols),_VT); FBlas::setzero(int(rank*nbCols),_VT);
...@@ -142,8 +142,14 @@ public: ...@@ -142,8 +142,14 @@ public:
// Determine numerical rank using prescribed accuracy // Determine numerical rank using prescribed accuracy
computeNumericalRank(rank, S, accuracy); computeNumericalRank(rank, S, accuracy);
//// Display singular values
//std::cout << "S = [";
//for(int idxRow = 0 ; idxRow < rank ; ++idxRow)
// std::cout << S[idxRow] << " " ;
//std::cout << "]" << std::endl;
//// display rank //// display rank
//std::cout << "rank=" << rank << std::endl; std::cout << "rank SVD =" << rank << " (" << nbRows << "," << nbCols << ")" << std::endl;
// Resize U and VT // Resize U and VT
U = new FReal[nbRows*rank]; // Call to computeSVD() copies block into U U = new FReal[nbRows*rank]; // Call to computeSVD() copies block into U
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "../Src/Viewers/FMatDensePerm.hpp" #include "../Src/Viewers/FMatDensePerm.hpp"
#include "../Src/Blocks/FDenseBlock.hpp" #include "../Src/Blocks/FDenseBlock.hpp"
#include "../Src/Blocks/FSVDBlock.hpp" #include "../Src/Blocks/FSVDBlock.hpp"
#include "../Src/Blocks/FACABlock.hpp"
#include "../Src/Clustering/FMaxDistCut.hpp" #include "../Src/Clustering/FMaxDistCut.hpp"
#include "../Src/Clustering/FCCLTreeCluster.hpp" #include "../Src/Clustering/FCCLTreeCluster.hpp"
...@@ -93,7 +94,7 @@ int main(int argc, char** argv){ ...@@ -93,7 +94,7 @@ int main(int argc, char** argv){
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
const char* outputdir = FParameters::getStr(argc, argv, SvgOutParam.options, "/tmp/"); const char* outputdir = FParameters::getStr(argc, argv, SvgOutParam.options, "/tmp/");
const char* distanceFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileOne.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* matrixFilename = FParameters::getStr(argc, argv, FParameterDefinitions::InputFileTwow.options, "../Addons/HMat/Data/unitCube1000_ONE_OVER_R.bin");
const int height = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 4); const int height = FParameters::getValue(argc, argv, FParameterDefinitions::OctreeHeight.options, 4);
......
...@@ -70,8 +70,8 @@ int main(int argc, char** argv){ ...@@ -70,8 +70,8 @@ int main(int argc, char** argv){
std::cout << "Test Dense:\n"; std::cout << "Test Dense:\n";
typedef FDenseBlock<FReal> LeafClass; typedef FDenseBlock<FReal> LeafClass;
//typedef FDenseBlock<FReal> CellClass; //typedef FDenseBlock<FReal> CellClass;
//typedef FSVDBlock<FReal,7> CellClass; typedef FSVDBlock<FReal,7> CellClass;
typedef FACABlock<FReal,7> CellClass; //typedef FACABlock<FReal,7> CellClass;
typedef FStaticDiagonalBisection<FReal, LeafClass, CellClass> GridClass; typedef FStaticDiagonalBisection<FReal, LeafClass, CellClass> GridClass;
...@@ -102,8 +102,8 @@ int main(int argc, char** argv){ ...@@ -102,8 +102,8 @@ int main(int argc, char** argv){
typedef FDenseBlock<FReal> LeafClass; typedef FDenseBlock<FReal> LeafClass;
//typedef FDenseBlock<FReal> CellClass; //typedef FDenseBlock<FReal> CellClass;
//typedef FSVDBlock<FReal,7> CellClass; typedef FSVDBlock<FReal,7> CellClass;
typedef FACABlock<FReal,7> CellClass; //typedef FACABlock<FReal,7> CellClass;
typedef FStaticDiagonalBisection<FReal, LeafClass, CellClass> GridClass; typedef FStaticDiagonalBisection<FReal, LeafClass, CellClass> GridClass;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment