├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── misc └── ui.png ├── modules └── FindKinectV2.cmake ├── src ├── CMakeLists.txt ├── GL │ └── glext.h ├── examples │ ├── classifier.nn │ └── example_detect.cpp ├── fhd.cpp ├── fhd.h ├── fhd_block_allocator.cpp ├── fhd_block_allocator.h ├── fhd_candidate.cpp ├── fhd_candidate.h ├── fhd_candidate_db.cpp ├── fhd_candidate_db.h ├── fhd_classifier.cpp ├── fhd_classifier.h ├── fhd_config.h ├── fhd_frame_source.h ├── fhd_hash.cpp ├── fhd_hash.h ├── fhd_image.cpp ├── fhd_image.h ├── fhd_kinect.cpp ├── fhd_kinect.h ├── fhd_math.cpp ├── fhd_math.h ├── fhd_perf.cpp ├── fhd_perf.h ├── fhd_sampler.cpp ├── fhd_sampler.h ├── fhd_segmentation.cpp ├── fhd_segmentation.h ├── fhd_sqlite_source.cpp ├── fhd_sqlite_source.h ├── imgui │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_draw.cpp │ ├── imgui_impl_glfw.cpp │ ├── imgui_impl_glfw.h │ ├── imgui_internal.h │ ├── stb_rect_pack.h │ ├── stb_textedit.h │ └── stb_truetype.h ├── pcg │ ├── pcg_basic.c │ └── pcg_basic.h ├── sqlite3 │ ├── sqlite3.c │ └── sqlite3.h ├── tinydir │ └── tinydir.h └── tools │ ├── fhd_debug_frame_source.cpp │ ├── fhd_debug_frame_source.h │ ├── fhd_filebrowser.cpp │ ├── fhd_filebrowser.h │ ├── fhd_kinect_source.cpp │ ├── fhd_kinect_source.h │ ├── fhd_test.cpp │ ├── fhd_texture.cpp │ ├── fhd_texture.h │ ├── fhd_train.cpp │ ├── fhd_training.cpp │ ├── fhd_training.h │ └── ui.cpp └── third_party ├── eigen └── 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 ├── fann ├── CMakeLists.txt ├── LICENSE.md ├── README.md ├── cmake │ ├── Modules │ │ └── DefineInstallationPaths.cmake │ ├── config.h.in │ ├── fann-config.cmake.in │ ├── fann-use.cmake │ └── fann.pc.cmake ├── fann-config.cmake └── src │ ├── CMakeLists.txt │ ├── doublefann.c │ ├── fann.c │ ├── fann_cascade.c │ ├── fann_error.c │ ├── fann_io.c │ ├── fann_train.c │ ├── fann_train_data.c │ ├── fixedfann.c │ ├── floatfann.c │ ├── include │ ├── CMakeLists.txt │ ├── config.h │ ├── doublefann.h │ ├── fann.h │ ├── fann_activation.h │ ├── fann_cascade.h │ ├── fann_cpp.h │ ├── fann_data.h │ ├── fann_data_cpp.h │ ├── fann_error.h │ ├── fann_internal.h │ ├── fann_io.h │ ├── fann_train.h │ ├── fann_training_data_cpp.h │ ├── fixedfann.h │ ├── floatfann.h │ ├── parallel_fann.h │ └── parallel_fann.hpp │ ├── parallel_doublefann_cpp.cpp │ ├── parallel_fann.c │ ├── parallel_fann_cpp.cpp │ └── parallel_floatfann_cpp.cpp └── glfw-3.1.2 ├── CMake ├── MacOSXBundleInfo.plist.in ├── amd64-mingw32msvc.cmake ├── i586-mingw32msvc.cmake ├── i686-pc-mingw32.cmake ├── i686-w64-mingw32.cmake ├── modules │ ├── FindEGL.cmake │ ├── FindGLESv1.cmake │ ├── FindGLESv2.cmake │ ├── FindMir.cmake │ ├── FindWayland.cmake │ └── FindXKBCommon.cmake └── x86_64-w64-mingw32.cmake ├── CMakeLists.txt ├── COPYING.txt ├── README.md ├── cmake_uninstall.cmake.in ├── deps ├── EGL │ └── eglext.h ├── GL │ ├── glext.h │ ├── glxext.h │ └── wglext.h ├── KHR │ └── khrplatform.h ├── getopt.c ├── getopt.h ├── glad.c ├── glad │ └── glad.h ├── linmath.h ├── tinycthread.c └── tinycthread.h ├── include └── GLFW │ ├── glfw3.h │ └── glfw3native.h └── src ├── CMakeLists.txt ├── cocoa_init.m ├── cocoa_monitor.m ├── cocoa_platform.h ├── cocoa_window.m ├── context.c ├── egl_context.c ├── egl_context.h ├── glfw3.pc.in ├── glfw3Config.cmake.in ├── glfw_config.h.in ├── glx_context.c ├── glx_context.h ├── init.c ├── input.c ├── internal.h ├── iokit_joystick.h ├── iokit_joystick.m ├── linux_joystick.c ├── linux_joystick.h ├── mach_time.c ├── mir_init.c ├── mir_monitor.c ├── mir_platform.h ├── mir_window.c ├── monitor.c ├── nsgl_context.h ├── nsgl_context.m ├── posix_time.c ├── posix_time.h ├── posix_tls.c ├── posix_tls.h ├── wgl_context.c ├── wgl_context.h ├── win32_init.c ├── win32_monitor.c ├── win32_platform.h ├── win32_time.c ├── win32_tls.c ├── win32_tls.h ├── win32_window.c ├── window.c ├── winmm_joystick.c ├── winmm_joystick.h ├── wl_init.c ├── wl_monitor.c ├── wl_platform.h ├── wl_window.c ├── x11_init.c ├── x11_monitor.c ├── x11_platform.h ├── x11_window.c ├── xkb_unicode.c └── xkb_unicode.h /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | project(FastHumanDetection) 3 | 4 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/modules") 5 | 6 | find_package(Threads) 7 | find_package(OpenMP) 8 | 9 | add_subdirectory("third_party/glfw-3.1.2") 10 | add_subdirectory("third_party/fann") 11 | 12 | option(KINECT_ENABLED "Use KinectV2 SDK" OFF) 13 | option(FHD_INSTALL "Generate install target" OFF) 14 | option(FHD_BUILD_EXAMPLES "Build examples" OFF) 15 | 16 | set (CMAKE_CXX_STANDARD 11) 17 | set (ARTIFACT_DIR "${CMAKE_BINARY_DIR}/bin") 18 | if (WIN32) 19 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${ARTIFACT_DIR}) 20 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${ARTIFACT_DIR}) 21 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${ARTIFACT_DIR}) 22 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${ARTIFACT_DIR}) 23 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${ARTIFACT_DIR}) 24 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${ARTIFACT_DIR}) 25 | add_definitions( 26 | -DNOMINMAX 27 | -D_WIN32_WINNT=0x0501 28 | -D_SCL_SECURE_NO_WARNINGS 29 | -D_CRT_SECURE_NO_WARNINGS 30 | ) 31 | 32 | find_package(KinectV2 REQUIRED) 33 | else() 34 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ARTIFACT_DIR}) 35 | add_definitions(-Wall -Wextra -march=native) 36 | endif() 37 | 38 | add_definitions(-DGLFW_INCLUDE_GLEXT) 39 | 40 | INCLUDE_DIRECTORIES(SYSTEM 41 | "third_party/glfw-3.1.2/include" 42 | "third_party/eigen" 43 | "third_party/fann/src/include" 44 | src 45 | ) 46 | 47 | add_subdirectory(src) 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Siim Kallas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Fast human detection in depth images 2 | 3 | An implementation of [Fast Human Detection for Indoor Mobile Robots Using Depth Images](http://www.cs.cmu.edu/~mmv/papers/13icra-CoBotPeopleDetection.pdf) for Kinect V2 depth images. 4 | 5 | Differences from the paper: 6 | * Kinect V2 over V1 7 | * Region planarity checks are disabled by default 8 | * A neural net is used for classification instead of SVM 9 | * Stratified sampling is used over random sampling for point cloud construction 10 | 11 | ### Building 12 | 13 | Standard CMake build. 14 | 15 | Generate the Makefiles: 16 | ``` 17 | $ mdkr build 18 | $ cd build 19 | $ cmake .. 20 | ``` 21 | 22 | Or MSVC project files: 23 | ``` 24 | $ mdkr build 25 | $ cd build 26 | $ cmake -G "Visual Studio 12 Win64" -DCMAKE_PREFIX_PATH=KINECT_SDK_DIR .. 27 | ``` 28 | KINECT_SDK_DIR is usually `C:\Program Files\Microsoft SDKs\Kinect\v2.0_1409` 29 | 30 | Run `make` or build the MSVC projects. 31 | 32 | ### Training a dataset 33 | 34 | fhd_ui can be used to create a training set from depth images. 35 | 36 | "open database" selects a Sqlite DB of depth images. Clicking on a candidate (marking it green) sets it as a positive candidate (human). 37 | Pressing space commits the candidates to the database, where selected (green) marks a human and unselected candidate marks a negative candidate. 38 | X advances to the next frame 39 | 40 | After creating the training set, a classifier can be trained under the Training tab. 41 | 42 | ![Training UI snapshot](misc/ui.png) 43 | -------------------------------------------------------------------------------- /misc/ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/seemk/FastHumanDetection/097564ba703dbcbe9737c63882e7dc986646e328/misc/ui.png -------------------------------------------------------------------------------- /modules/FindKinectV2.cmake: -------------------------------------------------------------------------------- 1 | # Find KinectV2 SDK 2 | # 3 | # This module defines: 4 | # 5 | # KINECTV2_FOUND 6 | # KINECTV2_LIBRARY 7 | # KINECTV2_INCLUDE_DIR 8 | # 9 | 10 | find_library(KINECTV2_LIBRARY Kinect20 11 | PATH_SUFFIXES Lib/x64 Lib/x86) 12 | set(KINECTV2_LIBRARY_NEEDED KINECTV2_LIBRARY) 13 | 14 | # Include dir 15 | find_path(KINECTV2_INCLUDE_DIR 16 | NAMES Kinect.h 17 | PATH_SUFFIXES Inc) 18 | 19 | include(FindPackageHandleStandardArgs) 20 | find_package_handle_standard_args("KinectV2" DEFAULT_MSG 21 | ${KINECTV2_LIBRARY_NEEDED} 22 | KINECTV2_INCLUDE_DIR) -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(imgui 2 | imgui/imgui.cpp 3 | imgui/imgui_draw.cpp 4 | imgui/imgui_impl_glfw.cpp 5 | ) 6 | 7 | add_library(sqlite 8 | sqlite3/sqlite3.c 9 | ) 10 | 11 | if (OPENMP_FOUND) 12 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 13 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 14 | add_definitions(-DFHD_OMP) 15 | endif() 16 | 17 | if (WIN32) 18 | include_directories(${KINECTV2_INCLUDE_DIR}) 19 | endif() 20 | 21 | add_library(fhd 22 | fhd.cpp 23 | fhd_block_allocator.cpp 24 | fhd_candidate.cpp 25 | fhd_classifier.cpp 26 | fhd_hash.cpp 27 | fhd_image.cpp 28 | fhd_kinect.cpp 29 | fhd_math.cpp 30 | fhd_perf.cpp 31 | fhd_sampler.cpp 32 | fhd_segmentation.cpp 33 | 34 | pcg/pcg_basic.c 35 | ) 36 | 37 | set(UTIL_SOURCES 38 | fhd_candidate_db.cpp 39 | fhd_sqlite_source.cpp 40 | tools/fhd_debug_frame_source.cpp 41 | ) 42 | 43 | if (WIN32) 44 | list(APPEND UTIL_SOURCES tools/fhd_kinect_source.cpp) 45 | endif() 46 | 47 | add_library(fhd_util 48 | ${UTIL_SOURCES} 49 | ) 50 | 51 | add_executable( 52 | fhd_ui 53 | tools/fhd_filebrowser.cpp 54 | tools/fhd_training.cpp 55 | tools/fhd_texture.cpp 56 | tools/ui.cpp 57 | ) 58 | 59 | add_executable( 60 | fhd_test 61 | tools/fhd_test.cpp 62 | ) 63 | 64 | target_link_libraries( 65 | fhd_ui 66 | ${KINECTV2_LIBRARY} 67 | fhd_util 68 | fhd 69 | sqlite 70 | imgui 71 | glfw 72 | floatfann 73 | ${GLFW_LIBRARIES} 74 | ) 75 | 76 | target_link_libraries( 77 | fhd_test 78 | fhd_util 79 | fhd 80 | floatfann 81 | sqlite 82 | ${CMAKE_DL_LIBS} 83 | ) 84 | 85 | if (FHD_BUILD_EXAMPLES) 86 | add_executable(example_detect 87 | examples/example_detect.cpp 88 | ) 89 | 90 | target_link_libraries(example_detect 91 | fhd_util 92 | fhd 93 | floatfann 94 | sqlite 95 | ${KINECTV2_LIBRARY} 96 | ) 97 | endif() 98 | 99 | set (FHD_HEADERS 100 | fhd.h 101 | fhd_candidate.h 102 | fhd_config.h 103 | fhd_image.h 104 | fhd_math.h 105 | fhd_perf.h 106 | fhd_sampler.h 107 | ) 108 | 109 | install(FILES ${FHD_HEADERS} DESTINATION include) 110 | install(TARGETS fhd EXPORT fhd DESTINATION lib) 111 | install(TARGETS fhd_ui fhd_test RUNTIME DESTINATION bin) 112 | 113 | if (WIN32) 114 | add_custom_command( 115 | TARGET fhd POST_BUILD 116 | COMMAND ${CMAKE_COMMAND} -E copy $/floatfann.dll ${ARTIFACT_DIR} 117 | ) 118 | endif() -------------------------------------------------------------------------------- /src/examples/example_detect.cpp: -------------------------------------------------------------------------------- 1 | #include "../fhd.h" 2 | #include "../fhd_classifier.h" 3 | #include "../fhd_candidate_db.h" 4 | #include "../tools/fhd_debug_frame_source.h" 5 | #include 6 | #include 7 | 8 | #if WIN32 9 | #include "../tools/fhd_kinect_source.h" 10 | #endif 11 | 12 | int main(int argc, char** argv) { 13 | if (argc < 2) { 14 | printf("usage: example_detect classifier.nn\n"); 15 | return 1; 16 | } 17 | 18 | fhd_classifier* classifier = fhd_classifier_create(argv[1]); 19 | if (!classifier) { 20 | printf("invalid classifier file\n"); 21 | return 1; 22 | } 23 | 24 | fhd_context detector; 25 | fhd_context_init(&detector, 512, 424, 8, 8); 26 | 27 | #if WIN32 28 | auto source = std::unique_ptr(new fhd_kinect_source()); 29 | #else 30 | // TODO: Replace with a small DB 31 | auto source = std::unique_ptr(new fhd_debug_frame_source()); 32 | #endif 33 | 34 | for (int i = 0; i < 10; i++) { 35 | fhd_run_pass(&detector, source->get_frame()); 36 | fhd_run_classifier(&detector, classifier); 37 | for (int j = 0; j < detector.candidates_len; j++) { 38 | fhd_candidate* candidate = &detector.candidates[j]; 39 | int x = candidate->depth_position.x; 40 | int y = candidate->depth_position.y; 41 | printf("(%d %d), (%d, %d); weight: %f\n", x, y, 42 | x + candidate->depth_position.width, 43 | y + candidate->depth_position.height, candidate->weight); 44 | } 45 | } 46 | 47 | 48 | fhd_classifier_destroy(classifier); 49 | fhd_context_destroy(&detector); 50 | return 0; 51 | } 52 | -------------------------------------------------------------------------------- /src/fhd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fhd_config.h" 4 | #include "fhd_candidate.h" 5 | #include "fhd_sampler.h" 6 | #include "fhd_perf.h" 7 | #include 8 | 9 | struct fhd_block_allocator; 10 | struct fhd_segmentation; 11 | struct fhd_classifier; 12 | struct fhd_edge; 13 | struct pcg_state_setseq_64; 14 | 15 | struct fhd_region_point { 16 | int x; 17 | int y; 18 | fhd_vec3 p_r; 19 | }; 20 | 21 | struct fhd_region { 22 | fhd_aabb bounds; // x, y depth space coordinates 23 | 24 | // Bounding rectangle, metric space 25 | float sx; 26 | float sy; 27 | float ex; 28 | float ey; 29 | 30 | fhd_vec3 center; // metric space 31 | float n; 32 | 33 | int points_len; 34 | fhd_region_point* points; 35 | }; 36 | 37 | struct fhd_context { 38 | fhd_perf_record perf_records[PERF_RECORD_COUNT]; 39 | 40 | int source_w; 41 | int source_h; 42 | int source_len; 43 | float source_wf; 44 | float source_hf; 45 | int cell_w; 46 | int cell_h; 47 | float cell_wf; 48 | float cell_hf; 49 | int cells_x; 50 | int cells_y; 51 | int cells_len; 52 | 53 | float min_region_size; 54 | float max_merge_distance; 55 | float max_vertical_merge_distance; 56 | float min_inlier_fraction; 57 | float min_region_height; 58 | float max_region_height; 59 | float min_region_width; 60 | float max_region_width; 61 | float ransac_max_plane_distance; 62 | int min_depth_segment_size; 63 | int min_normal_segment_size; 64 | float depth_segmentation_threshold; 65 | float normal_segmentation_threshold; 66 | 67 | fhd_block_allocator* point_allocator; 68 | 69 | fhd_image normalized_source; 70 | uint16_t* downscaled_depth; 71 | 72 | fhd_vec3* point_cloud; 73 | fhd_vec3* normals; 74 | 75 | fhd_edge* depth_graph; 76 | fhd_edge* normals_graph; 77 | 78 | fhd_segmentation* normals_segmentation; 79 | fhd_segmentation* depth_segmentation; 80 | 81 | int num_depth_edges; 82 | int num_normals_edges; 83 | 84 | int filtered_regions_capacity; 85 | int filtered_regions_len; 86 | fhd_region* filtered_regions; 87 | 88 | int* output_cell_indices; 89 | 90 | fhd_image output_depth; 91 | 92 | int candidates_capacity; 93 | int candidates_len; 94 | fhd_candidate* candidates; 95 | 96 | pcg_state_setseq_64* rng; 97 | 98 | int sampler_len; 99 | fhd_index_2d* sampler; 100 | uint16_t* cell_sample_buffer; 101 | }; 102 | 103 | void fhd_context_init(fhd_context* fhd, int source_w, int source_h, int cell_w, int cell_h); 104 | void fhd_run_pass(fhd_context* fhd, const uint16_t* source); 105 | void fhd_run_classifier(fhd_context* fhd, const fhd_classifier* classifier); 106 | void fhd_context_destroy(fhd_context* fhd); 107 | -------------------------------------------------------------------------------- /src/fhd_block_allocator.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_block_allocator.h" 2 | #include 3 | #include 4 | #include 5 | 6 | struct fhd_alloc_slot { 7 | void* ptr; 8 | int idx; 9 | }; 10 | 11 | struct fhd_block_allocator { 12 | int block_size; 13 | int num_bytes; 14 | int num_blocks; 15 | uint8_t* memory; 16 | int free_indices_len; 17 | int* free_indices; 18 | 19 | int full_slots_len; 20 | fhd_alloc_slot* full_slots; 21 | }; 22 | 23 | fhd_block_allocator* fhd_block_allocator_create(int block_size, 24 | int num_blocks) { 25 | fhd_block_allocator* block_alloc = 26 | (fhd_block_allocator*)calloc(1, sizeof(fhd_block_allocator)); 27 | 28 | block_alloc->block_size = block_size; 29 | block_alloc->num_bytes = block_size * num_blocks; 30 | block_alloc->num_blocks = num_blocks; 31 | block_alloc->memory = (uint8_t*)calloc(block_alloc->num_bytes, 1); 32 | block_alloc->free_indices_len = num_blocks; 33 | block_alloc->free_indices = (int*)calloc(num_blocks, sizeof(int)); 34 | block_alloc->full_slots_len = 0; 35 | block_alloc->full_slots = 36 | (fhd_alloc_slot*)calloc(num_blocks, sizeof(fhd_alloc_slot)); 37 | 38 | for (int i = 0; i < num_blocks; i++) { 39 | block_alloc->free_indices[i] = i; 40 | } 41 | 42 | return block_alloc; 43 | } 44 | 45 | void fhd_block_allocator_destroy(fhd_block_allocator* block_alloc) { 46 | free(block_alloc->memory); 47 | free(block_alloc->free_indices); 48 | free(block_alloc->full_slots); 49 | free(block_alloc); 50 | } 51 | 52 | void* fhd_block_allocator_acquire(fhd_block_allocator* block_alloc) { 53 | if (block_alloc->free_indices_len == 0) return NULL; 54 | 55 | const int free_idx = 56 | block_alloc->free_indices[block_alloc->free_indices_len - 1]; 57 | const int offset = free_idx * block_alloc->block_size; 58 | 59 | uint8_t* block = block_alloc->memory + offset; 60 | 61 | const fhd_alloc_slot slot = {block, free_idx}; 62 | block_alloc->full_slots[block_alloc->full_slots_len++] = slot; 63 | 64 | block_alloc->free_indices_len--; 65 | 66 | return block; 67 | } 68 | 69 | void fhd_block_allocator_release(fhd_block_allocator* block_alloc, void* ptr) { 70 | for (int i = 0; i < block_alloc->full_slots_len; i++) { 71 | fhd_alloc_slot slot = block_alloc->full_slots[i]; 72 | if (ptr == slot.ptr) { 73 | block_alloc->free_indices[block_alloc->free_indices_len] = slot.idx; 74 | 75 | for (int j = i; j < block_alloc->full_slots_len - 1; j++) { 76 | block_alloc->full_slots[j] = block_alloc->full_slots[j + 1]; 77 | } 78 | 79 | block_alloc->free_indices_len++; 80 | block_alloc->full_slots_len--; 81 | 82 | return; 83 | } 84 | } 85 | } 86 | 87 | void fhd_block_allocator_clear(fhd_block_allocator* block_alloc) { 88 | for (int i = 0; i < block_alloc->full_slots_len; i++) { 89 | block_alloc->free_indices[block_alloc->free_indices_len++] = 90 | block_alloc->full_slots[i].idx; 91 | } 92 | 93 | block_alloc->full_slots_len = 0; 94 | } 95 | -------------------------------------------------------------------------------- /src/fhd_block_allocator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct fhd_block_allocator; 4 | 5 | fhd_block_allocator* fhd_block_allocator_create(int block_size, int num_blocks); 6 | void fhd_block_allocator_destroy(fhd_block_allocator* block_alloc); 7 | void* fhd_block_allocator_acquire(fhd_block_allocator* block_alloc); 8 | void fhd_block_allocator_release(fhd_block_allocator* block_alloc, void* ptr); 9 | void fhd_block_allocator_clear(fhd_block_allocator* block_alloc); 10 | -------------------------------------------------------------------------------- /src/fhd_candidate.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_candidate.h" 2 | #include "fhd_config.h" 3 | #include "fhd_math.h" 4 | #include 5 | #include 6 | #include 7 | 8 | void fhd_hog_calculate_cells(const fhd_image* img, fhd_hog_cell* out) { 9 | const int width = img->width; 10 | for (int y = 0; y < FHD_HOG_HEIGHT; y++) { 11 | for (int x = 0; x < FHD_HOG_WIDTH; x++) { 12 | const int idx = (y + 1) * width + (x + 1); 13 | const int16_t pv_y = int16_t(img->data[idx - width]); 14 | const int16_t pv_x = int16_t(img->data[idx - 1]); 15 | const int16_t nv_x = int16_t(img->data[idx + 1]); 16 | const int16_t nv_y = int16_t(img->data[idx + width]); 17 | 18 | fhd_vec2 grad; 19 | if (pv_x == 0 || nv_x == 0) { 20 | grad.x = 0.f; 21 | } else { 22 | grad.x = float(nv_x - pv_x) / 1000.f; 23 | } 24 | 25 | if (pv_y == 0 || nv_y == 0) { 26 | grad.y = 0.f; 27 | } else { 28 | grad.y = float(nv_y - pv_y) / 1000.f; 29 | } 30 | 31 | const float magnitude = fhd_vec2_length(grad); 32 | const float num_bins = float(FHD_HOG_BINS); 33 | const float angle = 34 | (fhd_fast_atan2(grad.y, grad.x) + F_PI) / (2.f * F_PI); 35 | const int bin = int(angle * num_bins + FLT_EPSILON) % FHD_HOG_BINS; 36 | assert(bin >= 0 && bin < FHD_HOG_BINS); 37 | 38 | const int cell_x = x / FHD_HOG_CELL_SIZE; 39 | const int cell_y = y / FHD_HOG_CELL_SIZE; 40 | const int cell_idx = 41 | cell_y * (FHD_HOG_WIDTH / FHD_HOG_CELL_SIZE) + cell_x; 42 | 43 | out[cell_idx].bins[bin] += magnitude; 44 | } 45 | } 46 | } 47 | 48 | void fhd_hog_create_features(const fhd_hog_cell* cells, float* features) { 49 | for (int y = 0; y < FHD_HOG_BLOCKS_Y; y++) { 50 | for (int x = 0; x < FHD_HOG_BLOCKS_X; x++) { 51 | int block_idx = y * FHD_HOG_BLOCKS_X + x; 52 | int features_offset = FHD_HOG_BLOCK_LEN * block_idx; 53 | 54 | float squared_sum = 1.f; 55 | int block_elem_idx = 0; 56 | for (int cy = 0; cy < FHD_HOG_BLOCK_SIZE; cy++) { 57 | for (int cx = 0; cx < FHD_HOG_BLOCK_SIZE; cx++) { 58 | int cell_x = x + cx; 59 | int cell_y = y + cy; 60 | int cell_idx = cell_y * (FHD_HOG_WIDTH / FHD_HOG_CELL_SIZE) + cell_x; 61 | const fhd_hog_cell* cell = &cells[cell_idx]; 62 | for (int bin = 0; bin < FHD_HOG_BINS; bin++) { 63 | float v = cell->bins[bin]; 64 | squared_sum += v * v; 65 | features[features_offset + block_elem_idx] = v; 66 | block_elem_idx++; 67 | } 68 | } 69 | } 70 | 71 | float normalization_factor = 1.f / sqrtf(squared_sum); 72 | for (int j = 0; j < FHD_HOG_BLOCK_LEN; j++) { 73 | const int idx = features_offset + j; 74 | const float v = (features[idx] * normalization_factor) * 2.f - 1.f; 75 | features[idx] = v; 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/fhd_candidate.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fhd_image.h" 4 | #include "fhd_math.h" 5 | 6 | struct fhd_hog_cell { 7 | float bins[9]; 8 | }; 9 | 10 | struct fhd_candidate { 11 | int candidate_width; 12 | int candidate_height; 13 | fhd_image depth; 14 | fhd_image_region depth_position; 15 | 16 | int num_cells; 17 | fhd_hog_cell* cells; 18 | 19 | int num_features; 20 | float* features; 21 | 22 | float weight; 23 | }; 24 | 25 | struct fhd_result { 26 | int num_features; 27 | int human; 28 | float* features; 29 | }; 30 | 31 | void fhd_hog_calculate_cells(const fhd_image* img, fhd_hog_cell* out); 32 | void fhd_hog_create_features(const fhd_hog_cell* cells, float* features); 33 | -------------------------------------------------------------------------------- /src/fhd_candidate_db.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct sqlite3; 4 | struct sqlite3_stmt; 5 | struct fhd_candidate; 6 | struct fhd_result; 7 | 8 | struct fhd_candidate_db { 9 | sqlite3* db = nullptr; 10 | sqlite3_stmt* existing_query = nullptr; 11 | sqlite3_stmt* insert_query = nullptr; 12 | sqlite3_stmt* update_query = nullptr; 13 | sqlite3_stmt* features_query = nullptr; 14 | }; 15 | 16 | bool fhd_candidate_db_init(fhd_candidate_db* db, const char* db_name, bool read_only = false); 17 | void fhd_candidate_db_close(fhd_candidate_db* db); 18 | void fhd_candidate_db_add_candidate(fhd_candidate_db* db, 19 | const fhd_candidate* candidate, 20 | bool is_human); 21 | int fhd_candidate_db_get_count(fhd_candidate_db* db); 22 | int fhd_candidate_db_get_features(fhd_candidate_db* db, fhd_result* results, 23 | int max_results); 24 | const char* fhd_candidate_db_name(const fhd_candidate_db* db); 25 | -------------------------------------------------------------------------------- /src/fhd_classifier.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_classifier.h" 2 | #include "fhd_candidate.h" 3 | #include 4 | 5 | struct fhd_classifier { 6 | fann* nn; 7 | }; 8 | 9 | fhd_classifier* fhd_classifier_create(const char* nn_file) { 10 | fann* nn = fann_create_from_file(nn_file); 11 | if (nn) { 12 | fhd_classifier* classifier = (fhd_classifier*)calloc(1, sizeof(fhd_classifier)); 13 | classifier->nn = nn; 14 | return classifier; 15 | } 16 | 17 | return NULL; 18 | } 19 | 20 | float fhd_classify(const fhd_classifier* classifier, const fhd_candidate* candidate) { 21 | float* output = fann_run(classifier->nn, candidate->features); 22 | return output[0]; 23 | } 24 | 25 | void fhd_classifier_destroy(fhd_classifier* classifier) { 26 | if (classifier) { 27 | fann_destroy(classifier->nn); 28 | free(classifier); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/fhd_classifier.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct fhd_candidate; 4 | struct fhd_classifier; 5 | 6 | fhd_classifier* fhd_classifier_create(const char* nn_file); 7 | float fhd_classify(const fhd_classifier* classifier, const fhd_candidate* candidate); 8 | void fhd_classifier_destroy(fhd_classifier* classifier); 9 | -------------------------------------------------------------------------------- /src/fhd_config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define FHD_DEBUG_GRADIENTS 0 4 | #define FHD_PLANAR_REGIONS 0 5 | 6 | #ifndef FHD_NUM_THREADS 7 | #define FHD_NUM_THREADS 4 8 | #endif 9 | 10 | const int FHD_HOG_WIDTH = 64; 11 | const int FHD_HOG_HEIGHT = 128; 12 | const int FHD_HOG_BLOCK_SIZE = 2; // 2x2 cells per block 13 | const int FHD_HOG_CELL_SIZE = 8; // 8x8 pixels per cell 14 | const int FHD_HOG_BINS = 9; 15 | const int FHD_HOG_BLOCKS_X = 16 | (FHD_HOG_WIDTH - FHD_HOG_CELL_SIZE * 2) / FHD_HOG_CELL_SIZE + 1; 17 | const int FHD_HOG_BLOCKS_Y = 18 | (FHD_HOG_HEIGHT - FHD_HOG_CELL_SIZE * 2) / FHD_HOG_CELL_SIZE + 1; 19 | const int FHD_HOG_BLOCK_LEN = 20 | FHD_HOG_BINS * FHD_HOG_BLOCK_SIZE * FHD_HOG_BLOCK_SIZE; 21 | -------------------------------------------------------------------------------- /src/fhd_frame_source.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct fhd_frame_source { 6 | virtual const uint16_t* get_frame() = 0; 7 | virtual void advance() {} 8 | virtual void jump(int frame) { (void)frame; } 9 | virtual int current_frame() const = 0; 10 | virtual int total_frames() const = 0; 11 | virtual ~fhd_frame_source() {} 12 | }; 13 | -------------------------------------------------------------------------------- /src/fhd_hash.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_hash.h" 2 | 3 | fhd_fnv1a fhd_fnv1a_create() { 4 | fhd_fnv1a s; 5 | s.state = 14695981039346656037u; 6 | return s; 7 | } 8 | 9 | uint64_t fhd_fnv1a_hash(fhd_fnv1a* hash_state, const void* data, int length) { 10 | uint8_t* begin = (uint8_t*)data; 11 | uint8_t* end = begin + length; 12 | for (; begin < end; begin++) { 13 | hash_state->state = (hash_state->state ^ *begin) * 1099511628211u; 14 | } 15 | 16 | return hash_state->state; 17 | } 18 | 19 | uint64_t fhd_fnv1a_hash(const void* data, int length) { 20 | fhd_fnv1a s = fhd_fnv1a_create(); 21 | return fhd_fnv1a_hash(&s, data, length); 22 | } 23 | -------------------------------------------------------------------------------- /src/fhd_hash.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct fhd_fnv1a { 6 | uint64_t state; 7 | }; 8 | 9 | fhd_fnv1a fhd_fnv1a_create(); 10 | uint64_t fhd_fnv1a_hash(const void* data, int length); 11 | uint64_t fhd_fnv1a_hash(fhd_fnv1a* hash_state, const void* data, int length); 12 | -------------------------------------------------------------------------------- /src/fhd_image.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | struct fhd_image { 6 | int width; 7 | int height; 8 | int len; 9 | int pitch; 10 | int bytes; 11 | uint16_t* data; 12 | }; 13 | 14 | struct fhd_image_region { 15 | int x; 16 | int y; 17 | int width; 18 | int height; 19 | }; 20 | 21 | void fhd_image_init(fhd_image* img, int w, int h); 22 | void fhd_image_destroy(fhd_image* img); 23 | void fhd_image_clear(fhd_image* img, uint16_t v); 24 | // maps each fhd_image value from [a, b] to [c, d] 25 | void fhd_image_map_values(fhd_image* img, uint16_t a, uint16_t b, uint16_t c, 26 | uint16_t d); 27 | void fhd_copy_sub_image(const fhd_image* src, const fhd_image_region* src_reg, 28 | fhd_image* dst, const fhd_image_region* dst_reg); 29 | void fhd_copy_sub_image_scale(const fhd_image* src, 30 | const fhd_image_region* src_reg, fhd_image* dst, 31 | const fhd_image_region* dst_reg); 32 | void transpose_simd_8(const fhd_image* src, fhd_image* dst); 33 | void fhd_image_flip_x(const fhd_image* src, fhd_image* dst); 34 | -------------------------------------------------------------------------------- /src/fhd_kinect.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_kinect.h" 2 | 3 | const float FHD_KINECT_CX = 255.8f; 4 | const float FHD_KINECT_CY = 203.7f; 5 | const float FHD_KINECT_FX = 364.7f; 6 | const float FHD_KINECT_FY = 366.1f; 7 | 8 | fhd_vec2 fhd_kinect_coord_to_depth(fhd_vec3 p) { 9 | fhd_vec2 r; 10 | r.x = 11 | fhd_clamp((p.x * FHD_KINECT_FX) / p.z + FHD_KINECT_CX, 0.f, FHD_KINECT_W); 12 | r.y = fhd_clamp(-(p.y * FHD_KINECT_FY) / p.z + FHD_KINECT_CY, 0.f, 13 | FHD_KINECT_H); 14 | return r; 15 | }; 16 | 17 | fhd_vec3 fhd_depth_to_3d(float depth, float x, float y) { 18 | return {((x - FHD_KINECT_CX) / FHD_KINECT_FX) * depth, 19 | ((y - FHD_KINECT_CY) / FHD_KINECT_FY) * -depth, depth}; 20 | } 21 | -------------------------------------------------------------------------------- /src/fhd_kinect.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fhd_math.h" 4 | 5 | const float FHD_KINECT_W = 512.f; 6 | const float FHD_KINECT_H = 424.f; 7 | 8 | fhd_vec2 fhd_kinect_coord_to_depth(fhd_vec3 p); 9 | fhd_vec3 fhd_depth_to_3d(float depth, float x, float y); 10 | -------------------------------------------------------------------------------- /src/fhd_math.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | const float F_PI = 3.14159265358979323846f; 4 | const float F_PI_2 = F_PI * 0.5f; 5 | const float F_PI_4 = F_PI * 0.25f; 6 | 7 | struct fhd_vec2 { 8 | float x; 9 | float y; 10 | }; 11 | 12 | struct fhd_vec3 { 13 | float x; 14 | float y; 15 | float z; 16 | }; 17 | 18 | struct fhd_aabb { 19 | fhd_vec2 top_left; 20 | fhd_vec2 bot_right; 21 | }; 22 | 23 | struct fhd_plane { 24 | fhd_vec3 n; 25 | float d; 26 | }; 27 | 28 | fhd_vec2 fhd_vec2_sub(fhd_vec2 a, fhd_vec2 b); 29 | fhd_vec2 fhd_vec2_normalize(fhd_vec2 v); 30 | fhd_vec2 fhd_vec2_mul(fhd_vec2 a, float s); 31 | fhd_vec2 fhd_vec2_mul_pcw(fhd_vec2 a, fhd_vec2 b); 32 | float fhd_vec2_distance(fhd_vec2 a, fhd_vec2 b); 33 | float fhd_vec2_length(fhd_vec2 v); 34 | 35 | fhd_vec3 fhd_vec3_normalize(fhd_vec3 v); 36 | float fhd_vec3_dot(fhd_vec3 a, fhd_vec3 b); 37 | fhd_vec3 fhd_vec3_sub(fhd_vec3 a, fhd_vec3 b); 38 | fhd_vec3 fhd_vec3_cross(fhd_vec3 u, fhd_vec3 v); 39 | 40 | void fhd_aabb_expand(fhd_aabb* bbox, fhd_vec2 point); 41 | fhd_vec2 fhd_aabb_center(const fhd_aabb* bbox); 42 | bool fhd_aabb_overlap(const fhd_aabb* a, const fhd_aabb* b); 43 | fhd_vec2 fhd_aabb_size(const fhd_aabb* a); 44 | fhd_aabb fhd_aabb_from_points(const fhd_vec2* points, int len); 45 | 46 | float fhd_plane_point_dist(fhd_plane p, fhd_vec3 q); 47 | fhd_plane fhd_make_plane(fhd_vec3 a, fhd_vec3 b, fhd_vec3 c); 48 | 49 | template 50 | T fhd_map_range(T x, T a, T b, T c, T d) { 51 | return (x - a) * (d - c) / (b - a) + c; 52 | } 53 | 54 | template 55 | T fhd_clamp(T v, T min, T max) { 56 | if (v < min) return min; 57 | if (v > max) return max; 58 | 59 | return v; 60 | } 61 | 62 | float fhd_fast_atan2(float y, float x); 63 | 64 | fhd_vec3 fhd_pcl_normal(const fhd_vec3* points, int len); 65 | -------------------------------------------------------------------------------- /src/fhd_perf.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_perf.h" 2 | 3 | #ifdef _WIN32 4 | #include 5 | #else 6 | #include 7 | #endif 8 | uint64_t fhd_rdtsc() { return __rdtsc(); } 9 | -------------------------------------------------------------------------------- /src/fhd_perf.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | enum fhd_perf_record_type { 6 | pr_normalize_depth, 7 | pr_construct_pcl, 8 | pr_segment_depth, 9 | pr_construct_normals, 10 | pr_segment_normals, 11 | pr_construct_regions, 12 | pr_merge_regions, 13 | pr_copy_regions, 14 | pr_calc_hog, 15 | pr_create_features, 16 | pr_classify, 17 | PERF_RECORD_COUNT 18 | }; 19 | 20 | static const char* const fhd_perf_record_names[PERF_RECORD_COUNT] = { 21 | "normalize depth", "construct point cloud", "segment depth", 22 | "construct normals", "segment normals", "construct regions", 23 | "merge regions", "copy regions", "calculate HOG", 24 | "create features", "classify"}; 25 | 26 | struct fhd_perf_record { 27 | uint64_t cycles; 28 | uint64_t count; 29 | uint64_t avg_cycles; 30 | }; 31 | 32 | uint64_t fhd_rdtsc(); 33 | 34 | struct fhd_timed_block { 35 | fhd_perf_record* record; 36 | uint64_t start = 0; 37 | 38 | fhd_timed_block(fhd_perf_record* r) : record(r), start(fhd_rdtsc()) {} 39 | 40 | ~fhd_timed_block() { 41 | uint64_t end = fhd_rdtsc(); 42 | uint64_t cycles = end - start; 43 | record->cycles += cycles; 44 | record->count += 1; 45 | record->avg_cycles = record->cycles / record->count; 46 | } 47 | }; 48 | 49 | #define FHD_TIMED_BLOCK(r) fhd_timed_block tblock_##__LINE__(r) 50 | -------------------------------------------------------------------------------- /src/fhd_sampler.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_sampler.h" 2 | #include 3 | 4 | // Based on http://gruenschloss.org/diag0m2/gendiag0m2.h 5 | 6 | inline static int vdc(int bits) { 7 | bits = (bits << 16) | (bits >> 16); 8 | bits = ((bits & 0x00ff00ff) << 8) | ((bits & 0xff00ff00) >> 8); 9 | bits = ((bits & 0x0f0f0f0f) << 4) | ((bits & 0xf0f0f0f0) >> 4); 10 | bits = ((bits & 0x33333333) << 2) | ((bits & 0xcccccccc) >> 2); 11 | bits = ((bits & 0x55555555) << 1) | ((bits & 0xaaaaaaaa) >> 1); 12 | return bits; 13 | } 14 | 15 | int fhd_make_sampler(int m, int scale, fhd_index_2d* out, int len) { 16 | int n = 1 << m; 17 | int m2 = (m + 1) >> 1; 18 | int mask = ~-(1 << m2); 19 | int sqrtN = 1 << (m >> 1); 20 | int* d = (int*)calloc(sqrtN, sizeof(int)); 21 | 22 | const double norm_scale = 1.0 / (1ULL << m); 23 | int to_write = n > len ? len : n; 24 | int dx; 25 | int dy; 26 | 27 | if (m & 1) { 28 | dx = dy = m >> 1; 29 | for (int k = 0; k < sqrtN; k++) { 30 | d[k] = (vdc(k) >> (32 - m)) + k; 31 | } 32 | } else { 33 | dx = (m >> 1) - 2; 34 | dy = m >> 1; 35 | for (int k = 0; k < sqrtN; k++) { 36 | d[k] = (vdc(k) >> (32 - m)) + (k >> 2) + (1 << dx); 37 | } 38 | } 39 | 40 | for (int i = 0; i < to_write; i++) { 41 | const int k = i >> m2; 42 | const int j = i & mask; 43 | 44 | int x = (d[k] + (j << dx)) & (n - 1); 45 | int y = k + (j << dy); 46 | 47 | const double tx = norm_scale * x * scale; 48 | const double ty = norm_scale * y * scale; 49 | out[i].x = int(tx); 50 | out[i].y = int(ty); 51 | } 52 | 53 | free(d); 54 | return to_write; 55 | } 56 | -------------------------------------------------------------------------------- /src/fhd_sampler.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct fhd_index_2d { 4 | int x; 5 | int y; 6 | }; 7 | 8 | int fhd_make_sampler(int m, int scale, fhd_index_2d* out, int len); 9 | -------------------------------------------------------------------------------- /src/fhd_segmentation.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_segmentation.h" 2 | #include 3 | 4 | // Efficient Graph Based Image Segmentation 5 | // by Pedro F. Felzenswalb, Daniel P.Huttenlocher 6 | // Code taken from http://cs.brown.edu/~pff/segment/ 7 | 8 | inline float threshold_value(float size, float c) { return c / size; } 9 | 10 | int fhd_segmentation_find(fhd_segmentation* u, int x) { 11 | int y = x; 12 | while (y != u->nodes[y].p) { 13 | y = u->nodes[y].p; 14 | } 15 | 16 | u->nodes[x].p = y; 17 | return y; 18 | } 19 | 20 | void fhd_segmentation_reset(fhd_segmentation* u) { 21 | u->num_nodes = u->num_initial_nodes; 22 | for (int i = 0; i < u->num_initial_nodes; i++) { 23 | u->nodes[i].size = 1; 24 | u->nodes[i].p = i; 25 | } 26 | } 27 | 28 | void fhd_segmentation_init(fhd_segmentation* u, int num_elements) { 29 | u->num_initial_nodes = num_elements; 30 | u->threshold = (float*)calloc(num_elements, sizeof(float)); 31 | u->nodes = (fhd_seg_node*)calloc(num_elements, sizeof(fhd_seg_node)); 32 | 33 | fhd_segmentation_reset(u); 34 | } 35 | 36 | void fhd_segmentation_destroy(fhd_segmentation* u) { 37 | free(u->nodes); 38 | free(u->threshold); 39 | free(u); 40 | } 41 | 42 | void fhd_segmentation_join(fhd_segmentation* u, int x, int y) { 43 | fhd_seg_node* nodes = u->nodes; 44 | if (nodes[x].rank > nodes[y].rank) { 45 | nodes[y].p = x; 46 | nodes[x].size += nodes[y].size; 47 | } else { 48 | nodes[x].p = y; 49 | nodes[y].size += nodes[x].size; 50 | 51 | if (nodes[x].rank == nodes[y].rank) { 52 | nodes[y].rank++; 53 | } 54 | } 55 | 56 | u->num_nodes--; 57 | } 58 | 59 | int fhd_segmentation_size(const fhd_segmentation* u, int x) { 60 | return u->nodes[x].size; 61 | } 62 | 63 | void fhd_segment_graph(fhd_segmentation* u, fhd_edge* edges, int num_edges, 64 | float c, int min_size) { 65 | std::sort(edges, edges + num_edges, [](const fhd_edge& a, const fhd_edge& b) { 66 | return a.weight < b.weight; 67 | }); 68 | 69 | for (int i = 0; i < u->num_initial_nodes; i++) { 70 | u->threshold[i] = threshold_value(1.f, c); 71 | } 72 | 73 | for (int i = 0; i < num_edges; i++) { 74 | fhd_edge* e = &edges[i]; 75 | 76 | int a = fhd_segmentation_find(u, e->a); 77 | int b = fhd_segmentation_find(u, e->b); 78 | 79 | if (a != b) { 80 | if (e->weight <= u->threshold[a] && e->weight <= u->threshold[b]) { 81 | fhd_segmentation_join(u, a, b); 82 | a = fhd_segmentation_find(u, a); 83 | u->threshold[a] = 84 | e->weight + threshold_value(float(fhd_segmentation_size(u, a)), c); 85 | } 86 | } 87 | } 88 | 89 | for (int i = 0; i < num_edges; i++) { 90 | fhd_edge* e = &edges[i]; 91 | int a = fhd_segmentation_find(u, e->a); 92 | int b = fhd_segmentation_find(u, e->b); 93 | if (a != b && (fhd_segmentation_size(u, a) < min_size || 94 | fhd_segmentation_size(u, b) < min_size)) { 95 | fhd_segmentation_join(u, a, b); 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/fhd_segmentation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | struct fhd_edge { 4 | int a; 5 | int b; 6 | float weight; 7 | }; 8 | 9 | struct fhd_seg_node { 10 | int rank; 11 | int p; 12 | int size; 13 | }; 14 | 15 | struct fhd_segmentation { 16 | int num_initial_nodes; 17 | int num_nodes; 18 | float* threshold; 19 | fhd_seg_node* nodes; 20 | }; 21 | 22 | int fhd_segmentation_find(fhd_segmentation* u, int x); 23 | void fhd_segmentation_reset(fhd_segmentation* u); 24 | void fhd_segmentation_init(fhd_segmentation* u, int num_elements); 25 | void fhd_segmentation_destroy(fhd_segmentation* u); 26 | void fhd_segmentation_join(fhd_segmentation* u, int x, int y); 27 | int fhd_segmentation_size(const fhd_segmentation* u, int x); 28 | void fhd_segment_graph(fhd_segmentation* u, fhd_edge* edges, int num_edges, 29 | float c, int min_size); 30 | -------------------------------------------------------------------------------- /src/fhd_sqlite_source.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_sqlite_source.h" 2 | #include "sqlite3/sqlite3.h" 3 | #include "fhd_math.h" 4 | #include 5 | #include 6 | #include 7 | 8 | fhd_sqlite_source::fhd_sqlite_source(const char* database) { 9 | int res = sqlite3_open_v2(database, &db, SQLITE_OPEN_READONLY, NULL); 10 | if (res != SQLITE_OK) { 11 | printf("failed to open %s: %s\n", database, sqlite3_errmsg(db)); 12 | } 13 | 14 | res = sqlite3_prepare( 15 | db, "SELECT rowid, data FROM depth_frames WHERE rowid = (?)", -1, 16 | &frame_query, NULL); 17 | 18 | if (res != SQLITE_OK) { 19 | printf("failed to compile query: %s\n", sqlite3_errmsg(db)); 20 | } 21 | 22 | if (!res) { 23 | sqlite3_stmt* count_stmt = NULL; 24 | sqlite3_prepare_v2(db, "SELECT count(*) FROM depth_frames", -1, &count_stmt, 25 | NULL); 26 | 27 | res = sqlite3_step(count_stmt); 28 | 29 | if (res == SQLITE_ROW) { 30 | db_total_frames = sqlite3_column_int(count_stmt, 0); 31 | depth_data_len = 512 * 424; 32 | depth_data = (uint16_t*)calloc(depth_data_len, sizeof(uint16_t)); 33 | } 34 | 35 | sqlite3_finalize(count_stmt); 36 | } 37 | } 38 | 39 | fhd_sqlite_source::~fhd_sqlite_source() { 40 | sqlite3_close_v2(db); 41 | free(depth_data); 42 | } 43 | 44 | const uint16_t* fhd_sqlite_source::get_frame() { 45 | if (!db || db_total_frames == 0) return NULL; 46 | 47 | advance(); 48 | 49 | return depth_data; 50 | } 51 | 52 | void fhd_sqlite_source::advance() { 53 | sqlite3_reset(frame_query); 54 | sqlite3_bind_int(frame_query, 1, db_current_frame); 55 | int res; 56 | 57 | while ((res = sqlite3_step(frame_query)) == SQLITE_ROW) { 58 | const void* blob = sqlite3_column_blob(frame_query, 1); 59 | int bytes = sqlite3_column_bytes(frame_query, 1); 60 | const int req_depth_bytes = depth_data_len * sizeof(uint16_t); 61 | assert(bytes == req_depth_bytes); 62 | int bytes_to_copy = bytes; 63 | if (bytes_to_copy > req_depth_bytes) bytes_to_copy = req_depth_bytes; 64 | memcpy(depth_data, blob, bytes_to_copy); 65 | 66 | db_current_frame++; 67 | if (db_current_frame > db_total_frames) db_current_frame = 1; 68 | } 69 | 70 | if (res != SQLITE_DONE) { 71 | printf("failed to query frame: %s\n", sqlite3_errmsg(db)); 72 | } 73 | } 74 | 75 | int fhd_sqlite_source::current_frame() const { 76 | return db_current_frame; 77 | } 78 | 79 | int fhd_sqlite_source::total_frames() const { 80 | return db_total_frames; 81 | } 82 | 83 | void fhd_sqlite_source::jump(int frame) { 84 | db_current_frame = frame - 1; 85 | if (db_current_frame < 1) { 86 | db_current_frame = 1; 87 | } else if (db_current_frame > db_total_frames) { 88 | db_current_frame = db_total_frames; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/fhd_sqlite_source.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "fhd_frame_source.h" 4 | #include 5 | 6 | struct sqlite3; 7 | struct sqlite3_stmt; 8 | 9 | struct fhd_sqlite_source : fhd_frame_source { 10 | fhd_sqlite_source(const char* database); 11 | ~fhd_sqlite_source(); 12 | void advance() override; 13 | void jump(int frame) override; 14 | int current_frame() const override; 15 | int total_frames() const override; 16 | const uint16_t* get_frame() override; 17 | 18 | sqlite3* db = NULL; 19 | sqlite3_stmt* frame_query = NULL; 20 | 21 | int db_total_frames = 0; 22 | int db_current_frame = 1; 23 | int depth_data_len = 0; 24 | uint16_t* depth_data = NULL; 25 | }; 26 | -------------------------------------------------------------------------------- /src/imgui/imconfig.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // USER IMPLEMENTATION 3 | // This file contains compile-time options for ImGui. 4 | // Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO(). 5 | //----------------------------------------------------------------------------- 6 | 7 | #pragma once 8 | 9 | //---- Define assertion handler. Defaults to calling assert(). 10 | //#define IM_ASSERT(_EXPR) MyAssert(_EXPR) 11 | 12 | //---- Define attributes of all API symbols declarations, e.g. for DLL under Windows. 13 | //#define IMGUI_API __declspec( dllexport ) 14 | //#define IMGUI_API __declspec( dllimport ) 15 | 16 | //---- Include imgui_user.h at the end of imgui.h 17 | //#define IMGUI_INCLUDE_IMGUI_USER_H 18 | 19 | //---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions) 20 | //#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS 21 | //#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS 22 | 23 | //---- Don't implement help and test window functionality (ShowUserGuide()/ShowStyleEditor()/ShowTestWindow() methods will be empty) 24 | //#define IMGUI_DISABLE_TEST_WINDOWS 25 | 26 | //---- Don't define obsolete functions names 27 | //#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS 28 | 29 | //---- Implement STB libraries in a namespace to avoid conflicts 30 | //#define IMGUI_STB_NAMESPACE ImGuiStb 31 | 32 | //---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4. 33 | /* 34 | #define IM_VEC2_CLASS_EXTRA \ 35 | ImVec2(const MyVec2& f) { x = f.x; y = f.y; } \ 36 | operator MyVec2() const { return MyVec2(x,y); } 37 | 38 | #define IM_VEC4_CLASS_EXTRA \ 39 | ImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; } \ 40 | operator MyVec4() const { return MyVec4(x,y,z,w); } 41 | */ 42 | 43 | //---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files. 44 | //---- e.g. create variants of the ImGui::Value() helper for your low-level math types, or your own widgets/helpers. 45 | /* 46 | namespace ImGui 47 | { 48 | void Value(const char* prefix, const MyMatrix44& v, const char* float_format = NULL); 49 | } 50 | */ 51 | 52 | -------------------------------------------------------------------------------- /src/imgui/imgui_impl_glfw.h: -------------------------------------------------------------------------------- 1 | // ImGui GLFW binding with OpenGL 2 | // In this binding, ImTextureID is used to store an OpenGL 'GLuint' texture identifier. Read the FAQ about ImTextureID in imgui.cpp. 3 | 4 | // If your context is GL3/GL3 then prefer using the code in opengl3_example. 5 | // You *might* use this code with a GL3/GL4 context but make sure you disable the programmable pipeline by calling "glUseProgram(0)" before ImGui::Render(). 6 | // We cannot do that from GL2 code because the function doesn't exist. 7 | 8 | // You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this. 9 | // If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown(). 10 | // If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp. 11 | // https://github.com/ocornut/imgui 12 | 13 | struct GLFWwindow; 14 | 15 | IMGUI_API bool ImGui_ImplGlfw_Init(GLFWwindow* window, bool install_callbacks); 16 | IMGUI_API void ImGui_ImplGlfw_Shutdown(); 17 | IMGUI_API void ImGui_ImplGlfw_NewFrame(); 18 | 19 | // Use if you want to reset your rendering device without losing ImGui state. 20 | IMGUI_API void ImGui_ImplGlfw_InvalidateDeviceObjects(); 21 | IMGUI_API bool ImGui_ImplGlfw_CreateDeviceObjects(); 22 | 23 | // GLFW callbacks (installed by default if you enable 'install_callbacks' during initialization) 24 | // Provided here if you want to chain callbacks. 25 | // You can also handle inputs yourself and use those as a reference. 26 | IMGUI_API void ImGui_ImplGlfw_MouseButtonCallback(GLFWwindow* window, int button, int action, int mods); 27 | IMGUI_API void ImGui_ImplGlfw_ScrollCallback(GLFWwindow* window, double xoffset, double yoffset); 28 | IMGUI_API void ImGui_ImplGlFw_KeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods); 29 | IMGUI_API void ImGui_ImplGlfw_CharCallback(GLFWwindow* window, unsigned int c); 30 | -------------------------------------------------------------------------------- /src/pcg/pcg_basic.h: -------------------------------------------------------------------------------- 1 | /* 2 | * PCG Random Number Generation for C. 3 | * 4 | * Copyright 2014 Melissa O'Neill 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | * 18 | * For additional information about the PCG random number generation scheme, 19 | * including its license and other licensing options, visit 20 | * 21 | * http://www.pcg-random.org 22 | */ 23 | 24 | /* 25 | * This code is derived from the full C implementation, which is in turn 26 | * derived from the canonical C++ PCG implementation. The C++ version 27 | * has many additional features and is preferable if you can use C++ in 28 | * your project. 29 | */ 30 | 31 | #ifndef PCG_BASIC_H_INCLUDED 32 | #define PCG_BASIC_H_INCLUDED 1 33 | 34 | #include 35 | 36 | #if __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | struct pcg_state_setseq_64 { // Internals are *Private*. 41 | uint64_t state; // RNG state. All values are possible. 42 | uint64_t inc; // Controls which RNG sequence (stream) is 43 | // selected. Must *always* be odd. 44 | }; 45 | typedef struct pcg_state_setseq_64 pcg32_random_t; 46 | 47 | // If you *must* statically initialize it, here's one. 48 | 49 | #define PCG32_INITIALIZER { 0x853c49e6748fea9bULL, 0xda3e39cb94b95bdbULL } 50 | 51 | // pcg32_srandom(initstate, initseq) 52 | // pcg32_srandom_r(rng, initstate, initseq): 53 | // Seed the rng. Specified in two parts, state initializer and a 54 | // sequence selection constant (a.k.a. stream id) 55 | 56 | void pcg32_srandom(uint64_t initstate, uint64_t initseq); 57 | void pcg32_srandom_r(pcg32_random_t* rng, uint64_t initstate, 58 | uint64_t initseq); 59 | 60 | // pcg32_random() 61 | // pcg32_random_r(rng) 62 | // Generate a uniformly distributed 32-bit random number 63 | 64 | uint32_t pcg32_random(void); 65 | uint32_t pcg32_random_r(pcg32_random_t* rng); 66 | 67 | // pcg32_boundedrand(bound): 68 | // pcg32_boundedrand_r(rng, bound): 69 | // Generate a uniformly distributed number, r, where 0 <= r < bound 70 | 71 | uint32_t pcg32_boundedrand(uint32_t bound); 72 | uint32_t pcg32_boundedrand_r(pcg32_random_t* rng, uint32_t bound); 73 | 74 | #if __cplusplus 75 | } 76 | #endif 77 | 78 | #endif // PCG_BASIC_H_INCLUDED 79 | -------------------------------------------------------------------------------- /src/tools/fhd_debug_frame_source.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_debug_frame_source.h" 2 | #include 3 | #include 4 | 5 | fhd_debug_frame_source::fhd_debug_frame_source() 6 | : depth_data((uint16_t*)calloc(512 * 424, sizeof(uint16_t))) { 7 | } 8 | 9 | fhd_debug_frame_source::~fhd_debug_frame_source() { 10 | free(depth_data); 11 | } 12 | 13 | const uint16_t* fhd_debug_frame_source::get_frame() { 14 | for (int i = 0; i < 512 * 424; i++) { 15 | depth_data[i] = 500 + uint16_t(4200.f * fabsf(sinf(float(i / 1000.f) / (frame + 1)))); 16 | } 17 | 18 | frame = (frame + 1) % 100; 19 | return depth_data; 20 | } 21 | 22 | int fhd_debug_frame_source::current_frame() const { 23 | return frame; 24 | } 25 | 26 | int fhd_debug_frame_source::total_frames() const { 27 | return 100; 28 | } 29 | -------------------------------------------------------------------------------- /src/tools/fhd_debug_frame_source.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../fhd_frame_source.h" 4 | 5 | struct fhd_debug_frame_source : fhd_frame_source { 6 | fhd_debug_frame_source(); 7 | ~fhd_debug_frame_source(); 8 | const uint16_t* get_frame() override; 9 | int current_frame() const override; 10 | int total_frames() const override; 11 | 12 | int frame = 0; 13 | uint16_t* depth_data; 14 | }; 15 | -------------------------------------------------------------------------------- /src/tools/fhd_filebrowser.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_filebrowser.h" 2 | #include "../tinydir/tinydir.h" 3 | 4 | fhd_filebrowser::fhd_filebrowser(const char* root) { 5 | set_root(root); 6 | } 7 | 8 | void fhd_filebrowser::set_root(const char* root) { 9 | tinydir_dir dir; 10 | if (tinydir_open_sorted(&dir, root) != -1) { 11 | files.clear(); 12 | 13 | for (size_t i = 0; i < dir.n_files; i++) { 14 | tinydir_file f; 15 | tinydir_readfile_n(&dir, &f, i); 16 | if (strcmp(f.name, ".") != 0) { 17 | files.push_back({f.name, f.path, f.is_dir > 0}); 18 | } 19 | tinydir_next(&dir); 20 | } 21 | 22 | tinydir_close(&dir); 23 | } 24 | } 25 | 26 | const fhd_file* fhd_filebrowser::get_file(int index) { 27 | if (index >= 0 && index < int(files.size())) { 28 | return &files[index]; 29 | } 30 | 31 | return NULL; 32 | } 33 | -------------------------------------------------------------------------------- /src/tools/fhd_filebrowser.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | struct fhd_file { 7 | std::string name; 8 | std::string path; 9 | bool is_dir; 10 | }; 11 | 12 | struct fhd_filebrowser { 13 | fhd_filebrowser(const char* root); 14 | 15 | void set_root(const char* root); 16 | const fhd_file* get_file(int index); 17 | 18 | std::vector files; 19 | }; 20 | -------------------------------------------------------------------------------- /src/tools/fhd_kinect_source.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_kinect_source.h" 2 | #include 3 | #include 4 | #include 5 | 6 | namespace { 7 | 8 | template 9 | void interface_release(Interface*& i) { 10 | if (i != nullptr) { 11 | i->Release(); 12 | i = nullptr; 13 | } 14 | } 15 | 16 | bool read_depth_data(fhd_kinect_source* source) { 17 | bool got_data = false; 18 | 19 | IDepthFrame* frame = nullptr; 20 | 21 | HRESULT hr = source->depth_reader->AcquireLatestFrame(&frame); 22 | 23 | if (SUCCEEDED(hr)) { 24 | uint32_t buffer_size = 0; 25 | uint16_t* buffer = nullptr; 26 | hr = frame->AccessUnderlyingBuffer(&buffer_size, &buffer); 27 | 28 | if (SUCCEEDED(hr)) { 29 | source->depth_buffer.clear(); 30 | 31 | const uint16_t* begin = (const uint16_t*)buffer; 32 | const uint16_t* end = (const uint16_t*)buffer + buffer_size; 33 | 34 | source->depth_buffer.insert(source->depth_buffer.end(), begin, end); 35 | 36 | got_data = true; 37 | } 38 | } 39 | 40 | interface_release(frame); 41 | 42 | return got_data; 43 | } 44 | 45 | } 46 | 47 | fhd_kinect_source::fhd_kinect_source() { 48 | HRESULT hr = GetDefaultKinectSensor(&kinect); 49 | if (FAILED(hr)) { 50 | fprintf(stderr, "Failed to get the kinect sensor\n"); 51 | } 52 | 53 | if (kinect) { 54 | hr = kinect->Open(); 55 | if (FAILED(hr)) { 56 | fprintf(stderr, "Failed to open kinect sensor\n"); 57 | } 58 | 59 | IDepthFrameSource* depth_source = nullptr; 60 | hr = kinect->get_DepthFrameSource(&depth_source); 61 | 62 | if (SUCCEEDED(hr)) { 63 | hr = depth_source->OpenReader(&depth_reader); 64 | } 65 | 66 | interface_release(depth_source); 67 | } 68 | } 69 | 70 | fhd_kinect_source::~fhd_kinect_source() { 71 | if (kinect) { 72 | kinect->Close(); 73 | interface_release(kinect); 74 | } 75 | } 76 | 77 | const uint16_t* fhd_kinect_source::get_frame() { 78 | if (read_depth_data(this)) { 79 | return depth_buffer.data(); 80 | } 81 | 82 | return nullptr; 83 | } -------------------------------------------------------------------------------- /src/tools/fhd_kinect_source.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../fhd_frame_source.h" 4 | #include 5 | 6 | struct IKinectSensor; 7 | struct IDepthFrameReader; 8 | 9 | struct fhd_kinect_source : fhd_frame_source { 10 | fhd_kinect_source(); 11 | ~fhd_kinect_source(); 12 | 13 | const uint16_t* get_frame() override; 14 | int current_frame() const override { return -1; } 15 | int total_frames() const override { return -1; } 16 | 17 | IKinectSensor* kinect = nullptr; 18 | IDepthFrameReader* depth_reader = nullptr; 19 | 20 | std::vector depth_buffer; 21 | }; 22 | -------------------------------------------------------------------------------- /src/tools/fhd_test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../fhd_candidate_db.h" 4 | #include "../fhd_candidate.h" 5 | #include 6 | #include 7 | 8 | int main(int argc, char** argv) { 9 | 10 | if (argc < 3) { 11 | printf("usage: test_classifier testdata.db classifier.nn\n"); 12 | return 1; 13 | } 14 | 15 | const char* db_file = argv[1]; 16 | const char* nn_file = argv[2]; 17 | 18 | fhd_candidate_db db; 19 | fhd_candidate_db_init(&db, db_file); 20 | 21 | const int features_length = 3780; 22 | int count = fhd_candidate_db_get_count(&db); 23 | 24 | float* features = (float*)calloc(count * features_length, sizeof(float)); 25 | float* output = (float*)calloc(count, sizeof(float)); 26 | 27 | fhd_result* training_data = (fhd_result*)calloc(count, sizeof(fhd_result)); 28 | 29 | for (int i = 0; i < count; i++) { 30 | training_data[i].num_features = features_length; 31 | training_data[i].features = &features[features_length * i]; 32 | } 33 | 34 | fhd_candidate_db_get_features(&db, training_data, count); 35 | fhd_candidate_db_close(&db); 36 | 37 | for (int i = 0; i < count; i++) { 38 | float v = float(training_data[i].human * 2 - 1); 39 | output[i] = v; 40 | } 41 | 42 | fann* nn = fann_create_from_file(nn_file); 43 | fann_train_data* fann_td = fann_create_train_array(count, features_length, features, 1, output); 44 | float r = fann_test_data(nn, fann_td); 45 | printf("MSE: %f\n", r); 46 | fann_destroy_train(fann_td); 47 | fann_destroy(nn); 48 | 49 | nn = fann_create_from_file(nn_file); 50 | 51 | int true_positives = 0; 52 | int true_negatives = 0; 53 | int false_positives = 0; 54 | int false_negatives = 0; 55 | const float weight_threshold = 0.95f; 56 | 57 | for (int i = 0; i < count; i++) { 58 | bool expected = output[i] >= weight_threshold; 59 | bool real = fann_run(nn, training_data[i].features)[0] >= weight_threshold; 60 | 61 | if (expected && real) { 62 | true_positives++; 63 | } 64 | 65 | if (!expected && !real) { 66 | true_negatives++; 67 | } 68 | 69 | if (!expected && real) { 70 | false_positives++; 71 | } 72 | 73 | if (expected && !real) { 74 | false_negatives++; 75 | } 76 | } 77 | 78 | float tp = float(true_positives); 79 | float fp = float(false_positives); 80 | float fn = float(false_negatives); 81 | 82 | printf("Precision %.3f\n", (tp / (tp + fp))); 83 | printf("Recall: %.3f\n", (tp / (tp + fn))); 84 | 85 | free(training_data); 86 | fann_destroy(nn); 87 | 88 | return 0; 89 | } 90 | -------------------------------------------------------------------------------- /src/tools/fhd_texture.cpp: -------------------------------------------------------------------------------- 1 | #include "fhd_texture.h" 2 | #include 3 | 4 | fhd_texture fhd_create_texture(int width, int height) { 5 | fhd_texture t; 6 | t.width = width; 7 | t.height = height; 8 | t.pitch = width * 4; 9 | t.bytes = t.pitch * height; 10 | t.len = width * height; 11 | t.data = (uint8_t*)calloc(t.bytes, 1); 12 | glGenTextures(1, &t.handle); 13 | glBindTexture(GL_TEXTURE_2D, t.handle); 14 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 15 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 16 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, 17 | GL_UNSIGNED_BYTE, nullptr); 18 | return t; 19 | } 20 | 21 | void fhd_texture_destroy(fhd_texture* texture) { 22 | glDeleteTextures(1, &texture->handle); 23 | free(texture->data); 24 | } 25 | 26 | void fhd_texture_update(fhd_texture* texture, const uint8_t* data) { 27 | glBindTexture(GL_TEXTURE_2D, texture->handle); 28 | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture->width, texture->height, 29 | GL_RGBA, GL_UNSIGNED_BYTE, data); 30 | } 31 | 32 | void fhd_texture_upload(fhd_texture* texture) { 33 | glBindTexture(GL_TEXTURE_2D, texture->handle); 34 | glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, texture->width, texture->height, 35 | GL_RGBA, GL_UNSIGNED_BYTE, texture->data); 36 | } 37 | -------------------------------------------------------------------------------- /src/tools/fhd_texture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | struct fhd_texture { 6 | GLuint handle; 7 | int width; 8 | int height; 9 | int pitch; 10 | int bytes; 11 | int len; 12 | uint8_t* data; 13 | }; 14 | 15 | fhd_texture fhd_create_texture(int width, int height); 16 | void fhd_texture_destroy(fhd_texture* texture); 17 | void fhd_texture_update(fhd_texture* texture, const uint8_t* data); 18 | void fhd_texture_upload(fhd_texture* texture); 19 | -------------------------------------------------------------------------------- /src/tools/fhd_train.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "../fhd_candidate_db.h" 4 | #include "../fhd_candidate.h" 5 | #include 6 | #include 7 | #include 8 | 9 | volatile bool running = true; 10 | 11 | void interrupt_handler(int) { 12 | printf("Quitting...\n"); 13 | running = false; 14 | } 15 | 16 | int main(int argc, char** argv) { 17 | 18 | if (argc < 3) { 19 | printf("usage: train_classifier train_data.db result.nn\n"); 20 | return 1; 21 | } 22 | 23 | struct sigaction action; 24 | action.sa_handler = interrupt_handler; 25 | sigaction(SIGINT, &action, NULL); 26 | 27 | const char* db_file = argv[1]; 28 | const char* nn_file = argv[2]; 29 | 30 | printf("%s %s\n", db_file, nn_file); 31 | 32 | fhd_candidate_db db; 33 | fhd_candidate_db_init(&db, db_file); 34 | 35 | const int features_length = 3780; 36 | int count = fhd_candidate_db_get_count(&db); 37 | 38 | float* features = (float*)calloc(count * features_length, sizeof(float)); 39 | float* output = (float*)calloc(count, sizeof(float)); 40 | 41 | fhd_result* training_data = (fhd_result*)calloc(count, sizeof(fhd_result)); 42 | 43 | for (int i = 0; i < count; i++) { 44 | training_data[i].num_features = features_length; 45 | training_data[i].features = &features[features_length * i]; 46 | } 47 | 48 | fhd_candidate_db_get_features(&db, training_data, count); 49 | fhd_candidate_db_close(&db); 50 | 51 | for (int i = 0; i < count; i++) { 52 | float v = float(training_data[i].human * 2 - 1); 53 | output[i] = v; 54 | } 55 | 56 | free(training_data); 57 | 58 | fann* nn = fann_create_standard(2, features_length, 1); 59 | fann_set_activation_function_output(nn, FANN_SIGMOID_SYMMETRIC); 60 | 61 | fann_train_data* fann_td = fann_create_train_array(count, features_length, features, 1, output); 62 | 63 | for (int i = 1; i <= 40000; i++) { 64 | float err = fann_train_epoch_irpropm_parallel(nn, fann_td, 8); 65 | printf("Epoch: %d MSE %.10f\n", i, err); 66 | if (err < 0.001f || !running) break; 67 | } 68 | 69 | fann_save(nn, nn_file); 70 | 71 | fann_destroy_train(fann_td); 72 | fann_destroy(nn); 73 | 74 | return 0; 75 | } 76 | -------------------------------------------------------------------------------- /src/tools/fhd_training.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | struct fhd_training { 12 | int max_epochs = 40000; 13 | float target_mse = 0.001f; 14 | std::atomic running = ATOMIC_VAR_INIT(false); 15 | std::atomic epoch; 16 | std::thread training_thread; 17 | std::mutex access_lock; 18 | std::vector errors = std::vector(256, 0.f); 19 | std::string candidate_database_name = std::string(512, 0); 20 | std::array output_classifier_buf; 21 | std::string error; 22 | 23 | 24 | fhd_training(); 25 | ~fhd_training(); 26 | }; 27 | 28 | bool fhd_training_start(fhd_training* t); 29 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 | -------------------------------------------------------------------------------- /third_party/eigen/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 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | * \defgroup SparseCore_Module SparseCore module 16 | * 17 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 18 | * and operations. 19 | * 20 | * See the \ref TutorialSparse "Sparse tutorial" 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * This module depends on: Core. 27 | */ 28 | 29 | namespace Eigen { 30 | 31 | /** The type used to identify a general sparse storage. */ 32 | struct Sparse {}; 33 | 34 | } 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/CompressedStorage.h" 39 | #include "src/SparseCore/AmbiVector.h" 40 | #include "src/SparseCore/SparseMatrix.h" 41 | #include "src/SparseCore/MappedSparseMatrix.h" 42 | #include "src/SparseCore/SparseVector.h" 43 | #include "src/SparseCore/SparseBlock.h" 44 | #include "src/SparseCore/SparseTranspose.h" 45 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 46 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 47 | #include "src/SparseCore/SparseDot.h" 48 | #include "src/SparseCore/SparsePermutation.h" 49 | #include "src/SparseCore/SparseRedux.h" 50 | #include "src/SparseCore/SparseFuzzy.h" 51 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 52 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 53 | #include "src/SparseCore/SparseProduct.h" 54 | #include "src/SparseCore/SparseDenseProduct.h" 55 | #include "src/SparseCore/SparseDiagonalProduct.h" 56 | #include "src/SparseCore/SparseTriangularView.h" 57 | #include "src/SparseCore/SparseSelfAdjointView.h" 58 | #include "src/SparseCore/TriangularSolver.h" 59 | #include "src/SparseCore/SparseView.h" 60 | 61 | #include "src/Core/util/ReenableStupidWarnings.h" 62 | 63 | #endif // EIGEN_SPARSECORE_MODULE_H 64 | 65 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/SparseLU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // Copyright (C) 2012 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSELU_MODULE_H 12 | #define EIGEN_SPARSELU_MODULE_H 13 | 14 | #include "SparseCore" 15 | 16 | /** 17 | * \defgroup SparseLU_Module SparseLU module 18 | * This module defines a supernodal factorization of general sparse matrices. 19 | * The code is fully optimized for supernode-panel updates with specialized kernels. 20 | * Please, see the documentation of the SparseLU class for more details. 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/misc/SparseSolve.h" 25 | 26 | // Ordering interface 27 | #include "OrderingMethods" 28 | 29 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 30 | 31 | #include "src/SparseLU/SparseLU_Structs.h" 32 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 33 | #include "src/SparseLU/SparseLUImpl.h" 34 | #include "src/SparseCore/SparseColEtree.h" 35 | #include "src/SparseLU/SparseLU_Memory.h" 36 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 37 | #include "src/SparseLU/SparseLU_relax_snode.h" 38 | #include "src/SparseLU/SparseLU_pivotL.h" 39 | #include "src/SparseLU/SparseLU_panel_dfs.h" 40 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 41 | #include "src/SparseLU/SparseLU_panel_bmod.h" 42 | #include "src/SparseLU/SparseLU_column_dfs.h" 43 | #include "src/SparseLU/SparseLU_column_bmod.h" 44 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 45 | #include "src/SparseLU/SparseLU_pruneL.h" 46 | #include "src/SparseLU/SparseLU_Utils.h" 47 | #include "src/SparseLU/SparseLU.h" 48 | 49 | #endif // EIGEN_SPARSELU_MODULE_H 50 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSEQR_MODULE_H 2 | #define EIGEN_SPARSEQR_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup SparseQR_Module SparseQR module 9 | * \brief Provides QR decomposition for sparse matrices 10 | * 11 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 12 | * The columns of the input matrix should be reordered to limit the fill-in during the 13 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 14 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 15 | * of built-in and external ordering methods. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | 27 | #include "OrderingMethods" 28 | #include "src/SparseCore/SparseColEtree.h" 29 | #include "src/SparseQR/SparseQR.h" 30 | 31 | #include "src/Core/util/ReenableStupidWarnings.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 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_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 2 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #ifdef EMPTY 9 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 10 | #endif 11 | 12 | typedef int int_t; 13 | #include 14 | #include 15 | #include 16 | 17 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 18 | // so we remove it in favor of a SUPERLU_EMPTY token. 19 | // If EMPTY was already defined then we don't undef it. 20 | 21 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 22 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 23 | #elif defined(EMPTY) 24 | # undef EMPTY 25 | #endif 26 | 27 | #define SUPERLU_EMPTY (-1) 28 | 29 | namespace Eigen { struct SluMatrix; } 30 | 31 | /** \ingroup Support_modules 32 | * \defgroup SuperLUSupport_Module SuperLUSupport module 33 | * 34 | * This module provides an interface to the SuperLU library. 35 | * It provides the following factorization class: 36 | * - class SuperLU: a supernodal sequential LU factorization. 37 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 38 | * 39 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 40 | * 41 | * \code 42 | * #include 43 | * \endcode 44 | * 45 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 46 | * The dependencies depend on how superlu has been compiled. 47 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 48 | * 49 | */ 50 | 51 | #include "src/misc/Solve.h" 52 | #include "src/misc/SparseSolve.h" 53 | 54 | #include "src/SuperLUSupport/SuperLUSupport.h" 55 | 56 | 57 | #include "src/Core/util/ReenableStupidWarnings.h" 58 | 59 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 60 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 2 | #define EIGEN_UMFPACKSUPPORT_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 UmfPackSupport_Module UmfPackSupport module 14 | * 15 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 16 | * It provides the following factorization class: 17 | * - class UmfPackLU: a multifrontal sequential LU factorization. 18 | * 19 | * \code 20 | * #include 21 | * \endcode 22 | * 23 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 24 | * The dependencies depend on how umfpack has been compiled. 25 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 26 | * 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/UmfPackSupport/UmfPackSupport.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 37 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB Eigen_src_subdirectories "*") 2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 3 | foreach(f ${Eigen_src_subdirectories}) 4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) 5 | add_subdirectory(${f}) 6 | endif() 7 | endforeach() 8 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Cholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Cholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/CholmodSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_CholmodSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_CholmodSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/CholmodSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(products) 9 | ADD_SUBDIRECTORY(util) 10 | ADD_SUBDIRECTORY(arch) 11 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/CoreIterators.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 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_COREITERATORS_H 11 | #define EIGEN_COREITERATORS_H 12 | 13 | namespace Eigen { 14 | 15 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 16 | */ 17 | 18 | /** \ingroup SparseCore_Module 19 | * \class InnerIterator 20 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 21 | * 22 | * todo 23 | */ 24 | 25 | // generic version for dense matrix and expressions 26 | template class DenseBase::InnerIterator 27 | { 28 | protected: 29 | typedef typename Derived::Scalar Scalar; 30 | typedef typename Derived::Index Index; 31 | 32 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 33 | public: 34 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 35 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 36 | {} 37 | 38 | EIGEN_STRONG_INLINE Scalar value() const 39 | { 40 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 41 | : m_expression.coeff(m_inner, m_outer); 42 | } 43 | 44 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 45 | 46 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 47 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 48 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 49 | 50 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 51 | 52 | protected: 53 | const Derived& m_expression; 54 | Index m_inner; 55 | const Index m_outer; 56 | const Index m_end; 57 | }; 58 | 59 | } // end namespace Eigen 60 | 61 | #endif // EIGEN_COREITERATORS_H 62 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/arch/AltiVec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AltiVec_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AltiVec_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AltiVec COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/arch/Default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_Default_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_Default_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/Default COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 100 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/arch/NEON/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_NEON_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_NEON_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/NEON COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/arch/SSE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_SSE_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_SSE_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/SSE COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/products/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Product_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Product_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_util_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_util_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/util COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // typedef that may be a reference type. 25 | // 279 - controlling expression is constant 26 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 27 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 28 | #pragma warning push 29 | #endif 30 | #pragma warning disable 2196 279 31 | #elif defined __clang__ 32 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 33 | // this is really a stupid warning as it warns on compile-time expressions involving enums 34 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 35 | #pragma clang diagnostic push 36 | #endif 37 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 38 | #endif 39 | 40 | #endif // not EIGEN_WARNINGS_DISABLED 41 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(Geometry) -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/Lazy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 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_LAZY_H 11 | #define EIGEN_LAZY_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated it is only used by lazy() which is deprecated 16 | * 17 | * \returns an expression of *this with added flags 18 | * 19 | * Example: \include MatrixBase_marked.cpp 20 | * Output: \verbinclude MatrixBase_marked.out 21 | * 22 | * \sa class Flagged, extract(), part() 23 | */ 24 | template 25 | template 26 | inline const Flagged 27 | MatrixBase::marked() const 28 | { 29 | return derived(); 30 | } 31 | 32 | /** \deprecated use MatrixBase::noalias() 33 | * 34 | * \returns an expression of *this with the EvalBeforeAssigningBit flag removed. 35 | * 36 | * Example: \include MatrixBase_lazy.cpp 37 | * Output: \verbinclude MatrixBase_lazy.out 38 | * 39 | * \sa class Flagged, marked() 40 | */ 41 | template 42 | inline const Flagged 43 | MatrixBase::lazy() const 44 | { 45 | return derived(); 46 | } 47 | 48 | 49 | /** \internal 50 | * Overloaded to perform an efficient C += (A*B).lazy() */ 51 | template 52 | template 53 | Derived& MatrixBase::operator+=(const Flagged, 0, 54 | EvalBeforeAssigningBit>& other) 55 | { 56 | other._expression().derived().addTo(derived()); return derived(); 57 | } 58 | 59 | /** \internal 60 | * Overloaded to perform an efficient C -= (A*B).lazy() */ 61 | template 62 | template 63 | Derived& MatrixBase::operator-=(const Flagged, 0, 64 | EvalBeforeAssigningBit>& other) 65 | { 66 | other._expression().derived().subTo(derived()); return derived(); 67 | } 68 | 69 | } // end namespace Eigen 70 | 71 | #endif // EIGEN_LAZY_H 72 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 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 EIGEN2_MACROS_H 11 | #define EIGEN2_MACROS_H 12 | 13 | #define ei_assert eigen_assert 14 | #define ei_internal_assert eigen_internal_assert 15 | 16 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 17 | 18 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 19 | 20 | #endif // EIGEN2_MACROS_H 21 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 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 EIGEN2_MATH_FUNCTIONS_H 11 | #define EIGEN2_MATH_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | template inline typename NumTraits::Real ei_real(const T& x) { return numext::real(x); } 16 | template inline typename NumTraits::Real ei_imag(const T& x) { return numext::imag(x); } 17 | template inline T ei_conj(const T& x) { return numext::conj(x); } 18 | template inline typename NumTraits::Real ei_abs (const T& x) { using std::abs; return abs(x); } 19 | template inline typename NumTraits::Real ei_abs2(const T& x) { return numext::abs2(x); } 20 | template inline T ei_sqrt(const T& x) { using std::sqrt; return sqrt(x); } 21 | template inline T ei_exp (const T& x) { using std::exp; return exp(x); } 22 | template inline T ei_log (const T& x) { using std::log; return log(x); } 23 | template inline T ei_sin (const T& x) { using std::sin; return sin(x); } 24 | template inline T ei_cos (const T& x) { using std::cos; return cos(x); } 25 | template inline T ei_atan2(const T& x,const T& y) { using std::atan2; return atan2(x,y); } 26 | template inline T ei_pow (const T& x,const T& y) { return numext::pow(x,y); } 27 | template inline T ei_random () { return internal::random(); } 28 | template inline T ei_random (const T& x, const T& y) { return internal::random(x, y); } 29 | 30 | template inline T precision () { return NumTraits::dummy_precision(); } 31 | template inline T machine_epsilon () { return NumTraits::epsilon(); } 32 | 33 | 34 | template 35 | inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y, 36 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 37 | { 38 | return internal::isMuchSmallerThan(x, y, precision); 39 | } 40 | 41 | template 42 | inline bool ei_isApprox(const Scalar& x, const Scalar& y, 43 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 44 | { 45 | return internal::isApprox(x, y, precision); 46 | } 47 | 48 | template 49 | inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y, 50 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 51 | { 52 | return internal::isApproxOrLessThan(x, y, precision); 53 | } 54 | 55 | } // end namespace Eigen 56 | 57 | #endif // EIGEN2_MATH_FUNCTIONS_H 58 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 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 EIGEN2_MEMORY_H 11 | #define EIGEN2_MEMORY_H 12 | 13 | namespace Eigen { 14 | 15 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 16 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 17 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 18 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 19 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 20 | 21 | template inline void* ei_conditional_aligned_malloc(size_t size) 22 | { 23 | return internal::conditional_aligned_malloc(size); 24 | } 25 | template inline void ei_conditional_aligned_free(void *ptr) 26 | { 27 | internal::conditional_aligned_free(ptr); 28 | } 29 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 30 | { 31 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 32 | } 33 | 34 | template inline T* ei_aligned_new(size_t size) 35 | { 36 | return internal::aligned_new(size); 37 | } 38 | template inline void ei_aligned_delete(T *ptr, size_t size) 39 | { 40 | return internal::aligned_delete(ptr, size); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN2_MACROS_H 46 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/QR.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2011 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_QR_H 12 | #define EIGEN2_QR_H 13 | 14 | namespace Eigen { 15 | 16 | template 17 | class QR : public HouseholderQR 18 | { 19 | public: 20 | 21 | typedef HouseholderQR Base; 22 | typedef Block MatrixRBlockType; 23 | 24 | QR() : Base() {} 25 | 26 | template 27 | explicit QR(const T& t) : Base(t) {} 28 | 29 | template 30 | bool solve(const MatrixBase& b, ResultType *result) const 31 | { 32 | *result = static_cast(this)->solve(b); 33 | return true; 34 | } 35 | 36 | MatrixType matrixQ(void) const { 37 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 38 | ret = this->householderQ() * ret; 39 | return ret; 40 | } 41 | 42 | bool isFullRank() const { 43 | return true; 44 | } 45 | 46 | const TriangularView 47 | matrixR(void) const 48 | { 49 | int cols = this->cols(); 50 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 51 | } 52 | }; 53 | 54 | /** \return the QR decomposition of \c *this. 55 | * 56 | * \sa class QR 57 | */ 58 | template 59 | const QR::PlainObject> 60 | MatrixBase::qr() const 61 | { 62 | return QR(eval()); 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN2_QR_H 68 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 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_TRIANGULAR_SOLVER2_H 11 | #define EIGEN_TRIANGULAR_SOLVER2_H 12 | 13 | namespace Eigen { 14 | 15 | const unsigned int UnitDiagBit = UnitDiag; 16 | const unsigned int SelfAdjointBit = SelfAdjoint; 17 | const unsigned int UpperTriangularBit = Upper; 18 | const unsigned int LowerTriangularBit = Lower; 19 | 20 | const unsigned int UpperTriangular = Upper; 21 | const unsigned int LowerTriangular = Lower; 22 | const unsigned int UnitUpperTriangular = UnitUpper; 23 | const unsigned int UnitLowerTriangular = UnitLower; 24 | 25 | template 26 | template 27 | typename ExpressionType::PlainObject 28 | Flagged::solveTriangular(const MatrixBase& other) const 29 | { 30 | return m_matrix.template triangularView().solve(other.derived()); 31 | } 32 | 33 | template 34 | template 35 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 36 | { 37 | m_matrix.template triangularView().solveInPlace(other.derived()); 38 | } 39 | 40 | } // end namespace Eigen 41 | 42 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 43 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigen2Support/VectorBlock.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_VECTORBLOCK_H 12 | #define EIGEN2_VECTORBLOCK_H 13 | 14 | namespace Eigen { 15 | 16 | /** \deprecated use DenseMase::head(Index) */ 17 | template 18 | inline VectorBlock 19 | MatrixBase::start(Index size) 20 | { 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 22 | return VectorBlock(derived(), 0, size); 23 | } 24 | 25 | /** \deprecated use DenseMase::head(Index) */ 26 | template 27 | inline const VectorBlock 28 | MatrixBase::start(Index size) const 29 | { 30 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 31 | return VectorBlock(derived(), 0, size); 32 | } 33 | 34 | /** \deprecated use DenseMase::tail(Index) */ 35 | template 36 | inline VectorBlock 37 | MatrixBase::end(Index size) 38 | { 39 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 40 | return VectorBlock(derived(), this->size() - size, size); 41 | } 42 | 43 | /** \deprecated use DenseMase::tail(Index) */ 44 | template 45 | inline const VectorBlock 46 | MatrixBase::end(Index size) const 47 | { 48 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 49 | return VectorBlock(derived(), this->size() - size, size); 50 | } 51 | 52 | /** \deprecated use DenseMase::head() */ 53 | template 54 | template 55 | inline VectorBlock 56 | MatrixBase::start() 57 | { 58 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 59 | return VectorBlock(derived(), 0); 60 | } 61 | 62 | /** \deprecated use DenseMase::head() */ 63 | template 64 | template 65 | inline const VectorBlock 66 | MatrixBase::start() const 67 | { 68 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 69 | return VectorBlock(derived(), 0); 70 | } 71 | 72 | /** \deprecated use DenseMase::tail() */ 73 | template 74 | template 75 | inline VectorBlock 76 | MatrixBase::end() 77 | { 78 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 79 | return VectorBlock(derived(), size() - Size); 80 | } 81 | 82 | /** \deprecated use DenseMase::tail() */ 83 | template 84 | template 85 | inline const VectorBlock 86 | MatrixBase::end() const 87 | { 88 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 89 | return VectorBlock(derived(), size() - Size); 90 | } 91 | 92 | } // end namespace Eigen 93 | 94 | #endif // EIGEN2_VECTORBLOCK_H 95 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Eigenvalues/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EIGENVALUES_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EIGENVALUES_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigenvalues COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Geometry/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Householder/BlockHouseholder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Vincent Lejeune 5 | // Copyright (C) 2010 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_BLOCK_HOUSEHOLDER_H 12 | #define EIGEN_BLOCK_HOUSEHOLDER_H 13 | 14 | // This file contains some helper function to deal with block householder reflectors 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | 20 | /** \internal */ 21 | template 22 | void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) 23 | { 24 | typedef typename TriangularFactorType::Index Index; 25 | typedef typename VectorsType::Scalar Scalar; 26 | const Index nbVecs = vectors.cols(); 27 | eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); 28 | 29 | for(Index i = 0; i < nbVecs; i++) 30 | { 31 | Index rs = vectors.rows() - i; 32 | Scalar Vii = vectors(i,i); 33 | vectors.const_cast_derived().coeffRef(i,i) = Scalar(1); 34 | triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint() 35 | * vectors.col(i).tail(rs); 36 | vectors.const_cast_derived().coeffRef(i, i) = Vii; 37 | // FIXME add .noalias() once the triangular product can work inplace 38 | triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() 39 | * triFactor.col(i).head(i); 40 | triFactor(i,i) = hCoeffs(i); 41 | } 42 | } 43 | 44 | /** \internal */ 45 | template 46 | void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs) 47 | { 48 | typedef typename MatrixType::Index Index; 49 | enum { TFactorSize = MatrixType::ColsAtCompileTime }; 50 | Index nbVecs = vectors.cols(); 51 | Matrix T(nbVecs,nbVecs); 52 | make_block_householder_triangular_factor(T, vectors, hCoeffs); 53 | 54 | const TriangularView& V(vectors); 55 | 56 | // A -= V T V^* A 57 | Matrix tmp = V.adjoint() * mat; 59 | // FIXME add .noalias() once the triangular product can work inplace 60 | tmp = T.template triangularView().adjoint() * tmp; 61 | mat.noalias() -= V * tmp; 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_BLOCK_HOUSEHOLDER_H 69 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Householder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Householder_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Householder_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Householder COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/IterativeLinearSolvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_IterativeLinearSolvers_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_IterativeLinearSolvers_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/IterativeLinearSolvers COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/Jacobi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Jacobi_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Jacobi_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Jacobi COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/LU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/LU/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/MetisSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_MetisSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_MetisSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/MetisSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/OrderingMethods/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_OrderingMethods_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_OrderingMethods_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/OrderingMethods COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/PaStiXSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PastixSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PastixSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PaStiXSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/PardisoSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PardisoSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PardisoSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PardisoSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/QR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_QR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_QR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/QR COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SPQRSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SPQRSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SPQRSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SPQRSupport/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseCholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCore_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCore_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCore COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 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_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | // template 14 | // template 15 | // bool SparseMatrixBase::isApprox( 16 | // const OtherDerived& other, 17 | // typename NumTraits::Real prec 18 | // ) const 19 | // { 20 | // const typename internal::nested::type nested(derived()); 21 | // const typename internal::nested::type otherNested(other.derived()); 22 | // return (nested - otherNested).cwise().abs2().sum() 23 | // <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 24 | // } 25 | 26 | #endif // EIGEN_SPARSE_FUZZY_H 27 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 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_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | for (Index j=0; j 28 | typename internal::traits >::Scalar 29 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 30 | { 31 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 32 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 33 | } 34 | 35 | template 36 | typename internal::traits >::Scalar 37 | SparseVector<_Scalar,_Options,_Index>::sum() const 38 | { 39 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 40 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN_SPARSEREDUX_H 46 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseCore/SparseTranspose.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-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 EIGEN_SPARSETRANSPOSE_H 11 | #define EIGEN_SPARSETRANSPOSE_H 12 | 13 | namespace Eigen { 14 | 15 | template class TransposeImpl 16 | : public SparseMatrixBase > 17 | { 18 | typedef typename internal::remove_all::type _MatrixTypeNested; 19 | public: 20 | 21 | EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose ) 22 | 23 | class InnerIterator; 24 | class ReverseInnerIterator; 25 | 26 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 27 | }; 28 | 29 | // NOTE: VC10 and VC11 trigger an ICE if don't put typename TransposeImpl:: in front of Index, 30 | // a typedef typename TransposeImpl::Index Index; 31 | // does not fix the issue. 32 | // An alternative is to define the nested class in the parent class itself. 33 | template class TransposeImpl::InnerIterator 34 | : public _MatrixTypeNested::InnerIterator 35 | { 36 | typedef typename _MatrixTypeNested::InnerIterator Base; 37 | typedef typename TransposeImpl::Index Index; 38 | public: 39 | 40 | EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl::Index outer) 41 | : Base(trans.derived().nestedExpression(), outer) 42 | {} 43 | typename TransposeImpl::Index row() const { return Base::col(); } 44 | typename TransposeImpl::Index col() const { return Base::row(); } 45 | }; 46 | 47 | template class TransposeImpl::ReverseInnerIterator 48 | : public _MatrixTypeNested::ReverseInnerIterator 49 | { 50 | typedef typename _MatrixTypeNested::ReverseInnerIterator Base; 51 | typedef typename TransposeImpl::Index Index; 52 | public: 53 | 54 | EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl::Index outer) 55 | : Base(xpr.derived().nestedExpression(), outer) 56 | {} 57 | typename TransposeImpl::Index row() const { return Base::col(); } 58 | typename TransposeImpl::Index col() const { return Base::row(); } 59 | }; 60 | 61 | } // end namespace Eigen 62 | 63 | #endif // EIGEN_SPARSETRANSPOSE_H 64 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseLU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseLU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseLU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseLU COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseLU/SparseLU_Utils.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 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 | 11 | #ifndef EIGEN_SPARSELU_UTILS_H 12 | #define EIGEN_SPARSELU_UTILS_H 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | /** 18 | * \brief Count Nonzero elements in the factors 19 | */ 20 | template 21 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 22 | { 23 | nnzL = 0; 24 | nnzU = (glu.xusub)(n); 25 | Index nsuper = (glu.supno)(n); 26 | Index jlen; 27 | Index i, j, fsupc; 28 | if (n <= 0 ) return; 29 | // For each supernode 30 | for (i = 0; i <= nsuper; i++) 31 | { 32 | fsupc = glu.xsup(i); 33 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 34 | 35 | for (j = fsupc; j < glu.xsup(i+1); j++) 36 | { 37 | nnzL += jlen; 38 | nnzU += j - fsupc + 1; 39 | jlen--; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * \brief Fix up the data storage lsub for L-subscripts. 46 | * 47 | * It removes the subscripts sets for structural pruning, 48 | * and applies permutation to the remaining subscripts 49 | * 50 | */ 51 | template 52 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 53 | { 54 | Index fsupc, i, j, k, jstart; 55 | 56 | Index nextl = 0; 57 | Index nsuper = (glu.supno)(n); 58 | 59 | // For each supernode 60 | for (i = 0; i <= nsuper; i++) 61 | { 62 | fsupc = glu.xsup(i); 63 | jstart = glu.xlsub(fsupc); 64 | glu.xlsub(fsupc) = nextl; 65 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 66 | { 67 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 68 | nextl++; 69 | } 70 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 71 | glu.xlsub(k) = nextl; // other columns in supernode i 72 | } 73 | 74 | glu.xlsub(n) = nextl; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | #endif // EIGEN_SPARSELU_UTILS_H 81 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SparseQR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseQR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseQR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseQR/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/StlSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_StlSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_StlSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/StlSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/SuperLUSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SuperLUSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SuperLUSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SuperLUSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/UmfPackSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_UmfPackSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_UmfPackSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/UmfPackSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_misc_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_misc_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/misc COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/misc/Solve.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 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_MISC_SOLVE_H 11 | #define EIGEN_MISC_SOLVE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class solve_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix ReturnType; 30 | }; 31 | 32 | template struct solve_retval_base 33 | : public ReturnByValue > 34 | { 35 | typedef typename remove_all::type RhsNestedCleaned; 36 | typedef _DecompositionType DecompositionType; 37 | typedef ReturnByValue Base; 38 | typedef typename Base::Index Index; 39 | 40 | solve_retval_base(const DecompositionType& dec, const Rhs& rhs) 41 | : m_dec(dec), m_rhs(rhs) 42 | {} 43 | 44 | inline Index rows() const { return m_dec.cols(); } 45 | inline Index cols() const { return m_rhs.cols(); } 46 | inline const DecompositionType& dec() const { return m_dec; } 47 | inline const RhsNestedCleaned& rhs() const { return m_rhs; } 48 | 49 | template inline void evalTo(Dest& dst) const 50 | { 51 | static_cast*>(this)->evalTo(dst); 52 | } 53 | 54 | protected: 55 | const DecompositionType& m_dec; 56 | typename Rhs::Nested m_rhs; 57 | }; 58 | 59 | } // end namespace internal 60 | 61 | #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \ 62 | typedef typename DecompositionType::MatrixType MatrixType; \ 63 | typedef typename MatrixType::Scalar Scalar; \ 64 | typedef typename MatrixType::RealScalar RealScalar; \ 65 | typedef typename MatrixType::Index Index; \ 66 | typedef Eigen::internal::solve_retval_base Base; \ 67 | using Base::dec; \ 68 | using Base::rhs; \ 69 | using Base::rows; \ 70 | using Base::cols; \ 71 | solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 72 | : Base(dec, rhs) {} 73 | 74 | } // end namespace Eigen 75 | 76 | #endif // EIGEN_MISC_SOLVE_H 77 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_plugins_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_plugins_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/plugins COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/plugins/CommonCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing common coefficient wise functions. 12 | 13 | /** \returns an expression of the difference of \c *this and \a other 14 | * 15 | * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 16 | * 17 | * \sa class CwiseBinaryOp, operator-=() 18 | */ 19 | EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 20 | 21 | /** \returns an expression of the sum of \c *this and \a other 22 | * 23 | * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 24 | * 25 | * \sa class CwiseBinaryOp, operator+=() 26 | */ 27 | EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 28 | 29 | /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 30 | * 31 | * The template parameter \a CustomBinaryOp is the type of the functor 32 | * of the custom operator (see class CwiseBinaryOp for an example) 33 | * 34 | * Here is an example illustrating the use of custom functors: 35 | * \include class_CwiseBinaryOp.cpp 36 | * Output: \verbinclude class_CwiseBinaryOp.out 37 | * 38 | * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 39 | */ 40 | template 41 | EIGEN_STRONG_INLINE const CwiseBinaryOp 42 | binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const 43 | { 44 | return CwiseBinaryOp(derived(), other.derived(), func); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /third_party/eigen/Eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 12 | 13 | /** \returns an expression of the coefficient-wise absolute value of \c *this 14 | * 15 | * Example: \include MatrixBase_cwiseAbs.cpp 16 | * Output: \verbinclude MatrixBase_cwiseAbs.out 17 | * 18 | * \sa cwiseAbs2() 19 | */ 20 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 21 | cwiseAbs() const { return derived(); } 22 | 23 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this 24 | * 25 | * Example: \include MatrixBase_cwiseAbs2.cpp 26 | * Output: \verbinclude MatrixBase_cwiseAbs2.out 27 | * 28 | * \sa cwiseAbs() 29 | */ 30 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 31 | cwiseAbs2() const { return derived(); } 32 | 33 | /** \returns an expression of the coefficient-wise square root of *this. 34 | * 35 | * Example: \include MatrixBase_cwiseSqrt.cpp 36 | * Output: \verbinclude MatrixBase_cwiseSqrt.out 37 | * 38 | * \sa cwisePow(), cwiseSquare() 39 | */ 40 | inline const CwiseUnaryOp, const Derived> 41 | cwiseSqrt() const { return derived(); } 42 | 43 | /** \returns an expression of the coefficient-wise inverse of *this. 44 | * 45 | * Example: \include MatrixBase_cwiseInverse.cpp 46 | * Output: \verbinclude MatrixBase_cwiseInverse.out 47 | * 48 | * \sa cwiseProduct() 49 | */ 50 | inline const CwiseUnaryOp, const Derived> 51 | cwiseInverse() const { return derived(); } 52 | 53 | -------------------------------------------------------------------------------- /third_party/fann/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.8) 2 | 3 | if (NOT DEFINED CMAKE_BUILD_TYPE) 4 | set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type") 5 | endif () 6 | 7 | project (FANN) 8 | 9 | list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) 10 | 11 | set (FANN_VERSION_MAJOR 2) 12 | set (FANN_VERSION_MINOR 2) 13 | set (FANN_VERSION_PATCH 0) 14 | set (FANN_VERSION_STRING ${FANN_VERSION_MAJOR}.${FANN_VERSION_MINOR}.${FANN_VERSION_PATCH}) 15 | 16 | option(BUILD_SHARED_LIBS "build shared/static libs" OFF) 17 | 18 | INCLUDE(DefineInstallationPaths) 19 | 20 | configure_file (cmake/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/include/config.h) 21 | include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/include/) 22 | 23 | configure_file (cmake/fann.pc.cmake ${CMAKE_CURRENT_SOURCE_DIR}/fann.pc @ONLY) 24 | 25 | ADD_SUBDIRECTORY( src ) 26 | 27 | ################# cpack ################ 28 | 29 | SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Fast Artificial Neural Network Library (FANN)") 30 | SET(CPACK_PACKAGE_VENDOR "Steffen Nissen") 31 | SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") 32 | SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.md") 33 | SET(CPACK_PACKAGE_VERSION_MAJOR "${FANN_VERSION_MAJOR}") 34 | SET(CPACK_PACKAGE_VERSION_MINOR "${FANN_VERSION_MINOR}") 35 | SET(CPACK_PACKAGE_VERSION_PATCH "${FANN_VERSION_PATCH}") 36 | SET(CPACK_GENERATOR "TGZ;ZIP") 37 | SET(CPACK_SOURCE_GENERATOR "TGZ;ZIP") 38 | SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Steffen Nissen") 39 | IF(WIN32 AND NOT UNIX) 40 | # There is a bug in NSI that does not handle full unix paths properly. Make 41 | # sure there is at least one set of four (4) backlasshes. 42 | # SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/Release\\\\InstallIcon.bmp") 43 | # SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe") 44 | # SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} My Famous Project") 45 | SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\leenissen.dk/fann/") 46 | SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\leenissen.dk/fann/") 47 | SET(CPACK_NSIS_CONTACT "steffen.fann@gmail.com") 48 | SET(CPACK_NSIS_MODIFY_PATH ON) 49 | ELSE(WIN32 AND NOT UNIX) 50 | # SET(CPACK_STRIP_FILES "bin/MyExecutable") 51 | # SET(CPACK_SOURCE_STRIP_FILES "") 52 | ENDIF(WIN32 AND NOT UNIX) 53 | #SET(CPACK_PACKAGE_EXECUTABLES "MyExecutable" "My Executable") 54 | INCLUDE(CPack) 55 | 56 | ################# config ################ 57 | 58 | set (FANN_USE_FILE ${CMAKE_CONFIG_DIR}/fann-use.cmake) 59 | set (FANN_ROOT_DIR ${CMAKE_INSTALL_PREFIX}) 60 | set (FANN_INCLUDE_DIR ${CMAKE_INSTALL_PREFIX}/include) 61 | set (FANN_INCLUDE_DIRS ${FANN_INCLUDE_DIR}) 62 | set (FANN_LIBRARY_DIRS ${CMAKE_INSTALL_PREFIX}/lib) 63 | set (FANN_LIBRARY fann) 64 | set (FANN_LIBRARIES ${FANN_LIBRARY}) 65 | if (UNIX) 66 | list (APPEND FANN_LIBRARIES m) 67 | endif () 68 | 69 | if (CMAKE_VERSION VERSION_LESS 2.8.8) 70 | configure_file (cmake/fann-config.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/fann-config.cmake @ONLY) 71 | endif () 72 | -------------------------------------------------------------------------------- /third_party/fann/README.md: -------------------------------------------------------------------------------- 1 | # Fast Artificial Neural Network Library 2 | ## FANN 3 | 4 | **Fast Artificial Neural Network (FANN) Library** is a free open source neural network library, which implements multilayer artificial neural networks in C with support for both fully connected and sparsely connected networks. 5 | 6 | Cross-platform execution in both fixed and floating point are supported. It includes a framework for easy handling of training data sets. It is easy to use, versatile, well documented, and fast. 7 | 8 | Bindings to more than 15 programming languages are available. 9 | 10 | An easy to read introduction article and a reference manual accompanies the library with examples and recommendations on how to use the library. 11 | 12 | Several graphical user interfaces are also available for the library. 13 | 14 | ## FANN Features 15 | 16 | * Multilayer Artificial Neural Network Library in C 17 | * Backpropagation training (RPROP, Quickprop, Batch, Incremental) 18 | * Evolving topology training which dynamically builds and trains the ANN (Cascade2) 19 | * Easy to use (create, train and run an ANN with just three function calls) 20 | * Fast (up to 150 times faster execution than other libraries) 21 | * Versatile (possible to adjust many parameters and features on-the-fly) 22 | * Well documented (An easy to read introduction article, a thorough reference manual, and a 50+ page university report describing the implementation considerations etc.) 23 | * Cross-platform (configure script for linux and unix, dll files for windows, project files for MSVC++ and Borland compilers are also reported to work) 24 | * Several different activation functions implemented (including stepwise linear functions for that extra bit of speed) 25 | * Easy to save and load entire ANNs 26 | * Several easy to use examples 27 | * Can use both floating point and fixed point numbers (actually both float, double and int are available) 28 | * Cache optimized (for that extra bit of speed) 29 | * Open source, but can still be used in commercial applications (licenced under LGPL) 30 | * Framework for easy handling of training data sets 31 | * Graphical Interfaces 32 | * Language Bindings to a large number of different programming languages 33 | * Widely used (approximately 100 downloads a day) 34 | 35 | ## To Install 36 | 37 | ### On Linux 38 | 39 | #### From Source 40 | 41 | First you'll want to clone the repository: 42 | 43 | `git clone https://github.com/libfann/fann.git` 44 | 45 | Once that's finished, navigate to the Root directory. In this case it would be ./fann: 46 | 47 | `cd ./fann` 48 | 49 | Then run CMake 50 | 51 | `cmake .` 52 | 53 | After that, you'll need to use elevated priviledges to install the library: 54 | 55 | `sudo make install` 56 | 57 | That's it! If everything went right, you should see a lot of text, and FANN should be installed! 58 | 59 | ## To Learn More 60 | 61 | To get started with FANN, go to the [FANN help site](http://leenissen.dk/fann/wp/help/), which will include links to all the available resources. 62 | 63 | For more information about FANN, please refer to the [FANN website](http://leenissen.dk/fann/wp/) 64 | -------------------------------------------------------------------------------- /third_party/fann/cmake/config.h.in: -------------------------------------------------------------------------------- 1 | /* Name of package */ 2 | #cmakedefine PACKAGE "@PACKAGE@" 3 | 4 | /* Version number of package */ 5 | #cmakedefine VERSION "@FANN_VERSION_STRING@" 6 | 7 | /* Define for the x86_64 CPU famyly */ 8 | #cmakedefine X86_64 "@X86_64@" 9 | -------------------------------------------------------------------------------- /third_party/fann/cmake/fann-config.cmake.in: -------------------------------------------------------------------------------- 1 | # -*- cmake -*- 2 | # 3 | # fann-config.cmake(.in) 4 | # 5 | 6 | # Use the following variables to compile and link against FANN: 7 | # FANN_FOUND - True if FANN was found on your system 8 | # FANN_USE_FILE - The file making FANN usable 9 | # FANN_DEFINITIONS - Definitions needed to build with FANN 10 | # FANN_INCLUDE_DIR - Directory where fann.h can be found 11 | # FANN_INCLUDE_DIRS - List of directories of FANN and it's dependencies 12 | # FANN_LIBRARY - FANN library location 13 | # FANN_LIBRARIES - List of libraries to link against FANN library 14 | # FANN_LIBRARY_DIRS - List of directories containing FANN' libraries 15 | # FANN_ROOT_DIR - The base directory of FANN 16 | # FANN_VERSION_STRING - A human-readable string containing the version 17 | # FANN_VERSION_MAJOR - The major version of FANN 18 | # FANN_VERSION_MINOR - The minor version of FANN 19 | # FANN_VERSION_PATCH - The patch version of FANN 20 | 21 | @PACKAGE_INIT@ 22 | 23 | set ( FANN_FOUND 1 ) 24 | set ( FANN_USE_FILE "@FANN_USE_FILE@" ) 25 | 26 | set ( FANN_DEFINITIONS "@FANN_DEFINITIONS@" ) 27 | set ( FANN_INCLUDE_DIR "@FANN_INCLUDE_DIR@" ) 28 | set ( FANN_INCLUDE_DIRS "@FANN_INCLUDE_DIRS@" ) 29 | set ( FANN_LIBRARY "@FANN_LIBRARY@" ) 30 | set ( FANN_LIBRARIES "@FANN_LIBRARIES@" ) 31 | set ( FANN_LIBRARY_DIRS "@FANN_LIBRARY_DIRS@" ) 32 | set ( FANN_ROOT_DIR "@FANN_ROOT_DIR@" ) 33 | 34 | set ( FANN_VERSION_STRING "@FANN_VERSION_STRING@" ) 35 | set ( FANN_VERSION_MAJOR "@FANN_VERSION_MAJOR@" ) 36 | set ( FANN_VERSION_MINOR "@FANN_VERSION_MINOR@" ) 37 | set ( FANN_VERSION_PATCH "@FANN_VERSION_PATCH@" ) 38 | 39 | -------------------------------------------------------------------------------- /third_party/fann/cmake/fann-use.cmake: -------------------------------------------------------------------------------- 1 | # -*- cmake -*- 2 | # 3 | # fann-use.cmake 4 | # 5 | 6 | add_definitions ( ${FANN_DEFINITIONS} ) 7 | include_directories ( ${FANN_INCLUDE_DIRS} ) 8 | link_directories ( ${FANN_LIBRARY_DIRS} ) 9 | 10 | -------------------------------------------------------------------------------- /third_party/fann/cmake/fann.pc.cmake: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@BIN_INSTALL_DIR@ 3 | libdir=@LIB_INSTALL_DIR@ 4 | includedir=@INCLUDE_INSTALL_DIR@ 5 | 6 | Name: fann 7 | Description: Fast Artificial Neural Network Library 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lm -lfann 10 | Cflags: -I${includedir} 11 | -------------------------------------------------------------------------------- /third_party/fann/fann-config.cmake: -------------------------------------------------------------------------------- 1 | # -*- cmake -*- 2 | # 3 | # fann-config.cmake(.in) 4 | # 5 | 6 | # Use the following variables to compile and link against FANN: 7 | # FANN_FOUND - True if FANN was found on your system 8 | # FANN_USE_FILE - The file making FANN usable 9 | # FANN_DEFINITIONS - Definitions needed to build with FANN 10 | # FANN_INCLUDE_DIR - Directory where fann.h can be found 11 | # FANN_INCLUDE_DIRS - List of directories of FANN and it's dependencies 12 | # FANN_LIBRARY - FANN library location 13 | # FANN_LIBRARIES - List of libraries to link against FANN library 14 | # FANN_LIBRARY_DIRS - List of directories containing FANN' libraries 15 | # FANN_ROOT_DIR - The base directory of FANN 16 | # FANN_VERSION_STRING - A human-readable string containing the version 17 | # FANN_VERSION_MAJOR - The major version of FANN 18 | # FANN_VERSION_MINOR - The minor version of FANN 19 | # FANN_VERSION_PATCH - The patch version of FANN 20 | 21 | 22 | ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() ####### 23 | ####### Any changes to this file will be overwritten by the next CMake run #### 24 | ####### The input file was fann-config.cmake.in ######## 25 | 26 | get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../" ABSOLUTE) 27 | 28 | macro(set_and_check _var _file) 29 | set(${_var} "${_file}") 30 | if(NOT EXISTS "${_file}") 31 | message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !") 32 | endif() 33 | endmacro() 34 | 35 | #################################################################################### 36 | 37 | set ( FANN_FOUND 1 ) 38 | set ( FANN_USE_FILE "/home/siim/projects/FastHumanDetection/build/lib/cmake/fann/fann-use.cmake" ) 39 | 40 | set ( FANN_DEFINITIONS "" ) 41 | set ( FANN_INCLUDE_DIR "/home/siim/projects/FastHumanDetection/build/include" ) 42 | set ( FANN_INCLUDE_DIRS "/home/siim/projects/FastHumanDetection/build/include" ) 43 | set ( FANN_LIBRARY "fann" ) 44 | set ( FANN_LIBRARIES "fann;m" ) 45 | set ( FANN_LIBRARY_DIRS "/home/siim/projects/FastHumanDetection/build/lib" ) 46 | set ( FANN_ROOT_DIR "/home/siim/projects/FastHumanDetection/build" ) 47 | 48 | set ( FANN_VERSION_STRING "2.2.0" ) 49 | set ( FANN_VERSION_MAJOR "2" ) 50 | set ( FANN_VERSION_MINOR "2" ) 51 | set ( FANN_VERSION_PATCH "0" ) 52 | 53 | -------------------------------------------------------------------------------- /third_party/fann/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FIND_PACKAGE(OpenMP) 2 | IF(OPENMP_FOUND) 3 | OPTION(DISABLE_PARALLEL_FANN "Disable parallel fann functions" OFF) 4 | ENDIF(OPENMP_FOUND) 5 | 6 | IF(NOT OPENMP_FOUND OR DISABLE_PARALLEL_FANN) 7 | ADD_DEFINITIONS(-DDISABLE_PARALLEL_FANN) 8 | ELSE() 9 | SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 10 | SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 11 | ENDIF(NOT OPENMP_FOUND OR DISABLE_PARALLEL_FANN) 12 | 13 | ADD_SUBDIRECTORY( include ) 14 | 15 | INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/include) 16 | ADD_DEFINITIONS(-D_REENTRANT) 17 | if (WIN32) 18 | ADD_DEFINITIONS(-DFANN_DLL_EXPORTS) 19 | endif (WIN32) 20 | ########### next target ############### 21 | 22 | SET(floatfann_LIB_SRCS 23 | floatfann.c 24 | ) 25 | 26 | ADD_LIBRARY(floatfann SHARED ${floatfann_LIB_SRCS}) 27 | ADD_LIBRARY(floatfann_static STATIC ${floatfann_LIB_SRCS}) 28 | 29 | SET_TARGET_PROPERTIES(floatfann PROPERTIES VERSION ${FANN_VERSION_STRING} SOVERSION ${FANN_VERSION_MAJOR}) 30 | SET_TARGET_PROPERTIES(floatfann_static PROPERTIES VERSION ${FANN_VERSION_STRING} SOVERSION ${FANN_VERSION_MAJOR}) 31 | if (UNIX) 32 | SET_TARGET_PROPERTIES(floatfann_static PROPERTIES OUTPUT_NAME floatfann) 33 | endif(UNIX) 34 | -------------------------------------------------------------------------------- /third_party/fann/src/doublefann.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #include "config.h" 23 | #include "doublefann.h" 24 | 25 | #include "fann.c" 26 | #include "fann_io.c" 27 | #include "fann_train.c" 28 | #include "fann_train_data.c" 29 | #include "fann_error.c" 30 | #include "fann_cascade.c" 31 | #include "parallel_fann.c" 32 | -------------------------------------------------------------------------------- /third_party/fann/src/fixedfann.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #include "config.h" 23 | #include "fixedfann.h" 24 | 25 | #include "fann.c" 26 | #include "fann_io.c" 27 | #include "fann_train.c" 28 | #include "fann_train_data.c" 29 | #include "fann_error.c" 30 | #include "fann_cascade.c" 31 | -------------------------------------------------------------------------------- /third_party/fann/src/floatfann.c: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #include "config.h" 23 | #include "floatfann.h" 24 | 25 | #include "fann.c" 26 | #include "fann_io.c" 27 | #include "fann_train.c" 28 | #include "fann_train_data.c" 29 | #include "fann_error.c" 30 | #include "fann_cascade.c" 31 | #include "parallel_fann.c" 32 | -------------------------------------------------------------------------------- /third_party/fann/src/include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ########### install files ############### 2 | 3 | IF(NOT OPENMP_FOUND OR DISABLE_PARALLEL_FANN) 4 | SET(PARALLEL_INCLUDES "") 5 | ELSE(NOT OPENMP_FOUND OR DISABLE_PARALLEL_FANN) 6 | SET(PARALLEL_INCLUDES parallel_fann.h parallel_fann.hpp) 7 | ENDIF(NOT OPENMP_FOUND OR DISABLE_PARALLEL_FANN) 8 | -------------------------------------------------------------------------------- /third_party/fann/src/include/config.h: -------------------------------------------------------------------------------- 1 | /* Name of package */ 2 | /* #undef PACKAGE */ 3 | 4 | /* Version number of package */ 5 | /* #undef VERSION */ 6 | 7 | /* Define for the x86_64 CPU famyly */ 8 | /* #undef X86_64 */ 9 | -------------------------------------------------------------------------------- /third_party/fann/src/include/doublefann.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef __doublefann_h__ 21 | #define __doublefann_h__ 22 | 23 | typedef double fann_type; 24 | 25 | #undef DOUBLEFANN 26 | #define DOUBLEFANN 27 | #define FANNPRINTF "%.20e" 28 | #define FANNSCANF "%le" 29 | 30 | #define FANN_INCLUDE 31 | #include "fann.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /third_party/fann/src/include/fixedfann.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef __fixedfann_h__ 21 | #define __fixedfann_h__ 22 | 23 | typedef int fann_type; 24 | 25 | #undef FIXEDFANN 26 | #define FIXEDFANN 27 | #define FANNPRINTF "%d" 28 | #define FANNSCANF "%d" 29 | 30 | #define FANN_INCLUDE 31 | #include "fann.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /third_party/fann/src/include/floatfann.h: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | #ifndef __floatfann_h__ 21 | #define __floatfann_h__ 22 | 23 | typedef float fann_type; 24 | 25 | #undef FLOATFANN 26 | #define FLOATFANN 27 | #define FANNPRINTF "%.20e" 28 | #define FANNSCANF "%f" 29 | 30 | #define FANN_INCLUDE 31 | #include "fann.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /third_party/fann/src/include/parallel_fann.h: -------------------------------------------------------------------------------- 1 | /* 2 | * parallel_FANN.h 3 | * 4 | * Author: Alessandro Pietro Bardelli 5 | */ 6 | #ifndef DISABLE_PARALLEL_FANN 7 | #ifndef PARALLEL_FANN_H_ 8 | #define PARALLEL_FANN_H_ 9 | 10 | #include "fann.h" 11 | 12 | #ifdef __cplusplus 13 | extern "C" 14 | { 15 | 16 | #ifndef __cplusplus 17 | } /* to fool automatic indention engines */ 18 | #endif 19 | #endif /* __cplusplus */ 20 | 21 | #ifndef FIXEDFANN 22 | FANN_EXTERNAL float FANN_API fann_train_epoch_batch_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 23 | 24 | FANN_EXTERNAL float FANN_API fann_train_epoch_irpropm_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 25 | 26 | FANN_EXTERNAL float FANN_API fann_train_epoch_quickprop_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 27 | 28 | FANN_EXTERNAL float FANN_API fann_train_epoch_sarprop_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 29 | 30 | FANN_EXTERNAL float FANN_API fann_train_epoch_incremental_mod(struct fann *ann, struct fann_train_data *data); 31 | 32 | FANN_EXTERNAL float FANN_API fann_test_data_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 33 | #endif /* FIXEDFANN */ 34 | 35 | #ifdef __cplusplus 36 | #ifndef __cplusplus 37 | /* to fool automatic indention engines */ 38 | { 39 | 40 | #endif 41 | } 42 | #endif /* __cplusplus */ 43 | 44 | #endif /* PARALLEL_FANN_H_ */ 45 | #endif /* DISABLE_PARALLEL_FANN */ 46 | -------------------------------------------------------------------------------- /third_party/fann/src/include/parallel_fann.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * parallel_FANN.hpp 3 | * Author: Alessandro Pietro Bardelli 4 | */ 5 | #ifndef DISABLE_PARALLEL_FANN 6 | #ifndef PARALLEL_FANN_HPP_ 7 | #define PARALLEL_FANN_HPP_ 8 | #include 9 | #include 10 | #include "fann.h" 11 | 12 | #ifndef FIXEDFANN 13 | namespace parallel_fann { 14 | float train_epoch_batch_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 15 | 16 | float train_epoch_irpropm_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 17 | 18 | float train_epoch_quickprop_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 19 | 20 | float train_epoch_sarprop_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 21 | 22 | float train_epoch_incremental_mod(struct fann *ann, struct fann_train_data *data); 23 | 24 | float train_epoch_batch_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb,std::vector< std::vector >& predicted_outputs); 25 | 26 | float train_epoch_irpropm_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb, std::vector< std::vector >& predicted_outputs); 27 | 28 | float train_epoch_quickprop_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb, std::vector< std::vector >& predicted_outputs); 29 | 30 | float train_epoch_sarprop_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb, std::vector< std::vector >& predicted_outputs); 31 | 32 | float train_epoch_incremental_mod(struct fann *ann, struct fann_train_data *data, std::vector< std::vector >& predicted_outputs); 33 | 34 | float test_data_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb); 35 | float test_data_parallel(struct fann *ann, struct fann_train_data *data, const unsigned int threadnumb, std::vector< std::vector >& predicted_outputs); 36 | } 37 | #endif /* FIXEDFANN */ 38 | #endif /* PARALLEL_FANN_HPP_ */ 39 | #endif /* DISABLE_PARALLEL_FANN */ 40 | -------------------------------------------------------------------------------- /third_party/fann/src/parallel_doublefann_cpp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #ifndef DISABLE_PARALLEL_FANN 23 | #include "config.h" 24 | #include "doublefann.h" 25 | 26 | #include "parallel_fann_cpp.cpp" 27 | #endif /* DISABLE_PARALLEL_FANN */ 28 | -------------------------------------------------------------------------------- /third_party/fann/src/parallel_floatfann_cpp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Fast Artificial Neural Network Library (fann) 3 | Copyright (C) 2003-2016 Steffen Nissen (steffen.fann@gmail.com) 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with this library; if not, write to the Free Software 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 | */ 19 | 20 | /* Easy way to allow for build of multiple binaries */ 21 | 22 | #ifndef DISABLE_PARALLEL_FANN 23 | #include "config.h" 24 | #include "floatfann.h" 25 | 26 | #include "parallel_fann_cpp.cpp" 27 | #endif /* DISABLE_PARALLEL_FANN */ 28 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/MacOSXBundleInfo.plist.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${MACOSX_BUNDLE_EXECUTABLE_NAME} 9 | CFBundleGetInfoString 10 | ${MACOSX_BUNDLE_INFO_STRING} 11 | CFBundleIconFile 12 | ${MACOSX_BUNDLE_ICON_FILE} 13 | CFBundleIdentifier 14 | ${MACOSX_BUNDLE_GUI_IDENTIFIER} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleLongVersionString 18 | ${MACOSX_BUNDLE_LONG_VERSION_STRING} 19 | CFBundleName 20 | ${MACOSX_BUNDLE_BUNDLE_NAME} 21 | CFBundlePackageType 22 | APPL 23 | CFBundleShortVersionString 24 | ${MACOSX_BUNDLE_SHORT_VERSION_STRING} 25 | CFBundleSignature 26 | ???? 27 | CFBundleVersion 28 | ${MACOSX_BUNDLE_BUNDLE_VERSION} 29 | CSResourcesFileMapped 30 | 31 | LSRequiresCarbon 32 | 33 | NSHumanReadableCopyright 34 | ${MACOSX_BUNDLE_COPYRIGHT} 35 | NSHighResolutionCapable 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/amd64-mingw32msvc.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross compiling from Linux to Win64 2 | SET(CMAKE_SYSTEM_NAME Windows) 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "amd64-mingw32msvc-gcc") 5 | SET(CMAKE_CXX_COMPILER "amd64-mingw32msvc-g++") 6 | SET(CMAKE_RC_COMPILER "amd64-mingw32msvc-windres") 7 | SET(CMAKE_RANLIB "amd64-mingw32msvc-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/amd64-mingw32msvc") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/i586-mingw32msvc.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross compiling from Linux to Win32 2 | SET(CMAKE_SYSTEM_NAME Windows) 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i586-mingw32msvc-gcc") 5 | SET(CMAKE_CXX_COMPILER "i586-mingw32msvc-g++") 6 | SET(CMAKE_RC_COMPILER "i586-mingw32msvc-windres") 7 | SET(CMAKE_RANLIB "i586-mingw32msvc-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i586-mingw32msvc") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/i686-pc-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross compiling from Linux to Win32 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-pc-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "i686-pc-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "i686-pc-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-pc-mingw32-ranlib") 8 | 9 | #Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/opt/mingw/usr/i686-pc-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/i686-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross compiling from Linux to Win32 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "i686-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/modules/FindEGL.cmake: -------------------------------------------------------------------------------- 1 | # Find EGL 2 | # 3 | # EGL_INCLUDE_DIR 4 | # EGL_LIBRARY 5 | # EGL_FOUND 6 | 7 | find_path(EGL_INCLUDE_DIR NAMES EGL/egl.h PATHS /opt/vc/include) 8 | 9 | set(EGL_NAMES ${EGL_NAMES} egl EGL libEGL) 10 | find_library(EGL_LIBRARY NAMES ${EGL_NAMES} PATHS /opt/vc/lib) 11 | 12 | include(FindPackageHandleStandardArgs) 13 | find_package_handle_standard_args(EGL DEFAULT_MSG EGL_LIBRARY EGL_INCLUDE_DIR) 14 | 15 | mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY) 16 | 17 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/modules/FindGLESv1.cmake: -------------------------------------------------------------------------------- 1 | # Find GLESv1 2 | # 3 | # GLESv1_INCLUDE_DIR 4 | # GLESv1_LIBRARY 5 | # GLESv1_FOUND 6 | 7 | find_path(GLESv1_INCLUDE_DIR NAMES GLES/gl.h PATHS /opt/vc/include) 8 | 9 | set(GLESv1_NAMES ${GLESv1_NAMES} GLESv1_CM libGLES_CM) 10 | find_library(GLESv1_LIBRARY NAMES ${GLESv1_NAMES} PATHS /opt/vc/lib) 11 | 12 | include(FindPackageHandleStandardArgs) 13 | find_package_handle_standard_args(GLESv1 DEFAULT_MSG GLESv1_LIBRARY GLESv1_INCLUDE_DIR) 14 | 15 | mark_as_advanced(GLESv1_INCLUDE_DIR GLESv1_LIBRARY) 16 | 17 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/modules/FindGLESv2.cmake: -------------------------------------------------------------------------------- 1 | # Find GLESv2 2 | # 3 | # GLESv2_INCLUDE_DIR 4 | # GLESv2_LIBRARY 5 | # GLESv2_FOUND 6 | 7 | find_path(GLESv2_INCLUDE_DIR NAMES GLES2/gl2.h PATHS /opt/vc/include) 8 | 9 | set(GLESv2_NAMES ${GLESv2_NAMES} GLESv2 libGLESv2) 10 | find_library(GLESv2_LIBRARY NAMES ${GLESv2_NAMES} PATHS /opt/vc/lib) 11 | 12 | include(FindPackageHandleStandardArgs) 13 | find_package_handle_standard_args(GLESv2 DEFAULT_MSG GLESv2_LIBRARY GLESv2_INCLUDE_DIR) 14 | 15 | mark_as_advanced(GLESv2_INCLUDE_DIR GLESv2_LIBRARY) 16 | 17 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/modules/FindMir.cmake: -------------------------------------------------------------------------------- 1 | # Try to find Mir on a Unix system 2 | # 3 | # This will define: 4 | # 5 | # MIR_LIBRARIES - Link these to use Wayland 6 | # MIR_INCLUDE_DIR - Include directory for Wayland 7 | # 8 | # Copyright (c) 2014 Brandon Schaefer 9 | 10 | if (NOT WIN32) 11 | 12 | find_package (PkgConfig) 13 | pkg_check_modules (PKG_MIR QUIET mirclient) 14 | 15 | set (MIR_INCLUDE_DIR ${PKG_MIR_INCLUDE_DIRS}) 16 | set (MIR_LIBRARIES ${PKG_MIR_LIBRARIES}) 17 | 18 | endif () 19 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/modules/FindXKBCommon.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find XKBCommon 2 | # Once done, this will define 3 | # 4 | # XKBCOMMON_FOUND - System has XKBCommon 5 | # XKBCOMMON_INCLUDE_DIRS - The XKBCommon include directories 6 | # XKBCOMMON_LIBRARIES - The libraries needed to use XKBCommon 7 | # XKBCOMMON_DEFINITIONS - Compiler switches required for using XKBCommon 8 | 9 | find_package(PkgConfig) 10 | pkg_check_modules(PC_XKBCOMMON QUIET xkbcommon) 11 | set(XKBCOMMON_DEFINITIONS ${PC_XKBCOMMON_CFLAGS_OTHER}) 12 | 13 | find_path(XKBCOMMON_INCLUDE_DIR 14 | NAMES xkbcommon/xkbcommon.h 15 | HINTS ${PC_XKBCOMMON_INCLUDE_DIR} ${PC_XKBCOMMON_INCLUDE_DIRS} 16 | ) 17 | 18 | find_library(XKBCOMMON_LIBRARY 19 | NAMES xkbcommon 20 | HINTS ${PC_XKBCOMMON_LIBRARY} ${PC_XKBCOMMON_LIBRARY_DIRS} 21 | ) 22 | 23 | set(XKBCOMMON_LIBRARIES ${XKBCOMMON_LIBRARY}) 24 | set(XKBCOMMON_LIBRARY_DIRS ${XKBCOMMON_LIBRARY_DIRS}) 25 | set(XKBCOMMON_INCLUDE_DIRS ${XKBCOMMON_INCLUDE_DIR}) 26 | 27 | include(FindPackageHandleStandardArgs) 28 | find_package_handle_standard_args(XKBCommon DEFAULT_MSG 29 | XKBCOMMON_LIBRARY 30 | XKBCOMMON_INCLUDE_DIR 31 | ) 32 | 33 | mark_as_advanced(XKBCOMMON_LIBRARY XKBCOMMON_INCLUDE_DIR) 34 | 35 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/CMake/x86_64-w64-mingw32.cmake: -------------------------------------------------------------------------------- 1 | # Define the environment for cross compiling from Linux to Win32 2 | SET(CMAKE_SYSTEM_NAME Windows) # Target system name 3 | SET(CMAKE_SYSTEM_VERSION 1) 4 | SET(CMAKE_C_COMPILER "x86_64-w64-mingw32-gcc") 5 | SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++") 6 | SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres") 7 | SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib") 8 | 9 | # Configure the behaviour of the find commands 10 | SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32") 11 | SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 12 | SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 13 | SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 14 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/COPYING.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2002-2006 Marcus Geelnard 2 | Copyright (c) 2006-2010 Camilla Berglund 3 | 4 | This software is provided 'as-is', without any express or implied 5 | warranty. In no event will the authors be held liable for any damages 6 | arising from the use of this software. 7 | 8 | Permission is granted to anyone to use this software for any purpose, 9 | including commercial applications, and to alter it and redistribute it 10 | freely, subject to the following restrictions: 11 | 12 | 1. The origin of this software must not be misrepresented; you must not 13 | claim that you wrote the original software. If you use this software 14 | in a product, an acknowledgment in the product documentation would 15 | be appreciated but is not required. 16 | 17 | 2. Altered source versions must be plainly marked as such, and must not 18 | be misrepresented as being the original software. 19 | 20 | 3. This notice may not be removed or altered from any source 21 | distribution. 22 | 23 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 4 | endif() 5 | 6 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 7 | string(REGEX REPLACE "\n" ";" files "${files}") 8 | 9 | foreach (file ${files}) 10 | message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | if (EXISTS "$ENV{DESTDIR}${file}") 12 | exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 13 | OUTPUT_VARIABLE rm_out 14 | RETURN_VALUE rm_retval) 15 | if (NOT "${rm_retval}" STREQUAL 0) 16 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 17 | endif() 18 | elseif (IS_SYMLINK "$ENV{DESTDIR}${file}") 19 | EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 20 | OUTPUT_VARIABLE rm_out 21 | RETURN_VALUE rm_retval) 22 | if (NOT "${rm_retval}" STREQUAL 0) 23 | message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"") 24 | endif() 25 | else() 26 | message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 27 | endif() 28 | endforeach() 29 | 30 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/deps/getopt.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012, Kim Gräsman 2 | * All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * * Redistributions of source code must retain the above copyright notice, 7 | * this list of conditions and the following disclaimer. 8 | * * Redistributions in binary form must reproduce the above copyright notice, 9 | * this list of conditions and the following disclaimer in the documentation 10 | * and/or other materials provided with the distribution. 11 | * * Neither the name of Kim Gräsman nor the names of contributors may be used 12 | * to endorse or promote products derived from this software without specific 13 | * prior written permission. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL KIM GRÄSMAN BE LIABLE FOR ANY DIRECT, 19 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #ifndef INCLUDED_GETOPT_PORT_H 28 | #define INCLUDED_GETOPT_PORT_H 29 | 30 | #if defined(__cplusplus) 31 | extern "C" { 32 | #endif 33 | 34 | extern const int no_argument; 35 | extern const int required_argument; 36 | extern const int optional_argument; 37 | 38 | extern char* optarg; 39 | extern int optind, opterr, optopt; 40 | 41 | struct option { 42 | const char* name; 43 | int has_arg; 44 | int* flag; 45 | int val; 46 | }; 47 | 48 | int getopt(int argc, char* const argv[], const char* optstring); 49 | 50 | int getopt_long(int argc, char* const argv[], 51 | const char* optstring, const struct option* longopts, int* longindex); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #endif // INCLUDED_GETOPT_PORT_H 58 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/glfw3.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=${prefix} 3 | includedir=${prefix}/include 4 | libdir=${exec_prefix}/lib@LIB_SUFFIX@ 5 | 6 | Name: GLFW 7 | Description: A multi-platform library for OpenGL, window and input 8 | Version: @GLFW_VERSION_FULL@ 9 | URL: http://www.glfw.org/ 10 | Requires.private: @GLFW_PKG_DEPS@ 11 | Libs: -L${libdir} -l@GLFW_LIB_NAME@ 12 | Libs.private: @GLFW_PKG_LIBS@ 13 | Cflags: -I${includedir} 14 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/glfw3Config.cmake.in: -------------------------------------------------------------------------------- 1 | # - Config file for the glfw3 package 2 | # It defines the following variables 3 | # GLFW3_INCLUDE_DIR, the path where GLFW headers are located 4 | # GLFW3_LIBRARY_DIR, folder in which the GLFW library is located 5 | # GLFW3_LIBRARY, library to link against to use GLFW 6 | 7 | set(GLFW3_VERSION "@GLFW_VERSION_FULL@") 8 | 9 | @PACKAGE_INIT@ 10 | 11 | set_and_check(GLFW3_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/include") 12 | set_and_check(GLFW3_LIBRARY_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@") 13 | 14 | find_library(GLFW3_LIBRARY "@GLFW_LIB_NAME@" HINTS ${GLFW3_LIBRARY_DIR}) 15 | 16 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/iokit_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 IOKit - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2014 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_iokit_joystick_h_ 28 | #define _glfw3_iokit_joystick_h_ 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 36 | _GLFWjoystickIOKit iokit_js 37 | 38 | 39 | // IOKit-specific per-joystick data 40 | // 41 | typedef struct _GLFWjoydevice 42 | { 43 | int present; 44 | char name[256]; 45 | 46 | IOHIDDeviceRef deviceRef; 47 | 48 | CFMutableArrayRef axisElements; 49 | CFMutableArrayRef buttonElements; 50 | CFMutableArrayRef hatElements; 51 | 52 | float* axes; 53 | unsigned char* buttons; 54 | } _GLFWjoydevice; 55 | 56 | // IOKit-specific joystick API data 57 | // 58 | typedef struct _GLFWjoystickIOKit 59 | { 60 | _GLFWjoydevice devices[GLFW_JOYSTICK_LAST + 1]; 61 | 62 | IOHIDManagerRef managerRef; 63 | } _GLFWjoystickIOKit; 64 | 65 | void _glfwInitJoysticks(void); 66 | void _glfwTerminateJoysticks(void); 67 | 68 | #endif // _glfw3_iokit_joystick_h_ 69 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/linux_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_linux_joystick_h_ 28 | #define _glfw3_linux_joystick_h_ 29 | 30 | #include 31 | 32 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 33 | _GLFWjoystickLinux linux_js 34 | 35 | 36 | // Linux-specific joystick API data 37 | // 38 | typedef struct _GLFWjoystickLinux 39 | { 40 | struct 41 | { 42 | int present; 43 | int fd; 44 | float* axes; 45 | int axisCount; 46 | unsigned char* buttons; 47 | int buttonCount; 48 | char* name; 49 | char* path; 50 | } js[GLFW_JOYSTICK_LAST + 1]; 51 | 52 | #if defined(__linux__) 53 | int inotify; 54 | int watch; 55 | regex_t regex; 56 | #endif /*__linux__*/ 57 | } _GLFWjoystickLinux; 58 | 59 | 60 | int _glfwInitJoysticks(void); 61 | void _glfwTerminateJoysticks(void); 62 | 63 | #endif // _glfw3_linux_joystick_h_ 64 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/mach_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2010 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #include "internal.h" 28 | 29 | #include 30 | 31 | 32 | // Return raw time 33 | // 34 | static uint64_t getRawTime(void) 35 | { 36 | return mach_absolute_time(); 37 | } 38 | 39 | 40 | ////////////////////////////////////////////////////////////////////////// 41 | ////// GLFW internal API ////// 42 | ////////////////////////////////////////////////////////////////////////// 43 | 44 | // Initialise timer 45 | // 46 | void _glfwInitTimer(void) 47 | { 48 | mach_timebase_info_data_t info; 49 | mach_timebase_info(&info); 50 | 51 | _glfw.ns_time.resolution = (double) info.numer / (info.denom * 1.0e9); 52 | _glfw.ns_time.base = getRawTime(); 53 | } 54 | 55 | 56 | ////////////////////////////////////////////////////////////////////////// 57 | ////// GLFW platform API ////// 58 | ////////////////////////////////////////////////////////////////////////// 59 | 60 | double _glfwPlatformGetTime(void) 61 | { 62 | return (double) (getRawTime() - _glfw.ns_time.base) * 63 | _glfw.ns_time.resolution; 64 | } 65 | 66 | void _glfwPlatformSetTime(double time) 67 | { 68 | _glfw.ns_time.base = getRawTime() - 69 | (uint64_t) (time / _glfw.ns_time.resolution); 70 | } 71 | 72 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/nsgl_context.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 OS X - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2009-2010 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_nsgl_context_h_ 28 | #define _glfw3_nsgl_context_h_ 29 | 30 | #define _GLFW_PLATFORM_FBCONFIG 31 | #define _GLFW_PLATFORM_CONTEXT_STATE _GLFWcontextNSGL nsgl 32 | #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE _GLFWlibraryNSGL nsgl 33 | 34 | 35 | // NSGL-specific per-context data 36 | // 37 | typedef struct _GLFWcontextNSGL 38 | { 39 | id pixelFormat; 40 | id context; 41 | 42 | } _GLFWcontextNSGL; 43 | 44 | 45 | // NSGL-specific global data 46 | // 47 | typedef struct _GLFWlibraryNSGL 48 | { 49 | // dlopen handle for OpenGL.framework (for glfwGetProcAddress) 50 | void* framework; 51 | 52 | } _GLFWlibraryNSGL; 53 | 54 | 55 | int _glfwInitContextAPI(void); 56 | void _glfwTerminateContextAPI(void); 57 | int _glfwCreateContext(_GLFWwindow* window, 58 | const _GLFWctxconfig* ctxconfig, 59 | const _GLFWfbconfig* fbconfig); 60 | void _glfwDestroyContext(_GLFWwindow* window); 61 | 62 | #endif // _glfw3_nsgl_context_h_ 63 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/posix_time.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_time_h_ 29 | #define _glfw3_posix_time_h_ 30 | 31 | #define _GLFW_PLATFORM_LIBRARY_TIME_STATE _GLFWtimePOSIX posix_time 32 | 33 | #include 34 | 35 | 36 | // POSIX-specific global timer data 37 | // 38 | typedef struct _GLFWtimePOSIX 39 | { 40 | GLboolean monotonic; 41 | double resolution; 42 | uint64_t base; 43 | 44 | } _GLFWtimePOSIX; 45 | 46 | 47 | void _glfwInitTimer(void); 48 | 49 | #endif // _glfw3_posix_time_h_ 50 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/posix_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | int _glfwCreateContextTLS(void) 36 | { 37 | if (pthread_key_create(&_glfw.posix_tls.context, NULL) != 0) 38 | { 39 | _glfwInputError(GLFW_PLATFORM_ERROR, 40 | "POSIX: Failed to create context TLS"); 41 | return GL_FALSE; 42 | } 43 | 44 | return GL_TRUE; 45 | } 46 | 47 | void _glfwDestroyContextTLS(void) 48 | { 49 | pthread_key_delete(_glfw.posix_tls.context); 50 | } 51 | 52 | void _glfwSetContextTLS(_GLFWwindow* context) 53 | { 54 | pthread_setspecific(_glfw.posix_tls.context, context); 55 | } 56 | 57 | 58 | ////////////////////////////////////////////////////////////////////////// 59 | ////// GLFW platform API ////// 60 | ////////////////////////////////////////////////////////////////////////// 61 | 62 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 63 | { 64 | return pthread_getspecific(_glfw.posix_tls.context); 65 | } 66 | 67 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/posix_tls.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 POSIX - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_posix_tls_h_ 29 | #define _glfw3_posix_tls_h_ 30 | 31 | #include 32 | 33 | #define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsPOSIX posix_tls 34 | 35 | 36 | // POSIX-specific global TLS data 37 | // 38 | typedef struct _GLFWtlsPOSIX 39 | { 40 | pthread_key_t context; 41 | 42 | } _GLFWtlsPOSIX; 43 | 44 | 45 | int _glfwCreateContextTLS(void); 46 | void _glfwDestroyContextTLS(void); 47 | void _glfwSetContextTLS(_GLFWwindow* context); 48 | 49 | #endif // _glfw3_posix_tls_h_ 50 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/win32_time.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | // Return raw time 32 | // 33 | static unsigned __int64 getRawTime(void) 34 | { 35 | if (_glfw.win32_time.hasPC) 36 | { 37 | unsigned __int64 time; 38 | QueryPerformanceCounter((LARGE_INTEGER*) &time); 39 | return time; 40 | } 41 | else 42 | return (unsigned __int64) _glfw_timeGetTime(); 43 | } 44 | 45 | 46 | ////////////////////////////////////////////////////////////////////////// 47 | ////// GLFW internal API ////// 48 | ////////////////////////////////////////////////////////////////////////// 49 | 50 | // Initialise timer 51 | // 52 | void _glfwInitTimer(void) 53 | { 54 | unsigned __int64 frequency; 55 | 56 | if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) 57 | { 58 | _glfw.win32_time.hasPC = GL_TRUE; 59 | _glfw.win32_time.resolution = 1.0 / (double) frequency; 60 | } 61 | else 62 | { 63 | _glfw.win32_time.hasPC = GL_FALSE; 64 | _glfw.win32_time.resolution = 0.001; // winmm resolution is 1 ms 65 | } 66 | 67 | _glfw.win32_time.base = getRawTime(); 68 | } 69 | 70 | 71 | ////////////////////////////////////////////////////////////////////////// 72 | ////// GLFW platform API ////// 73 | ////////////////////////////////////////////////////////////////////////// 74 | 75 | double _glfwPlatformGetTime(void) 76 | { 77 | return (double) (getRawTime() - _glfw.win32_time.base) * 78 | _glfw.win32_time.resolution; 79 | } 80 | 81 | void _glfwPlatformSetTime(double time) 82 | { 83 | _glfw.win32_time.base = getRawTime() - 84 | (unsigned __int64) (time / _glfw.win32_time.resolution); 85 | } 86 | 87 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/win32_tls.c: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #include "internal.h" 29 | 30 | 31 | ////////////////////////////////////////////////////////////////////////// 32 | ////// GLFW internal API ////// 33 | ////////////////////////////////////////////////////////////////////////// 34 | 35 | int _glfwCreateContextTLS(void) 36 | { 37 | _glfw.win32_tls.context = TlsAlloc(); 38 | if (_glfw.win32_tls.context == TLS_OUT_OF_INDEXES) 39 | { 40 | _glfwInputError(GLFW_PLATFORM_ERROR, 41 | "Win32: Failed to allocate TLS index"); 42 | return GL_FALSE; 43 | } 44 | 45 | _glfw.win32_tls.allocated = GL_TRUE; 46 | return GL_TRUE; 47 | } 48 | 49 | void _glfwDestroyContextTLS(void) 50 | { 51 | if (_glfw.win32_tls.allocated) 52 | TlsFree(_glfw.win32_tls.context); 53 | } 54 | 55 | void _glfwSetContextTLS(_GLFWwindow* context) 56 | { 57 | TlsSetValue(_glfw.win32_tls.context, context); 58 | } 59 | 60 | 61 | ////////////////////////////////////////////////////////////////////////// 62 | ////// GLFW platform API ////// 63 | ////////////////////////////////////////////////////////////////////////// 64 | 65 | _GLFWwindow* _glfwPlatformGetCurrentContext(void) 66 | { 67 | return TlsGetValue(_glfw.win32_tls.context); 68 | } 69 | 70 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/win32_tls.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Win32 - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2002-2006 Marcus Geelnard 5 | // Copyright (c) 2006-2010 Camilla Berglund 6 | // 7 | // This software is provided 'as-is', without any express or implied 8 | // warranty. In no event will the authors be held liable for any damages 9 | // arising from the use of this software. 10 | // 11 | // Permission is granted to anyone to use this software for any purpose, 12 | // including commercial applications, and to alter it and redistribute it 13 | // freely, subject to the following restrictions: 14 | // 15 | // 1. The origin of this software must not be misrepresented; you must not 16 | // claim that you wrote the original software. If you use this software 17 | // in a product, an acknowledgment in the product documentation would 18 | // be appreciated but is not required. 19 | // 20 | // 2. Altered source versions must be plainly marked as such, and must not 21 | // be misrepresented as being the original software. 22 | // 23 | // 3. This notice may not be removed or altered from any source 24 | // distribution. 25 | // 26 | //======================================================================== 27 | 28 | #ifndef _glfw3_win32_tls_h_ 29 | #define _glfw3_win32_tls_h_ 30 | 31 | #define _GLFW_PLATFORM_LIBRARY_TLS_STATE _GLFWtlsWin32 win32_tls 32 | 33 | 34 | // Win32-specific global TLS data 35 | // 36 | typedef struct _GLFWtlsWin32 37 | { 38 | GLboolean allocated; 39 | DWORD context; 40 | 41 | } _GLFWtlsWin32; 42 | 43 | 44 | int _glfwCreateContextTLS(void); 45 | void _glfwDestroyContextTLS(void); 46 | void _glfwSetContextTLS(_GLFWwindow* context); 47 | 48 | #endif // _glfw3_win32_tls_h_ 49 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/winmm_joystick.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 WinMM - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2006-2014 Camilla Berglund 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_winmm_joystick_h_ 28 | #define _glfw3_winmm_joystick_h_ 29 | 30 | #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE \ 31 | _GLFWjoystickWinMM winmm_js[GLFW_JOYSTICK_LAST + 1] 32 | 33 | 34 | // WinMM-specific per-joystick data 35 | // 36 | typedef struct _GLFWjoystickWinMM 37 | { 38 | float axes[6]; 39 | unsigned char buttons[36]; // 32 buttons plus one hat 40 | char* name; 41 | } _GLFWjoystickWinMM; 42 | 43 | 44 | void _glfwInitJoysticks(void); 45 | void _glfwTerminateJoysticks(void); 46 | 47 | #endif // _glfw3_winmm_joystick_h_ 48 | -------------------------------------------------------------------------------- /third_party/glfw-3.1.2/src/xkb_unicode.h: -------------------------------------------------------------------------------- 1 | //======================================================================== 2 | // GLFW 3.1 Linux - www.glfw.org 3 | //------------------------------------------------------------------------ 4 | // Copyright (c) 2014 Jonas Ådahl 5 | // 6 | // This software is provided 'as-is', without any express or implied 7 | // warranty. In no event will the authors be held liable for any damages 8 | // arising from the use of this software. 9 | // 10 | // Permission is granted to anyone to use this software for any purpose, 11 | // including commercial applications, and to alter it and redistribute it 12 | // freely, subject to the following restrictions: 13 | // 14 | // 1. The origin of this software must not be misrepresented; you must not 15 | // claim that you wrote the original software. If you use this software 16 | // in a product, an acknowledgment in the product documentation would 17 | // be appreciated but is not required. 18 | // 19 | // 2. Altered source versions must be plainly marked as such, and must not 20 | // be misrepresented as being the original software. 21 | // 22 | // 3. This notice may not be removed or altered from any source 23 | // distribution. 24 | // 25 | //======================================================================== 26 | 27 | #ifndef _glfw3_xkb_unicode_h_ 28 | #define _glfw3_xkb_unicode_h_ 29 | 30 | 31 | long _glfwKeySym2Unicode(unsigned int keysym); 32 | 33 | #endif // _glfw3_xkb_unicode_h_ 34 | --------------------------------------------------------------------------------