├── Source ├── include │ ├── Eigen │ │ ├── Eigen │ │ ├── src │ │ │ ├── Core │ │ │ │ ├── util │ │ │ │ │ ├── NonMPL2.h │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── ReenableStupidWarnings.h │ │ │ │ │ └── DisableStupidWarnings.h │ │ │ │ ├── arch │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ ├── SSE │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── NEON │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ ├── AltiVec │ │ │ │ │ │ └── CMakeLists.txt │ │ │ │ │ └── Default │ │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ │ └── Settings.h │ │ │ │ ├── products │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CoreIterators.h │ │ │ │ ├── ReturnByValue.h │ │ │ │ ├── NestByValue.h │ │ │ │ └── VectorBlock.h │ │ │ ├── QR │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── HouseholderQR_MKL.h │ │ │ ├── SVD │ │ │ │ └── CMakeLists.txt │ │ │ ├── misc │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Solve.h │ │ │ │ ├── Kernel.h │ │ │ │ └── Image.h │ │ │ ├── Jacobi │ │ │ │ └── CMakeLists.txt │ │ │ ├── LU │ │ │ │ ├── arch │ │ │ │ │ └── CMakeLists.txt │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Determinant.h │ │ │ │ └── PartialPivLU_MKL.h │ │ │ ├── plugins │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ │ └── MatrixCwiseUnaryOps.h │ │ │ ├── Cholesky │ │ │ │ └── CMakeLists.txt │ │ │ ├── SparseLU │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── SparseLU_Utils.h │ │ │ │ └── SparseLU_relax_snode.h │ │ │ ├── SparseQR │ │ │ │ └── CMakeLists.txt │ │ │ ├── StlSupport │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── details.h │ │ │ ├── Eigenvalues │ │ │ │ └── CMakeLists.txt │ │ │ ├── Householder │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── BlockHouseholder.h │ │ │ ├── SPQRSupport │ │ │ │ └── CMakeLists.txt │ │ │ ├── SparseCore │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── SparseFuzzy.h │ │ │ │ ├── SparseRedux.h │ │ │ │ ├── SparseTranspose.h │ │ │ │ ├── SparseView.h │ │ │ │ └── SparseDot.h │ │ │ ├── MetisSupport │ │ │ │ └── CMakeLists.txt │ │ │ ├── Geometry │ │ │ │ ├── arch │ │ │ │ │ └── CMakeLists.txt │ │ │ │ └── CMakeLists.txt │ │ │ ├── PaStiXSupport │ │ │ │ └── CMakeLists.txt │ │ │ ├── CholmodSupport │ │ │ │ └── CMakeLists.txt │ │ │ ├── OrderingMethods │ │ │ │ └── CMakeLists.txt │ │ │ ├── PardisoSupport │ │ │ │ └── CMakeLists.txt │ │ │ ├── SparseCholesky │ │ │ │ └── CMakeLists.txt │ │ │ ├── SuperLUSupport │ │ │ │ └── CMakeLists.txt │ │ │ ├── UmfPackSupport │ │ │ │ └── CMakeLists.txt │ │ │ ├── Eigen2Support │ │ │ │ ├── Geometry │ │ │ │ │ ├── CMakeLists.txt │ │ │ │ │ └── All.h │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Macros.h │ │ │ │ ├── TriangularSolver.h │ │ │ │ ├── Memory.h │ │ │ │ ├── QR.h │ │ │ │ ├── Lazy.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── VectorBlock.h │ │ │ │ └── Meta.h │ │ │ ├── IterativeLinearSolvers │ │ │ │ └── CMakeLists.txt │ │ │ └── CMakeLists.txt │ │ ├── Dense │ │ ├── Array │ │ ├── Householder │ │ ├── CMakeLists.txt │ │ ├── Sparse │ │ ├── Jacobi │ │ ├── StdList │ │ ├── QtAlignedMalloc │ │ ├── MetisSupport │ │ ├── LeastSquares │ │ ├── StdDeque │ │ ├── StdVector │ │ ├── Cholesky │ │ ├── PardisoSupport │ │ ├── SVD │ │ ├── SPQRSupport │ │ ├── QR │ │ ├── SparseQR │ │ ├── LU │ │ ├── UmfPackSupport │ │ ├── Eigenvalues │ │ ├── SparseCholesky │ │ ├── PaStiXSupport │ │ ├── IterativeLinearSolvers │ │ ├── Geometry │ │ ├── CholmodSupport │ │ ├── SparseLU │ │ ├── SparseCore │ │ ├── SuperLUSupport │ │ ├── OrderingMethods │ │ └── Eigen2Support │ ├── Utils │ │ ├── myUtils.h │ │ ├── myUtils.h~ │ │ ├── FileSystemHelper.h │ │ ├── cutil_inline.h │ │ ├── stopwatch.h │ │ ├── cutil_gl_inline.h │ │ ├── stopwatch_base.h │ │ └── stopwatch_base.inl │ ├── config.h │ ├── config.h.in │ ├── Raycaster.h │ ├── VolumeIntegrator.h │ ├── General.h │ ├── GL │ │ └── freeglut.h │ ├── CameraFromFile.h │ ├── utilities.h │ ├── WriteToFile.h │ ├── GIPCam.h │ ├── PrimesenseCamera.h │ ├── CameraHandler.h │ ├── SoftKineticCamera.h │ ├── CudaUtilities.cuh │ ├── BasicTypes.h │ ├── MainApp.h~ │ ├── MainApp.h │ ├── ICP.h │ └── CameraAbstract.h ├── src │ ├── Utils │ │ ├── myUtils.cpp~ │ │ ├── myUtils.cpp │ │ ├── CMakeLists.txt │ │ ├── stopwatch_linux.cpp │ │ ├── FileSystemHelper.cpp │ │ ├── FileSystemHelper.cpp~ │ │ ├── stopwatch_win.cpp │ │ └── stopwatch.cpp │ ├── CMakeLists.txt │ ├── CameraSupport │ │ ├── GIPCam │ │ │ └── gipFile.def │ │ ├── PrimesenseCamera.cu │ │ ├── CMakeLists.txt │ │ ├── SoftKineticCamera.cu │ │ ├── GIPCam.cu │ │ └── CameraAbstract.cpp │ ├── General.cpp │ ├── General.cpp~ │ └── General.cu ├── data │ ├── ParametersFileFormat.txt │ └── OpenNIConfig.xml └── CMakeLists.txt ├── .gitignore └── README.md /Source/include/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /Source/include/Utils/myUtils.h: -------------------------------------------------------------------------------- 1 | 2 | static int iDivUp(int a,int b); 3 | -------------------------------------------------------------------------------- /Source/src/Utils/myUtils.cpp~: -------------------------------------------------------------------------------- 1 | #include "myUtils.h" 2 | 3 | int iDivUp(int a,int b) { 4 | return (int)((double)a/b +0.5); 5 | } 6 | -------------------------------------------------------------------------------- /Source/include/Utils/myUtils.h~: -------------------------------------------------------------------------------- 1 | #include "myUtils.h" 2 | 3 | int iDivUp(int a,int b) { 4 | return (int)((double)a/b +0.5); 5 | } 6 | -------------------------------------------------------------------------------- /Source/src/Utils/myUtils.cpp: -------------------------------------------------------------------------------- 1 | #include "myUtils.h" 2 | 3 | static int iDivUp(int a,int b) { 4 | return (int)((double)a/b +0.5); 5 | } 6 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/config.h: -------------------------------------------------------------------------------- 1 | #define BUILD_SOFTKINETIC 2 | /* #undef BUILD_GIPCAM */ 3 | /* #undef BUILD_PRIMESENSE */ 4 | #define BUILD_FROMFILE 5 | -------------------------------------------------------------------------------- /Source/include/config.h.in: -------------------------------------------------------------------------------- 1 | #cmakedefine BUILD_SOFTKINETIC 2 | #cmakedefine BUILD_GIPCAM 3 | #cmakedefine BUILD_PRIMESENSE 4 | #cmakedefine BUILD_FROMFILE -------------------------------------------------------------------------------- /Source/include/Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /Source/include/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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) -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/data/ParametersFileFormat.txt: -------------------------------------------------------------------------------- 1 | Image width (pixels) 2 | Image height (pixels) 3 | Intrinsic-fx Intrinsic-fy 4 | Intrinsic-cx Intrinsic-cy 5 | Z offset in mm (for GIP, otherwise 0) 6 | Camera min depth in positive mm 7 | Camera max depth in positive mm 8 | Number of frames 9 | Name 10 | Date taken 11 | Camera type 12 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/Raycaster.h: -------------------------------------------------------------------------------- 1 | #ifndef ___RAYCASTER_H_ 2 | #define ___RAYCASTER_H_ 3 | 4 | #include "BasicTypes.h" 5 | 6 | class Raycaster { 7 | dim3 m_numBlocks; 8 | CameraParams m_cameraParams; 9 | 10 | public: 11 | Raycaster(CameraParams* cameraParams); 12 | void Raycast(uint *d_output, float* transform, VoxelType* d_voxel_array, const PointInfo& _renderedVertexMap, const float3* d_cameraPosition, bool showNormals); 13 | }; 14 | 15 | 16 | #endif // ___RAYCASTER_H_ 17 | -------------------------------------------------------------------------------- /Source/include/VolumeIntegrator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef ___TSDF_H_ 4 | #define ___TSDF_H_ 5 | 6 | #include "utilities.h" 7 | 8 | 9 | class VolumeIntegrator{ 10 | const CameraParams m_cameraParams; 11 | dim3 m_numBlocks; 12 | 13 | public: 14 | VolumeIntegrator(CameraParams* cameraParams); 15 | void Integrate (VoxelType* d_voxel_array, VoxelWeightType* d_weight_array, const float* const invTransform, const CameraData& depthMap, const float3* d_cameraPosition); 16 | 17 | }; 18 | 19 | 20 | 21 | #endif // ___TSDF_H_ 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Compiled Dynamic libraries 8 | *.so 9 | *.dylib 10 | *.dll 11 | 12 | # Fortran module files 13 | *.mod 14 | 15 | # Compiled Static libraries 16 | *.lai 17 | *.la 18 | *.a 19 | *.lib 20 | 21 | # Executables 22 | *.exe 23 | *.out 24 | *.app 25 | 26 | # Compiled directories 27 | Source/OpenFusion/x64/* 28 | Source/OpenFusion/x64/ 29 | Source\OpenFusion\x64\* 30 | Source\OpenFusion\x64\ 31 | 32 | 33 | # Output files 34 | *.raw 35 | 36 | # DOXYGEN OUTPUT - temp 37 | Doc/ 38 | -------------------------------------------------------------------------------- /Source/include/General.h: -------------------------------------------------------------------------------- 1 | #ifndef ___OUR_GENERAL____ 2 | #define ___OUR_GENERAL____ 3 | 4 | #include "utilities.h" 5 | 6 | class General{ 7 | static bool m_instanceFlag; 8 | static General* m_instance; 9 | 10 | General(){} 11 | public: 12 | static General* Instance(); 13 | ~General(){ 14 | m_instanceFlag = false; 15 | } 16 | 17 | 18 | void InitVoxelArray(VoxelType* d_voxel_array, VoxelWeightType* d_weight_array); 19 | void UpdateTransforms(float* d_currentTransform, float* d_invCurrentTransform, float3* d_cameraPosition, float* invViewMatrix); 20 | }; 21 | 22 | 23 | #endif //___OUR_GENERAL____ 24 | -------------------------------------------------------------------------------- /Source/src/Utils/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #utils 2 | 3 | include_directories ( 4 | ${GLEW_INCLUDE_DIR} 5 | "${PROJECT_SOURCE_DIR}/include" 6 | "${PROJECT_SOURCE_DIR}/include/TinyThread" 7 | "${PROJECT_SOURCE_DIR}/include/Eigen" 8 | "${PROJECT_SOURCE_DIR}/include/Utils" 9 | ${CUDA_TOOLKIT_INCLUDE} 10 | ${OPEN_NI_INCLUDE} 11 | ${SOFTKINETIC_SDK_INCLUDE}) 12 | 13 | 14 | set(SRCS cutil.cpp FileSystemHelper.cpp stopwatch.cpp tinythread.cpp myUtils.cpp) 15 | if(UNIX) 16 | list(APPEND SRCS stopwatch_linux.cpp) 17 | else() 18 | list(APPEND SRCS stopwatch_win.cpp) 19 | endif() 20 | 21 | add_library(OpenFusionUtils ${SRCS}) 22 | -------------------------------------------------------------------------------- /Source/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #src 2 | 3 | 4 | include_directories ( 5 | ${GLEW_INCLUDE_DIR} 6 | "${PROJECT_SOURCE_DIR}/include" 7 | "${PROJECT_SOURCE_DIR}/include/TinyThread" 8 | "${PROJECT_SOURCE_DIR}/include/Eigen" 9 | "${PROJECT_SOURCE_DIR}/include/Utils" 10 | ${CUDA_TOOLKIT_INCLUDE} 11 | ${OPENNI_INCLUDE} 12 | ${SOFTKINETIC_SDK_INCLUDE}) 13 | 14 | 15 | set(SRCSCU Raycaster.cu General.cu ICP.cu VolumeIntegrator.cu) 16 | set(SRCS General.cpp ICP.cpp) 17 | 18 | add_subdirectory(Utils) 19 | add_subdirectory(CameraSupport) 20 | cuda_add_library(OpenFusionSrcCU ${SRCSCU}) 21 | add_library(OpenFusionSrc ${SRCS}) 22 | 23 | -------------------------------------------------------------------------------- /Source/src/CameraSupport/GIPCam/gipFile.def: -------------------------------------------------------------------------------- 1 | LIBRARY GipFileC 2 | EXPORTS 3 | clearImageDataGIP @1 4 | allocateImageData @2 5 | copyImageData @3 6 | readFileGIP @4 7 | writeFileGIP @5 8 | copyGIPHeader @6 9 | initGIPHeader @7 10 | closeFileGIP @8 11 | 12 | copyReservedFields @13 13 | readSLCalibrationFile @14 14 | 15 | readCalibrationFile @20 16 | writeCalibrationFile @21 17 | allocateCalibrationParameters @22 18 | clearCalibrationParameters @23 19 | copyCalibrationParameters @24 20 | sizeOfCalibrationParameters @25 21 | readCalibrationParametersFromGipFile @26 22 | writeCalibrationParametersToGipFile @27 23 | 24 | 25 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/GL/freeglut.h: -------------------------------------------------------------------------------- 1 | #ifndef __FREEGLUT_H__ 2 | #define __FREEGLUT_H__ 3 | 4 | /* 5 | * freeglut.h 6 | * 7 | * The freeglut library include file 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 10 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 11 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | * PAWEL W. OLSZTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | */ 16 | 17 | #include "freeglut_std.h" 18 | #include "freeglut_ext.h" 19 | 20 | /*** END OF FILE ***/ 21 | 22 | #endif /* __FREEGLUT_H__ */ 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | OpenFusion 2 | ========== 3 | Open fusion is an implementation of [KinectFusion](http://research.microsoft.com/en-us/projects/surfacerecon/). 4 | 5 | For more information see [OpenFusion](http://www.cs.technion.ac.il/~veredc/openfusion/). 6 | 7 | Requirements 8 | ------------ 9 | The project is [Cuda](http://www.nvidia.com/object/cuda_home_new.html) based and therefore a Nvidia gpu with a [cuda support](https://developer.nvidia.com/cuda-gpus) is required. 10 | 11 | Furthermore [cuda development kit](https://developer.nvidia.com/cuda-downloads) is also required. 12 | 13 | In addition the project is making use of the following libraries- 14 | - [Eigen](http://eigen.tuxfamily.org/index.php?title=Main_Page) 15 | - [Cimg](http://cimg.sourceforge.net/) 16 | - [OpenNI](https://github.com/OpenNI/OpenNI) 17 | -------------------------------------------------------------------------------- /Source/include/CameraFromFile.h: -------------------------------------------------------------------------------- 1 | #ifndef ___CAMERAFROMFILE_H_ 2 | #define ___CAMERAFROMFILE_H_ 3 | 4 | #include "CameraAbstract.h" 5 | 6 | class CameraFromFile : public CameraAbstract { 7 | protected: 8 | char m_path[200]; 9 | int m_currentFrameNumber; 10 | CAMERA_DEPTH_TYPE* m_inputDataDepth; 11 | CAMERA_RGB_TYPE* m_inputDataRgb; 12 | 13 | virtual bool Init(); 14 | public: 15 | // C'tor. 16 | CameraFromFile(char* path); 17 | 18 | // D'tor. 19 | virtual ~CameraFromFile(); 20 | 21 | // Get new depth frame. 22 | virtual bool GetDepthFrame(CAMERA_DEPTH_TYPE* d_newDepthMap); 23 | 24 | // Get new rgb frame, if available. 25 | virtual bool GetRgbFrame(CAMERA_RGB_TYPE* d_newRgbMap); 26 | 27 | virtual char* GetCameraTypeStr() { return "CameraFromFile"; } 28 | }; 29 | 30 | #endif // ___CAMERAFROMFILE_H_ 31 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/data/OpenNIConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/utilities.h: -------------------------------------------------------------------------------- 1 | #ifndef ___UTILITIES_H_ 2 | #define ___UTILITIES_H_ 3 | 4 | //#include 5 | 6 | // openCV Includes 7 | //#include 8 | 9 | #include "Constants.h" 10 | #include "BasicTypes.h" 11 | 12 | static int iDivUp(int a, int b) { 13 | return (a % b != 0) ? (a / b + 1) : (a / b); 14 | } 15 | 16 | 17 | #endif // ___UTILITIES_H_ 18 | 19 | 20 | // TODO - REMOVE THIS 21 | /////////////////////////// CONVENTIONS ////////////////////////// 22 | // - Classes and Function: TitleCase 23 | // - Methods: Use verbs 24 | // - Member fields: m_nameNameName 25 | // - Member device fields: md_nameNameName 26 | // - Member methods: TitleCase 27 | // - Arguments in Functions: nameNameName 28 | // - Device Arguments in Functions: d_nameNameName 29 | // - CONST EVERYWHERE 30 | // - Constants in uppercase 31 | // - Doxygen Comments 32 | // - 100 letter lines 33 | // - Egyptian brackets -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/WriteToFile.h: -------------------------------------------------------------------------------- 1 | #ifndef ___WRITETOFILE_H_ 2 | #define ___WRITETOFILE_H_ 3 | 4 | #include "CameraAbstract.h" 5 | #include // TODO DON'T REMOVE 6 | using std::ofstream; 7 | 8 | class WriteToFile : public CameraAbstract { 9 | protected: 10 | CameraAbstract* m_camera; 11 | 12 | char m_dirName[100]; //directory for write 13 | ofstream m_settingsFile; 14 | uint m_frameNumber; 15 | CAMERA_DEPTH_TYPE* m_inputDataDepth; 16 | CAMERA_RGB_TYPE* m_inputDataRgb; 17 | 18 | virtual bool Init(); 19 | public: 20 | // C'tor. 21 | WriteToFile(CameraAbstract* camera); 22 | 23 | // D'tor. 24 | virtual ~WriteToFile(); 25 | 26 | CameraParams* GetParameters(); 27 | 28 | // Get new depth frame. 29 | virtual bool GetDepthFrame(CAMERA_DEPTH_TYPE* d_newDepthMap); 30 | 31 | // Get new rgb frame, if available. 32 | virtual bool GetRgbFrame(CAMERA_RGB_TYPE* d_newRgbMap); 33 | 34 | virtual char* GetCameraTypeStr() { return "WriteToFile"; } 35 | }; 36 | 37 | #endif // ___WRITETOFILE_H_ 38 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/Utils/FileSystemHelper.h: -------------------------------------------------------------------------------- 1 | 2 | class FileHandler { 3 | public: 4 | // TODO: ADD ERROR CHECKS TO ALL CALLERS FUNCTIONS THAT CALL THE FUNCTIONS IN THIS CLASS. 5 | // TODO: DON'T FORGET TO DELETE THE POINTER WHEN YOU FINISH WITH THE CLASS (IN THE CALLER FUNCTION). 6 | 7 | // Returns true if directory was created or already existed. Returns false if error occured. 8 | virtual bool CreateDir(const char* dir_name) = 0; 9 | // Returns the concatenation of directory name and filename. output should be in MAX_PATH length. 10 | virtual bool GetPath(const char* dir_name, const char* file_name, char* output) = 0; 11 | static FileHandler* Init(); 12 | }; 13 | 14 | 15 | class FileHandlerWindows : public FileHandler { 16 | virtual bool CreateDir(const char* dir_name); 17 | virtual bool GetPath(const char* dir_name, const char* file_name, char* output); 18 | }; 19 | 20 | class FileHandlerLinux : public FileHandler { 21 | virtual bool CreateDir(const char* dir_name); 22 | virtual bool GetPath(const char* dir_name, const char* file_name, char* output); 23 | }; 24 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/src/CameraSupport/PrimesenseCamera.cu: -------------------------------------------------------------------------------- 1 | #include "utilities.h" 2 | #include "CudaUtilities.cuh" 3 | #include "PrimesenseCamera.h" 4 | 5 | __global__ void d_ConvertRGBToRGBA(const XnRGB24Pixel* primesense_rgb, CAMERA_RGB_TYPE* d_resultRgbMap, uint width, uint height) { 6 | const uint x = blockIdx.x*blockDim.x + threadIdx.x; 7 | const uint y = blockIdx.y*blockDim.y + threadIdx.y; 8 | if ((x >= width) || (y >= height)) return; 9 | const uint offset = width*y + x; 10 | 11 | XnUInt8 r = primesense_rgb[offset].nRed; 12 | XnUInt8 g = primesense_rgb[offset].nGreen; 13 | XnUInt8 b = primesense_rgb[offset].nBlue; 14 | XnUInt8 a = 255; 15 | 16 | d_resultRgbMap[offset] = (uint(a)<<24) | (uint(b)<<16) | (uint(g)<<8) | uint(r); 17 | } 18 | 19 | 20 | void PrimesenseCamera::ConvertRGBToRGBA(const XnRGB24Pixel* primesense_rgb, CAMERA_RGB_TYPE* d_newRgbMap) { 21 | dim3 gridSize(iDivUp(m_params.m_width, blockSize.x), iDivUp(m_params.m_height, blockSize.y)); 22 | d_ConvertRGBToRGBA<<>>(primesense_rgb, d_newRgbMap, m_params.m_width, m_params.m_height); 23 | cutilSafeCall(cudaDeviceSynchronize()); 24 | } -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/GIPCam.h: -------------------------------------------------------------------------------- 1 | #ifndef ___GIPCAM_H_ 2 | #define ___GIPCAM_H_ 3 | 4 | #include "CameraAbstract.h" 5 | 6 | class GIPCam : public CameraAbstract { 7 | protected: 8 | // private stuff 9 | 10 | virtual bool Init(); 11 | 12 | void ConvertDepthMap(float* d_data, CAMERA_DEPTH_TYPE* d_newDepthMap, uint width, uint height, float z_offset); 13 | //void ReduceNoise(CAMERA_DEPTH_TYPE* d_newDepthMap, uint width, uint height); //TODO - WAS MOVED TO CAMERA ABSTRACT 14 | float* m_zCoordsMatrix; // holds the z values of the incoming frames (the incoming depth). Before conversion to camera depth type 15 | int m_zCoordsMatrixSize; 16 | 17 | int m_currentFrameNumber; 18 | 19 | public: 20 | // C'tor. 21 | GIPCam(); 22 | 23 | // D'tor. 24 | virtual ~GIPCam(); 25 | 26 | // Set parameters. 27 | void SetParams(float fx, float fy, float cx, float cy, uint width, uint height); 28 | 29 | // Get new depth frame. 30 | virtual bool GetDepthFrame(CAMERA_DEPTH_TYPE* d_newDepthMap); 31 | 32 | virtual char* GetCameraTypeStr() { return "GIPCam"; } 33 | 34 | // Get new rgb frame, if available. 35 | //virtual void GetRgbFrame(); // TODO 36 | }; 37 | 38 | 39 | #endif // ___GIPCAM_H_ 40 | -------------------------------------------------------------------------------- /Source/src/Utils/stopwatch_linux.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 1993-2013 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | /* Stopwatch Implementation Class for linux */ 13 | 14 | // includes, file 15 | #include 16 | 17 | 18 | //////////////////////////////////////////////////////////////////////////////// 19 | //! Constructor, default 20 | //////////////////////////////////////////////////////////////////////////////// 21 | StopWatchLinux::StopWatchLinux() : 22 | start_time(), 23 | diff_time(0.0), 24 | total_time(0.0), 25 | running(false), 26 | clock_sessions(0) 27 | { } 28 | 29 | //////////////////////////////////////////////////////////////////////////////// 30 | // Destructor 31 | //////////////////////////////////////////////////////////////////////////////// 32 | StopWatchLinux::~StopWatchLinux() { } 33 | 34 | -------------------------------------------------------------------------------- /Source/include/PrimesenseCamera.h: -------------------------------------------------------------------------------- 1 | #ifndef ___PRIMESENSECAMERA_H_ 2 | #define ___PRIMESENSECAMERA_H_ 3 | 4 | #include "CameraAbstract.h" 5 | #include 6 | #include 7 | 8 | using xn::Context; 9 | using xn::ScriptNode; 10 | using xn::DepthGenerator; 11 | using xn::DepthMetaData; 12 | using xn::ImageGenerator; 13 | using xn::ImageMetaData; 14 | 15 | class PrimesenseCamera : public CameraAbstract { 16 | private: 17 | void ConvertRGBToRGBA(const XnRGB24Pixel* primesense_rgb, CAMERA_RGB_TYPE* d_newRgbMap); 18 | protected: 19 | Context m_context; 20 | ScriptNode m_scriptNode; 21 | DepthGenerator m_depth; 22 | DepthMetaData m_depthMD; 23 | ImageGenerator m_rgb; 24 | ImageMetaData m_rgbMD; 25 | XnRGB24Pixel* md_source_rgb; // Used for storing the source rgb image, before converting to rgba. 26 | 27 | virtual bool Init(); 28 | public: 29 | // C'tor. 30 | PrimesenseCamera(); 31 | 32 | // D'tor. 33 | virtual ~PrimesenseCamera(); 34 | 35 | // Get new depth frame. 36 | virtual bool GetDepthFrame(CAMERA_DEPTH_TYPE* d_newDepthMap); 37 | 38 | virtual char* GetCameraTypeStr() { return "PrimesenseCamera"; } 39 | // Get new rgb frame, if available. 40 | virtual bool GetRgbFrame(CAMERA_RGB_TYPE* d_newRgbMap); 41 | }; 42 | 43 | #endif // ___PRIMESENSECAMERA_H_ 44 | -------------------------------------------------------------------------------- /Source/include/Utils/cutil_inline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | #ifndef _CUTIL_INLINE_H_ 13 | #define _CUTIL_INLINE_H_ 14 | 15 | #include 16 | #include 17 | 18 | #include "cutil.h" 19 | #include "cutil_inline_runtime.h" 20 | 21 | //#include 22 | 23 | //#include 24 | 25 | /* 26 | inline void print_NVCC_min_spec(const char *sSDKsample, const char *sNVCCReq, const char *sDriverReq) 27 | { 28 | printf("CUDA %d.%02d Toolkit built this project.\n", CUDART_VERSION/1000, (CUDART_VERSION%100)); 29 | printf(" [ %s ] requirements:\n", sSDKsample); 30 | printf(" -> CUDA %s Toolkit\n" , sNVCCReq); 31 | printf(" -> %s NVIDIA Display Driver.\n", sDriverReq); 32 | } 33 | */ 34 | 35 | /* 36 | #define ALIGN_OFFSET(offset, alignment) offset = (offset + (alignment-1)) & ~((alignment-1)) 37 | */ 38 | 39 | #endif // _CUTIL_INLINE_H_ 40 | -------------------------------------------------------------------------------- /Source/include/Utils/stopwatch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | /* CUda UTility Library */ 13 | 14 | #ifndef _STOPWATCH_H_ 15 | #define _STOPWATCH_H_ 16 | 17 | // stop watch base class 18 | #include 19 | 20 | // include OS specific policy 21 | #ifdef _WIN32 22 | # include 23 | typedef StopWatchWin OSStopWatch; 24 | #else 25 | # include 26 | typedef StopWatchLinux OSStopWatch; 27 | #endif 28 | 29 | // concrete stop watch type 30 | typedef StopWatchBase StopWatchC; 31 | 32 | namespace StopWatch 33 | { 34 | //! Create a stop watch 35 | const unsigned int create(); 36 | 37 | //! Get a handle to the stop watch with the name \a name 38 | StopWatchC& get( const unsigned int& name); 39 | 40 | // Delete the stop watch with the name \a name 41 | void destroy( const unsigned int& name); 42 | } // end namespace, stopwatch 43 | 44 | #endif // _STOPWATCH_H_ 45 | 46 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/src/CameraSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #cam 2 | 3 | 4 | 5 | include_directories ( 6 | ${GLEW_INCLUDE_DIR} 7 | "${PROJECT_SOURCE_DIR}/include" 8 | "${PROJECT_SOURCE_DIR}/include/TinyThread" 9 | "${PROJECT_SOURCE_DIR}/include/Eigen" 10 | "${PROJECT_SOURCE_DIR}/include/Utils" 11 | ${CUDA_TOOLKIT_INCLUDE} 12 | ${OPENNI_INCLUDE} 13 | ${SOFTKINETIC_SDK_INCLUDE}) 14 | 15 | set(SRCSCU CameraAbstract.cu CameraHandler.cu) 16 | set(SRCS CameraAbstract.cpp CameraHandler.cpp WriteToFile.cpp) 17 | 18 | if(BUILD_FROMFILE) 19 | MESSAGE(STATUS "build fromfile") 20 | list(APPEND SRCS CameraFromFile.cpp) 21 | endif() 22 | if(BUILD_SOFTKINETIC) 23 | MESSAGE(STATUS "build softkinetic") 24 | list(APPEND SRCS SoftKineticCamera.cpp) 25 | list(APPEND SRCSCU SoftKineticCamera.cu) 26 | endif() 27 | if(BUILD_PRIMESENSE) 28 | MESSAGE(STATUS "build primesense") 29 | list(APPEND SRCS PrimesenseCamera.cpp) 30 | list(APPEND SRCSCU PrimesenseCamera.cu) 31 | endif() 32 | if(BUILD_GIPCAM) 33 | MESSAGE(STATUS "build gipcam") 34 | list(APPEND SRCS GIPCam.cpp) 35 | list(APPEND SRCSCU GIPCam.cu) 36 | endif() 37 | if (NOT BUILD_SOFTKINETIC AND NOT BUILD_PRIMESENSE AND NOT BUILD_GIPCAM AND NOT BUILD_FROMFILE) 38 | MESSAGE(FATAL_ERROR "no camera") 39 | endif() 40 | 41 | cuda_add_library(OpenFusionCamCU ${SRCSCU}) 42 | add_library(OpenFusionCam ${SRCS}) 43 | -------------------------------------------------------------------------------- /Source/include/CameraHandler.h: -------------------------------------------------------------------------------- 1 | #ifndef ___CAMERAHANDLER_H_ 2 | #define ___CAMERAHANDLER_H_ 3 | 4 | #include "utilities.h" 5 | #include "CameraAbstract.h" 6 | 7 | //using namespace cv; 8 | 9 | class CameraHandler { 10 | 11 | CameraAbstract* m_camera; 12 | static CameraParams m_params; // TODO: WHY STATIC???? WHAT ABOUT RESET? 13 | 14 | CAMERA_DEPTH_TYPE* inputData_depth; 15 | CAMERA_RGB_TYPE* inputData_rgb; 16 | void writeInputToFile(); 17 | void readInputFromFile(CAMERA_DEPTH_TYPE* d_newDepthMap, CAMERA_RGB_TYPE* newRgbMap); 18 | void readInputFromCamera(CAMERA_DEPTH_TYPE* d_newDepthMap, CAMERA_RGB_TYPE* newRgbMap); 19 | public: 20 | CameraHandler(); 21 | ~CameraHandler(); 22 | CameraParams* GetCameraParams(); 23 | void cameraIteration(CAMERA_DEPTH_TYPE* d_newDepthMap, CAMERA_RGB_TYPE* newRgbMap, uint* newDepthMap, const CameraData& d_cameraData, float* d_currentTransform, uint* newNormalMap, dim3 gridSize, dim3 blockSize); // TODO - uppercase first letter 24 | static void updateCameraData(dim3 gridSize, dim3 blockSize, const CameraData& d_cameraData, CAMERA_DEPTH_TYPE* d_newDepth, float* d_currentTransform, uint* newNormalMap, uint* newDepthMap); 25 | void SwitchToWriteMode(); 26 | void SwitchToReadMode(); 27 | }; 28 | 29 | inline CameraParams* CameraHandler::GetCameraParams() { 30 | return m_camera->GetParameters(); 31 | } 32 | 33 | #endif // ___CAMERAHANDLER_H_ 34 | -------------------------------------------------------------------------------- /Source/src/CameraSupport/SoftKineticCamera.cu: -------------------------------------------------------------------------------- 1 | #include "utilities.h" 2 | #include "CudaUtilities.cuh" 3 | #include "SoftKineticCamera.h" 4 | //#include // TODO REMOVE 5 | //using std::cout; 6 | 7 | __global__ void d_ConvertBGRToRGBA(const bgr_pixel* SoftKineticBGR, CAMERA_RGB_TYPE* d_resultRgbMap, 8 | uint depthWidth,uint depthHeight,uint colorWidth,uint colorHeight) { 9 | const uint x = blockIdx.x*blockDim.x + threadIdx.x; 10 | const uint y = blockIdx.y*blockDim.y + threadIdx.y; 11 | if ((x >= depthWidth) || (y >= depthHeight)) return; 12 | float widthRatio,heightRatio; 13 | widthRatio=colorWidth/depthWidth; 14 | heightRatio=colorHeight/depthHeight; 15 | 16 | uint offset = floor(heightRatio*(colorWidth)*y) + floor(widthRatio*x); 17 | uint8_t b = SoftKineticBGR[offset].blue; 18 | uint8_t g = SoftKineticBGR[offset].green; 19 | uint8_t r = SoftKineticBGR[offset].red; 20 | uint8_t a = 255; 21 | offset=depthWidth*y+x; 22 | d_resultRgbMap[offset] = (uint(a)<<24) | (uint(b)<<16) | (uint(g)<<8) | uint(r); 23 | } 24 | 25 | void SoftKineticCamera::ConvertBGRToRGBA(const bgr_pixel* SoftKineticBGR, CAMERA_RGB_TYPE* d_newRgbMap) { 26 | dim3 gridSize(iDivUp(m_params.m_width, blockSize.x), iDivUp(m_params.m_height, blockSize.y)); 27 | d_ConvertBGRToRGBA<<>>(SoftKineticBGR, d_newRgbMap, m_params.m_width, m_params.m_height,colorWidth,colorHeight); 28 | cutilSafeCall(cudaDeviceSynchronize()); 29 | } 30 | 31 | -------------------------------------------------------------------------------- /Source/src/Utils/FileSystemHelper.cpp: -------------------------------------------------------------------------------- 1 | #include "FileSystemHelper.h" 2 | #include 3 | #include 4 | 5 | 6 | #if defined(_WIN32) || defined(_WIN64) 7 | // Windows 8 | #include // for CreateDirectory 9 | #include "Shlwapi.h" // for PathAppend 10 | 11 | FileHandler* FileHandler::Init() { 12 | return new FileHandlerWindows(); 13 | } 14 | 15 | bool FileHandlerWindows::CreateDir(const char* dir_name) { 16 | int status = CreateDirectory(dir_name, NULL); 17 | if (!status) { // Calling WinBase.h 18 | return (GetLastError() == ERROR_ALREADY_EXISTS); // Returns ok if path exists 19 | } 20 | return true; 21 | } 22 | 23 | bool FileHandlerWindows::GetPath(const char* dir_name, const char* file_name, char* output) { 24 | strcpy(output, dir_name); 25 | int status = PathAppend(output, file_name); 26 | return status; 27 | } 28 | 29 | #else 30 | // Linux 31 | #include 32 | #include 33 | #include 34 | 35 | FileHandler* FileHandler::Init() { 36 | return new FileHandlerLinux(); 37 | } 38 | 39 | bool FileHandlerLinux::CreateDir(const char* dir_name) { 40 | int status = mkdir(dir_name, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); 41 | if (!status) { 42 | return (errno == EEXIST); // Returns ok if path exists 43 | } 44 | return true; 45 | } 46 | 47 | bool FileHandlerLinux::GetPath(const char* dir_name, const char* file_name, char* output) { 48 | sprintf(output, "%s%c%s", dir_name, '/', file_name); 49 | return true; 50 | } 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Source/src/Utils/FileSystemHelper.cpp~: -------------------------------------------------------------------------------- 1 | #include "FileSystemHelper.h" 2 | #include 3 | #include 4 | 5 | 6 | #if defined(_WIN32) || defined(_WIN64) 7 | // Windows 8 | #include // for CreateDirectory 9 | #include "Shlwapi.h" // for PathAppend 10 | 11 | FileHandler* FileHandler::Init() { 12 | return new FileHandlerWindows(); 13 | } 14 | 15 | bool FileHandlerWindows::CreateDir(const char* dir_name) { 16 | int status = CreateDirectory(dir_name, NULL); 17 | if (!status) { // Calling WinBase.h 18 | return (GetLastError() == ERROR_ALREADY_EXISTS); // Returns ok if path exists 19 | } 20 | return true; 21 | } 22 | 23 | bool FileHandlerWindows::GetPath(const char* dir_name, const char* file_name, char* output) { 24 | strcpy(output, dir_name); 25 | int status = PathAppend(output, file_name); 26 | return status; 27 | } 28 | 29 | #else 30 | // Linux 31 | #include 32 | #include 33 | #include 34 | 35 | FileHandler* FileHandler::Init() { 36 | return new FileHandlerLinux(); 37 | } 38 | 39 | bool FileHandlerLinux::CreateDir(const char* dir_name) { 40 | int status = mkdir(dir_name, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); 41 | if (!status) { 42 | return (errno == EEXIST); // Returns ok if path exists 43 | } 44 | return true; 45 | } 46 | 47 | bool FileHandlerLinux::GetPath(const char* dir_name, const char* file_name, char* output) { 48 | sprintf(output, "%s%c%s", dir_name, '/', file_name); 49 | return true; 50 | } 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /Source/src/CameraSupport/GIPCam.cu: -------------------------------------------------------------------------------- 1 | #include "GIPCam.h" 2 | #include "utilities.h" 3 | 4 | #include // includes cuda.h and cuda_runtime_api.h 5 | #include // TODO: PROBABLY REDUNDANT 6 | 7 | // The conversion has two purposes: 1. Convert from decimeters to mm by multiplying Z-coordinate by 100. 8 | // 2. Convert from float to CAMERA_DEPTH_TYPE. 9 | __global__ void d_ConvertDepthMap(float* d_data, CAMERA_DEPTH_TYPE* d_newDepthMap, uint width, uint height, float z_offset) { 10 | const uint x = blockIdx.x*blockDim.x + threadIdx.x; 11 | const uint y = blockIdx.y*blockDim.y + threadIdx.y; 12 | if ((x >= width) || (y >= height)) return; 13 | const uint offset_camera = width*y + x; 14 | const uint offset_data = height*(width-1-x) + y; 15 | 16 | // Converting from decimeters to mm, plus translating so the camera is at the origin. 17 | d_newDepthMap[offset_camera] = (CAMERA_DEPTH_TYPE)(d_data[offset_data] * 100.f + z_offset); // TODO: Z is taken from the LOG file!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! MAY BE CHANGED IN CALIBRATION 18 | } 19 | 20 | void GIPCam::ConvertDepthMap(float* d_data, CAMERA_DEPTH_TYPE* d_newDepthMap, uint width, uint height, float z_offset) { 21 | dim3 gridSize(iDivUp(width, blockSize.x), iDivUp(height, blockSize.y)); // TODO - MAKE THIS GRID_DIM A PARAMETER OF CAMERA_ABSTRACT. IT SHOULD BE THE RESOLUTION OF THE PICTURE. UPDATE_CAMERA_DATA SHOULD USE IT TOO 22 | d_ConvertDepthMap<<>>(d_data, d_newDepthMap, width, height, z_offset); 23 | cutilSafeCall(cudaDeviceSynchronize()); 24 | } 25 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/src/Utils/stopwatch_win.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | /* CUda UTility Library */ 13 | 14 | // includes, file 15 | #include 16 | 17 | //////////////////////////////////////////////////////////////////////////////// 18 | // Variables, static 19 | 20 | //! tick frequency 21 | /*static*/ double StopWatchWin::freq; 22 | 23 | //! flag if the frequency has been set 24 | /*static*/ bool StopWatchWin::freq_set; 25 | 26 | //////////////////////////////////////////////////////////////////////////////// 27 | //! Constructor, default 28 | //////////////////////////////////////////////////////////////////////////////// 29 | StopWatchWin::StopWatchWin() : 30 | start_time(), 31 | end_time(), 32 | diff_time( 0.0), 33 | total_time(0.0), 34 | running( false), 35 | clock_sessions(0) 36 | { 37 | if( ! freq_set) 38 | { 39 | // helper variable 40 | LARGE_INTEGER temp; 41 | 42 | // get the tick frequency from the OS 43 | QueryPerformanceFrequency((LARGE_INTEGER*) &temp); 44 | 45 | // convert to type in which it is needed 46 | freq = ((double) temp.QuadPart) / 1000.0; 47 | 48 | // rememeber query 49 | freq_set = true; 50 | } 51 | } 52 | 53 | //////////////////////////////////////////////////////////////////////////////// 54 | // Destructor 55 | //////////////////////////////////////////////////////////////////////////////// 56 | StopWatchWin::~StopWatchWin() { } 57 | 58 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 associatd 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 | -------------------------------------------------------------------------------- /Source/include/Utils/cutil_gl_inline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | #ifndef _CUTIL_GL_INLINE_H_ 13 | #define _CUTIL_GL_INLINE_H_ 14 | 15 | //#include 16 | //#include 17 | //#include 18 | 19 | #include 20 | #include 21 | //#include 22 | #include 23 | #include 24 | 25 | 26 | #if __DEVICE_EMULATION__ 27 | inline int cutilGLDeviceInit(int ARGC, char **ARGV) { return 0; } 28 | inline int cutilGLDeviceInitDrv(int cuDevice, int ARGC, char **ARGV) { return 0; } 29 | inline void cutilChooseCudaGLDevice(int ARGC, char **ARGV) { } 30 | #else 31 | inline int cutilGLDeviceInit(int ARGC, char **ARGV) 32 | { 33 | int deviceCount; 34 | cutilSafeCallNoSync(cudaGetDeviceCount(&deviceCount)); 35 | if (deviceCount == 0) { 36 | fprintf(stderr, "CUTIL CUDA error: no devices supporting CUDA.\n"); 37 | exit(-1); 38 | } 39 | int dev = 0; 40 | cudaDeviceProp deviceProp; 41 | cutilSafeCallNoSync(cudaGetDeviceProperties(&deviceProp, dev)); 42 | if (deviceProp.major < 1) { 43 | fprintf(stderr, "cutil error: device does not support CUDA.\n"); 44 | exit(-1); 45 | } 46 | cutilSafeCall(cudaGLSetGLDevice(dev)); 47 | return dev; 48 | } 49 | 50 | // This function will pick the best CUDA device available with OpenGL interop 51 | inline int cutilChooseCudaGLDevice() 52 | { 53 | // Pick the device with highest Gflops/s 54 | int devID = cutGetMaxGflopsDeviceId(); 55 | cudaGLSetGLDevice( devID ); 56 | return devID; 57 | } 58 | 59 | #endif 60 | 61 | #endif // _CUTIL_GL_INLINE_H_ 62 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/SoftKineticCamera.h: -------------------------------------------------------------------------------- 1 | #ifndef ___SOFTKINETICCAMERA_H_ 2 | #define ___SOFTKINETICCAMERA_H_ 3 | 4 | #include "CameraAbstract.h" 5 | #include "DepthSense.hxx" 6 | #include 7 | 8 | using namespace DepthSense; 9 | 10 | typedef struct{ 11 | uint8_t blue; 12 | uint8_t green; 13 | uint8_t red; 14 | } bgr_pixel; 15 | 16 | 17 | class SoftKineticCamera : public CameraAbstract { 18 | private: 19 | void ConvertBGRToRGBA(const bgr_pixel* SoftKineticBGR, CAMERA_RGB_TYPE* d_newRgbMap); 20 | uint colorWidth,colorHeight; 21 | 22 | static CAMERA_DEPTH_TYPE* m_depthMap; 23 | static uint8_t* m_rgbMap; 24 | static bgr_pixel* m_cudaRGBMap; 25 | static CAMERA_DEPTH_TYPE* m_cudaDepthMap; 26 | static uint sizeOfDepthMap,sizeOfRGBMap; 27 | static bool m_bDeviceFound; 28 | static tthread::mutex depth_mutex; 29 | static tthread::mutex rgb_mutex; 30 | 31 | static void onNewAudioSample(AudioNode node, AudioNode::NewSampleReceivedData data); 32 | static void onNewColorSample(ColorNode node, ColorNode::NewSampleReceivedData data); 33 | static void onNewDepthSample(DepthNode node, DepthNode::NewSampleReceivedData data); 34 | static void configureAudioNode(); 35 | static void configureDepthNode(); 36 | static void configureColorNode(); 37 | static void configureNode(Node node); 38 | static void onNodeConnected(Device device, Device::NodeAddedData data); 39 | static void onNodeDisconnected(Device device, Device::NodeRemovedData data); 40 | static void onDeviceConnected(DepthSense::Context context, DepthSense::Context::DeviceAddedData data); 41 | static void onDeviceDisconnected(DepthSense::Context context, DepthSense::Context::DeviceRemovedData data); 42 | 43 | tthread::thread* eventThread; 44 | 45 | protected: 46 | 47 | 48 | virtual bool Init(); 49 | public: 50 | 51 | 52 | // C'tor. 53 | SoftKineticCamera(); 54 | 55 | // D'tor. 56 | virtual ~SoftKineticCamera(); 57 | 58 | // Get new depth frame. 59 | virtual bool GetDepthFrame(CAMERA_DEPTH_TYPE* d_newDepthMap); 60 | 61 | virtual char* GetCameraTypeStr() { return "SoftKineticCamera"; } 62 | // Get new rgb frame, if available. 63 | virtual bool GetRgbFrame(CAMERA_RGB_TYPE* d_newRgbMap); 64 | 65 | 66 | }; 67 | 68 | 69 | 70 | 71 | 72 | #endif // ___SOFTKINETICCAMERA_H_ 73 | -------------------------------------------------------------------------------- /Source/include/Utils/stopwatch_base.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | /* CUda UTility Library */ 13 | 14 | #ifndef _STOPWATCH_BASE_H_ 15 | #define _STOPWATCH_BASE_H_ 16 | 17 | // includes, system 18 | #include 19 | 20 | //! Simple stop watch 21 | template 22 | class StopWatchBase : public OSPolicy 23 | { 24 | public: 25 | 26 | // generic, specialized type 27 | typedef StopWatchBase SelfType; 28 | // generic, specialized type pointer 29 | typedef StopWatchBase* SelfTypePtr; 30 | 31 | //! global index for all stop watches 32 | static std::vector< SelfTypePtr > swatches; 33 | 34 | public: 35 | 36 | //! Constructor, default 37 | StopWatchBase(); 38 | 39 | // Destructor 40 | ~StopWatchBase(); 41 | 42 | public: 43 | 44 | //! Start time measurement 45 | inline void start(); 46 | 47 | //! Stop time measurement 48 | inline void stop(); 49 | 50 | //! Reset time counters to zero 51 | inline void reset(); 52 | 53 | //! Time in msec. after start. If the stop watch is still running (i.e. there 54 | //! was no call to stop()) then the elapsed time is returned, otherwise the 55 | //! time between the last start() and stop call is returned 56 | inline const float getTime() const; 57 | 58 | //! Mean time to date based on the number of times the stopwatch has been 59 | //! _stopped_ (ie finished sessions) and the current total time 60 | inline const float getAverageTime() const; 61 | 62 | private: 63 | 64 | //! Constructor, copy (not implemented) 65 | StopWatchBase( const StopWatchBase&); 66 | 67 | //! Assignment operator (not implemented) 68 | StopWatchBase& operator=( const StopWatchBase&); 69 | }; 70 | 71 | // include, implementation 72 | #include "stopwatch_base.inl" 73 | 74 | #endif // _STOPWATCH_BASE_H_ 75 | 76 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/CudaUtilities.cuh: -------------------------------------------------------------------------------- 1 | #ifndef ___CUDA_UTILITIES_H_ 2 | #define ___CUDA_UTILITIES_H_ 3 | 4 | #include "utilities.h" 5 | #include // includes cuda.h and cuda_runtime_api.h 6 | #include 7 | 8 | 9 | __device__ __inline__ 10 | float2 CameraToImage (const Intrinsic intrinsic, const float3 vec) { 11 | float2 retVal; 12 | 13 | if(fabs(vec.z) < _EPSILON_){ //TODO - remove if this is checked elsewhere 14 | return make_float2(BAD_VERTEX, BAD_VERTEX); 15 | } 16 | 17 | float invZ = 1.f / vec.z; 18 | retVal.x = (intrinsic.m_fx*vec.x + intrinsic.m_cx*vec.z)*invZ; 19 | retVal.y = (intrinsic.m_fy*vec.y + intrinsic.m_cy*vec.z)*invZ; 20 | 21 | return retVal; 22 | } 23 | 24 | __device__ __inline__ 25 | float3 ImageToCamera (const Intrinsic invIntrinsic, const float2 pixel, const float depth) { 26 | float3 retVal; 27 | 28 | retVal.x = depth*(invIntrinsic.m_fx*pixel.x + invIntrinsic.m_cx); 29 | retVal.y = depth*(invIntrinsic.m_fy*pixel.y + invIntrinsic.m_cy); 30 | retVal.z = depth; 31 | 32 | return retVal; 33 | } 34 | 35 | __device__ __inline__ 36 | float3 CameraToWorld (const float* transform, const float3 vec) { 37 | float3 retVal; 38 | 39 | retVal.x = transform[0]*vec.x + transform[1]*vec.y + transform[2]*vec.z + transform[3]; 40 | retVal.y = transform[4]*vec.x + transform[5]*vec.y + transform[6]*vec.z + transform[7]; 41 | retVal.z = transform[8]*vec.x + transform[9]*vec.y + transform[10]*vec.z + transform[11]; 42 | 43 | return retVal; 44 | } 45 | 46 | __device__ __inline__ 47 | float3 WorldToCamera (const float* invTransform, const float3 vec) { 48 | return CameraToWorld(invTransform, vec); 49 | } 50 | 51 | __device__ __inline__ 52 | float3 ImageToWorld (const Intrinsic invIntrinsic, const float2 pixel, const float depth, const float* transform){ 53 | return CameraToWorld(transform, ImageToCamera(invIntrinsic, pixel, depth)); 54 | } 55 | 56 | __device__ __inline__ 57 | float2 WorldToImage (const float* invTransform, const float3 vec, const Intrinsic intrinsic){ 58 | return CameraToImage(intrinsic, WorldToCamera(invTransform, vec)); 59 | } 60 | 61 | //rounds the floating point to the nearest integer. 62 | __device__ __inline__ int roundFloat(float a){ 63 | return fracf(a) < 0.5 ? floorf(a) : ceilf(a); 64 | } 65 | 66 | #endif // ___CUDA_UTILITIES_H_ -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 2.6) 2 | project (OpenFusion) 3 | 4 | find_package(GLEW REQUIRED) 5 | 6 | FIND_PACKAGE(CUDA REQUIRED) 7 | 8 | option (BUILD_FROMFILE "Build the camera from file library" ON) 9 | option (BUILD_SOFTKINETIC "Build the softkinetic camera library" OFF) 10 | option (BUILD_PRIMESENSE "Build the primesense camera library" OFF) 11 | option (BUILD_GIPCAM "Build the gipcam camera library" OFF) 12 | 13 | set(SOFTKINETIC_SDK_LIB "DepthSense lib not found" CACHE FILEPATH "The softkinetic sdk lib") 14 | set(OPENNI_LIB "OpenNI lib not found" CACHE FILEPATH "The OpenNI lib") 15 | set(SOFTKINETIC_SDK_INCLUDE "DepthSense include path not found" CACHE PATH "The softkinetic sdk include path") 16 | set(OPENNI_INCLUDE "OpenNI lib include path found" CACHE PATH "The OpenNI include path") 17 | 18 | configure_file( ${CMAKE_SOURCE_DIR}/include/config.h.in ${CMAKE_SOURCE_DIR}/include/config.h ) 19 | 20 | add_subdirectory(src) 21 | 22 | INCLUDE(FindCUDA) 23 | 24 | FILE(GLOB SOURCES "*.cu" "*.cpp" "*.c" "*.h") 25 | #CUDA_ADD_EXECUTABLE(lbmslv ${SOURCES}) 26 | 27 | LIST(APPEND CMAKE_CXX_FLAGS "-std=c++0x -O3 -ffast-math") 28 | 29 | LIST(APPEND CUDA_NVCC_FLAGS --compiler-options -fno-strict-aliasing -lineinfo -use_fast_math -Xptxas -dlcm=cg) 30 | LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_20,code=sm_20) 31 | LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_30,code=sm_30) 32 | LIST(APPEND CUDA_NVCC_FLAGS -gencode arch=compute_35,code=sm_35) 33 | 34 | 35 | 36 | FIND_PATH( 37 | CIMG_INCLUDE_DIR CImg.h 38 | "${CMAKE_CURRENT_SOURCE_DIR}/CImg" 39 | ) 40 | 41 | SET(CIMG_FOUND FALSE) 42 | IF(CIMG_INCLUDE_DIR) 43 | SET(CIMG_FOUND TRUE) 44 | INCLUDE_DIRECTORIES(${CIMG_INCLUDE_DIR}) 45 | ELSE(CIMG_INCLUDE_DIR) 46 | MESSAGE(FATAL ERROR "CImg.h not found - Please install CImg") 47 | ENDIF(CIMG_INCLUDE_DIR) 48 | 49 | 50 | include_directories ( 51 | ${GLEW_INCLUDE_DIR} 52 | "${PROJECT_SOURCE_DIR}/include" 53 | "${PROJECT_SOURCE_DIR}/include/TinyThread" 54 | "${PROJECT_SOURCE_DIR}/include/Eigen" 55 | "${PROJECT_SOURCE_DIR}/include/Utils" 56 | ${CUDA_TOOLKIT_INCLUDE} 57 | ${OPENNI_INCLUDE} 58 | ${SOFTKINETIC_SDK_INCLUDE}) 59 | 60 | 61 | add_executable(OpenFusion src/MainApp.cpp) 62 | 63 | 64 | target_link_libraries (OpenFusion 65 | OpenFusionSrc 66 | OpenFusionSrcCU 67 | OpenFusionCam 68 | OpenFusionCamCU 69 | OpenFusionUtils 70 | ${GLEW_LIBRARY} 71 | ${CUDA_CUDART_LIBRARY} 72 | pthread 73 | X11 74 | GL 75 | GLU 76 | glut 77 | ${SOFTKINETIC_SDK_LIB} 78 | ${OPENNI_LIB} 79 | ) 80 | 81 | -------------------------------------------------------------------------------- /Source/include/BasicTypes.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ___BASIC_TYPES 3 | #define ___BASIC_TYPES 4 | 5 | #include "Constants.h" 6 | // CUDA Includes 7 | #include 8 | #include 9 | #include 10 | 11 | //OpenGL Graphics includes 12 | #include "GL/glew.h" 13 | #if defined (__APPLE__) || defined(MACOSX) 14 | #include "GLUT/glut.h" 15 | #else 16 | #include "GL/freeglut.h" 17 | #endif 18 | ////////////////////////////This was for pbo data struct//////////////////////////////////// 19 | 20 | 21 | typedef unsigned int uint; 22 | typedef unsigned char uchar; 23 | 24 | 25 | typedef unsigned short CAMERA_DEPTH_TYPE; 26 | typedef uint CAMERA_RGB_TYPE; 27 | 28 | static const dim3 blockSize(BLOCK_SIZE, BLOCK_SIZE); 29 | 30 | // Voxels Size and type declaration 31 | typedef struct { 32 | /** 33 | \brief Stands for Truncated Surface Distance Function. 34 | */ 35 | float tsdf; 36 | //char weight; 37 | } Voxel; 38 | 39 | typedef Voxel VoxelType; 40 | typedef unsigned char VoxelWeightType; 41 | 42 | 43 | typedef struct { 44 | float3* vertex; 45 | float3* normal; 46 | } PointInfo; 47 | 48 | typedef struct { 49 | CAMERA_DEPTH_TYPE* depth; 50 | float3* vertex; 51 | float3* normal; 52 | } CameraData; 53 | 54 | 55 | 56 | ////////////////PUT THIS IN VOLUMERENDER.CPP 57 | typedef struct _PboData 58 | { 59 | GLuint pbo; // OpenGL pixel buffer object 60 | GLuint tex; // OpenGL texture object 61 | struct cudaGraphicsResource *cuda_pbo_resource; // CUDA Graphics Resource (to transfer PBO) 62 | 63 | _PboData() : pbo(0), tex(0), cuda_pbo_resource(NULL) 64 | { 65 | //empty 66 | } 67 | } PboData; 68 | 69 | //////////////////////////////////////////////////////////////////////////////////////////// 70 | 71 | 72 | 73 | // intrinsic calibration matrix 74 | typedef struct Intrinsic_t { 75 | float m_fx; 76 | float m_fy; 77 | float m_cx; 78 | float m_cy; 79 | 80 | void Set(float fx = 0, float fy = 0, float cx = 0, float cy = 0) { 81 | m_fx = fx; 82 | m_fy = fy; 83 | m_cx = cx; 84 | m_cy = cy; 85 | } 86 | } Intrinsic; 87 | 88 | // camera parameters 89 | typedef struct CameraParams_t { 90 | Intrinsic m_intrinsic; 91 | Intrinsic m_invIntrinsic; 92 | uint m_width; 93 | uint m_height; 94 | float m_z_offset; 95 | float m_min_depth; // in mm 96 | float m_max_depth; // in mm 97 | float k1; 98 | float k2; 99 | float k3; 100 | float p1; 101 | float p2; 102 | CAMERA_DEPTH_TYPE depthNullValue; 103 | } CameraParams; 104 | 105 | 106 | 107 | #endif //___BASIC_TYPES -------------------------------------------------------------------------------- /Source/include/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 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 | Index row() const { return Base::col(); } 44 | 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 | Index row() const { return Base::col(); } 58 | Index col() const { return Base::row(); } 59 | }; 60 | 61 | } // end namespace Eigen 62 | 63 | #endif // EIGEN_SPARSETRANSPOSE_H 64 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/src/General.cpp: -------------------------------------------------------------------------------- 1 | #include "General.h" 2 | 3 | #include // includes cuda.h and cuda_runtime_api.h 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | // Declarations for functions in General.cu 10 | void initVoxelArrayCuda(dim3 dimGrid, dim3 dimBlock, VoxelType* d_voxel_array, VoxelWeightType* d_weight_array); 11 | void updateTransformsCuda(float* d_currentTransform, float3* d_cameraPosition); 12 | void addToCurrentTransformCuda(float* d_currentTransform, float* d_invViewMatrix); 13 | 14 | void General::UpdateTransforms(float* d_currentTransform, float* d_invCurrentTransform, float3* d_cameraPosition, float* invViewMatrix) 15 | { 16 | // If invViewMatrix == NULL then don't add the viewMatrix to the currentTransform 17 | if (invViewMatrix != NULL) { 18 | float* d_invViewMatrix = NULL; 19 | cutilSafeCall(cudaMalloc((void**)&d_invViewMatrix, 12*sizeof(float))); 20 | cutilSafeCall(cudaMemcpy(d_invViewMatrix, invViewMatrix, 12*sizeof(float), cudaMemcpyHostToDevice)); 21 | addToCurrentTransformCuda(d_currentTransform, d_invViewMatrix); 22 | cutilSafeCall(cudaFree(d_invViewMatrix)); 23 | } 24 | 25 | 26 | //Only d_currentTransform is up to date - we need to calculate and update the others. 27 | float invCurrentTransform_host[16]; 28 | // copy current transform to host 29 | cutilSafeCall( cudaMemcpy(invCurrentTransform_host, d_currentTransform, 16*sizeof(float), cudaMemcpyDeviceToHost) ); 30 | cudaDeviceSynchronize(); 31 | // Calculate inverse of current transformation matrix. 32 | Eigen::Map > invCurrentTransformMatrix(invCurrentTransform_host); // TODO: COLMAJOR IS ALSO WORKING WELL. CHECK OUT. MAYBE BUGGY 33 | invCurrentTransformMatrix = invCurrentTransformMatrix.inverse(); 34 | 35 | // Copy current inverse transformation matrix back into cuda. 36 | cutilSafeCall( cudaMemcpy(d_invCurrentTransform, invCurrentTransform_host, 16*sizeof(float), cudaMemcpyHostToDevice) ); 37 | cudaDeviceSynchronize(); 38 | // At this point both d_currentTransform and d_invCurrentTransform are up to date. 39 | updateTransformsCuda(d_currentTransform, d_cameraPosition); 40 | } 41 | 42 | void General::InitVoxelArray(VoxelType* d_voxel_array, VoxelWeightType* d_weight_array) 43 | { 44 | dim3 dimGrid(VOLUME_SIZE, VOLUME_SIZE); 45 | dim3 dimBlock(VOLUME_SIZE); 46 | initVoxelArrayCuda(dimGrid, dimBlock, d_voxel_array, d_weight_array); // TODO: VOLUME_SIZE=512, AND THIS IS THE MAXIMUM THREADS FOR PARALLEL EXECUTION 47 | 48 | // TODO: THINK HOW TO DO THIS BETTER. DIVIDE THE THREADS INTO FEWER BLOCKS TO SAVE RESOURCES. 49 | } 50 | 51 | General* General::Instance() { 52 | if(!m_instanceFlag) { 53 | m_instance = new General(); 54 | m_instanceFlag = true; 55 | return m_instance; 56 | } else { 57 | return m_instance; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Source/src/General.cpp~: -------------------------------------------------------------------------------- 1 | #include "General.h" 2 | 3 | #include // includes cuda.h and cuda_runtime_api.h 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | // Declarations for functions in General.cu 10 | void initVoxelArrayCuda(dim3 dimGrid, dim3 dimBlock, VoxelType* d_voxel_array, VoxelWeightType* d_weight_array); 11 | void updateTransformsCuda(float* d_currentTransform, float3* d_cameraPosition); 12 | void addToCurrentTransformCuda(float* d_currentTransform, float* d_invViewMatrix); 13 | 14 | void General::UpdateTransforms(float* d_currentTransform, float* d_invCurrentTransform, float3* d_cameraPosition, float* invViewMatrix) 15 | { 16 | // If invViewMatrix == NULL then don't add the viewMatrix to the currentTransform 17 | if (invViewMatrix != NULL) { 18 | float* d_invViewMatrix = NULL; 19 | cutilSafeCall(cudaMalloc((void**)&d_invViewMatrix, 12*sizeof(float))); 20 | cutilSafeCall(cudaMemcpy(d_invViewMatrix, invViewMatrix, 12*sizeof(float), cudaMemcpyHostToDevice)); 21 | addToCurrentTransformCuda(d_currentTransform, d_invViewMatrix); 22 | cutilSafeCall(cudaFree(d_invViewMatrix)); 23 | } 24 | 25 | 26 | //Only d_currentTransform is up to date - we need to calculate and update the others. 27 | float invCurrentTransform_host[16]; 28 | // copy current transform to host 29 | cutilSafeCall( cudaMemcpy(invCurrentTransform_host, d_currentTransform, 16*sizeof(float), cudaMemcpyDeviceToHost) ); 30 | cudaDeviceSynchronize(); 31 | // Calculate inverse of current transformation matrix. 32 | Eigen::Map > invCurrentTransformMatrix(invCurrentTransform_host); // TODO: COLMAJOR IS ALSO WORKING WELL. CHECK OUT. MAYBE BUGGY 33 | invCurrentTransformMatrix = invCurrentTransformMatrix.inverse(); 34 | 35 | // Copy current inverse transformation matrix back into cuda. 36 | cutilSafeCall( cudaMemcpy(d_invCurrentTransform, invCurrentTransform_host, 16*sizeof(float), cudaMemcpyHostToDevice) ); 37 | cudaDeviceSynchronize(); 38 | // At this point both d_currentTransform and d_invCurrentTransform are up to date. 39 | updateTransformsCuda(d_currentTransform, d_cameraPosition); 40 | } 41 | 42 | void General::InitVoxelArray(VoxelType* d_voxel_array, VoxelWeightType* d_weight_array) 43 | { 44 | dim3 dimGrid(VOLUME_SIZE, VOLUME_SIZE); 45 | dim3 dimBlock(VOLUME_SIZE); 46 | initVoxelArrayCuda(dimGrid, dimBlock, d_voxel_array, d_weight_array); // TODO: VOLUME_SIZE=512, AND THIS IS THE MAXIMUM THREADS FOR PARALLEL EXECUTION 47 | 48 | // TODO: THINK HOW TO DO THIS BETTER. DIVIDE THE THREADS INTO FEWER BLOCKS TO SAVE RESOURCES. 49 | } 50 | 51 | General* General::Instance() { 52 | if(!m_instanceFlag) { 53 | m_instance = new General(); 54 | m_instanceFlag = true; 55 | return m_instance; 56 | } else { 57 | return m_instance; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Source/include/MainApp.h~: -------------------------------------------------------------------------------- 1 | #ifndef ___RUNAPP_H_ 2 | #define ___RUNAPP_H_ 3 | 4 | #define PBO_MAIN 0 5 | #define PBO_DEPTH 1 6 | #define PBO_NEW_NORMAL 2 7 | #define PBO_RGB 3 8 | #define PBO_FILE 4 9 | 10 | #define NUM_OF_PBO 5 11 | 12 | #define EMAIL_LENGTH 200 13 | 14 | // CUDA Include 15 | #include 16 | 17 | #include "CameraHandler.h" 18 | #include "ICP.h" 19 | #include "VolumeIntegrator.h" 20 | #include "Raycaster.h" 21 | 22 | class RunApp { 23 | float3 viewRotation; 24 | float3 viewTranslation; 25 | float invViewMatrix[12]; 26 | 27 | // For Mouse Callback 28 | int ox, oy; 29 | int buttonState; 30 | 31 | // The pointer to the voxel array on the GPU 32 | VoxelType *d_voxel_array; 33 | VoxelWeightType *d_weight_array; 34 | 35 | ICP* icp_module; 36 | VolumeIntegrator* m_volumeIntegrator; 37 | CameraHandler* cameraHandler; 38 | Raycaster* m_raycaster; 39 | 40 | // This is copied to a symbol in the volumeRender_kernel module, and is used for the d_render function 41 | float3* d_cameraPosition; // This one is for the volume integration (TSDF parameter) 42 | 43 | PointInfo d_renderedVertexMap; // this holds the vertices and normals found during the raycasting. 44 | 45 | float* d_currentTransform; // Holds the current transform on cuda 46 | float* d_invCurrentTransform; // Holds the inverse current transform on cuda 47 | CAMERA_DEPTH_TYPE* d_newDepthMap; // Holds the depth map coming from camera in each iteration (recycled memory) 48 | 49 | float* d_savedTransform; // Holds the transform used when tracking was enabled 50 | CameraData newDepthData; // Holds the new depth data and the calculated normals (global) 51 | 52 | PboData pboArr[NUM_OF_PBO]; 53 | 54 | bool initDone; 55 | bool startTracking; 56 | bool writingModeOn; 57 | bool terminateTracking; // TODO - This is used to stop the tracking and allow traveling through the volume with the mouse 58 | bool showNormalsFlag; 59 | bool tPressed; 60 | int iteration; 61 | 62 | char emailAddress[EMAIL_LENGTH]; 63 | int savesCounter; 64 | 65 | uint m_width; 66 | uint m_height; 67 | 68 | 69 | // Methods 70 | void PrintWelcomeMessage(); 71 | void initCudaPointers(); 72 | void cleanup(); 73 | void render(); 74 | void initPixelBuffer(); 75 | void drawTextureToScreen(int buffer); 76 | void saveImageToFile(); 77 | void initGL(int *argc, char **argv); 78 | int chooseCudaDevice(int argc, char **argv, bool bUseOpenGL); 79 | void saveVolumeToFile(); 80 | 81 | public: 82 | static RunApp* thisClass; 83 | 84 | void display(); 85 | void mouse(int button, int state, int x, int y); 86 | void motion(int x, int y); 87 | void reshape(int w, int h); 88 | void keyboard(unsigned char key, int x, int y); 89 | void idle(); 90 | 91 | RunApp(int argc, char** argv); 92 | 93 | ~RunApp(); 94 | void MainLoop(); 95 | }; 96 | 97 | #endif // ___RUNAPP_H_ 98 | 99 | -------------------------------------------------------------------------------- /Source/src/CameraSupport/CameraAbstract.cpp: -------------------------------------------------------------------------------- 1 | #include "CameraAbstract.h" 2 | 3 | // CUDA utilities and system includes 4 | #include "cutil_inline.h" // includes cuda.h and cuda_runtime_api.h 5 | 6 | #include // TODO REMOVE 7 | using namespace std; 8 | 9 | void CameraAbstract::SetParams(float foh, float fov, uint width, uint height) { 10 | 11 | cout << "FOH: " << foh << endl; 12 | cout << "FOV: " << fov << endl; 13 | 14 | /////////////////////////////////////////////////////////////////////////////// 15 | ///////////////// TODO WANTED!!!!!!!!!!!!!! /////////////////////////////// 16 | // foh = 1.01229096; - 58 degrees in radian 17 | // fov = 0.78539816; - 45 degrees in radian 18 | /////////////////////////////////////////////////////////////////////////////// 19 | /////////////////////////////////////////////////////////////////////////////// 20 | /////////////////////////////////////////////////////////////////////////////// 21 | 22 | 23 | // TODO, using fov, foh from camera, maybe problematic (slightly different angles than what we're used to). 24 | 25 | 26 | float focalLengthX = tan(foh*0.5)*2.f; // Horizontal focal length (foh in radians). 27 | float focalLengthY = tan(fov*0.5)*2.f; // Vertical focal length (fov in radians). 28 | 29 | // Intrinsic. 30 | m_params.m_intrinsic.Set( -(float)width / focalLengthX, 31 | -(float)height / focalLengthY, 32 | width * 0.5, 33 | height * 0.5); 34 | 35 | // Inverse intrinsic. 36 | m_params.m_invIntrinsic.Set( -focalLengthX / (float)width, 37 | -focalLengthY / (float)height, 38 | focalLengthX * 0.5, 39 | focalLengthY * 0.5); 40 | 41 | m_params.m_width = width; 42 | m_params.m_height = height; 43 | } 44 | 45 | CameraAbstract::CameraAbstract() : m_isInitialized(false), 46 | m_tempDepthArray(NULL), 47 | m_depthSizeBytes(0), 48 | m_rgbSizeBytes(0) { 49 | 50 | } 51 | 52 | CameraAbstract::~CameraAbstract() { 53 | cutilSafeCall(cudaFree(m_tempDepthArray)); 54 | } 55 | 56 | bool CameraAbstract::IsInitialized() { 57 | return m_isInitialized; 58 | } 59 | 60 | CameraParams* CameraAbstract::GetParameters() { 61 | return &m_params; 62 | } 63 | 64 | 65 | // Note that this must be called at the end of the child's Init() implementation 66 | // (because only then do we know the width/height) 67 | bool CameraAbstract::Init() { 68 | m_depthSizeBytes = m_params.m_width*m_params.m_height*sizeof(CAMERA_DEPTH_TYPE); 69 | cutilSafeCall(cudaMalloc((void**)&m_tempDepthArray, m_depthSizeBytes)); 70 | cutilSafeCall(cudaMemset(m_tempDepthArray, 0, m_depthSizeBytes)); 71 | 72 | m_rgbSizeBytes = m_params.m_width*m_params.m_height*sizeof(CAMERA_RGB_TYPE); 73 | cutilSafeCall(cudaMalloc((void**)&m_tempRgbArray, m_rgbSizeBytes)); 74 | cutilSafeCall(cudaMemset(m_tempRgbArray, 0, m_rgbSizeBytes)); 75 | 76 | return true; 77 | } 78 | -------------------------------------------------------------------------------- /Source/include/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 | /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s 54 | * 55 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 56 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 57 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 58 | * isMuchSmallerThan(). 59 | * 60 | * \sa cwiseEqual(const MatrixBase &) const 61 | */ 62 | inline const CwiseUnaryOp >, const Derived> 63 | cwiseEqual(const Scalar& s) const 64 | { 65 | return CwiseUnaryOp >,const Derived> 66 | (derived(), std::bind1st(std::equal_to(), s)); 67 | } 68 | -------------------------------------------------------------------------------- /Source/include/MainApp.h: -------------------------------------------------------------------------------- 1 | #ifndef ___RUNAPP_H_ 2 | #define ___RUNAPP_H_ 3 | 4 | #define PBO_MAIN 0 5 | #define PBO_DEPTH 1 6 | #define PBO_NEW_NORMAL 2 7 | #define PBO_RGB 3 8 | #define PBO_FILE 4 9 | 10 | #define NUM_OF_PBO 5 11 | 12 | #define EMAIL_LENGTH 200 13 | 14 | // CUDA Include 15 | #include 16 | 17 | #include "CameraHandler.h" 18 | #include "ICP.h" 19 | #include "VolumeIntegrator.h" 20 | #include "Raycaster.h" 21 | #include "config.h" 22 | 23 | class RunApp { 24 | float3 viewRotation; 25 | float3 viewTranslation; 26 | float invViewMatrix[12]; 27 | 28 | // For Mouse Callback 29 | int ox, oy; 30 | int buttonState; 31 | 32 | // The pointer to the voxel array on the GPU 33 | VoxelType *d_voxel_array; 34 | VoxelWeightType *d_weight_array; 35 | 36 | ICP* icp_module; 37 | VolumeIntegrator* m_volumeIntegrator; 38 | CameraHandler* cameraHandler; 39 | Raycaster* m_raycaster; 40 | 41 | // This is copied to a symbol in the volumeRender_kernel module, and is used for the d_render function 42 | float3* d_cameraPosition; // This one is for the volume integration (TSDF parameter) 43 | 44 | PointInfo d_renderedVertexMap; // this holds the vertices and normals found during the raycasting. 45 | 46 | float* d_currentTransform; // Holds the current transform on cuda 47 | float* d_invCurrentTransform; // Holds the inverse current transform on cuda 48 | CAMERA_DEPTH_TYPE* d_newDepthMap; // Holds the depth map coming from camera in each iteration (recycled memory) 49 | 50 | float* d_savedTransform; // Holds the transform used when tracking was enabled 51 | CameraData newDepthData; // Holds the new depth data and the calculated normals (global) 52 | 53 | PboData pboArr[NUM_OF_PBO]; 54 | 55 | bool initDone; 56 | bool startTracking; 57 | bool writingModeOn; 58 | bool terminateTracking; // TODO - This is used to stop the tracking and allow traveling through the volume with the mouse 59 | bool showNormalsFlag; 60 | bool tPressed; 61 | int iteration; 62 | 63 | char emailAddress[EMAIL_LENGTH]; 64 | int savesCounter; 65 | 66 | uint m_width; 67 | uint m_height; 68 | 69 | 70 | // Methods 71 | void PrintWelcomeMessage(); 72 | void initCudaPointers(); 73 | void cleanup(); 74 | void render(); 75 | void initPixelBuffer(); 76 | void drawTextureToScreen(int buffer); 77 | void saveImageToFile(); 78 | void initGL(int *argc, char **argv); 79 | int chooseCudaDevice(int argc, char **argv, bool bUseOpenGL); 80 | void saveVolumeToFile(); 81 | 82 | public: 83 | static RunApp* thisClass; 84 | 85 | void display(); 86 | void mouse(int button, int state, int x, int y); 87 | void motion(int x, int y); 88 | void reshape(int w, int h); 89 | void keyboard(unsigned char key, int x, int y); 90 | void idle(); 91 | 92 | RunApp(int argc, char** argv); 93 | 94 | ~RunApp(); 95 | void MainLoop(); 96 | }; 97 | 98 | #endif // ___RUNAPP_H_ 99 | 100 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/ICP.h: -------------------------------------------------------------------------------- 1 | #ifndef ___ICP_H_ 2 | #define ___ICP_H_ 3 | 4 | #include "utilities.h" 5 | 6 | #define NUM_VARS (6) 7 | 8 | class ICP { 9 | float* d_A_Matrix; // matrix of dim: (imageW*ImageH)x6 10 | float* d_b_Matrix; // array of dim: (imageW*ImageH)x1 11 | 12 | float* AtA; // matrix of dim: (36)xCorrespondence_block 13 | float* Atb; // array of dim: Correspondence_block 14 | 15 | float* Atransposed; // matrix of dim: 6x(imageW*ImageH) 16 | float* Atransposed_x_A; // The multiplication of Atransposed by A (a 6x6 matrix) 17 | float* inv_Atransposed_x_A; // The inverse of Atransposed by A (a 6x6 matrix) 18 | float* Atransposed_x_b; // The multiplication of Atransposed by b (a 6x1 matrix) 19 | float* xOpt; // The values of alpha, beta, gamma, tx,ty, tz, which make up the new transormation matrix. 20 | // (a 6x1 matrix) 21 | float* invLastTransform; // pointer to previous transformation matrix in cuda 22 | float* newTransform; // pointer to current (new) transformation matrix in cuda 23 | float* incrementalTransform; // pointer to the incremental transform matrix created for this frame in all ICP iterations 24 | float* bestTransform; // pointer to the best transform matrix found so far (minimum average error) 25 | float* errorSum; // single float, holds sum of errors calculated for new transformation matrix. 26 | 27 | float* Atransposed_x_A_host; 28 | float* invLastTransform_host; // the inverse of the transformation from the previous iteration of ICP 29 | 30 | //TODO - can these be removed entirely? They're only needed for the call to camera handler for updateCameraData 31 | dim3 m_gridSize; //The grid size for GPU calls 32 | dim3 m_blockSize; //The block size for GPU calls 33 | 34 | const int m_maxIterations; //number of icp iterations 35 | 36 | void Cpu_buildNewTransformMatrix (float* xOpt, float* newTransform, float* fullIncrementalTransform); //builds the new transformation matrix 37 | void ClearHostMatrices(); 38 | 39 | // host matrices 40 | float AtA_sum[NUM_VARS*NUM_VARS]; 41 | float Atb_sum[NUM_VARS]; 42 | float* AtA_host; 43 | float* Atb_host; 44 | float* xOpt_host; 45 | CameraParams m_cameraParams; 46 | 47 | uint m_numCorrespondenceBlocks; 48 | 49 | 50 | public: 51 | 52 | //called once at the beginning of the program, allocates A,b arrays in cuda 53 | ICP (dim3 gridSize, dim3 blockSize, CameraParams* cameraParams); 54 | ~ICP (); 55 | 56 | //receives depth map and vertex map pointers, previous transformation matrix, performs ICP 57 | // The output is in @Param _newTransform_output 58 | void Iterate_ICP (const CameraData& _newDepthData, 59 | const PointInfo& _currentVertexMap, 60 | float* _currentTransform); 61 | 62 | void FindCorresponding(const CameraData& newDepthMap, const PointInfo& currentVertexMap); 63 | 64 | void BuildNewTransformMatrix (); 65 | 66 | void CopyProjectionMatrix(const float *_kMat, const float *_kInvMat); 67 | 68 | void CopyWidthAndHeight(const int _width, const int _height); 69 | 70 | }; 71 | 72 | #endif // #ifndef ___ICP_H_ -------------------------------------------------------------------------------- /Source/include/CameraAbstract.h: -------------------------------------------------------------------------------- 1 | #ifndef ___CAMERAABSTRACT_H_ 2 | #define ___CAMERAABSTRACT_H_ 3 | 4 | #include "utilities.h" 5 | 6 | 7 | /** 8 | \brief Generic camera interface 9 | 10 | This class represent a camera connected to the system. 11 | The class provide an interface to get the depth/RGB frames from the camera. 12 | */ 13 | 14 | class CameraAbstract { 15 | 16 | protected: 17 | bool m_isInitialized; 18 | CameraParams m_params; 19 | /** 20 | \brief Used by the filter function too store the original frame being filterd. 21 | \sa AverageFilter(), GradientFilter(), MedianFilter() 22 | */ 23 | CAMERA_DEPTH_TYPE* m_tempDepthArray; 24 | /** 25 | \brief Used by the filter function too store the original frame being filterd. 26 | \sa AverageFilter(), GradientFilter(), MedianFilter() 27 | */ 28 | CAMERA_RGB_TYPE* m_tempRgbArray; 29 | 30 | /** 31 | \brief Calculates and sets camera's params. Not virtual. 32 | */ 33 | void SetParams(float foh, float fov, uint width, uint height); 34 | /** 35 | \brief Initializes camera, creates parameters struct. 36 | 37 | Very Important!!!! CameraAbstract::Init() must be called from the end of each child class's Init() implementation. 38 | It uses the cameraParams width and height which are only known at the end of the child's Init(). 39 | */ 40 | virtual bool Init(); 41 | 42 | /** \brief Fix distortion coused by the lens. 43 | 44 | based on Aaron solution described here. 45 | */ 46 | void undistort(CameraParams m_params, 47 | CAMERA_DEPTH_TYPE* depthMap, CAMERA_DEPTH_TYPE* newDepthMap); 48 | 49 | /** \brief An average filter for a depth frame */ 50 | void AverageFilter(CAMERA_DEPTH_TYPE* d_newDepthMap); 51 | /** \brief A gradient filter for a depth frame */ 52 | void GradientFilter(CAMERA_DEPTH_TYPE* d_newDepthMap); 53 | /** \brief An Median filter for a depth frame */ 54 | void MedianFilter(CAMERA_DEPTH_TYPE* d_newDepthMap); 55 | 56 | public: 57 | 58 | /** \brief The size of a depth frame in bytes */ 59 | int m_depthSizeBytes; 60 | /** \brief The size of a color frame in bytes */ 61 | int m_rgbSizeBytes; 62 | 63 | /** \brief Post: camera parameters are initialized. */ 64 | CameraAbstract(); 65 | 66 | // Virtual destructor. 67 | virtual ~CameraAbstract(); 68 | 69 | /** \brief Getter.*/ 70 | bool IsInitialized(); 71 | 72 | /** \brief Getter.*/ 73 | CameraParams* GetParameters(); 74 | 75 | /** \brief Get new depth frame. */ 76 | virtual bool GetDepthFrame(CAMERA_DEPTH_TYPE* d_newDepthMap) = 0; 77 | 78 | virtual char* GetCameraTypeStr() = 0; 79 | 80 | /** \brief Get new rgb frame, if available. */ 81 | virtual bool GetRgbFrame(CAMERA_RGB_TYPE* d_newRgbMap) { 82 | return false; 83 | }; 84 | 85 | // TODO: Add functions readToFile, writeToFile in the abstract class. 86 | // notice that we need to add a configurations file for each camera when it writes to file. 87 | 88 | }; 89 | 90 | #endif // ___CAMERAABSTRACT_H_ 91 | 92 | -------------------------------------------------------------------------------- /Source/include/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 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/StlSupport/details.h: -------------------------------------------------------------------------------- 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_STL_DETAILS_H 12 | #define EIGEN_STL_DETAILS_H 13 | 14 | #ifndef EIGEN_ALIGNED_ALLOCATOR 15 | #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator 16 | #endif 17 | 18 | namespace Eigen { 19 | 20 | // This one is needed to prevent reimplementing the whole std::vector. 21 | template 22 | class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR 23 | { 24 | public: 25 | typedef size_t size_type; 26 | typedef ptrdiff_t difference_type; 27 | typedef T* pointer; 28 | typedef const T* const_pointer; 29 | typedef T& reference; 30 | typedef const T& const_reference; 31 | typedef T value_type; 32 | 33 | template 34 | struct rebind 35 | { 36 | typedef aligned_allocator_indirection other; 37 | }; 38 | 39 | aligned_allocator_indirection() {} 40 | aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} 41 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 42 | template 43 | aligned_allocator_indirection(const aligned_allocator_indirection& ) {} 44 | template 45 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 46 | ~aligned_allocator_indirection() {} 47 | }; 48 | 49 | #ifdef _MSC_VER 50 | 51 | // sometimes, MSVC detects, at compile time, that the argument x 52 | // in std::vector::resize(size_t s,T x) won't be aligned and generate an error 53 | // even if this function is never called. Whence this little wrapper. 54 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ 55 | typename Eigen::internal::conditional< \ 56 | Eigen::internal::is_arithmetic::value, \ 57 | T, \ 58 | Eigen::internal::workaround_msvc_stl_support \ 59 | >::type 60 | 61 | namespace internal { 62 | template struct workaround_msvc_stl_support : public T 63 | { 64 | inline workaround_msvc_stl_support() : T() {} 65 | inline workaround_msvc_stl_support(const T& other) : T(other) {} 66 | inline operator T& () { return *static_cast(this); } 67 | inline operator const T& () const { return *static_cast(this); } 68 | template 69 | inline T& operator=(const OtherT& other) 70 | { T::operator=(other); return *this; } 71 | inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) 72 | { T::operator=(other); return *this; } 73 | }; 74 | } 75 | 76 | #else 77 | 78 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T 79 | 80 | #endif 81 | 82 | } 83 | 84 | #endif // EIGEN_STL_DETAILS_H 85 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/misc/Kernel.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_KERNEL_H 11 | #define EIGEN_MISC_KERNEL_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class kernel_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" 27 | // is the number of cols of the original matrix 28 | // so that the product "matrix * kernel = zero" makes sense 29 | Dynamic, // we don't know at compile-time the dimension of the kernel 30 | MatrixType::Options, 31 | MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter 32 | MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, 33 | // whose dimension is the number of columns of the original matrix 34 | > ReturnType; 35 | }; 36 | 37 | template struct kernel_retval_base 38 | : public ReturnByValue > 39 | { 40 | typedef _DecompositionType DecompositionType; 41 | typedef ReturnByValue Base; 42 | typedef typename Base::Index Index; 43 | 44 | kernel_retval_base(const DecompositionType& dec) 45 | : m_dec(dec), 46 | m_rank(dec.rank()), 47 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 48 | {} 49 | 50 | inline Index rows() const { return m_dec.cols(); } 51 | inline Index cols() const { return m_cols; } 52 | inline Index rank() const { return m_rank; } 53 | inline const DecompositionType& dec() const { return m_dec; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | }; 64 | 65 | } // end namespace internal 66 | 67 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 68 | typedef typename DecompositionType::MatrixType MatrixType; \ 69 | typedef typename MatrixType::Scalar Scalar; \ 70 | typedef typename MatrixType::RealScalar RealScalar; \ 71 | typedef typename MatrixType::Index Index; \ 72 | typedef Eigen::internal::kernel_retval_base Base; \ 73 | using Base::dec; \ 74 | using Base::rank; \ 75 | using Base::rows; \ 76 | using Base::cols; \ 77 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 78 | 79 | } // end namespace Eigen 80 | 81 | #endif // EIGEN_MISC_KERNEL_H 82 | -------------------------------------------------------------------------------- /Source/include/Utils/stopwatch_base.inl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | /* CUda UTility Library */ 13 | 14 | //////////////////////////////////////////////////////////////////////////////// 15 | //! Constructor, default 16 | //////////////////////////////////////////////////////////////////////////////// 17 | template 18 | StopWatchBase::StopWatchBase() : 19 | OSPolicy() 20 | { } 21 | 22 | //////////////////////////////////////////////////////////////////////////////// 23 | //! Destructor 24 | //////////////////////////////////////////////////////////////////////////////// 25 | template 26 | StopWatchBase::~StopWatchBase() { } 27 | 28 | /////////////////////////////////////////////////////////////////////////////// 29 | //! Start time measurement 30 | //////////////////////////////////////////////////////////////////////////////// 31 | template 32 | inline void 33 | StopWatchBase::start() 34 | { 35 | OSPolicy::start(); 36 | } 37 | 38 | //////////////////////////////////////////////////////////////////////////////// 39 | //! Stop time measurement 40 | //////////////////////////////////////////////////////////////////////////////// 41 | template 42 | inline void 43 | StopWatchBase::stop() 44 | { 45 | OSPolicy::stop(); 46 | } 47 | 48 | 49 | //////////////////////////////////////////////////////////////////////////////// 50 | //! Reset the timer to 0. Does not change the timer running state but does 51 | //! recapture this point in time as the current start time if it is running. 52 | //////////////////////////////////////////////////////////////////////////////// 53 | template 54 | inline void 55 | StopWatchBase::reset() 56 | { 57 | OSPolicy::reset(); 58 | } 59 | 60 | //////////////////////////////////////////////////////////////////////////////// 61 | //! Time in msec. after start. If the stop watch is still running (i.e. there 62 | //! was no call to stop()) then the elapsed time is returned, otherwise the 63 | //! time between the last start() and stop call is returned 64 | //////////////////////////////////////////////////////////////////////////////// 65 | template 66 | inline const float 67 | StopWatchBase::getTime() const 68 | { 69 | return OSPolicy::getTime(); 70 | } 71 | 72 | //////////////////////////////////////////////////////////////////////////////// 73 | //! Time in msec. for a single run based on the total number of COMPLETED runs 74 | //! and the total time. 75 | //////////////////////////////////////////////////////////////////////////////// 76 | template 77 | inline const float 78 | StopWatchBase::getAverageTime() const 79 | { 80 | return OSPolicy::getAverageTime(); 81 | } 82 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/SparseLU/SparseLU_relax_snode.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 | /* This file is a modified version of heap_relax_snode.c file in SuperLU 11 | * -- SuperLU routine (version 3.0) -- 12 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 13 | * and Lawrence Berkeley National Lab. 14 | * October 15, 2003 15 | * 16 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 17 | * 18 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 19 | * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 20 | * 21 | * Permission is hereby granted to use or copy this program for any 22 | * purpose, provided the above notices are retained on all copies. 23 | * Permission to modify the code and to distribute modified code is 24 | * granted, provided the above notices are retained, and a notice that 25 | * the code was modified is included with the above copyright notice. 26 | */ 27 | 28 | #ifndef SPARSELU_RELAX_SNODE_H 29 | #define SPARSELU_RELAX_SNODE_H 30 | 31 | namespace Eigen { 32 | 33 | namespace internal { 34 | 35 | /** 36 | * \brief Identify the initial relaxed supernodes 37 | * 38 | * This routine is applied to a column elimination tree. 39 | * It assumes that the matrix has been reordered according to the postorder of the etree 40 | * \param n the number of columns 41 | * \param et elimination tree 42 | * \param relax_columns Maximum number of columns allowed in a relaxed snode 43 | * \param descendants Number of descendants of each node in the etree 44 | * \param relax_end last column in a supernode 45 | */ 46 | template 47 | void SparseLUImpl::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) 48 | { 49 | 50 | // compute the number of descendants of each node in the etree 51 | Index j, parent; 52 | relax_end.setConstant(emptyIdxLU); 53 | descendants.setZero(); 54 | for (j = 0; j < n; j++) 55 | { 56 | parent = et(j); 57 | if (parent != n) // not the dummy root 58 | descendants(parent) += descendants(j) + 1; 59 | } 60 | // Identify the relaxed supernodes by postorder traversal of the etree 61 | Index snode_start; // beginning of a snode 62 | for (j = 0; j < n; ) 63 | { 64 | parent = et(j); 65 | snode_start = j; 66 | while ( parent != n && descendants(parent) < relax_columns ) 67 | { 68 | j = parent; 69 | parent = et(j); 70 | } 71 | // Found a supernode in postordered etree, j is the last column 72 | relax_end(snode_start) = j; // Record last column 73 | j++; 74 | // Search for a new leaf 75 | while (descendants(j) != 0 && j < n) j++; 76 | } // End postorder traversal of the etree 77 | 78 | } 79 | 80 | } // end namespace internal 81 | 82 | } // end namespace Eigen 83 | #endif 84 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/QR/HouseholderQR_MKL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to Intel(R) MKL 29 | * Householder QR decomposition of a matrix w/o pivoting based on 30 | * LAPACKE_?geqrf function. 31 | ******************************************************************************** 32 | */ 33 | 34 | #ifndef EIGEN_QR_MKL_H 35 | #define EIGEN_QR_MKL_H 36 | 37 | #include "Eigen/src/Core/util/MKL_support.h" 38 | 39 | namespace Eigen { 40 | 41 | namespace internal { 42 | 43 | /** \internal Specialization for the data types supported by MKL */ 44 | 45 | #define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \ 46 | template \ 47 | void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs, \ 48 | typename MatrixQR::Index maxBlockSize=32, \ 49 | EIGTYPE* tempData = 0) \ 50 | { \ 51 | lapack_int m = mat.rows(); \ 52 | lapack_int n = mat.cols(); \ 53 | lapack_int lda = mat.outerStride(); \ 54 | lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 55 | LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \ 56 | hCoeffs.adjointInPlace(); \ 57 | \ 58 | } 59 | 60 | EIGEN_MKL_QR_NOPIV(double, double, d) 61 | EIGEN_MKL_QR_NOPIV(float, float, s) 62 | EIGEN_MKL_QR_NOPIV(dcomplex, MKL_Complex16, z) 63 | EIGEN_MKL_QR_NOPIV(scomplex, MKL_Complex8, c) 64 | 65 | } // end namespace internal 66 | 67 | } // end namespace Eigen 68 | 69 | #endif // EIGEN_QR_MKL_H 70 | -------------------------------------------------------------------------------- /Source/src/Utils/stopwatch.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | /* CUda UTility Library */ 13 | 14 | #include 15 | 16 | // includes, file 17 | #include 18 | 19 | //////////////////////////////////////////////////////////////////////////////// 20 | // static variables 21 | 22 | //! global index for all stop watches 23 | #ifdef _WIN32 24 | /*static*/ std::vector< StopWatchC* > StopWatchC::swatches; 25 | #else 26 | template 27 | /*static*/ std::vector< StopWatchBase* > 28 | StopWatchBase:: swatches; 29 | #endif 30 | 31 | 32 | // namespace, unnamed 33 | namespace 34 | { 35 | // convenience typedef 36 | typedef std::vector< StopWatchC* >::size_type swatches_size_type; 37 | 38 | ////////////////////////////////////////////////////////////////////////////// 39 | //! Translate stop watch name to index 40 | ////////////////////////////////////////////////////////////////////////////// 41 | swatches_size_type 42 | nameToIndex( const unsigned int& name) 43 | { 44 | return name - 1; 45 | } 46 | 47 | } // end namespace, unnamed 48 | 49 | // Stop watch 50 | namespace StopWatch 51 | { 52 | ////////////////////////////////////////////////////////////////////////////// 53 | //! Create a stop watch 54 | ////////////////////////////////////////////////////////////////////////////// 55 | const unsigned int 56 | create() 57 | { 58 | // create new stopwatch 59 | StopWatchC* swatch = new StopWatchC(); 60 | if( NULL == swatch) 61 | { 62 | return 0; 63 | } 64 | 65 | // store new stop watch 66 | StopWatchC::swatches.push_back( swatch); 67 | 68 | // return the handle to the new stop watch 69 | return (unsigned int) StopWatchC::swatches.size(); 70 | } 71 | 72 | ////////////////////////////////////////////////////////////////////////////// 73 | // Get a handle to the stop watch with the name \a name 74 | ////////////////////////////////////////////////////////////////////////////// 75 | StopWatchC& 76 | get( const unsigned int& name) 77 | { 78 | return *(StopWatchC::swatches[nameToIndex( name)]); 79 | } 80 | 81 | ////////////////////////////////////////////////////////////////////////////// 82 | // Delete the stop watch with the name \a name 83 | ////////////////////////////////////////////////////////////////////////////// 84 | void 85 | destroy( const unsigned int& name) 86 | { 87 | // get index into global memory 88 | swatches_size_type pos = nameToIndex( name); 89 | // delete stop watch 90 | delete StopWatchC::swatches[pos]; 91 | // invalidate storage 92 | StopWatchC::swatches[pos] = NULL; 93 | } 94 | 95 | } // end namespace, StopWatch 96 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/Eigen2Support/Geometry/All.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN2_GEOMETRY_MODULE_H 2 | #define EIGEN2_GEOMETRY_MODULE_H 3 | 4 | #include 5 | 6 | #ifndef M_PI 7 | #define M_PI 3.14159265358979323846 8 | #endif 9 | 10 | #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 11 | #include "RotationBase.h" 12 | #include "Rotation2D.h" 13 | #include "Quaternion.h" 14 | #include "AngleAxis.h" 15 | #include "Transform.h" 16 | #include "Translation.h" 17 | #include "Scaling.h" 18 | #include "AlignedBox.h" 19 | #include "Hyperplane.h" 20 | #include "ParametrizedLine.h" 21 | #endif 22 | 23 | 24 | #define RotationBase eigen2_RotationBase 25 | #define Rotation2D eigen2_Rotation2D 26 | #define Rotation2Df eigen2_Rotation2Df 27 | #define Rotation2Dd eigen2_Rotation2Dd 28 | 29 | #define Quaternion eigen2_Quaternion 30 | #define Quaternionf eigen2_Quaternionf 31 | #define Quaterniond eigen2_Quaterniond 32 | 33 | #define AngleAxis eigen2_AngleAxis 34 | #define AngleAxisf eigen2_AngleAxisf 35 | #define AngleAxisd eigen2_AngleAxisd 36 | 37 | #define Transform eigen2_Transform 38 | #define Transform2f eigen2_Transform2f 39 | #define Transform2d eigen2_Transform2d 40 | #define Transform3f eigen2_Transform3f 41 | #define Transform3d eigen2_Transform3d 42 | 43 | #define Translation eigen2_Translation 44 | #define Translation2f eigen2_Translation2f 45 | #define Translation2d eigen2_Translation2d 46 | #define Translation3f eigen2_Translation3f 47 | #define Translation3d eigen2_Translation3d 48 | 49 | #define Scaling eigen2_Scaling 50 | #define Scaling2f eigen2_Scaling2f 51 | #define Scaling2d eigen2_Scaling2d 52 | #define Scaling3f eigen2_Scaling3f 53 | #define Scaling3d eigen2_Scaling3d 54 | 55 | #define AlignedBox eigen2_AlignedBox 56 | 57 | #define Hyperplane eigen2_Hyperplane 58 | #define ParametrizedLine eigen2_ParametrizedLine 59 | 60 | #define ei_toRotationMatrix eigen2_ei_toRotationMatrix 61 | #define ei_quaternion_assign_impl eigen2_ei_quaternion_assign_impl 62 | #define ei_transform_product_impl eigen2_ei_transform_product_impl 63 | 64 | #include "RotationBase.h" 65 | #include "Rotation2D.h" 66 | #include "Quaternion.h" 67 | #include "AngleAxis.h" 68 | #include "Transform.h" 69 | #include "Translation.h" 70 | #include "Scaling.h" 71 | #include "AlignedBox.h" 72 | #include "Hyperplane.h" 73 | #include "ParametrizedLine.h" 74 | 75 | #undef ei_toRotationMatrix 76 | #undef ei_quaternion_assign_impl 77 | #undef ei_transform_product_impl 78 | 79 | #undef RotationBase 80 | #undef Rotation2D 81 | #undef Rotation2Df 82 | #undef Rotation2Dd 83 | 84 | #undef Quaternion 85 | #undef Quaternionf 86 | #undef Quaterniond 87 | 88 | #undef AngleAxis 89 | #undef AngleAxisf 90 | #undef AngleAxisd 91 | 92 | #undef Transform 93 | #undef Transform2f 94 | #undef Transform2d 95 | #undef Transform3f 96 | #undef Transform3d 97 | 98 | #undef Translation 99 | #undef Translation2f 100 | #undef Translation2d 101 | #undef Translation3f 102 | #undef Translation3d 103 | 104 | #undef Scaling 105 | #undef Scaling2f 106 | #undef Scaling2d 107 | #undef Scaling3f 108 | #undef Scaling3d 109 | 110 | #undef AlignedBox 111 | 112 | #undef Hyperplane 113 | #undef ParametrizedLine 114 | 115 | #endif // EIGEN2_GEOMETRY_MODULE_H 116 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/Eigen2Support/Meta.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_META_H 11 | #define EIGEN2_META_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | struct ei_traits : internal::traits 17 | {}; 18 | 19 | struct ei_meta_true { enum { ret = 1 }; }; 20 | struct ei_meta_false { enum { ret = 0 }; }; 21 | 22 | template 23 | struct ei_meta_if { typedef Then ret; }; 24 | 25 | template 26 | struct ei_meta_if { typedef Else ret; }; 27 | 28 | template struct ei_is_same_type { enum { ret = 0 }; }; 29 | template struct ei_is_same_type { enum { ret = 1 }; }; 30 | 31 | template struct ei_unref { typedef T type; }; 32 | template struct ei_unref { typedef T type; }; 33 | 34 | template struct ei_unpointer { typedef T type; }; 35 | template struct ei_unpointer { typedef T type; }; 36 | template struct ei_unpointer { typedef T type; }; 37 | 38 | template struct ei_unconst { typedef T type; }; 39 | template struct ei_unconst { typedef T type; }; 40 | template struct ei_unconst { typedef T & type; }; 41 | template struct ei_unconst { typedef T * type; }; 42 | 43 | template struct ei_cleantype { typedef T type; }; 44 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 45 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 46 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 47 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 48 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 49 | 50 | /** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer. 51 | * Usage example: \code ei_meta_sqrt<1023>::ret \endcode 52 | */ 53 | template Y))) > 57 | // use ?: instead of || just to shut up a stupid gcc 4.3 warning 58 | class ei_meta_sqrt 59 | { 60 | enum { 61 | MidX = (InfX+SupX)/2, 62 | TakeInf = MidX*MidX > Y ? 1 : 0, 63 | NewInf = int(TakeInf) ? InfX : int(MidX), 64 | NewSup = int(TakeInf) ? int(MidX) : SupX 65 | }; 66 | public: 67 | enum { ret = ei_meta_sqrt::ret }; 68 | }; 69 | 70 | template 71 | class ei_meta_sqrt { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; }; 72 | 73 | } // end namespace Eigen 74 | 75 | #endif // EIGEN2_META_H 76 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/SparseCore/SparseView.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Gael Guennebaud 5 | // Copyright (C) 2010 Daniel Lowengrub 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_SPARSEVIEW_H 12 | #define EIGEN_SPARSEVIEW_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | struct traits > : traits 20 | { 21 | typedef typename MatrixType::Index Index; 22 | typedef Sparse StorageKind; 23 | enum { 24 | Flags = int(traits::Flags) & (RowMajorBit) 25 | }; 26 | }; 27 | 28 | } // end namespace internal 29 | 30 | template 31 | class SparseView : public SparseMatrixBase > 32 | { 33 | typedef typename MatrixType::Nested MatrixTypeNested; 34 | typedef typename internal::remove_all::type _MatrixTypeNested; 35 | public: 36 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView) 37 | 38 | SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0), 39 | typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) : 40 | m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {} 41 | 42 | class InnerIterator; 43 | 44 | inline Index rows() const { return m_matrix.rows(); } 45 | inline Index cols() const { return m_matrix.cols(); } 46 | 47 | inline Index innerSize() const { return m_matrix.innerSize(); } 48 | inline Index outerSize() const { return m_matrix.outerSize(); } 49 | 50 | protected: 51 | MatrixTypeNested m_matrix; 52 | Scalar m_reference; 53 | typename NumTraits::Real m_epsilon; 54 | }; 55 | 56 | template 57 | class SparseView::InnerIterator : public _MatrixTypeNested::InnerIterator 58 | { 59 | typedef typename SparseView::Index Index; 60 | public: 61 | typedef typename _MatrixTypeNested::InnerIterator IterBase; 62 | InnerIterator(const SparseView& view, Index outer) : 63 | IterBase(view.m_matrix, outer), m_view(view) 64 | { 65 | incrementToNonZero(); 66 | } 67 | 68 | EIGEN_STRONG_INLINE InnerIterator& operator++() 69 | { 70 | IterBase::operator++(); 71 | incrementToNonZero(); 72 | return *this; 73 | } 74 | 75 | using IterBase::value; 76 | 77 | protected: 78 | const SparseView& m_view; 79 | 80 | private: 81 | void incrementToNonZero() 82 | { 83 | while((bool(*this)) && internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon)) 84 | { 85 | IterBase::operator++(); 86 | } 87 | } 88 | }; 89 | 90 | template 91 | const SparseView MatrixBase::sparseView(const Scalar& m_reference, 92 | const typename NumTraits::Real& m_epsilon) const 93 | { 94 | return SparseView(derived(), m_reference, m_epsilon); 95 | } 96 | 97 | } // end namespace Eigen 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/misc/Image.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_IMAGE_H 11 | #define EIGEN_MISC_IMAGE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class image_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose 27 | // dimension is the number of rows of the original matrix 28 | Dynamic, // we don't know at compile time the dimension of the image (the rank) 29 | MatrixType::Options, 30 | MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, 31 | MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. 32 | > ReturnType; 33 | }; 34 | 35 | template struct image_retval_base 36 | : public ReturnByValue > 37 | { 38 | typedef _DecompositionType DecompositionType; 39 | typedef typename DecompositionType::MatrixType MatrixType; 40 | typedef ReturnByValue Base; 41 | typedef typename Base::Index Index; 42 | 43 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 44 | : m_dec(dec), m_rank(dec.rank()), 45 | m_cols(m_rank == 0 ? 1 : m_rank), 46 | m_originalMatrix(originalMatrix) 47 | {} 48 | 49 | inline Index rows() const { return m_dec.rows(); } 50 | inline Index cols() const { return m_cols; } 51 | inline Index rank() const { return m_rank; } 52 | inline const DecompositionType& dec() const { return m_dec; } 53 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | const MatrixType& m_originalMatrix; 64 | }; 65 | 66 | } // end namespace internal 67 | 68 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 69 | typedef typename DecompositionType::MatrixType MatrixType; \ 70 | typedef typename MatrixType::Scalar Scalar; \ 71 | typedef typename MatrixType::RealScalar RealScalar; \ 72 | typedef typename MatrixType::Index Index; \ 73 | typedef Eigen::internal::image_retval_base Base; \ 74 | using Base::dec; \ 75 | using Base::originalMatrix; \ 76 | using Base::rank; \ 77 | using Base::rows; \ 78 | using Base::cols; \ 79 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 80 | : Base(dec, originalMatrix) {} 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_MISC_IMAGE_H 85 | -------------------------------------------------------------------------------- /Source/src/General.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 | * 4 | * Please refer to the NVIDIA end user license agreement (EULA) associated 5 | * with this source code for terms and conditions that govern your use of 6 | * this software. Any use, reproduction, disclosure, or distribution of 7 | * this software and related documentation outside the terms of the EULA 8 | * is strictly prohibited. 9 | * 10 | */ 11 | 12 | // Simple 3D volume renderer 13 | 14 | 15 | #include // includes cuda.h and cuda_runtime_api.h 16 | #include 17 | 18 | #include "General.h" 19 | #include 20 | 21 | ///////////// General functions: /////////// 22 | 23 | bool General::m_instanceFlag = false; 24 | General* General::m_instance = NULL; 25 | 26 | 27 | __global__ void d_initVoxelArray(VoxelType* d_voxel_array, VoxelWeightType* d_weight_array) 28 | { 29 | uint x_index = blockIdx.x; //blockIdx.x * blockDim.x + threadIdx.x; 30 | uint y_index = blockIdx.y; //blockIdx.y * blockDim.y + threadIdx.y; 31 | 32 | if ((x_index >= VOLUME_SIZE) || (y_index >= VOLUME_SIZE)) return; 33 | 34 | uint offset = x_index*VOLUME_SIZE*VOLUME_SIZE + y_index*VOLUME_SIZE; 35 | uint z_index = threadIdx.x; //blockIdx.x + offset; 36 | 37 | //float x = (float)x_index; 38 | //float y = (float)y_index; 39 | //float z = (float)z_index; 40 | 41 | offset += z_index; 42 | 43 | // At the end: weight should be zero. tsdf should be 1. 44 | 45 | d_voxel_array[offset].tsdf = TRUNCATION; 46 | d_weight_array[offset] = 0; 47 | 48 | return; 49 | 50 | } 51 | 52 | // Rotation = { 0 1 2 Transform = { 0 1 2 3 Transform = {0 4 8 12 53 | // 3 4 5 4 5 6 7 Transposed 1 5 9 13 54 | // 6 7 8} 8 9 10 11 2 6 10 14 55 | // 12 13 14 15} 3 7 11 15 56 | // Transposes the rotation matrix of currentTransform, and extract the camera position. 57 | __global__ void d_updateTransforms (float* d_currentTransform, float3* d_cameraPosition) 58 | { 59 | d_cameraPosition->x = d_currentTransform[3]; 60 | d_cameraPosition->y = d_currentTransform[7]; 61 | d_cameraPosition->z = d_currentTransform[11]; 62 | } 63 | 64 | __global__ void d_addToCurrentTransform(float* d_currentTransform, float* d_invViewMatrix) { 65 | float result[12] = {0.f}; 66 | for (int i = 0; i < 3; ++i) { 67 | for (int j = 0; j < 4; ++j) { 68 | for (int k = 0; k < 4; ++k) { 69 | result[i * 4 + j] += d_invViewMatrix[i * 4 + k] * d_currentTransform[k * 4 + j]; 70 | } 71 | } 72 | } 73 | for (int i = 0; i < 12; ++i) { // The last row of currentTransform remains (0,0,0,1) 74 | d_currentTransform[i] = result[i]; 75 | } 76 | } 77 | 78 | 79 | ///////////////////////// C++ functions //////////////////////////////////////////////////// 80 | 81 | void initVoxelArrayCuda(dim3 dimGrid, dim3 dimBlock, VoxelType* d_voxel_array, VoxelWeightType* d_weight_array) { 82 | d_initVoxelArray<<>>(d_voxel_array, d_weight_array); 83 | } 84 | 85 | void updateTransformsCuda(float* d_currentTransform, float3* d_cameraPosition) { 86 | d_updateTransforms<<<1, 1>>>(d_currentTransform, d_cameraPosition); 87 | } 88 | 89 | void addToCurrentTransformCuda(float* d_currentTransform, float* d_invViewMatrix) { 90 | d_addToCurrentTransform<<<1,1>>>(d_currentTransform, d_invViewMatrix); 91 | } 92 | 93 | 94 | // MOVED TO General.cpp -------------------------------------------------------------------------------- /Source/include/Eigen/src/Core/ReturnByValue.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // Copyright (C) 2009-2010 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 EIGEN_RETURNBYVALUE_H 12 | #define EIGEN_RETURNBYVALUE_H 13 | 14 | namespace Eigen { 15 | 16 | /** \class ReturnByValue 17 | * \ingroup Core_Module 18 | * 19 | */ 20 | 21 | namespace internal { 22 | 23 | template 24 | struct traits > 25 | : public traits::ReturnType> 26 | { 27 | enum { 28 | // We're disabling the DirectAccess because e.g. the constructor of 29 | // the Block-with-DirectAccess expression requires to have a coeffRef method. 30 | // Also, we don't want to have to implement the stride stuff. 31 | Flags = (traits::ReturnType>::Flags 32 | | EvalBeforeNestingBit) & ~DirectAccessBit 33 | }; 34 | }; 35 | 36 | /* The ReturnByValue object doesn't even have a coeff() method. 37 | * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix. 38 | * So internal::nested always gives the plain return matrix type. 39 | * 40 | * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? 41 | */ 42 | template 43 | struct nested, n, PlainObject> 44 | { 45 | typedef typename traits::ReturnType type; 46 | }; 47 | 48 | } // end namespace internal 49 | 50 | template class ReturnByValue 51 | : internal::no_assignment_operator, public internal::dense_xpr_base< ReturnByValue >::type 52 | { 53 | public: 54 | typedef typename internal::traits::ReturnType ReturnType; 55 | 56 | typedef typename internal::dense_xpr_base::type Base; 57 | EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) 58 | 59 | template 60 | inline void evalTo(Dest& dst) const 61 | { static_cast(this)->evalTo(dst); } 62 | inline Index rows() const { return static_cast(this)->rows(); } 63 | inline Index cols() const { return static_cast(this)->cols(); } 64 | 65 | #ifndef EIGEN_PARSED_BY_DOXYGEN 66 | #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT 67 | class Unusable{ 68 | Unusable(const Unusable&) {} 69 | Unusable& operator=(const Unusable&) {return *this;} 70 | }; 71 | const Unusable& coeff(Index) const { return *reinterpret_cast(this); } 72 | const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } 73 | Unusable& coeffRef(Index) { return *reinterpret_cast(this); } 74 | Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } 75 | #endif 76 | }; 77 | 78 | template 79 | template 80 | Derived& DenseBase::operator=(const ReturnByValue& other) 81 | { 82 | other.evalTo(derived()); 83 | return derived(); 84 | } 85 | 86 | } // end namespace Eigen 87 | 88 | #endif // EIGEN_RETURNBYVALUE_H 89 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/LU/Determinant.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_DETERMINANT_H 11 | #define EIGEN_DETERMINANT_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template 18 | inline const typename Derived::Scalar bruteforce_det3_helper 19 | (const MatrixBase& matrix, int a, int b, int c) 20 | { 21 | return matrix.coeff(0,a) 22 | * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b)); 23 | } 24 | 25 | template 26 | const typename Derived::Scalar bruteforce_det4_helper 27 | (const MatrixBase& matrix, int j, int k, int m, int n) 28 | { 29 | return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1)) 30 | * (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3)); 31 | } 32 | 33 | template struct determinant_impl 36 | { 37 | static inline typename traits::Scalar run(const Derived& m) 38 | { 39 | if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0) 40 | return typename traits::Scalar(1); 41 | return m.partialPivLu().determinant(); 42 | } 43 | }; 44 | 45 | template struct determinant_impl 46 | { 47 | static inline typename traits::Scalar run(const Derived& m) 48 | { 49 | return m.coeff(0,0); 50 | } 51 | }; 52 | 53 | template struct determinant_impl 54 | { 55 | static inline typename traits::Scalar run(const Derived& m) 56 | { 57 | return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1); 58 | } 59 | }; 60 | 61 | template struct determinant_impl 62 | { 63 | static inline typename traits::Scalar run(const Derived& m) 64 | { 65 | return bruteforce_det3_helper(m,0,1,2) 66 | - bruteforce_det3_helper(m,1,0,2) 67 | + bruteforce_det3_helper(m,2,0,1); 68 | } 69 | }; 70 | 71 | template struct determinant_impl 72 | { 73 | static typename traits::Scalar run(const Derived& m) 74 | { 75 | // trick by Martin Costabel to compute 4x4 det with only 30 muls 76 | return bruteforce_det4_helper(m,0,1,2,3) 77 | - bruteforce_det4_helper(m,0,2,1,3) 78 | + bruteforce_det4_helper(m,0,3,1,2) 79 | + bruteforce_det4_helper(m,1,2,0,3) 80 | - bruteforce_det4_helper(m,1,3,0,2) 81 | + bruteforce_det4_helper(m,2,3,0,1); 82 | } 83 | }; 84 | 85 | } // end namespace internal 86 | 87 | /** \lu_module 88 | * 89 | * \returns the determinant of this matrix 90 | */ 91 | template 92 | inline typename internal::traits::Scalar MatrixBase::determinant() const 93 | { 94 | eigen_assert(rows() == cols()); 95 | typedef typename internal::nested::type Nested; 96 | return internal::determinant_impl::type>::run(derived()); 97 | } 98 | 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_DETERMINANT_H 102 | -------------------------------------------------------------------------------- /Source/include/Eigen/Eigen2Support: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2SUPPORT_H 11 | #define EIGEN2SUPPORT_H 12 | 13 | #if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) 14 | #error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header 15 | #endif 16 | 17 | #ifndef EIGEN_NO_EIGEN2_DEPRECATED_WARNING 18 | 19 | #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) 20 | #warning "Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)" 21 | #else 22 | #pragma message ("Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)") 23 | #endif 24 | 25 | #endif // EIGEN_NO_EIGEN2_DEPRECATED_WARNING 26 | 27 | #include "src/Core/util/DisableStupidWarnings.h" 28 | 29 | /** \ingroup Support_modules 30 | * \defgroup Eigen2Support_Module Eigen2 support module 31 | * 32 | * \warning Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. 33 | * 34 | * This module provides a couple of deprecated functions improving the compatibility with Eigen2. 35 | * 36 | * To use it, define EIGEN2_SUPPORT before including any Eigen header 37 | * \code 38 | * #define EIGEN2_SUPPORT 39 | * \endcode 40 | * 41 | */ 42 | 43 | #include "src/Eigen2Support/Macros.h" 44 | #include "src/Eigen2Support/Memory.h" 45 | #include "src/Eigen2Support/Meta.h" 46 | #include "src/Eigen2Support/Lazy.h" 47 | #include "src/Eigen2Support/Cwise.h" 48 | #include "src/Eigen2Support/CwiseOperators.h" 49 | #include "src/Eigen2Support/TriangularSolver.h" 50 | #include "src/Eigen2Support/Block.h" 51 | #include "src/Eigen2Support/VectorBlock.h" 52 | #include "src/Eigen2Support/Minor.h" 53 | #include "src/Eigen2Support/MathFunctions.h" 54 | 55 | 56 | #include "src/Core/util/ReenableStupidWarnings.h" 57 | 58 | // Eigen2 used to include iostream 59 | #include 60 | 61 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ 62 | using Eigen::Matrix##SizeSuffix##TypeSuffix; \ 63 | using Eigen::Vector##SizeSuffix##TypeSuffix; \ 64 | using Eigen::RowVector##SizeSuffix##TypeSuffix; 65 | 66 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \ 67 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ 68 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ 69 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ 70 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ 71 | 72 | #define EIGEN_USING_MATRIX_TYPEDEFS \ 73 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \ 74 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \ 75 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \ 76 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \ 77 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd) 78 | 79 | #define USING_PART_OF_NAMESPACE_EIGEN \ 80 | EIGEN_USING_MATRIX_TYPEDEFS \ 81 | using Eigen::Matrix; \ 82 | using Eigen::MatrixBase; \ 83 | using Eigen::ei_random; \ 84 | using Eigen::ei_real; \ 85 | using Eigen::ei_imag; \ 86 | using Eigen::ei_conj; \ 87 | using Eigen::ei_abs; \ 88 | using Eigen::ei_abs2; \ 89 | using Eigen::ei_sqrt; \ 90 | using Eigen::ei_exp; \ 91 | using Eigen::ei_log; \ 92 | using Eigen::ei_sin; \ 93 | using Eigen::ei_cos; 94 | 95 | #endif // EIGEN2SUPPORT_H 96 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/SparseCore/SparseDot.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_DOT_H 11 | #define EIGEN_SPARSE_DOT_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | typename internal::traits::Scalar 18 | SparseMatrixBase::dot(const MatrixBase& other) const 19 | { 20 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 22 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 23 | EIGEN_STATIC_ASSERT((internal::is_same::value), 24 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 25 | 26 | eigen_assert(size() == other.size()); 27 | eigen_assert(other.size()>0 && "you are using a non initialized vector"); 28 | 29 | typename Derived::InnerIterator i(derived(),0); 30 | Scalar res(0); 31 | while (i) 32 | { 33 | res += numext::conj(i.value()) * other.coeff(i.index()); 34 | ++i; 35 | } 36 | return res; 37 | } 38 | 39 | template 40 | template 41 | typename internal::traits::Scalar 42 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 43 | { 44 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 45 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 46 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 47 | EIGEN_STATIC_ASSERT((internal::is_same::value), 48 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 49 | 50 | eigen_assert(size() == other.size()); 51 | 52 | typedef typename Derived::Nested Nested; 53 | typedef typename OtherDerived::Nested OtherNested; 54 | typedef typename internal::remove_all::type NestedCleaned; 55 | typedef typename internal::remove_all::type OtherNestedCleaned; 56 | 57 | Nested nthis(derived()); 58 | OtherNested nother(other.derived()); 59 | 60 | typename NestedCleaned::InnerIterator i(nthis,0); 61 | typename OtherNestedCleaned::InnerIterator j(nother,0); 62 | Scalar res(0); 63 | while (i && j) 64 | { 65 | if (i.index()==j.index()) 66 | { 67 | res += numext::conj(i.value()) * j.value(); 68 | ++i; ++j; 69 | } 70 | else if (i.index() 79 | inline typename NumTraits::Scalar>::Real 80 | SparseMatrixBase::squaredNorm() const 81 | { 82 | return numext::real((*this).cwiseAbs2().sum()); 83 | } 84 | 85 | template 86 | inline typename NumTraits::Scalar>::Real 87 | SparseMatrixBase::norm() const 88 | { 89 | using std::sqrt; 90 | return sqrt(squaredNorm()); 91 | } 92 | 93 | template 94 | inline typename NumTraits::Scalar>::Real 95 | SparseMatrixBase::blueNorm() const 96 | { 97 | return internal::blueNorm_impl(*this); 98 | } 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_SPARSE_DOT_H 102 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/Core/NestByValue.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) 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 EIGEN_NESTBYVALUE_H 12 | #define EIGEN_NESTBYVALUE_H 13 | 14 | namespace Eigen { 15 | 16 | /** \class NestByValue 17 | * \ingroup Core_Module 18 | * 19 | * \brief Expression which must be nested by value 20 | * 21 | * \param ExpressionType the type of the object of which we are requiring nesting-by-value 22 | * 23 | * This class is the return type of MatrixBase::nestByValue() 24 | * and most of the time this is the only way it is used. 25 | * 26 | * \sa MatrixBase::nestByValue() 27 | */ 28 | 29 | namespace internal { 30 | template 31 | struct traits > : public traits 32 | {}; 33 | } 34 | 35 | template class NestByValue 36 | : public internal::dense_xpr_base< NestByValue >::type 37 | { 38 | public: 39 | 40 | typedef typename internal::dense_xpr_base::type Base; 41 | EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) 42 | 43 | inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} 44 | 45 | inline Index rows() const { return m_expression.rows(); } 46 | inline Index cols() const { return m_expression.cols(); } 47 | inline Index outerStride() const { return m_expression.outerStride(); } 48 | inline Index innerStride() const { return m_expression.innerStride(); } 49 | 50 | inline const CoeffReturnType coeff(Index row, Index col) const 51 | { 52 | return m_expression.coeff(row, col); 53 | } 54 | 55 | inline Scalar& coeffRef(Index row, Index col) 56 | { 57 | return m_expression.const_cast_derived().coeffRef(row, col); 58 | } 59 | 60 | inline const CoeffReturnType coeff(Index index) const 61 | { 62 | return m_expression.coeff(index); 63 | } 64 | 65 | inline Scalar& coeffRef(Index index) 66 | { 67 | return m_expression.const_cast_derived().coeffRef(index); 68 | } 69 | 70 | template 71 | inline const PacketScalar packet(Index row, Index col) const 72 | { 73 | return m_expression.template packet(row, col); 74 | } 75 | 76 | template 77 | inline void writePacket(Index row, Index col, const PacketScalar& x) 78 | { 79 | m_expression.const_cast_derived().template writePacket(row, col, x); 80 | } 81 | 82 | template 83 | inline const PacketScalar packet(Index index) const 84 | { 85 | return m_expression.template packet(index); 86 | } 87 | 88 | template 89 | inline void writePacket(Index index, const PacketScalar& x) 90 | { 91 | m_expression.const_cast_derived().template writePacket(index, x); 92 | } 93 | 94 | operator const ExpressionType&() const { return m_expression; } 95 | 96 | protected: 97 | const ExpressionType m_expression; 98 | }; 99 | 100 | /** \returns an expression of the temporary version of *this. 101 | */ 102 | template 103 | inline const NestByValue 104 | DenseBase::nestByValue() const 105 | { 106 | return NestByValue(derived()); 107 | } 108 | 109 | } // end namespace Eigen 110 | 111 | #endif // EIGEN_NESTBYVALUE_H 112 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/Core/VectorBlock.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 | #ifndef EIGEN_VECTORBLOCK_H 12 | #define EIGEN_VECTORBLOCK_H 13 | 14 | namespace Eigen { 15 | 16 | /** \class VectorBlock 17 | * \ingroup Core_Module 18 | * 19 | * \brief Expression of a fixed-size or dynamic-size sub-vector 20 | * 21 | * \param VectorType the type of the object in which we are taking a sub-vector 22 | * \param Size size of the sub-vector we are taking at compile time (optional) 23 | * 24 | * This class represents an expression of either a fixed-size or dynamic-size sub-vector. 25 | * It is the return type of DenseBase::segment(Index,Index) and DenseBase::segment(Index) and 26 | * most of the time this is the only way it is used. 27 | * 28 | * However, if you want to directly maniputate sub-vector expressions, 29 | * for instance if you want to write a function returning such an expression, you 30 | * will need to use this class. 31 | * 32 | * Here is an example illustrating the dynamic case: 33 | * \include class_VectorBlock.cpp 34 | * Output: \verbinclude class_VectorBlock.out 35 | * 36 | * \note Even though this expression has dynamic size, in the case where \a VectorType 37 | * has fixed size, this expression inherits a fixed maximal size which means that evaluating 38 | * it does not cause a dynamic memory allocation. 39 | * 40 | * Here is an example illustrating the fixed-size case: 41 | * \include class_FixedVectorBlock.cpp 42 | * Output: \verbinclude class_FixedVectorBlock.out 43 | * 44 | * \sa class Block, DenseBase::segment(Index,Index,Index,Index), DenseBase::segment(Index,Index) 45 | */ 46 | 47 | namespace internal { 48 | template 49 | struct traits > 50 | : public traits::Flags & RowMajorBit ? 1 : Size, 52 | traits::Flags & RowMajorBit ? Size : 1> > 53 | { 54 | }; 55 | } 56 | 57 | template class VectorBlock 58 | : public Block::Flags & RowMajorBit ? 1 : Size, 60 | internal::traits::Flags & RowMajorBit ? Size : 1> 61 | { 62 | typedef Block::Flags & RowMajorBit ? 1 : Size, 64 | internal::traits::Flags & RowMajorBit ? Size : 1> Base; 65 | enum { 66 | IsColVector = !(internal::traits::Flags & RowMajorBit) 67 | }; 68 | public: 69 | EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock) 70 | 71 | using Base::operator=; 72 | 73 | /** Dynamic-size constructor 74 | */ 75 | inline VectorBlock(VectorType& vector, Index start, Index size) 76 | : Base(vector, 77 | IsColVector ? start : 0, IsColVector ? 0 : start, 78 | IsColVector ? size : 1, IsColVector ? 1 : size) 79 | { 80 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock); 81 | } 82 | 83 | /** Fixed-size constructor 84 | */ 85 | inline VectorBlock(VectorType& vector, Index start) 86 | : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start) 87 | { 88 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock); 89 | } 90 | }; 91 | 92 | 93 | } // end namespace Eigen 94 | 95 | #endif // EIGEN_VECTORBLOCK_H 96 | -------------------------------------------------------------------------------- /Source/include/Eigen/src/LU/PartialPivLU_MKL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to Intel(R) MKL 29 | * LU decomposition with partial pivoting based on LAPACKE_?getrf function. 30 | ******************************************************************************** 31 | */ 32 | 33 | #ifndef EIGEN_PARTIALLU_LAPACK_H 34 | #define EIGEN_PARTIALLU_LAPACK_H 35 | 36 | #include "Eigen/src/Core/util/MKL_support.h" 37 | 38 | namespace Eigen { 39 | 40 | namespace internal { 41 | 42 | /** \internal Specialization for the data types supported by MKL */ 43 | 44 | #define EIGEN_MKL_LU_PARTPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \ 45 | template \ 46 | struct partial_lu_impl \ 47 | { \ 48 | /* \internal performs the LU decomposition in-place of the matrix represented */ \ 49 | static lapack_int blocked_lu(lapack_int rows, lapack_int cols, EIGTYPE* lu_data, lapack_int luStride, lapack_int* row_transpositions, lapack_int& nb_transpositions, lapack_int maxBlockSize=256) \ 50 | { \ 51 | EIGEN_UNUSED_VARIABLE(maxBlockSize);\ 52 | lapack_int matrix_order, first_zero_pivot; \ 53 | lapack_int m, n, lda, *ipiv, info; \ 54 | EIGTYPE* a; \ 55 | /* Set up parameters for ?getrf */ \ 56 | matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 57 | lda = luStride; \ 58 | a = lu_data; \ 59 | ipiv = row_transpositions; \ 60 | m = rows; \ 61 | n = cols; \ 62 | nb_transpositions = 0; \ 63 | \ 64 | info = LAPACKE_##MKLPREFIX##getrf( matrix_order, m, n, (MKLTYPE*)a, lda, ipiv ); \ 65 | \ 66 | for(int i=0;i= 0); \ 69 | /* something should be done with nb_transpositions */ \ 70 | \ 71 | first_zero_pivot = info; \ 72 | return first_zero_pivot; \ 73 | } \ 74 | }; 75 | 76 | EIGEN_MKL_LU_PARTPIV(double, double, d) 77 | EIGEN_MKL_LU_PARTPIV(float, float, s) 78 | EIGEN_MKL_LU_PARTPIV(dcomplex, MKL_Complex16, z) 79 | EIGEN_MKL_LU_PARTPIV(scomplex, MKL_Complex8, c) 80 | 81 | } // end namespace internal 82 | 83 | } // end namespace Eigen 84 | 85 | #endif // EIGEN_PARTIALLU_LAPACK_H 86 | --------------------------------------------------------------------------------