├── LICENSE
├── README.md
├── bowlib
├── BofSearchManager.cpp
├── BofSearchManager.h
├── bowlib.pro
├── galif.cpp
├── galif.h
├── histvw.h
├── image_sampler.h
├── inverted_index.cpp
├── inverted_index.h
├── iofiles.h
├── kmeans.h
├── quantizer.h
├── tf_idf.cpp
├── tf_idf.h
├── types.h
├── utilities.h
├── vocabulary.cpp
└── vocabulary.h
├── bowpackage.pro
├── common.pri
├── images
├── image01.png
├── image02.png
├── image03.png
├── image04.png
├── image05.png
├── image06.png
├── image07.png
├── image08.png
├── image09.png
├── image10.png
└── image11.png
└── testGUI
├── Eigen
├── Array
├── CMakeLists.txt
├── Cholesky
├── CholmodSupport
├── Core
├── Dense
├── Eigen
├── Eigen2Support
├── Eigenvalues
├── Geometry
├── Householder
├── IterativeLinearSolvers
├── Jacobi
├── LU
├── LeastSquares
├── MetisSupport
├── OrderingMethods
├── PaStiXSupport
├── PardisoSupport
├── QR
├── QtAlignedMalloc
├── SPQRSupport
├── SVD
├── Sparse
├── SparseCholesky
├── SparseCore
├── SparseLU
├── SparseQR
├── StdDeque
├── StdList
├── StdVector
├── SuperLUSupport
├── UmfPackSupport
└── src
│ ├── CMakeLists.txt
│ ├── Cholesky
│ ├── CMakeLists.txt
│ ├── LDLT.h
│ ├── LLT.h
│ └── LLT_MKL.h
│ ├── CholmodSupport
│ ├── CMakeLists.txt
│ └── CholmodSupport.h
│ ├── Core
│ ├── Array.h
│ ├── ArrayBase.h
│ ├── ArrayWrapper.h
│ ├── Assign.h
│ ├── Assign_MKL.h
│ ├── BandMatrix.h
│ ├── Block.h
│ ├── BooleanRedux.h
│ ├── CMakeLists.txt
│ ├── CommaInitializer.h
│ ├── CoreIterators.h
│ ├── CwiseBinaryOp.h
│ ├── CwiseNullaryOp.h
│ ├── CwiseUnaryOp.h
│ ├── CwiseUnaryView.h
│ ├── DenseBase.h
│ ├── DenseCoeffsBase.h
│ ├── DenseStorage.h
│ ├── Diagonal.h
│ ├── DiagonalMatrix.h
│ ├── DiagonalProduct.h
│ ├── Dot.h
│ ├── EigenBase.h
│ ├── Flagged.h
│ ├── ForceAlignedAccess.h
│ ├── Functors.h
│ ├── Fuzzy.h
│ ├── GeneralProduct.h
│ ├── GenericPacketMath.h
│ ├── GlobalFunctions.h
│ ├── IO.h
│ ├── Map.h
│ ├── MapBase.h
│ ├── MathFunctions.h
│ ├── Matrix.h
│ ├── MatrixBase.h
│ ├── NestByValue.h
│ ├── NoAlias.h
│ ├── NumTraits.h
│ ├── PermutationMatrix.h
│ ├── PlainObjectBase.h
│ ├── ProductBase.h
│ ├── Random.h
│ ├── Redux.h
│ ├── Ref.h
│ ├── Replicate.h
│ ├── ReturnByValue.h
│ ├── Reverse.h
│ ├── Select.h
│ ├── SelfAdjointView.h
│ ├── SelfCwiseBinaryOp.h
│ ├── SolveTriangular.h
│ ├── StableNorm.h
│ ├── Stride.h
│ ├── Swap.h
│ ├── Transpose.h
│ ├── Transpositions.h
│ ├── TriangularMatrix.h
│ ├── VectorBlock.h
│ ├── VectorwiseOp.h
│ ├── Visitor.h
│ ├── arch
│ │ ├── AltiVec
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Complex.h
│ │ │ └── PacketMath.h
│ │ ├── CMakeLists.txt
│ │ ├── Default
│ │ │ ├── CMakeLists.txt
│ │ │ └── Settings.h
│ │ ├── NEON
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Complex.h
│ │ │ └── PacketMath.h
│ │ └── SSE
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Complex.h
│ │ │ ├── MathFunctions.h
│ │ │ └── PacketMath.h
│ ├── products
│ │ ├── CMakeLists.txt
│ │ ├── CoeffBasedProduct.h
│ │ ├── GeneralBlockPanelKernel.h
│ │ ├── GeneralMatrixMatrix.h
│ │ ├── GeneralMatrixMatrixTriangular.h
│ │ ├── GeneralMatrixMatrixTriangular_MKL.h
│ │ ├── GeneralMatrixMatrix_MKL.h
│ │ ├── GeneralMatrixVector.h
│ │ ├── GeneralMatrixVector_MKL.h
│ │ ├── Parallelizer.h
│ │ ├── SelfadjointMatrixMatrix.h
│ │ ├── SelfadjointMatrixMatrix_MKL.h
│ │ ├── SelfadjointMatrixVector.h
│ │ ├── SelfadjointMatrixVector_MKL.h
│ │ ├── SelfadjointProduct.h
│ │ ├── SelfadjointRank2Update.h
│ │ ├── TriangularMatrixMatrix.h
│ │ ├── TriangularMatrixMatrix_MKL.h
│ │ ├── TriangularMatrixVector.h
│ │ ├── TriangularMatrixVector_MKL.h
│ │ ├── TriangularSolverMatrix.h
│ │ ├── TriangularSolverMatrix_MKL.h
│ │ └── TriangularSolverVector.h
│ └── util
│ │ ├── BlasUtil.h
│ │ ├── CMakeLists.txt
│ │ ├── Constants.h
│ │ ├── DisableStupidWarnings.h
│ │ ├── ForwardDeclarations.h
│ │ ├── MKL_support.h
│ │ ├── Macros.h
│ │ ├── Memory.h
│ │ ├── Meta.h
│ │ ├── NonMPL2.h
│ │ ├── ReenableStupidWarnings.h
│ │ ├── StaticAssert.h
│ │ └── XprHelper.h
│ ├── Eigen2Support
│ ├── Block.h
│ ├── CMakeLists.txt
│ ├── Cwise.h
│ ├── CwiseOperators.h
│ ├── Geometry
│ │ ├── AlignedBox.h
│ │ ├── All.h
│ │ ├── AngleAxis.h
│ │ ├── CMakeLists.txt
│ │ ├── Hyperplane.h
│ │ ├── ParametrizedLine.h
│ │ ├── Quaternion.h
│ │ ├── Rotation2D.h
│ │ ├── RotationBase.h
│ │ ├── Scaling.h
│ │ ├── Transform.h
│ │ └── Translation.h
│ ├── LU.h
│ ├── Lazy.h
│ ├── LeastSquares.h
│ ├── Macros.h
│ ├── MathFunctions.h
│ ├── Memory.h
│ ├── Meta.h
│ ├── Minor.h
│ ├── QR.h
│ ├── SVD.h
│ ├── TriangularSolver.h
│ └── VectorBlock.h
│ ├── Eigenvalues
│ ├── CMakeLists.txt
│ ├── ComplexEigenSolver.h
│ ├── ComplexSchur.h
│ ├── ComplexSchur_MKL.h
│ ├── EigenSolver.h
│ ├── GeneralizedEigenSolver.h
│ ├── GeneralizedSelfAdjointEigenSolver.h
│ ├── HessenbergDecomposition.h
│ ├── MatrixBaseEigenvalues.h
│ ├── RealQZ.h
│ ├── RealSchur.h
│ ├── RealSchur_MKL.h
│ ├── SelfAdjointEigenSolver.h
│ ├── SelfAdjointEigenSolver_MKL.h
│ └── Tridiagonalization.h
│ ├── Geometry
│ ├── AlignedBox.h
│ ├── AngleAxis.h
│ ├── CMakeLists.txt
│ ├── EulerAngles.h
│ ├── Homogeneous.h
│ ├── Hyperplane.h
│ ├── OrthoMethods.h
│ ├── ParametrizedLine.h
│ ├── Quaternion.h
│ ├── Rotation2D.h
│ ├── RotationBase.h
│ ├── Scaling.h
│ ├── Transform.h
│ ├── Translation.h
│ ├── Umeyama.h
│ └── arch
│ │ ├── CMakeLists.txt
│ │ └── Geometry_SSE.h
│ ├── Householder
│ ├── BlockHouseholder.h
│ ├── CMakeLists.txt
│ ├── Householder.h
│ └── HouseholderSequence.h
│ ├── IterativeLinearSolvers
│ ├── BasicPreconditioners.h
│ ├── BiCGSTAB.h
│ ├── CMakeLists.txt
│ ├── ConjugateGradient.h
│ ├── IncompleteLUT.h
│ └── IterativeSolverBase.h
│ ├── Jacobi
│ ├── CMakeLists.txt
│ └── Jacobi.h
│ ├── LU
│ ├── CMakeLists.txt
│ ├── Determinant.h
│ ├── FullPivLU.h
│ ├── Inverse.h
│ ├── PartialPivLU.h
│ ├── PartialPivLU_MKL.h
│ └── arch
│ │ ├── CMakeLists.txt
│ │ └── Inverse_SSE.h
│ ├── MetisSupport
│ ├── CMakeLists.txt
│ └── MetisSupport.h
│ ├── OrderingMethods
│ ├── Amd.h
│ ├── CMakeLists.txt
│ ├── Eigen_Colamd.h
│ └── Ordering.h
│ ├── PaStiXSupport
│ ├── CMakeLists.txt
│ └── PaStiXSupport.h
│ ├── PardisoSupport
│ ├── CMakeLists.txt
│ └── PardisoSupport.h
│ ├── QR
│ ├── CMakeLists.txt
│ ├── ColPivHouseholderQR.h
│ ├── ColPivHouseholderQR_MKL.h
│ ├── FullPivHouseholderQR.h
│ ├── HouseholderQR.h
│ └── HouseholderQR_MKL.h
│ ├── SPQRSupport
│ ├── CMakeLists.txt
│ └── SuiteSparseQRSupport.h
│ ├── SVD
│ ├── CMakeLists.txt
│ ├── JacobiSVD.h
│ ├── JacobiSVD_MKL.h
│ └── UpperBidiagonalization.h
│ ├── SparseCholesky
│ ├── CMakeLists.txt
│ ├── SimplicialCholesky.h
│ └── SimplicialCholesky_impl.h
│ ├── SparseCore
│ ├── AmbiVector.h
│ ├── CMakeLists.txt
│ ├── CompressedStorage.h
│ ├── ConservativeSparseSparseProduct.h
│ ├── MappedSparseMatrix.h
│ ├── SparseBlock.h
│ ├── SparseColEtree.h
│ ├── SparseCwiseBinaryOp.h
│ ├── SparseCwiseUnaryOp.h
│ ├── SparseDenseProduct.h
│ ├── SparseDiagonalProduct.h
│ ├── SparseDot.h
│ ├── SparseFuzzy.h
│ ├── SparseMatrix.h
│ ├── SparseMatrixBase.h
│ ├── SparsePermutation.h
│ ├── SparseProduct.h
│ ├── SparseRedux.h
│ ├── SparseSelfAdjointView.h
│ ├── SparseSparseProductWithPruning.h
│ ├── SparseTranspose.h
│ ├── SparseTriangularView.h
│ ├── SparseUtil.h
│ ├── SparseVector.h
│ ├── SparseView.h
│ └── TriangularSolver.h
│ ├── SparseLU
│ ├── CMakeLists.txt
│ ├── SparseLU.h
│ ├── SparseLUImpl.h
│ ├── SparseLU_Memory.h
│ ├── SparseLU_Structs.h
│ ├── SparseLU_SupernodalMatrix.h
│ ├── SparseLU_Utils.h
│ ├── SparseLU_column_bmod.h
│ ├── SparseLU_column_dfs.h
│ ├── SparseLU_copy_to_ucol.h
│ ├── SparseLU_gemm_kernel.h
│ ├── SparseLU_heap_relax_snode.h
│ ├── SparseLU_kernel_bmod.h
│ ├── SparseLU_panel_bmod.h
│ ├── SparseLU_panel_dfs.h
│ ├── SparseLU_pivotL.h
│ ├── SparseLU_pruneL.h
│ └── SparseLU_relax_snode.h
│ ├── SparseQR
│ ├── CMakeLists.txt
│ └── SparseQR.h
│ ├── StlSupport
│ ├── CMakeLists.txt
│ ├── StdDeque.h
│ ├── StdList.h
│ ├── StdVector.h
│ └── details.h
│ ├── SuperLUSupport
│ ├── CMakeLists.txt
│ └── SuperLUSupport.h
│ ├── UmfPackSupport
│ ├── CMakeLists.txt
│ └── UmfPackSupport.h
│ ├── misc
│ ├── CMakeLists.txt
│ ├── Image.h
│ ├── Kernel.h
│ ├── Solve.h
│ ├── SparseSolve.h
│ └── blas.h
│ └── plugins
│ ├── ArrayCwiseBinaryOps.h
│ ├── ArrayCwiseUnaryOps.h
│ ├── BlockMethods.h
│ ├── CMakeLists.txt
│ ├── CommonCwiseBinaryOps.h
│ ├── CommonCwiseUnaryOps.h
│ ├── MatrixCwiseBinaryOps.h
│ └── MatrixCwiseUnaryOps.h
├── Globals.h
├── PaintWidget.cpp
├── PaintWidget.h
├── PaintWidget.ui
├── RemoveDup.cpp
├── RemoveDup.h
├── RemoveDup.ui
├── Render3D.cpp
├── Render3D.h
├── Render3D.ui
├── Viewer.cpp
├── Viewer.h
├── bin
└── testGUI.exe
├── example.gif
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow.ui
└── testGUI.pro
/README.md:
--------------------------------------------------------------------------------
1 | sketch-search
2 | =============
3 |
4 | Sketch-based Image Retrieval, based on the paper ["Sketch-Based Shape Retrieval" - SIGGRAPH 2012](http://cybertron.cg.tu-berlin.de/eitz/projects/sbsr/).
5 |
6 | Original code from [mathiaseitz's imdb_framework](https://github.com/mathiaseitz/imdb_framework).
7 |
8 | Only requirments are **OpenCV** and **Qt**. Original code needed boost for threading, here we are using OpenMP. Code is not fully optimized. A simple GUI demo and sample data are supplied.
9 |
10 | ###What it looks like
11 |
12 |
13 |
--------------------------------------------------------------------------------
/bowlib/BofSearchManager.cpp:
--------------------------------------------------------------------------------
1 | #include "BofSearchManager.h"
2 | #include "vocabulary.h"
3 | #include "quantizer.h"
4 | #include "kmeans.h"
5 | #include "histvw.h"
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | BofSearchManager::BofSearchManager(QString folderPath) : folderPath(folderPath)
12 | {
13 | std::cout << "Building / loading vocabulary..\n";
14 |
15 | // Read vocabulary from desk
16 | imdb::vocabulary voc(folderPath, 3000);
17 | vocab = voc.centers;
18 |
19 | std::cout << "Building / loading index..\n";
20 |
21 | // Indexing
22 | std::string tf = "video_google", idf = "video_google";
23 | _tf = imdb::make_tf(tf);
24 | _idf = imdb::make_idf(idf);
25 | index.prepare(folderPath, voc);
26 | }
27 |
28 | std::vector BofSearchManager::search(const cv::Mat &image)
29 | {
30 | MapType data;
31 |
32 | data["image"].setValue( image );
33 |
34 | // Compute descriptor
35 | gen.compute( data );
36 |
37 | // quantize
38 | imdb::quantize_fn quantizer = imdb::quantize_hard >();
39 | Array2Df quantized_samples;
40 |
41 | const Array2Df& samples = data["features"].value();
42 | imdb::quantize_samples_parallel(samples, vocab, quantized_samples, quantizer);
43 |
44 | Array1Df histvw;
45 | imdb::build_histvw(quantized_samples, vocab.size(), histvw, false);
46 |
47 | // Search
48 | size_t in_numresults = std::numeric_limits::max();
49 | std::vector results;
50 | this->query( histvw, in_numresults, results );
51 |
52 | return results;
53 | }
54 |
55 | std::vector BofSearchManager::search(QString imageFilename)
56 | {
57 | cv::Mat img = cv::imread( imageFilename.toStdString(), CV_LOAD_IMAGE_GRAYSCALE );
58 | return search( img );
59 | }
60 |
61 | void BofSearchManager::query(const Array1Df &histvw, size_t num_results, std::vector &results) const
62 | {
63 | index.query(histvw, *_tf, *_idf, (imdb::uint)num_results, results);
64 | }
65 |
66 | void BofSearchManager::buildSimiliartyMatrix()
67 | {
68 | std::cout << "Now we will build similiarty matrix..\n";
69 |
70 | QDir d(folderPath);
71 | QString absPath = d.absolutePath() + "/";
72 | QStringList files = d.entryList( QStringList() << "*.png" );
73 |
74 | size_t N = files.size();
75 |
76 | std::vector< std::vector > M(N, std::vector(N, 0));
77 |
78 | // Build matrix
79 | {
80 | qDebug() << "Building matrix..";
81 | QElapsedTimer timer; timer.start();
82 |
83 | // Fill up matrix
84 | #pragma omp parallel for
85 | for(int i = 0; i < N; i++)
86 | {
87 | cv::Mat curImg = cv::imread((absPath + files.at(i)).toStdString(), CV_LOAD_IMAGE_GRAYSCALE);
88 |
89 | std::vector row = search(curImg);
90 |
91 | for(int j = 0; j < (int)row.size(); j++)
92 | {
93 | double similiarty = row[j].first;
94 | if(i == j) similiarty = 1;
95 |
96 | M[i][j] = M[j][i] = similiarty;
97 | }
98 | }
99 |
100 | qDebug() << "Matrix took " << timer.elapsed() << " ms\n";
101 | }
102 |
103 | // Save to file
104 | {
105 | std::ofstream out;
106 | out.open( qPrintable( d.absolutePath() + "/" + QString("%1_affinity.csv").arg( "affinity" ) ) );
107 |
108 | for(int i = 0; i < N; i++){
109 | QStringList vector;
110 | for(int j = 0; j < N; j++)
111 | vector << QString::number( M[i][j] );
112 | out << vector.join(",").toStdString() << "\n";
113 | }
114 | out.close();
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/bowlib/BofSearchManager.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "galif.h"
3 | #include "inverted_index.h"
4 |
5 | class BofSearchManager
6 | {
7 | public:
8 | BofSearchManager(QString folderPath);
9 |
10 | std::vector search( QString imageFilename );
11 | std::vector search( const cv::Mat& image );
12 |
13 | /**
14 | * @brief Perform a query for the most similar 'documents' on the inverted index.
15 | * @param histvw Histogram of visual words encoding the query 'document' (image)
16 | * @param num_results Desired number of results
17 | * @param results A vector of dist_idx_t that holds the result indices in descending order of
18 | * similarity (i.e. best matches are first in the vector). Any potentially existing contents
19 | * of this vector are cleared before the new results are added.
20 | */
21 | void query(const Array1Df& histvw, size_t num_results, std::vector& results) const;
22 |
23 | void buildSimiliartyMatrix();
24 |
25 | private:
26 | imdb::galif_generator gen;
27 | std::shared_ptr _tf;
28 | std::shared_ptr _idf;
29 |
30 | Array2Df vocab;
31 | imdb::InvertedIndex index;
32 |
33 | QString folderPath;
34 | };
35 |
--------------------------------------------------------------------------------
/bowlib/bowlib.pro:
--------------------------------------------------------------------------------
1 | include(../common.pri)
2 |
3 | # Configuration
4 | TEMPLATE = lib
5 | CONFIG += staticlib
6 |
7 | TARGET = bow
8 | DESTDIR = $$PWD/$$CFG/lib
9 |
10 | SOURCES += galif.cpp \
11 | vocabulary.cpp \
12 | BofSearchManager.cpp \
13 | inverted_index.cpp \
14 | tf_idf.cpp
15 |
16 | HEADERS += galif.h \
17 | types.h \
18 | image_sampler.h \
19 | utilities.h \
20 | vocabulary.h \
21 | kmeans.h \
22 | BofSearchManager.h \
23 | inverted_index.h \
24 | tf_idf.h \
25 | quantizer.h \
26 | histvw.h \
27 | iofiles.h
28 |
--------------------------------------------------------------------------------
/bowlib/galif.h:
--------------------------------------------------------------------------------
1 | // Adapted code from imdb_framework
2 | /* Copyright (C) 2012 Mathias Eitz and Ronald Richter - BSD license */
3 |
4 | #pragma once
5 |
6 | #include "types.h"
7 |
8 | namespace imdb
9 | {
10 |
11 | class galif_generator
12 | {
13 | public:
14 | galif_generator();
15 |
16 | void compute(MapType& data) const;
17 | void detect(const cv::Mat& image, Array2Df& keypoints) const;
18 | void extract(const cv::Mat& image, const Array2Df &keypoints, Array2Df& features, std::vector &emptyFeatures) const;
19 |
20 | private:
21 |
22 | const uint _width;
23 | const uint _numOrients;
24 | const double _peakFrequency;
25 | const double _line_width;
26 | const double _lambda;
27 | const double _featureSize;
28 | const uint _tiles;
29 | const bool _smoothHist;
30 | const std::string _normalizeHist;
31 | const std::string _samplerName;
32 |
33 | cv::Size _filterSize;
34 | std::vector< cv::Mat_< std::complex > > _gaborFilter;
35 | };
36 |
37 |
38 | } // namespace imdb
39 |
--------------------------------------------------------------------------------
/bowlib/histvw.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "types.h"
3 | #include "quantizer.h"
4 | #include "kmeans.h"
5 | #include "vocabulary.h"
6 |
7 | namespace imdb{
8 | inline Array2Df compute_histvw(const vocabulary& voc)
9 | {
10 | Array2Df result;
11 |
12 | quantize_fn quantizer = quantize_hard >();
13 |
14 | int N = (int)voc.descriptors.size();
15 |
16 | for (index_t i = 0; i < N; i++)
17 | {
18 | Array2Df samples = voc.descriptors[i];
19 | Array2Df positions = voc.positions[i];
20 |
21 | // quantize all samples contained in the current Array2Df in parallel, the
22 | // result is again a Array2Df which has the same size as the samples vector,
23 | // i.e. one quantized sample for each original sample.
24 | Array2Df quantized_samples;
25 | quantize_samples_parallel(samples, voc.centers, quantized_samples, quantizer);
26 |
27 | int pyramidlevels = 1;
28 | bool normalizeHistvw = false;
29 |
30 | Array1Df hist;
31 |
32 | for (size_t j = 0; j < pyramidlevels; j++)
33 | {
34 | Array1Df tmp;
35 | int res = 1 << j; // 2^j
36 | build_histvw(quantized_samples, voc.centers.size(), tmp, normalizeHistvw, positions, res);
37 |
38 | // append the current pyramid level histograms to
39 | // the overall histogram
40 | hist.insert(hist.end(), tmp.begin(), tmp.end());
41 | }
42 |
43 | result.push_back( hist );
44 | }
45 |
46 | return result;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/bowlib/image_sampler.h:
--------------------------------------------------------------------------------
1 | #include "types.h"
2 |
3 | namespace imdb {
4 |
5 | struct grid_sampler{
6 | // the resulting samples contain (x,y) coordinates within the sampling area
7 | static void sample(Array2Df& samples, const cv::Mat& image, int _numSamples = 625)
8 | {
9 | cv::Rect samplingArea(0, 0, image.size().width, image.size().height);
10 |
11 | uint numSamples1D = std::ceil(std::sqrt(static_cast(_numSamples)));
12 | float stepX = samplingArea.width / static_cast(numSamples1D+1);
13 | float stepY = samplingArea.height / static_cast(numSamples1D+1);
14 |
15 | for (uint x = 1; x <= numSamples1D; x++) {
16 | uint posX = x*stepX;
17 | for (uint y = 1; y <= numSamples1D; y++) {
18 | uint posY = y*stepY;
19 | Array1Df p(2);
20 | p[0] = posX;
21 | p[1] = posY;
22 | samples.push_back(p);
23 | }
24 | }
25 | }
26 | };
27 |
28 | } // end namespace
29 |
--------------------------------------------------------------------------------
/bowlib/iofiles.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "types.h"
3 | #include
4 | #include
5 |
6 | // poor-man's serialization
7 |
8 | inline void writeArray1Df(QDataStream & out, const Array1Df& vec){
9 | out << quint64(vec.size());
10 | for(auto v : vec) out << v;
11 | }
12 | inline void writeArray2Df(QDataStream & out, const Array2Df& vec){
13 | out << quint64(vec.size());
14 | for(auto v : vec) writeArray1Df(out, v);
15 | }
16 | inline void writeVectorArray2Df(QDataStream & out, const std::vector& vec){
17 | out << quint64(vec.size());
18 | for(auto v : vec) writeArray2Df(out, v);
19 | }
20 | inline Array1Df readArray1Df(QDataStream & in){
21 | Array1Df result;
22 | quint64 length;
23 | in >> length;
24 | for(size_t i = 0; i < length; i++){
25 | float v;
26 | in >> v;
27 | result.push_back(v);
28 | }
29 | return result;
30 | }
31 | inline Array2Df readArray2Df(QDataStream & in){
32 | Array2Df result;
33 | quint64 length;
34 | in >> length;
35 | for(size_t i = 0; i < length; i++){
36 | Array1Df v = readArray1Df( in );
37 | result.push_back(v);
38 | }
39 | return result;
40 | }
41 | inline std::vector readVectorArray2Df(QDataStream & in){
42 | std::vector result;
43 | quint64 length;
44 | in >> length;
45 | for(size_t i = 0; i < length; i++){
46 | Array2Df v = readArray2Df( in );
47 | result.push_back(v);
48 | }
49 | return result;
50 | }
51 |
52 | inline void writeArray1Duint(QDataStream & out, const Array1Duint& vec){
53 | out << quint64(vec.size());
54 | for(auto v : vec) out << quint32(v);
55 | }
56 | inline Array1Duint readArray1Duint(QDataStream & in){
57 | Array1Duint result;
58 | quint64 length;
59 | in >> length;
60 | for(size_t i = 0; i < length; i++){
61 | quint32 v;
62 | in >> v;
63 | result.push_back(v);
64 | }
65 | return result;
66 | }
67 |
68 | // Set
69 | inline void writeSetUint(QDataStream & out, const std::set & set){
70 | out << quint64(set.size());
71 | for(auto v : set) out << v;
72 | }
73 | inline std::set readSetUnit(QDataStream & in){
74 | std::set set;
75 | quint64 length;
76 | in >> length;
77 | for(size_t i = 0; i < length; i++){
78 | uint32_t v;
79 | in >> v;
80 | set.insert(v);
81 | }
82 | return set;
83 | }
84 |
85 | // Special type
86 | inline void writeFreqList(QDataStream & out, const std::vector > >& freqList){
87 | out << quint64(freqList.size());
88 | for(auto vec : freqList){
89 | out << quint64(vec.size());
90 | for(auto p : vec){
91 | out << p.first;
92 | out << p.second;
93 | }
94 | }
95 | }
96 |
97 | inline std::vector > > readFreqList(QDataStream & in){
98 | std::vector > > freqList;
99 | quint64 length;
100 | in >> length;
101 | for(size_t i = 0; i < length; i++){
102 | std::vector > vec;
103 | quint64 vec_length;
104 | in >> vec_length;
105 | for(size_t j = 0; j < vec_length; j++){
106 | std::pair pair;
107 | in >> pair.first;
108 | in >> pair.second;
109 | vec.push_back(pair);
110 | }
111 | freqList.push_back(vec);
112 | }
113 | return freqList;
114 | }
115 |
--------------------------------------------------------------------------------
/bowlib/tf_idf.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2012 Mathias Eitz and Ronald Richter.
3 | All rights reserved.
4 |
5 | This file is part of the imdb library and is made available under
6 | the terms of the BSD license (see the LICENSE file).
7 | */
8 |
9 | #include "tf_idf.h"
10 | #include "inverted_index.h"
11 |
12 | namespace imdb {
13 |
14 | std::shared_ptr make_idf(const std::string& name)
15 | {
16 | if (name == "constant") return std::make_shared();
17 | if (name == "video_google") return std::make_shared();
18 | if (name == "simple") return std::make_shared();
19 | if (name == "lucene") return std::make_shared();
20 |
21 | // print warning message and return the most basic function
22 | //std::cerr << "idf_function named " << name << " not registered, returning constant function" << std::endl;
23 | return make_idf("constant");
24 | }
25 |
26 |
27 | std::shared_ptr make_tf(const std::string& name)
28 | {
29 | if (name == "constant") return std::make_shared();
30 | if (name == "video_google") return std::make_shared();
31 | if (name == "simple") return std::make_shared();
32 | if (name == "lucene") return std::make_shared();
33 |
34 | // print warning message and return the most basic function
35 | //std::cerr << "tf_function named " << name << " not registered, returning constant function" << std::endl;
36 | return make_tf("constant");
37 | }
38 |
39 | // idf function from the Video Google paper
40 | float idf_video_google::operator()(const InvertedIndex* index, uint term_id) const
41 | {
42 | // according to the Video Google paper, we need to use Ft here, i.e.
43 | // "the number of occurrences of term i in the whole database".
44 | // This can theoretically be larger than the number of documents,
45 | // resulting in a result < 0. Also, a div by zero is not handled
46 | float ft = index->Ft()[term_id];
47 | return std::log(index->num_documents() / ft);
48 | }
49 |
50 | float tf_video_google::operator()(const InvertedIndex* index, uint term_id, uint doc_id, uint list_id) const
51 | {
52 | float f_dt = index->doc_frequency_list()[term_id][list_id].second;
53 | uint32_t nd = index->document_sizes()[doc_id];
54 | return f_dt / nd;
55 | }
56 |
57 | float idf_simple::operator()(const InvertedIndex* index, uint term_id) const
58 | {
59 | uint32_t ft = index->ft()[term_id];
60 | return std::log(1 + index->num_documents() / static_cast(ft));
61 | }
62 |
63 | float tf_simple::operator()(const InvertedIndex* index, uint term_id, uint /*doc_id*/, uint list_id) const
64 | {
65 | float f_dt = index->doc_frequency_list()[term_id][list_id].second;
66 | return 1 + std::log(f_dt);
67 | }
68 |
69 |
70 | float idf_lucene::operator()(const InvertedIndex* index, uint term_id) const
71 | {
72 | uint32_t ft = index->ft()[term_id];
73 | return 1 + std::log(index->num_documents() / (1 + static_cast(ft)));
74 | }
75 |
76 |
77 | float tf_lucene::operator()(const InvertedIndex* index, uint term_id, uint /*doc_id*/, uint list_id) const
78 | {
79 | return std::sqrt(index->doc_frequency_list()[term_id][list_id].second);
80 | }
81 |
82 |
83 | float idf_identity::operator()(const InvertedIndex* index, uint term_id) const
84 | {
85 | return static_cast(index->ft()[term_id]);
86 | }
87 |
88 |
89 | float tf_identity::operator()(const InvertedIndex* index, uint term_id, uint /*doc_id*/, uint list_id) const
90 | {
91 | return static_cast(index->doc_frequency_list()[term_id][list_id].second);
92 | }
93 |
94 | }
95 |
96 |
--------------------------------------------------------------------------------
/bowlib/tf_idf.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2012 Mathias Eitz and Ronald Richter.
3 | All rights reserved.
4 |
5 | This file is part of the imdb library and is made available under
6 | the terms of the BSD license (see the LICENSE file).
7 | */
8 |
9 | #ifndef TF_IDF_HPP
10 | #define TF_IDF_HPP
11 |
12 | #include "types.h"
13 | #include
14 |
15 | namespace imdb {
16 |
17 | /**
18 | * \addtogroup tfidf
19 | * @{
20 | */
21 |
22 | typedef unsigned int uint;
23 |
24 | // We need to use a forward declaration here (rather than directly including
25 | // the header file) as Index also includes this file
26 | class InvertedIndex;
27 |
28 | /// Base class for all idf (inverse document frequency) functions
29 | struct idf_function {
30 | virtual float operator()(const InvertedIndex* index, uint term_id) const = 0;
31 | };
32 |
33 | /// Base class for all tf (term frequency) functions
34 | struct tf_function {
35 | virtual float operator()(const InvertedIndex* index, uint term_id, uint doc_id, uint list_id) const = 0;
36 | };
37 |
38 | /// Constant idf_function function, returns 1.0 independently of input
39 | struct idf_constant : public idf_function {
40 | float operator()(const InvertedIndex* /*index*/, uint /*term_id*/) const { return 1.0f; }
41 | };
42 |
43 | /// Constant tf_function, returns 1.0 independently of input
44 | struct tf_constant : public tf_function {
45 | float operator()(const InvertedIndex* /*index*/, uint /*term_id*/, uint /*doc_id*/, uint /*list_id*/) const { return 1.0f; }
46 | };
47 |
48 | /// Indentity idf_function function, exactly returns the input frequency
49 | struct idf_identity : public idf_function {
50 | float operator()(const InvertedIndex* index, uint term_id) const;
51 | };
52 |
53 | /// Identity tf_function, exactly returns the input frequency
54 | struct tf_identity : public tf_function {
55 | float operator()(const InvertedIndex* index, uint term_id, uint doc_id, uint list_id) const;
56 | };
57 |
58 | /// 'Video Google' idf_function: idf = log(num_documents / freq_term_coll)
59 | struct idf_video_google : public idf_function {
60 | float operator()(const InvertedIndex* index, uint term_id) const;
61 | };
62 |
63 | /// 'Video Google' tf_function: tf = freq_term_doc / doc_size
64 | struct tf_video_google : public tf_function {
65 | float operator()(const InvertedIndex* index, uint term_id, uint doc_id, uint list_id) const;
66 | };
67 |
68 |
69 | /// simple idf_function, computes idf = log(1 + (num_docs / freq_term_coll))
70 | struct idf_simple : public idf_function {
71 | float operator()(const InvertedIndex* index, uint term_id) const;
72 | };
73 |
74 | /// simple tf_function, computes tf = 1 + log(freq_term_doc)
75 | struct tf_simple : public tf_function {
76 | float operator()(const InvertedIndex* index, uint term_id, uint /*doc_id*/, uint list_id) const;
77 | };
78 |
79 |
80 | /// default idf function as used by Lucene: idf = 1 + log(num_documents / (1 + freq_term_coll))
81 | struct idf_lucene : public idf_function {
82 | float operator()(const InvertedIndex* index, uint term_id) const;
83 | };
84 |
85 | /// default tf function as used by Lucene: tf = sqrt(freq_term_doc)
86 | struct tf_lucene : public tf_function {
87 | float operator()(const InvertedIndex* index, uint term_id, uint /*doc_id*/, uint list_id) const;
88 | };
89 |
90 | /// @brief Create an idf_function by name
91 | /// @param name Can be "constant", "identity", "video_google", "simple" or "lucene"
92 | std::shared_ptr make_idf(const std::string& name);
93 |
94 | /// @brief Create an tf_function by name
95 | /// @param name Can be "constant", "identity", "video_google", "simple" or "lucene"
96 | std::shared_ptr make_tf(const std::string& name);
97 |
98 | /** @} */ // end ingroup
99 |
100 | } // end namespace imdb
101 |
102 | #endif // TF_IDF_HPP
103 |
--------------------------------------------------------------------------------
/bowlib/types.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | // QT
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 |
17 | // Types:
18 | typedef QMap MapType;
19 | typedef std::vector Array1Df;
20 | typedef std::vector Array2Df;
21 | typedef std::vector Array1Duint;
22 | typedef size_t index_t;
23 | typedef std::pair dist_idx_t;
24 |
25 | // Mapped types
26 | Q_DECLARE_METATYPE(cv::Mat)
27 |
28 | // Conversion from/to cv::Mat to QImage
29 | inline QImage cvMatToQImage( const cv::Mat &inMat ){
30 | switch ( inMat.type() )
31 | {
32 | // 8-bit, 4 channel
33 | case CV_8UC4:
34 | {
35 | QImage image( inMat.data, inMat.cols, inMat.rows, inMat.step, QImage::Format_RGB32 );
36 | return image;
37 | }
38 | // 8-bit, 3 channel
39 | case CV_8UC3:
40 | {
41 | QImage image( inMat.data, inMat.cols, inMat.rows, inMat.step, QImage::Format_RGB888 );
42 | return image.rgbSwapped();
43 | }
44 | // 8-bit, 1 channel
45 | case CV_8UC1:
46 | {
47 | static QVector sColorTable;
48 | // only create our color table once
49 | if ( sColorTable.isEmpty() )
50 | {
51 | for ( int i = 0; i < 256; ++i )
52 | sColorTable.push_back( qRgb( i, i, i ) );
53 | }
54 | QImage image( inMat.data, inMat.cols, inMat.rows, inMat.step, QImage::Format_Indexed8 );
55 | image.setColorTable( sColorTable );
56 | return image;
57 | }
58 | default:
59 | qDebug() << "cvMatToQImage() - cv::Mat image type not handled in switch:" << inMat.type();
60 | break;
61 | }
62 | return QImage();
63 | }
64 |
65 | // Will force a conversion to grayscale
66 | inline cv::Mat QImageToCvMat( const QImage &inputImage, bool inCloneImageData = true ){
67 | QImage swapped = inputImage.convertToFormat(QImage::Format_RGB888).rgbSwapped();
68 | cv::Mat colored = cv::Mat( swapped.height(), swapped.width(), CV_8UC3, const_cast(swapped.bits()), swapped.bytesPerLine() ).clone();
69 | cv::Mat gray;
70 | cvtColor(colored, gray, CV_BGR2GRAY);
71 | return gray;
72 | }
73 |
--------------------------------------------------------------------------------
/bowlib/utilities.h:
--------------------------------------------------------------------------------
1 | #include "types.h"
2 |
3 | namespace imdb {
4 |
5 | void filterEmptyFeatures(const Array2Df& features, const Array2Df& keypoints, const std::vector& emptyFeatures, Array2Df& featuresFiltered, Array2Df& keypointsFiltered)
6 | {
7 | assert(features.size() == keypoints.size());
8 | assert(features.size() == emptyFeatures.size());
9 |
10 | for (size_t i = 0; i < emptyFeatures.size(); i++) {
11 |
12 | if (!emptyFeatures[i]) {
13 | featuresFiltered.push_back(features[i]);
14 | keypointsFiltered.push_back(keypoints[i]);
15 | }
16 | }
17 | }
18 |
19 | void normalizePositions(const Array2Df& keypoints, const cv::Size& imageSize, Array2Df& keypointsNormalized) {
20 |
21 | Array1Df p(2);
22 | for (size_t i = 0; i < keypoints.size(); i++) {
23 | p[0] = keypoints[i][0] / imageSize.width;
24 | p[1] = keypoints[i][1] / imageSize.height;
25 | keypointsNormalized.push_back(p);
26 | }
27 | }
28 |
29 |
30 | double scaleToSideLength(const cv::Mat& image, int maxSideLength, cv::Mat& scaled)
31 | {
32 | double scaling_factor = (image.size().width > image.size().height)
33 | ? static_cast(maxSideLength) / image.size().width
34 | : static_cast(maxSideLength) / image.size().height;
35 |
36 | // as of OpenCV version 2.2 we need to user INTER_AREA for downscaling as all
37 | // other options lead to severe aliasing!
38 | cv::resize(image, scaled, cv::Size(0, 0), scaling_factor, scaling_factor, cv::INTER_AREA);
39 | return scaling_factor;
40 | }
41 |
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/bowlib/vocabulary.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "vocabulary.h"
4 | #include "kmeans.h"
5 | #include "galif.h"
6 |
7 | #include "iofiles.h"
8 |
9 | namespace imdb{
10 |
11 | vocabulary::vocabulary(QString folderPath, int numclusters)
12 | {
13 | imdb::galif_generator gen;
14 | Array2Df samples;
15 |
16 | QDir d(folderPath);
17 |
18 | QString voc_file = QString("%1/vocabulary.bin").arg(d.absolutePath());
19 | QString desc_file = QString("%1/features.bin").arg(d.absolutePath());
20 | QString pos_file = QString("%1/positions.bin").arg(d.absolutePath());
21 | QString index_file = QString("%1/index.bin").arg(d.absolutePath());
22 |
23 | if( QFileInfo(voc_file).exists() )
24 | {
25 | load( voc_file.toStdString() );
26 | if(QFileInfo(index_file).exists()) return; // everything is ready
27 | }
28 |
29 | // Load from disk if existing
30 | if( QFileInfo(desc_file).exists() && QFileInfo(pos_file).exists() )
31 | {
32 |
33 | QFile dfile( desc_file ); dfile.open(QIODevice::ReadOnly); QDataStream din(&dfile);
34 | QFile pfile( pos_file ); pfile.open(QIODevice::ReadOnly); QDataStream pin(&pfile);
35 | descriptors = readVectorArray2Df(din);
36 | positions = readVectorArray2Df(pin);
37 | return;
38 | }
39 |
40 | QStringList files = d.entryList( QStringList() << "*.png" );
41 |
42 | std::vector allData(files.size());
43 |
44 | // Load files and compute description
45 | #pragma omp parallel for
46 | for(int f = 0; f < files.size(); f++)
47 | {
48 | QString file = d.absolutePath() + "/" + files[f];
49 |
50 | cv::Mat input = cv::imread(file.toStdString(), CV_LOAD_IMAGE_GRAYSCALE);
51 | //temp = imread(file.toStdString(), CV_LOAD_IMAGE_GRAYSCALE);
52 | //threshold(temp, input, 200, 255, 0);
53 |
54 | MapType & data = allData[f];
55 | data["image"].setValue( input );
56 |
57 | // Compute features
58 | gen.compute( data );
59 |
60 | #pragma omp critical
61 | {
62 | // Add to set of features
63 | for(auto feature : data["features"].value())
64 | {
65 | samples.push_back( feature );
66 | }
67 | }
68 | }
69 |
70 | if(samples.empty()) return;
71 |
72 | // Cluster the set of features
73 | cluster(samples, numclusters);
74 |
75 | // Save vocabulary to file
76 | std::string voc_filename = voc_file.toStdString();
77 | save(voc_filename);
78 |
79 | // Save descriptors & positions to file
80 | {
81 | for(int f = 0; f < files.size(); f++){
82 | descriptors.push_back(allData[f]["features"].value());
83 | positions.push_back(allData[f]["positions"].value());
84 | }
85 |
86 | QFile dfile( desc_file ); dfile.open(QIODevice::WriteOnly); QDataStream dout(&dfile);
87 | QFile pfile( pos_file ); pfile.open(QIODevice::WriteOnly); QDataStream pout(&pfile);
88 | writeVectorArray2Df(dout, descriptors);
89 | writeVectorArray2Df(pout, positions);
90 | }
91 | }
92 |
93 | void vocabulary::load(const std::string &filename){
94 | QFile file( QString::fromStdString(filename) );
95 | file.open(QIODevice::ReadOnly);
96 | QDataStream in(&file);
97 |
98 | // Read centers from file
99 | centers = readArray2Df(in);
100 |
101 | qDebug() << "Loaded vocab :" << QString::fromStdString(filename);
102 | }
103 |
104 | void vocabulary::save(const std::string &filename) const
105 | {
106 | QFile file( QString::fromStdString(filename) );
107 | file.open(QIODevice::WriteOnly);
108 | QDataStream out(&file);
109 |
110 | // Cluster centers of features space
111 | writeArray2Df(out, centers);
112 | }
113 |
114 | void vocabulary::cluster(const Array2Df &samples, int numclusters)
115 | {
116 | typedef clustering::l2norm_squared dist_fn;
117 |
118 | clustering::kmeans< Array2Df, dist_fn > km(samples, numclusters);
119 | km.run(100, 0.01);
120 |
121 | centers = km.centers();
122 | }
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/bowlib/vocabulary.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "types.h"
4 |
5 | namespace imdb{
6 |
7 | // numclusters = number of clusters/visual words to generate
8 | class vocabulary
9 | {
10 | public:
11 | vocabulary(QString folderPath, int numclusters = 2500);
12 |
13 | void save(const std::string& filename) const;
14 | void load(const std::string &filename);
15 |
16 | void cluster(const Array2Df &samples, int numclusters);
17 |
18 | Array2Df centers;
19 | std::vector descriptors, positions;
20 | };
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/bowpackage.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += testGUI bowlib
4 |
5 | testGUI.depends = bowlib
6 |
--------------------------------------------------------------------------------
/common.pri:
--------------------------------------------------------------------------------
1 | # My Stuff:
2 | # OpenCV
3 | win32{
4 | INCLUDEPATH *= C:/Development/opencv/build/include
5 | LIBS *= -L"C:/Development/opencv/build/x64/vc11/lib"
6 | OpenCV_VERSION = 248
7 | Debug:LIBS *= -lopencv_core$${OpenCV_VERSION}d -lopencv_highgui$${OpenCV_VERSION}d -lopencv_features2d$${OpenCV_VERSION}d -lopencv_nonfree$${OpenCV_VERSION}d -lopencv_flann$${OpenCV_VERSION}d -lopencv_imgproc$${OpenCV_VERSION}d
8 | Release:LIBS *= -lopencv_core$${OpenCV_VERSION} -lopencv_highgui$${OpenCV_VERSION} -lopencv_features2d$${OpenCV_VERSION} -lopencv_nonfree$${OpenCV_VERSION} -lopencv_flann$${OpenCV_VERSION} -lopencv_imgproc$${OpenCV_VERSION}
9 | }
10 |
11 | # OpenMP
12 | win32{
13 | QMAKE_CXXFLAGS *= /openmp
14 | QMAKE_CXXFLAGS *= /MP
15 | }
16 | unix:!mac{
17 | QMAKE_CXXFLAGS *= -fopenmp
18 | LIBS += -lgomp
19 | }
20 |
21 | # Other
22 | win32{
23 | DEFINES *= NOMINMAX _USE_MATH_DEFINES
24 | }
25 |
26 | # Build flag
27 | CONFIG(debug, debug|release) {
28 | CFG = debug
29 | } else {
30 | CFG = release
31 | }
32 |
--------------------------------------------------------------------------------
/images/image01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image01.png
--------------------------------------------------------------------------------
/images/image02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image02.png
--------------------------------------------------------------------------------
/images/image03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image03.png
--------------------------------------------------------------------------------
/images/image04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image04.png
--------------------------------------------------------------------------------
/images/image05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image05.png
--------------------------------------------------------------------------------
/images/image06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image06.png
--------------------------------------------------------------------------------
/images/image07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image07.png
--------------------------------------------------------------------------------
/images/image08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image08.png
--------------------------------------------------------------------------------
/images/image09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image09.png
--------------------------------------------------------------------------------
/images/image10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image10.png
--------------------------------------------------------------------------------
/images/image11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ialhashim/sketch-search/6c9746aba8332a203d45f6aeb6fa2227fd338c66/images/image11.png
--------------------------------------------------------------------------------
/testGUI/Eigen/Array:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_ARRAY_MODULE_H
2 | #define EIGEN_ARRAY_MODULE_H
3 |
4 | // include Core first to handle Eigen2 support macros
5 | #include "Core"
6 |
7 | #ifndef EIGEN2_SUPPORT
8 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core.
9 | #endif
10 |
11 | #endif // EIGEN_ARRAY_MODULE_H
12 |
--------------------------------------------------------------------------------
/testGUI/Eigen/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(RegexUtils)
2 | test_escape_string_as_regex()
3 |
4 | file(GLOB Eigen_directory_files "*")
5 |
6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
7 |
8 | foreach(f ${Eigen_directory_files})
9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src")
10 | list(APPEND Eigen_directory_files_to_install ${f})
11 | endif()
12 | endforeach(f ${Eigen_directory_files})
13 |
14 | install(FILES
15 | ${Eigen_directory_files_to_install}
16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel
17 | )
18 |
19 | add_subdirectory(src)
20 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Cholesky:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_CHOLESKY_MODULE_H
2 | #define EIGEN_CHOLESKY_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup Cholesky_Module Cholesky module
9 | *
10 | *
11 | *
12 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
13 | * Those decompositions are accessible via the following MatrixBase methods:
14 | * - MatrixBase::llt(),
15 | * - MatrixBase::ldlt()
16 | *
17 | * \code
18 | * #include
19 | * \endcode
20 | */
21 |
22 | #include "src/misc/Solve.h"
23 | #include "src/Cholesky/LLT.h"
24 | #include "src/Cholesky/LDLT.h"
25 | #ifdef EIGEN_USE_LAPACKE
26 | #include "src/Cholesky/LLT_MKL.h"
27 | #endif
28 |
29 | #include "src/Core/util/ReenableStupidWarnings.h"
30 |
31 | #endif // EIGEN_CHOLESKY_MODULE_H
32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
33 |
--------------------------------------------------------------------------------
/testGUI/Eigen/CholmodSupport:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H
2 | #define EIGEN_CHOLMODSUPPORT_MODULE_H
3 |
4 | #include "SparseCore"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | extern "C" {
9 | #include
10 | }
11 |
12 | /** \ingroup Support_modules
13 | * \defgroup CholmodSupport_Module CholmodSupport module
14 | *
15 | * This module provides an interface to the Cholmod library which is part of the suitesparse package.
16 | * It provides the two following main factorization classes:
17 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization.
18 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial).
19 | *
20 | * For the sake of completeness, this module also propose the two following classes:
21 | * - class CholmodSimplicialLLT
22 | * - class CholmodSimplicialLDLT
23 | * Note that these classes does not bring any particular advantage compared to the built-in
24 | * SimplicialLLT and SimplicialLDLT factorization classes.
25 | *
26 | * \code
27 | * #include
28 | * \endcode
29 | *
30 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies.
31 | * The dependencies depend on how cholmod has been compiled.
32 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task.
33 | *
34 | */
35 |
36 | #include "src/misc/Solve.h"
37 | #include "src/misc/SparseSolve.h"
38 |
39 | #include "src/CholmodSupport/CholmodSupport.h"
40 |
41 |
42 | #include "src/Core/util/ReenableStupidWarnings.h"
43 |
44 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H
45 |
46 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Dense:
--------------------------------------------------------------------------------
1 | #include "Core"
2 | #include "LU"
3 | #include "Cholesky"
4 | #include "QR"
5 | #include "SVD"
6 | #include "Geometry"
7 | #include "Eigenvalues"
8 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Eigen:
--------------------------------------------------------------------------------
1 | #include "Dense"
2 | //#include "Sparse"
3 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Eigen2Support:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // Copyright (C) 2009 Gael Guennebaud
5 | //
6 | // This Source Code Form is subject to the terms of the Mozilla
7 | // Public License v. 2.0. If a copy of the MPL was not distributed
8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 |
10 | #ifndef EIGEN2SUPPORT_H
11 | #define EIGEN2SUPPORT_H
12 |
13 | #if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H))
14 | #error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header
15 | #endif
16 |
17 | #ifndef EIGEN_NO_EIGEN2_DEPRECATED_WARNING
18 |
19 | #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__)
20 | #warning "Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)"
21 | #else
22 | #pragma message ("Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)")
23 | #endif
24 |
25 | #endif // EIGEN_NO_EIGEN2_DEPRECATED_WARNING
26 |
27 | #include "src/Core/util/DisableStupidWarnings.h"
28 |
29 | /** \ingroup Support_modules
30 | * \defgroup Eigen2Support_Module Eigen2 support module
31 | *
32 | * \warning Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3.
33 | *
34 | * This module provides a couple of deprecated functions improving the compatibility with Eigen2.
35 | *
36 | * To use it, define EIGEN2_SUPPORT before including any Eigen header
37 | * \code
38 | * #define EIGEN2_SUPPORT
39 | * \endcode
40 | *
41 | */
42 |
43 | #include "src/Eigen2Support/Macros.h"
44 | #include "src/Eigen2Support/Memory.h"
45 | #include "src/Eigen2Support/Meta.h"
46 | #include "src/Eigen2Support/Lazy.h"
47 | #include "src/Eigen2Support/Cwise.h"
48 | #include "src/Eigen2Support/CwiseOperators.h"
49 | #include "src/Eigen2Support/TriangularSolver.h"
50 | #include "src/Eigen2Support/Block.h"
51 | #include "src/Eigen2Support/VectorBlock.h"
52 | #include "src/Eigen2Support/Minor.h"
53 | #include "src/Eigen2Support/MathFunctions.h"
54 |
55 |
56 | #include "src/Core/util/ReenableStupidWarnings.h"
57 |
58 | // Eigen2 used to include iostream
59 | #include
60 |
61 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \
62 | using Eigen::Matrix##SizeSuffix##TypeSuffix; \
63 | using Eigen::Vector##SizeSuffix##TypeSuffix; \
64 | using Eigen::RowVector##SizeSuffix##TypeSuffix;
65 |
66 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \
67 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \
68 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \
69 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \
70 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \
71 |
72 | #define EIGEN_USING_MATRIX_TYPEDEFS \
73 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \
74 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \
75 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \
76 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \
77 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd)
78 |
79 | #define USING_PART_OF_NAMESPACE_EIGEN \
80 | EIGEN_USING_MATRIX_TYPEDEFS \
81 | using Eigen::Matrix; \
82 | using Eigen::MatrixBase; \
83 | using Eigen::ei_random; \
84 | using Eigen::ei_real; \
85 | using Eigen::ei_imag; \
86 | using Eigen::ei_conj; \
87 | using Eigen::ei_abs; \
88 | using Eigen::ei_abs2; \
89 | using Eigen::ei_sqrt; \
90 | using Eigen::ei_exp; \
91 | using Eigen::ei_log; \
92 | using Eigen::ei_sin; \
93 | using Eigen::ei_cos;
94 |
95 | #endif // EIGEN2SUPPORT_H
96 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Eigenvalues:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_EIGENVALUES_MODULE_H
2 | #define EIGEN_EIGENVALUES_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include "Cholesky"
9 | #include "Jacobi"
10 | #include "Householder"
11 | #include "LU"
12 | #include "Geometry"
13 |
14 | /** \defgroup Eigenvalues_Module Eigenvalues module
15 | *
16 | *
17 | *
18 | * This module mainly provides various eigenvalue solvers.
19 | * This module also provides some MatrixBase methods, including:
20 | * - MatrixBase::eigenvalues(),
21 | * - MatrixBase::operatorNorm()
22 | *
23 | * \code
24 | * #include
25 | * \endcode
26 | */
27 |
28 | #include "src/Eigenvalues/Tridiagonalization.h"
29 | #include "src/Eigenvalues/RealSchur.h"
30 | #include "src/Eigenvalues/EigenSolver.h"
31 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h"
32 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h"
33 | #include "src/Eigenvalues/HessenbergDecomposition.h"
34 | #include "src/Eigenvalues/ComplexSchur.h"
35 | #include "src/Eigenvalues/ComplexEigenSolver.h"
36 | #include "src/Eigenvalues/RealQZ.h"
37 | #include "src/Eigenvalues/GeneralizedEigenSolver.h"
38 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h"
39 | #ifdef EIGEN_USE_LAPACKE
40 | #include "src/Eigenvalues/RealSchur_MKL.h"
41 | #include "src/Eigenvalues/ComplexSchur_MKL.h"
42 | #include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h"
43 | #endif
44 |
45 | #include "src/Core/util/ReenableStupidWarnings.h"
46 |
47 | #endif // EIGEN_EIGENVALUES_MODULE_H
48 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
49 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Geometry:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_GEOMETRY_MODULE_H
2 | #define EIGEN_GEOMETRY_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include "SVD"
9 | #include "LU"
10 | #include
11 |
12 | #ifndef M_PI
13 | #define M_PI 3.14159265358979323846
14 | #endif
15 |
16 | /** \defgroup Geometry_Module Geometry module
17 | *
18 | *
19 | *
20 | * This module provides support for:
21 | * - fixed-size homogeneous transformations
22 | * - translation, scaling, 2D and 3D rotations
23 | * - quaternions
24 | * - \ref MatrixBase::cross() "cross product"
25 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation"
26 | * - some linear components: parametrized-lines and hyperplanes
27 | *
28 | * \code
29 | * #include
30 | * \endcode
31 | */
32 |
33 | #include "src/Geometry/OrthoMethods.h"
34 | #include "src/Geometry/EulerAngles.h"
35 |
36 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
37 | #include "src/Geometry/Homogeneous.h"
38 | #include "src/Geometry/RotationBase.h"
39 | #include "src/Geometry/Rotation2D.h"
40 | #include "src/Geometry/Quaternion.h"
41 | #include "src/Geometry/AngleAxis.h"
42 | #include "src/Geometry/Transform.h"
43 | #include "src/Geometry/Translation.h"
44 | #include "src/Geometry/Scaling.h"
45 | #include "src/Geometry/Hyperplane.h"
46 | #include "src/Geometry/ParametrizedLine.h"
47 | #include "src/Geometry/AlignedBox.h"
48 | #include "src/Geometry/Umeyama.h"
49 |
50 | #if defined EIGEN_VECTORIZE_SSE
51 | #include "src/Geometry/arch/Geometry_SSE.h"
52 | #endif
53 | #endif
54 |
55 | #ifdef EIGEN2_SUPPORT
56 | #include "src/Eigen2Support/Geometry/All.h"
57 | #endif
58 |
59 | #include "src/Core/util/ReenableStupidWarnings.h"
60 |
61 | #endif // EIGEN_GEOMETRY_MODULE_H
62 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
63 |
64 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Householder:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H
2 | #define EIGEN_HOUSEHOLDER_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup Householder_Module Householder module
9 | * This module provides Householder transformations.
10 | *
11 | * \code
12 | * #include
13 | * \endcode
14 | */
15 |
16 | #include "src/Householder/Householder.h"
17 | #include "src/Householder/HouseholderSequence.h"
18 | #include "src/Householder/BlockHouseholder.h"
19 |
20 | #include "src/Core/util/ReenableStupidWarnings.h"
21 |
22 | #endif // EIGEN_HOUSEHOLDER_MODULE_H
23 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
24 |
--------------------------------------------------------------------------------
/testGUI/Eigen/IterativeLinearSolvers:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
2 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
3 |
4 | #include "SparseCore"
5 | #include "OrderingMethods"
6 |
7 | #include "src/Core/util/DisableStupidWarnings.h"
8 |
9 | /**
10 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module
11 | *
12 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse.
13 | * Those solvers are accessible via the following classes:
14 | * - ConjugateGradient for selfadjoint (hermitian) matrices,
15 | * - BiCGSTAB for general square matrices.
16 | *
17 | * These iterative solvers are associated with some preconditioners:
18 | * - IdentityPreconditioner - not really useful
19 | * - DiagonalPreconditioner - also called JAcobi preconditioner, work very well on diagonal dominant matrices.
20 | * - IncompleteILUT - incomplete LU factorization with dual thresholding
21 | *
22 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport.
23 | *
24 | * \code
25 | * #include
26 | * \endcode
27 | */
28 |
29 | #include "src/misc/Solve.h"
30 | #include "src/misc/SparseSolve.h"
31 |
32 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h"
33 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h"
34 | #include "src/IterativeLinearSolvers/ConjugateGradient.h"
35 | #include "src/IterativeLinearSolvers/BiCGSTAB.h"
36 | #include "src/IterativeLinearSolvers/IncompleteLUT.h"
37 |
38 | #include "src/Core/util/ReenableStupidWarnings.h"
39 |
40 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H
41 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Jacobi:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_JACOBI_MODULE_H
2 | #define EIGEN_JACOBI_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup Jacobi_Module Jacobi module
9 | * This module provides Jacobi and Givens rotations.
10 | *
11 | * \code
12 | * #include
13 | * \endcode
14 | *
15 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation:
16 | * - MatrixBase::applyOnTheLeft()
17 | * - MatrixBase::applyOnTheRight().
18 | */
19 |
20 | #include "src/Jacobi/Jacobi.h"
21 |
22 | #include "src/Core/util/ReenableStupidWarnings.h"
23 |
24 | #endif // EIGEN_JACOBI_MODULE_H
25 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
26 |
27 |
--------------------------------------------------------------------------------
/testGUI/Eigen/LU:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_LU_MODULE_H
2 | #define EIGEN_LU_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup LU_Module LU module
9 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant.
10 | * This module defines the following MatrixBase methods:
11 | * - MatrixBase::inverse()
12 | * - MatrixBase::determinant()
13 | *
14 | * \code
15 | * #include
16 | * \endcode
17 | */
18 |
19 | #include "src/misc/Solve.h"
20 | #include "src/misc/Kernel.h"
21 | #include "src/misc/Image.h"
22 | #include "src/LU/FullPivLU.h"
23 | #include "src/LU/PartialPivLU.h"
24 | #ifdef EIGEN_USE_LAPACKE
25 | #include "src/LU/PartialPivLU_MKL.h"
26 | #endif
27 | #include "src/LU/Determinant.h"
28 | #include "src/LU/Inverse.h"
29 |
30 | #if defined EIGEN_VECTORIZE_SSE
31 | #include "src/LU/arch/Inverse_SSE.h"
32 | #endif
33 |
34 | #ifdef EIGEN2_SUPPORT
35 | #include "src/Eigen2Support/LU.h"
36 | #endif
37 |
38 | #include "src/Core/util/ReenableStupidWarnings.h"
39 |
40 | #endif // EIGEN_LU_MODULE_H
41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
42 |
--------------------------------------------------------------------------------
/testGUI/Eigen/LeastSquares:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_REGRESSION_MODULE_H
2 | #define EIGEN_REGRESSION_MODULE_H
3 |
4 | #ifndef EIGEN2_SUPPORT
5 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT)
6 | #endif
7 |
8 | // exclude from normal eigen3-only documentation
9 | #ifdef EIGEN2_SUPPORT
10 |
11 | #include "Core"
12 |
13 | #include "src/Core/util/DisableStupidWarnings.h"
14 |
15 | #include "Eigenvalues"
16 | #include "Geometry"
17 |
18 | /** \defgroup LeastSquares_Module LeastSquares module
19 | * This module provides linear regression and related features.
20 | *
21 | * \code
22 | * #include
23 | * \endcode
24 | */
25 |
26 | #include "src/Eigen2Support/LeastSquares.h"
27 |
28 | #include "src/Core/util/ReenableStupidWarnings.h"
29 |
30 | #endif // EIGEN2_SUPPORT
31 |
32 | #endif // EIGEN_REGRESSION_MODULE_H
33 |
--------------------------------------------------------------------------------
/testGUI/Eigen/MetisSupport:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_METISSUPPORT_MODULE_H
2 | #define EIGEN_METISSUPPORT_MODULE_H
3 |
4 | #include "SparseCore"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | extern "C" {
9 | #include
10 | }
11 |
12 |
13 | /** \ingroup Support_modules
14 | * \defgroup MetisSupport_Module MetisSupport module
15 | *
16 | * \code
17 | * #include
18 | * \endcode
19 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis).
20 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink
21 | */
22 |
23 |
24 | #include "src/MetisSupport/MetisSupport.h"
25 |
26 | #include "src/Core/util/ReenableStupidWarnings.h"
27 |
28 | #endif // EIGEN_METISSUPPORT_MODULE_H
29 |
--------------------------------------------------------------------------------
/testGUI/Eigen/OrderingMethods:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H
2 | #define EIGEN_ORDERINGMETHODS_MODULE_H
3 |
4 | #include "SparseCore"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /**
9 | * \defgroup OrderingMethods_Module OrderingMethods module
10 | *
11 | * This module is currently for internal use only
12 | *
13 | * It defines various built-in and external ordering methods for sparse matrices.
14 | * They are typically used to reduce the number of elements during
15 | * the sparse matrix decomposition (LLT, LU, QR).
16 | * Precisely, in a preprocessing step, a permutation matrix P is computed using
17 | * those ordering methods and applied to the columns of the matrix.
18 | * Using for instance the sparse Cholesky decomposition, it is expected that
19 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A).
20 | *
21 | *
22 | * Usage :
23 | * \code
24 | * #include
25 | * \endcode
26 | *
27 | * A simple usage is as a template parameter in the sparse decomposition classes :
28 | *
29 | * \code
30 | * SparseLU > solver;
31 | * \endcode
32 | *
33 | * \code
34 | * SparseQR > solver;
35 | * \endcode
36 | *
37 | * It is possible as well to call directly a particular ordering method for your own purpose,
38 | * \code
39 | * AMDOrdering ordering;
40 | * PermutationMatrix perm;
41 | * SparseMatrix A;
42 | * //Fill the matrix ...
43 | *
44 | * ordering(A, perm); // Call AMD
45 | * \endcode
46 | *
47 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern
48 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric,
49 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method.
50 | * If your matrix is already symmetric (at leat in structure), you can avoid that
51 | * by calling the method with a SelfAdjointView type.
52 | *
53 | * \code
54 | * // Call the ordering on the pattern of the lower triangular matrix A
55 | * ordering(A.selfadjointView(), perm);
56 | * \endcode
57 | */
58 |
59 | #ifndef EIGEN_MPL2_ONLY
60 | #include "src/OrderingMethods/Amd.h"
61 | #endif
62 |
63 | #include "src/OrderingMethods/Ordering.h"
64 | #include "src/Core/util/ReenableStupidWarnings.h"
65 |
66 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H
67 |
--------------------------------------------------------------------------------
/testGUI/Eigen/PaStiXSupport:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H
2 | #define EIGEN_PASTIXSUPPORT_MODULE_H
3 |
4 | #include "SparseCore"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include
9 | extern "C" {
10 | #include
11 | #include
12 | }
13 |
14 | #ifdef complex
15 | #undef complex
16 | #endif
17 |
18 | /** \ingroup Support_modules
19 | * \defgroup PaStiXSupport_Module PaStiXSupport module
20 | *
21 | * This module provides an interface to the PaSTiX library.
22 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver.
23 | * It provides the two following main factorization classes:
24 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization.
25 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization.
26 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern).
27 | *
28 | * \code
29 | * #include
30 | * \endcode
31 | *
32 | * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies.
33 | * The dependencies depend on how PaSTiX has been compiled.
34 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task.
35 | *
36 | */
37 |
38 | #include "src/misc/Solve.h"
39 | #include "src/misc/SparseSolve.h"
40 |
41 | #include "src/PaStiXSupport/PaStiXSupport.h"
42 |
43 |
44 | #include "src/Core/util/ReenableStupidWarnings.h"
45 |
46 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H
47 |
--------------------------------------------------------------------------------
/testGUI/Eigen/PardisoSupport:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H
2 | #define EIGEN_PARDISOSUPPORT_MODULE_H
3 |
4 | #include "SparseCore"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include
9 |
10 | #include
11 |
12 | /** \ingroup Support_modules
13 | * \defgroup PardisoSupport_Module PardisoSupport module
14 | *
15 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers.
16 | *
17 | * \code
18 | * #include
19 | * \endcode
20 | *
21 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies.
22 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration.
23 | *
24 | */
25 |
26 | #include "src/PardisoSupport/PardisoSupport.h"
27 |
28 | #include "src/Core/util/ReenableStupidWarnings.h"
29 |
30 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H
31 |
--------------------------------------------------------------------------------
/testGUI/Eigen/QR:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_QR_MODULE_H
2 | #define EIGEN_QR_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include "Cholesky"
9 | #include "Jacobi"
10 | #include "Householder"
11 |
12 | /** \defgroup QR_Module QR module
13 | *
14 | *
15 | *
16 | * This module provides various QR decompositions
17 | * This module also provides some MatrixBase methods, including:
18 | * - MatrixBase::qr(),
19 | *
20 | * \code
21 | * #include
22 | * \endcode
23 | */
24 |
25 | #include "src/misc/Solve.h"
26 | #include "src/QR/HouseholderQR.h"
27 | #include "src/QR/FullPivHouseholderQR.h"
28 | #include "src/QR/ColPivHouseholderQR.h"
29 | #ifdef EIGEN_USE_LAPACKE
30 | #include "src/QR/HouseholderQR_MKL.h"
31 | #include "src/QR/ColPivHouseholderQR_MKL.h"
32 | #endif
33 |
34 | #ifdef EIGEN2_SUPPORT
35 | #include "src/Eigen2Support/QR.h"
36 | #endif
37 |
38 | #include "src/Core/util/ReenableStupidWarnings.h"
39 |
40 | #ifdef EIGEN2_SUPPORT
41 | #include "Eigenvalues"
42 | #endif
43 |
44 | #endif // EIGEN_QR_MODULE_H
45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
46 |
--------------------------------------------------------------------------------
/testGUI/Eigen/QtAlignedMalloc:
--------------------------------------------------------------------------------
1 |
2 | #ifndef EIGEN_QTMALLOC_MODULE_H
3 | #define EIGEN_QTMALLOC_MODULE_H
4 |
5 | #include "Core"
6 |
7 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED)
8 |
9 | #include "src/Core/util/DisableStupidWarnings.h"
10 |
11 | void *qMalloc(size_t size)
12 | {
13 | return Eigen::internal::aligned_malloc(size);
14 | }
15 |
16 | void qFree(void *ptr)
17 | {
18 | Eigen::internal::aligned_free(ptr);
19 | }
20 |
21 | void *qRealloc(void *ptr, size_t size)
22 | {
23 | void* newPtr = Eigen::internal::aligned_malloc(size);
24 | memcpy(newPtr, ptr, size);
25 | Eigen::internal::aligned_free(ptr);
26 | return newPtr;
27 | }
28 |
29 | #include "src/Core/util/ReenableStupidWarnings.h"
30 |
31 | #endif
32 |
33 | #endif // EIGEN_QTMALLOC_MODULE_H
34 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
35 |
--------------------------------------------------------------------------------
/testGUI/Eigen/SPQRSupport:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H
2 | #define EIGEN_SPQRSUPPORT_MODULE_H
3 |
4 | #include "SparseCore"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include "SuiteSparseQR.hpp"
9 |
10 | /** \ingroup Support_modules
11 | * \defgroup SPQRSupport_Module SuiteSparseQR module
12 | *
13 | * This module provides an interface to the SPQR library, which is part of the suitesparse package.
14 | *
15 | * \code
16 | * #include
17 | * \endcode
18 | *
19 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...).
20 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules
21 | *
22 | */
23 |
24 | #include "src/misc/Solve.h"
25 | #include "src/misc/SparseSolve.h"
26 | #include "src/CholmodSupport/CholmodSupport.h"
27 | #include "src/SPQRSupport/SuiteSparseQRSupport.h"
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/testGUI/Eigen/SVD:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_SVD_MODULE_H
2 | #define EIGEN_SVD_MODULE_H
3 |
4 | #include "QR"
5 | #include "Householder"
6 | #include "Jacobi"
7 |
8 | #include "src/Core/util/DisableStupidWarnings.h"
9 |
10 | /** \defgroup SVD_Module SVD module
11 | *
12 | *
13 | *
14 | * This module provides SVD decomposition for matrices (both real and complex).
15 | * This decomposition is accessible via the following MatrixBase method:
16 | * - MatrixBase::jacobiSvd()
17 | *
18 | * \code
19 | * #include
20 | * \endcode
21 | */
22 |
23 | #include "src/misc/Solve.h"
24 | #include "src/SVD/JacobiSVD.h"
25 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
26 | #include "src/SVD/JacobiSVD_MKL.h"
27 | #endif
28 | #include "src/SVD/UpperBidiagonalization.h"
29 |
30 | #ifdef EIGEN2_SUPPORT
31 | #include "src/Eigen2Support/SVD.h"
32 | #endif
33 |
34 | #include "src/Core/util/ReenableStupidWarnings.h"
35 |
36 | #endif // EIGEN_SVD_MODULE_H
37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
38 |
--------------------------------------------------------------------------------
/testGUI/Eigen/Sparse:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_SPARSE_MODULE_H
2 | #define EIGEN_SPARSE_MODULE_H
3 |
4 | /** \defgroup Sparse_Module Sparse meta-module
5 | *
6 | * Meta-module including all related modules:
7 | * - \ref SparseCore_Module
8 | * - \ref OrderingMethods_Module
9 | * - \ref SparseCholesky_Module
10 | * - \ref SparseLU_Module
11 | * - \ref SparseQR_Module
12 | * - \ref IterativeLinearSolvers_Module
13 | *
14 | * \code
15 | * #include
16 | * \endcode
17 | */
18 |
19 | #include "SparseCore"
20 | #include "OrderingMethods"
21 | #include "SparseCholesky"
22 | #include "SparseLU"
23 | #include "SparseQR"
24 | #include "IterativeLinearSolvers"
25 |
26 | #endif // EIGEN_SPARSE_MODULE_H
27 |
28 |
--------------------------------------------------------------------------------
/testGUI/Eigen/SparseCholesky:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // Copyright (C) 2008-2013 Gael Guennebaud
5 | //
6 | // This Source Code Form is subject to the terms of the Mozilla
7 | // Public License v. 2.0. If a copy of the MPL was not distributed
8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 |
10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H
11 | #define EIGEN_SPARSECHOLESKY_MODULE_H
12 |
13 | #include "SparseCore"
14 | #include "OrderingMethods"
15 |
16 | #include "src/Core/util/DisableStupidWarnings.h"
17 |
18 | /**
19 | * \defgroup SparseCholesky_Module SparseCholesky module
20 | *
21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices.
22 | * Those decompositions are accessible via the following classes:
23 | * - SimplicialLLt,
24 | * - SimplicialLDLt
25 | *
26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module.
27 | *
28 | * \code
29 | * #include
30 | * \endcode
31 | */
32 |
33 | #ifdef EIGEN_MPL2_ONLY
34 | #error The SparseCholesky module has nothing to offer in MPL2 only mode
35 | #endif
36 |
37 | #include "src/misc/Solve.h"
38 | #include "src/misc/SparseSolve.h"
39 | #include "src/SparseCholesky/SimplicialCholesky.h"
40 |
41 | #ifndef EIGEN_MPL2_ONLY
42 | #include "src/SparseCholesky/SimplicialCholesky_impl.h"
43 | #endif
44 |
45 | #include "src/Core/util/ReenableStupidWarnings.h"
46 |
47 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H
48 |
--------------------------------------------------------------------------------
/testGUI/Eigen/SparseCore:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_SPARSECORE_MODULE_H
2 | #define EIGEN_SPARSECORE_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include
9 | #include