├── README.md ├── cpp ├── CMakeLists.txt ├── build │ ├── CMakeCache.txt │ ├── CMakeFiles │ │ ├── 3.10.2 │ │ │ ├── CMakeCCompiler.cmake │ │ │ ├── CMakeCXXCompiler.cmake │ │ │ ├── CMakeDetermineCompilerABI_C.bin │ │ │ ├── CMakeDetermineCompilerABI_CXX.bin │ │ │ ├── CMakeSystem.cmake │ │ │ ├── CompilerIdC │ │ │ │ ├── CMakeCCompilerId.c │ │ │ │ └── a.out │ │ │ └── CompilerIdCXX │ │ │ │ ├── CMakeCXXCompilerId.cpp │ │ │ │ └── a.out │ │ ├── CMakeDirectoryInformation.cmake │ │ ├── CMakeOutput.log │ │ ├── Makefile.cmake │ │ ├── Makefile2 │ │ ├── TargetDirectories.txt │ │ ├── cmake.check_cache │ │ ├── feature_tests.bin │ │ ├── feature_tests.c │ │ ├── feature_tests.cxx │ │ ├── min_snap.dir │ │ │ ├── CXX.includecache │ │ │ ├── DependInfo.cmake │ │ │ ├── build.make │ │ │ ├── cmake_clean.cmake │ │ │ ├── depend.internal │ │ │ ├── depend.make │ │ │ ├── flags.make │ │ │ ├── include │ │ │ │ ├── ALGLIB │ │ │ │ │ ├── alglibinternal.cpp.o │ │ │ │ │ ├── alglibmisc.cpp.o │ │ │ │ │ ├── ap.cpp.o │ │ │ │ │ ├── dataanalysis.cpp.o │ │ │ │ │ ├── diffequations.cpp.o │ │ │ │ │ ├── fasttransforms.cpp.o │ │ │ │ │ ├── integration.cpp.o │ │ │ │ │ ├── interpolation.cpp.o │ │ │ │ │ ├── linalg.cpp.o │ │ │ │ │ ├── optimization.cpp.o │ │ │ │ │ ├── solvers.cpp.o │ │ │ │ │ ├── specialfunctions.cpp.o │ │ │ │ │ └── statistics.cpp.o │ │ │ │ └── mymav.cpp.o │ │ │ ├── link.txt │ │ │ ├── progress.make │ │ │ └── src │ │ │ │ └── min_snap.cpp.o │ │ └── progress.marks │ ├── Makefile │ ├── cmake_install.cmake │ └── min_snap ├── include │ ├── ALGLIB │ │ ├── alglibinternal.cpp │ │ ├── alglibinternal.h │ │ ├── alglibmisc.cpp │ │ ├── alglibmisc.h │ │ ├── ap.cpp │ │ ├── ap.h │ │ ├── dataanalysis.cpp │ │ ├── dataanalysis.h │ │ ├── diffequations.cpp │ │ ├── diffequations.h │ │ ├── fasttransforms.cpp │ │ ├── fasttransforms.h │ │ ├── integration.cpp │ │ ├── integration.h │ │ ├── interpolation.cpp │ │ ├── interpolation.h │ │ ├── linalg.cpp │ │ ├── linalg.h │ │ ├── optimization.cpp │ │ ├── optimization.h │ │ ├── solvers.cpp │ │ ├── solvers.h │ │ ├── specialfunctions.cpp │ │ ├── specialfunctions.h │ │ ├── statistics.cpp │ │ ├── statistics.h │ │ └── stdafx.h │ ├── Eigen │ │ ├── CMakeLists.txt │ │ ├── Cholesky │ │ ├── CholmodSupport │ │ ├── Core │ │ ├── Dense │ │ ├── Eigen │ │ ├── Eigenvalues │ │ ├── Geometry │ │ ├── Householder │ │ ├── IterativeLinearSolvers │ │ ├── Jacobi │ │ ├── LU │ │ ├── MetisSupport │ │ ├── OrderingMethods │ │ ├── PaStiXSupport │ │ ├── PardisoSupport │ │ ├── QR │ │ ├── QtAlignedMalloc │ │ ├── SPQRSupport │ │ ├── SVD │ │ ├── Sparse │ │ ├── SparseCholesky │ │ ├── SparseCore │ │ ├── SparseLU │ │ ├── SparseQR │ │ ├── StdDeque │ │ ├── StdList │ │ ├── StdVector │ │ ├── SuperLUSupport │ │ ├── UmfPackSupport │ │ └── src │ │ │ ├── Cholesky │ │ │ ├── LDLT.h │ │ │ ├── LLT.h │ │ │ └── LLT_LAPACKE.h │ │ │ ├── CholmodSupport │ │ │ └── CholmodSupport.h │ │ │ ├── Core │ │ │ ├── Array.h │ │ │ ├── ArrayBase.h │ │ │ ├── ArrayWrapper.h │ │ │ ├── Assign.h │ │ │ ├── AssignEvaluator.h │ │ │ ├── Assign_MKL.h │ │ │ ├── BandMatrix.h │ │ │ ├── Block.h │ │ │ ├── BooleanRedux.h │ │ │ ├── CommaInitializer.h │ │ │ ├── ConditionEstimator.h │ │ │ ├── CoreEvaluators.h │ │ │ ├── CoreIterators.h │ │ │ ├── CwiseBinaryOp.h │ │ │ ├── CwiseNullaryOp.h │ │ │ ├── CwiseTernaryOp.h │ │ │ ├── CwiseUnaryOp.h │ │ │ ├── CwiseUnaryView.h │ │ │ ├── DenseBase.h │ │ │ ├── DenseCoeffsBase.h │ │ │ ├── DenseStorage.h │ │ │ ├── Diagonal.h │ │ │ ├── DiagonalMatrix.h │ │ │ ├── DiagonalProduct.h │ │ │ ├── Dot.h │ │ │ ├── EigenBase.h │ │ │ ├── ForceAlignedAccess.h │ │ │ ├── Fuzzy.h │ │ │ ├── GeneralProduct.h │ │ │ ├── GenericPacketMath.h │ │ │ ├── GlobalFunctions.h │ │ │ ├── IO.h │ │ │ ├── Inverse.h │ │ │ ├── Map.h │ │ │ ├── MapBase.h │ │ │ ├── MathFunctions.h │ │ │ ├── MathFunctionsImpl.h │ │ │ ├── Matrix.h │ │ │ ├── MatrixBase.h │ │ │ ├── NestByValue.h │ │ │ ├── NoAlias.h │ │ │ ├── NumTraits.h │ │ │ ├── PermutationMatrix.h │ │ │ ├── PlainObjectBase.h │ │ │ ├── Product.h │ │ │ ├── ProductEvaluators.h │ │ │ ├── Random.h │ │ │ ├── Redux.h │ │ │ ├── Ref.h │ │ │ ├── Replicate.h │ │ │ ├── ReturnByValue.h │ │ │ ├── Reverse.h │ │ │ ├── Select.h │ │ │ ├── SelfAdjointView.h │ │ │ ├── SelfCwiseBinaryOp.h │ │ │ ├── Solve.h │ │ │ ├── SolveTriangular.h │ │ │ ├── SolverBase.h │ │ │ ├── StableNorm.h │ │ │ ├── Stride.h │ │ │ ├── Swap.h │ │ │ ├── Transpose.h │ │ │ ├── Transpositions.h │ │ │ ├── TriangularMatrix.h │ │ │ ├── VectorBlock.h │ │ │ ├── VectorwiseOp.h │ │ │ ├── Visitor.h │ │ │ ├── arch │ │ │ │ ├── AVX │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── AVX512 │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ └── PacketMath.h │ │ │ │ ├── AltiVec │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ └── PacketMath.h │ │ │ │ ├── CUDA │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── Half.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ ├── PacketMathHalf.h │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── Default │ │ │ │ │ ├── ConjHelper.h │ │ │ │ │ └── Settings.h │ │ │ │ ├── NEON │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ └── PacketMath.h │ │ │ │ ├── SSE │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ └── TypeCasting.h │ │ │ │ └── ZVector │ │ │ │ │ ├── Complex.h │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ └── PacketMath.h │ │ │ ├── functors │ │ │ │ ├── AssignmentFunctors.h │ │ │ │ ├── BinaryFunctors.h │ │ │ │ ├── NullaryFunctors.h │ │ │ │ ├── StlFunctors.h │ │ │ │ ├── TernaryFunctors.h │ │ │ │ └── UnaryFunctors.h │ │ │ ├── products │ │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ │ ├── GeneralMatrixMatrix.h │ │ │ │ ├── GeneralMatrixMatrixTriangular.h │ │ │ │ ├── GeneralMatrixMatrixTriangular_BLAS.h │ │ │ │ ├── GeneralMatrixMatrix_BLAS.h │ │ │ │ ├── GeneralMatrixVector.h │ │ │ │ ├── GeneralMatrixVector_BLAS.h │ │ │ │ ├── Parallelizer.h │ │ │ │ ├── SelfadjointMatrixMatrix.h │ │ │ │ ├── SelfadjointMatrixMatrix_BLAS.h │ │ │ │ ├── SelfadjointMatrixVector.h │ │ │ │ ├── SelfadjointMatrixVector_BLAS.h │ │ │ │ ├── SelfadjointProduct.h │ │ │ │ ├── SelfadjointRank2Update.h │ │ │ │ ├── TriangularMatrixMatrix.h │ │ │ │ ├── TriangularMatrixMatrix_BLAS.h │ │ │ │ ├── TriangularMatrixVector.h │ │ │ │ ├── TriangularMatrixVector_BLAS.h │ │ │ │ ├── TriangularSolverMatrix.h │ │ │ │ ├── TriangularSolverMatrix_BLAS.h │ │ │ │ └── TriangularSolverVector.h │ │ │ └── util │ │ │ │ ├── BlasUtil.h │ │ │ │ ├── Constants.h │ │ │ │ ├── DisableStupidWarnings.h │ │ │ │ ├── ForwardDeclarations.h │ │ │ │ ├── MKL_support.h │ │ │ │ ├── Macros.h │ │ │ │ ├── Memory.h │ │ │ │ ├── Meta.h │ │ │ │ ├── NonMPL2.h │ │ │ │ ├── ReenableStupidWarnings.h │ │ │ │ ├── StaticAssert.h │ │ │ │ └── XprHelper.h │ │ │ ├── Eigenvalues │ │ │ ├── ComplexEigenSolver.h │ │ │ ├── ComplexSchur.h │ │ │ ├── ComplexSchur_LAPACKE.h │ │ │ ├── EigenSolver.h │ │ │ ├── GeneralizedEigenSolver.h │ │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ │ ├── HessenbergDecomposition.h │ │ │ ├── MatrixBaseEigenvalues.h │ │ │ ├── RealQZ.h │ │ │ ├── RealSchur.h │ │ │ ├── RealSchur_LAPACKE.h │ │ │ ├── SelfAdjointEigenSolver.h │ │ │ ├── SelfAdjointEigenSolver_LAPACKE.h │ │ │ └── Tridiagonalization.h │ │ │ ├── Geometry │ │ │ ├── AlignedBox.h │ │ │ ├── AngleAxis.h │ │ │ ├── EulerAngles.h │ │ │ ├── Homogeneous.h │ │ │ ├── Hyperplane.h │ │ │ ├── OrthoMethods.h │ │ │ ├── ParametrizedLine.h │ │ │ ├── Quaternion.h │ │ │ ├── Rotation2D.h │ │ │ ├── RotationBase.h │ │ │ ├── Scaling.h │ │ │ ├── Transform.h │ │ │ ├── Translation.h │ │ │ ├── Umeyama.h │ │ │ └── arch │ │ │ │ └── Geometry_SSE.h │ │ │ ├── Householder │ │ │ ├── BlockHouseholder.h │ │ │ ├── Householder.h │ │ │ └── HouseholderSequence.h │ │ │ ├── IterativeLinearSolvers │ │ │ ├── BasicPreconditioners.h │ │ │ ├── BiCGSTAB.h │ │ │ ├── ConjugateGradient.h │ │ │ ├── IncompleteCholesky.h │ │ │ ├── IncompleteLUT.h │ │ │ ├── IterativeSolverBase.h │ │ │ ├── LeastSquareConjugateGradient.h │ │ │ └── SolveWithGuess.h │ │ │ ├── Jacobi │ │ │ └── Jacobi.h │ │ │ ├── LU │ │ │ ├── Determinant.h │ │ │ ├── FullPivLU.h │ │ │ ├── InverseImpl.h │ │ │ ├── PartialPivLU.h │ │ │ ├── PartialPivLU_LAPACKE.h │ │ │ └── arch │ │ │ │ └── Inverse_SSE.h │ │ │ ├── MetisSupport │ │ │ └── MetisSupport.h │ │ │ ├── OrderingMethods │ │ │ ├── Amd.h │ │ │ ├── Eigen_Colamd.h │ │ │ └── Ordering.h │ │ │ ├── PaStiXSupport │ │ │ └── PaStiXSupport.h │ │ │ ├── PardisoSupport │ │ │ └── PardisoSupport.h │ │ │ ├── QR │ │ │ ├── ColPivHouseholderQR.h │ │ │ ├── ColPivHouseholderQR_LAPACKE.h │ │ │ ├── CompleteOrthogonalDecomposition.h │ │ │ ├── FullPivHouseholderQR.h │ │ │ ├── HouseholderQR.h │ │ │ └── HouseholderQR_LAPACKE.h │ │ │ ├── SPQRSupport │ │ │ └── SuiteSparseQRSupport.h │ │ │ ├── SVD │ │ │ ├── BDCSVD.h │ │ │ ├── JacobiSVD.h │ │ │ ├── JacobiSVD_LAPACKE.h │ │ │ ├── SVDBase.h │ │ │ └── UpperBidiagonalization.h │ │ │ ├── SparseCholesky │ │ │ ├── SimplicialCholesky.h │ │ │ └── SimplicialCholesky_impl.h │ │ │ ├── SparseCore │ │ │ ├── AmbiVector.h │ │ │ ├── CompressedStorage.h │ │ │ ├── ConservativeSparseSparseProduct.h │ │ │ ├── MappedSparseMatrix.h │ │ │ ├── SparseAssign.h │ │ │ ├── SparseBlock.h │ │ │ ├── SparseColEtree.h │ │ │ ├── SparseCompressedBase.h │ │ │ ├── SparseCwiseBinaryOp.h │ │ │ ├── SparseCwiseUnaryOp.h │ │ │ ├── SparseDenseProduct.h │ │ │ ├── SparseDiagonalProduct.h │ │ │ ├── SparseDot.h │ │ │ ├── SparseFuzzy.h │ │ │ ├── SparseMap.h │ │ │ ├── SparseMatrix.h │ │ │ ├── SparseMatrixBase.h │ │ │ ├── SparsePermutation.h │ │ │ ├── SparseProduct.h │ │ │ ├── SparseRedux.h │ │ │ ├── SparseRef.h │ │ │ ├── SparseSelfAdjointView.h │ │ │ ├── SparseSolverBase.h │ │ │ ├── SparseSparseProductWithPruning.h │ │ │ ├── SparseTranspose.h │ │ │ ├── SparseTriangularView.h │ │ │ ├── SparseUtil.h │ │ │ ├── SparseVector.h │ │ │ ├── SparseView.h │ │ │ └── TriangularSolver.h │ │ │ ├── SparseLU │ │ │ ├── SparseLU.h │ │ │ ├── SparseLUImpl.h │ │ │ ├── SparseLU_Memory.h │ │ │ ├── SparseLU_Structs.h │ │ │ ├── SparseLU_SupernodalMatrix.h │ │ │ ├── SparseLU_Utils.h │ │ │ ├── SparseLU_column_bmod.h │ │ │ ├── SparseLU_column_dfs.h │ │ │ ├── SparseLU_copy_to_ucol.h │ │ │ ├── SparseLU_gemm_kernel.h │ │ │ ├── SparseLU_heap_relax_snode.h │ │ │ ├── SparseLU_kernel_bmod.h │ │ │ ├── SparseLU_panel_bmod.h │ │ │ ├── SparseLU_panel_dfs.h │ │ │ ├── SparseLU_pivotL.h │ │ │ ├── SparseLU_pruneL.h │ │ │ └── SparseLU_relax_snode.h │ │ │ ├── SparseQR │ │ │ └── SparseQR.h │ │ │ ├── StlSupport │ │ │ ├── StdDeque.h │ │ │ ├── StdList.h │ │ │ ├── StdVector.h │ │ │ └── details.h │ │ │ ├── SuperLUSupport │ │ │ └── SuperLUSupport.h │ │ │ ├── UmfPackSupport │ │ │ └── UmfPackSupport.h │ │ │ ├── misc │ │ │ ├── Image.h │ │ │ ├── Kernel.h │ │ │ ├── RealSvd2x2.h │ │ │ ├── blas.h │ │ │ ├── lapack.h │ │ │ ├── lapacke.h │ │ │ └── lapacke_mangling.h │ │ │ └── plugins │ │ │ ├── ArrayCwiseBinaryOps.h │ │ │ ├── ArrayCwiseUnaryOps.h │ │ │ ├── BlockMethods.h │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ ├── CommonCwiseUnaryOps.h │ │ │ ├── MatrixCwiseBinaryOps.h │ │ │ └── MatrixCwiseUnaryOps.h │ ├── mymav.cpp │ └── mymav.h └── src │ └── min_snap.cpp ├── dynamic_mav.m ├── images ├── control_input.png ├── find_best_time_interval.png ├── moving_target_result.gif └── result.gif ├── main.m ├── mav_controller.m ├── moving_target.m ├── path_planner.m ├── plot_2d_obj.m ├── plot_3d_obj.m ├── plot_path.m └── time_optimal_path_planner.m /README.md: -------------------------------------------------------------------------------- 1 | # MAV Real Time Trajectory Generator 2 | An implementation of real-time optimal trajectory generation bases on the minimum snap trajectory. 3 | ## Objectives 4 | The algorithm is able to perform real-time optimal trajectory planning and compute the corresponding control input. The generated trajectory should be trackable, which means the initial and the final MAV states as well as the limitation of pitch angle should be taken into consideration. 5 | ![](https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/master/images/result.gif) 6 | ## Data Structure 7 | Structure contains the position, the orientation and the speed on body frame. 8 | ```Matlab 9 | obj.position = [x,y,z]; 10 | obj.angle = [yaw,pitch,roll]; 11 | obj.speed = [vx,vy,vz]; % body frame 12 | ``` 13 | ## Simple Dynamic Model of MAV 14 | The discrete time dynamic model of MAV with the maximum of angular velocity 90 degrees per second. 15 | ```Matlab 16 | ts = 0.05; % sampling time is 0.05 s 17 | u = [throttle,yaw,pitch,roll]; % control input 18 | obj = dynamic_mav(obj,u,ts); 19 | ``` 20 | ## Minimum Snap Trajectory 21 | Generates a trajectory by minimizing the snap over time with designed consraints (e.g. initial position, velocity etc.). 22 | ```Matlab 23 | [waypoints,path_c] = path_planner(obj,tgt,time) 24 | ``` 25 | where *obj* is the MAV and *tgt* is the target point. 26 | ## Find The Optimal Time Interval of The Trajectory 27 | This function finds the shortest trajectory satisfies the constraint that the pitch angle should be less than 20 degrees. 28 | ```Matlab 29 | [waypoints,path_c,opt_time] = time_optimal_path_planner(mav,tgt,ts); 30 | ``` 31 | ![](https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/master/images/find_best_time_interval.png) 32 | ## Add Disturbances 33 | Regarding the uncertainties in real enviroment, we added disturbances to the dynamic model as well as the target's position and orientation to evaluate the robutness of our implementation. 34 | ![](https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/master/images/moving_target_result.gif) 35 | ## References 36 | 1. [Minimum Snap Trajectory Generation and Control for Quadrotors](https://ieeexplore.ieee.org/abstract/document/5980409/) 37 | 2. [Aggressive Flight of Fixed-wing and Quadrotor Aircraft in Dense Indoor Environments](http://journals.sagepub.com/doi/abs/10.1177/0278364914558129) 38 | 39 | -------------------------------------------------------------------------------- /cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Declare the version of the CMake API for forward-compatibility 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # Declare the name of the CMake Project 5 | project(min_snap) 6 | 7 | # Add the directory to search for header files 8 | include_directories(include) 9 | 10 | # Define 11 | file( GLOB ALGLIB_SOURCES include/ALGLIB/*.cpp ) 12 | file( GLOB ALGLIB_HEADERS include/ALGLIB/*.h ) 13 | file( GLOB MY_SOURCES include/*.cpp ) 14 | file( GLOB MY_HEADERS include/*.h ) 15 | add_executable(min_snap src/min_snap.cpp ${ALGLIB_SOURCES} ${ALGLIB_HEADERS} ${MY_SOURCES} ${MY_HEADERS}) 16 | 17 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/3.10.2/CMakeCCompiler.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_C_COMPILER "/usr/bin/cc") 2 | set(CMAKE_C_COMPILER_ARG1 "") 3 | set(CMAKE_C_COMPILER_ID "GNU") 4 | set(CMAKE_C_COMPILER_VERSION "7.3.0") 5 | set(CMAKE_C_COMPILER_VERSION_INTERNAL "") 6 | set(CMAKE_C_COMPILER_WRAPPER "") 7 | set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "11") 8 | set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert") 9 | set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") 10 | set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") 11 | set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") 12 | 13 | set(CMAKE_C_PLATFORM_ID "Linux") 14 | set(CMAKE_C_SIMULATE_ID "") 15 | set(CMAKE_C_SIMULATE_VERSION "") 16 | 17 | 18 | 19 | set(CMAKE_AR "/usr/bin/ar") 20 | set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-7") 21 | set(CMAKE_RANLIB "/usr/bin/ranlib") 22 | set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-7") 23 | set(CMAKE_LINKER "/usr/bin/ld") 24 | set(CMAKE_COMPILER_IS_GNUCC 1) 25 | set(CMAKE_C_COMPILER_LOADED 1) 26 | set(CMAKE_C_COMPILER_WORKS TRUE) 27 | set(CMAKE_C_ABI_COMPILED TRUE) 28 | set(CMAKE_COMPILER_IS_MINGW ) 29 | set(CMAKE_COMPILER_IS_CYGWIN ) 30 | if(CMAKE_COMPILER_IS_CYGWIN) 31 | set(CYGWIN 1) 32 | set(UNIX 1) 33 | endif() 34 | 35 | set(CMAKE_C_COMPILER_ENV_VAR "CC") 36 | 37 | if(CMAKE_COMPILER_IS_MINGW) 38 | set(MINGW 1) 39 | endif() 40 | set(CMAKE_C_COMPILER_ID_RUN 1) 41 | set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) 42 | set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) 43 | set(CMAKE_C_LINKER_PREFERENCE 10) 44 | 45 | # Save compiler ABI information. 46 | set(CMAKE_C_SIZEOF_DATA_PTR "8") 47 | set(CMAKE_C_COMPILER_ABI "ELF") 48 | set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") 49 | 50 | if(CMAKE_C_SIZEOF_DATA_PTR) 51 | set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") 52 | endif() 53 | 54 | if(CMAKE_C_COMPILER_ABI) 55 | set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") 56 | endif() 57 | 58 | if(CMAKE_C_LIBRARY_ARCHITECTURE) 59 | set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") 60 | endif() 61 | 62 | set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") 63 | if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) 64 | set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") 65 | endif() 66 | 67 | 68 | 69 | 70 | 71 | set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") 72 | set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") 73 | set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") 74 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_C.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_C.bin -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_CXX.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/3.10.2/CMakeDetermineCompilerABI_CXX.bin -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/3.10.2/CMakeSystem.cmake: -------------------------------------------------------------------------------- 1 | set(CMAKE_HOST_SYSTEM "Linux-4.15.0-29-generic") 2 | set(CMAKE_HOST_SYSTEM_NAME "Linux") 3 | set(CMAKE_HOST_SYSTEM_VERSION "4.15.0-29-generic") 4 | set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") 5 | 6 | 7 | 8 | set(CMAKE_SYSTEM "Linux-4.15.0-29-generic") 9 | set(CMAKE_SYSTEM_NAME "Linux") 10 | set(CMAKE_SYSTEM_VERSION "4.15.0-29-generic") 11 | set(CMAKE_SYSTEM_PROCESSOR "x86_64") 12 | 13 | set(CMAKE_CROSSCOMPILING "FALSE") 14 | 15 | set(CMAKE_SYSTEM_LOADED 1) 16 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/3.10.2/CompilerIdC/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/3.10.2/CompilerIdC/a.out -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/3.10.2/CompilerIdCXX/a.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/3.10.2/CompilerIdCXX/a.out -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/CMakeDirectoryInformation.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # Relative path conversion top directories. 5 | set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp") 6 | set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build") 7 | 8 | # Force unix paths in dependencies. 9 | set(CMAKE_FORCE_UNIX_PATHS 1) 10 | 11 | 12 | # The C and CXX include file regular expressions for this directory. 13 | set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") 14 | set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") 15 | set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) 16 | set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) 17 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/Makefile.cmake: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # The generator used is: 5 | set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") 6 | 7 | # The top level Makefile was generated from the following files: 8 | set(CMAKE_MAKEFILE_DEPENDS 9 | "CMakeCache.txt" 10 | "../CMakeLists.txt" 11 | "CMakeFiles/3.10.2/CMakeCCompiler.cmake" 12 | "CMakeFiles/3.10.2/CMakeCXXCompiler.cmake" 13 | "CMakeFiles/3.10.2/CMakeSystem.cmake" 14 | "/usr/share/cmake-3.10/Modules/CMakeCInformation.cmake" 15 | "/usr/share/cmake-3.10/Modules/CMakeCXXInformation.cmake" 16 | "/usr/share/cmake-3.10/Modules/CMakeCommonLanguageInclude.cmake" 17 | "/usr/share/cmake-3.10/Modules/CMakeGenericSystem.cmake" 18 | "/usr/share/cmake-3.10/Modules/CMakeLanguageInformation.cmake" 19 | "/usr/share/cmake-3.10/Modules/CMakeSystemSpecificInformation.cmake" 20 | "/usr/share/cmake-3.10/Modules/CMakeSystemSpecificInitialize.cmake" 21 | "/usr/share/cmake-3.10/Modules/Compiler/CMakeCommonCompilerMacros.cmake" 22 | "/usr/share/cmake-3.10/Modules/Compiler/GNU-C.cmake" 23 | "/usr/share/cmake-3.10/Modules/Compiler/GNU-CXX.cmake" 24 | "/usr/share/cmake-3.10/Modules/Compiler/GNU.cmake" 25 | "/usr/share/cmake-3.10/Modules/Platform/Linux-GNU-C.cmake" 26 | "/usr/share/cmake-3.10/Modules/Platform/Linux-GNU-CXX.cmake" 27 | "/usr/share/cmake-3.10/Modules/Platform/Linux-GNU.cmake" 28 | "/usr/share/cmake-3.10/Modules/Platform/Linux.cmake" 29 | "/usr/share/cmake-3.10/Modules/Platform/UnixPaths.cmake" 30 | ) 31 | 32 | # The corresponding makefile is: 33 | set(CMAKE_MAKEFILE_OUTPUTS 34 | "Makefile" 35 | "CMakeFiles/cmake.check_cache" 36 | ) 37 | 38 | # Byproducts of CMake generate step: 39 | set(CMAKE_MAKEFILE_PRODUCTS 40 | "CMakeFiles/CMakeDirectoryInformation.cmake" 41 | ) 42 | 43 | # Dependency information for all targets: 44 | set(CMAKE_DEPEND_INFO_FILES 45 | "CMakeFiles/min_snap.dir/DependInfo.cmake" 46 | ) 47 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/Makefile2: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # Default target executed when no arguments are given to make. 5 | default_target: all 6 | 7 | .PHONY : default_target 8 | 9 | # The main recursive all target 10 | all: 11 | 12 | .PHONY : all 13 | 14 | # The main recursive preinstall target 15 | preinstall: 16 | 17 | .PHONY : preinstall 18 | 19 | #============================================================================= 20 | # Special targets provided by cmake. 21 | 22 | # Disable implicit rules so canonical targets will work. 23 | .SUFFIXES: 24 | 25 | 26 | # Remove some rules from gmake that .SUFFIXES does not remove. 27 | SUFFIXES = 28 | 29 | .SUFFIXES: .hpux_make_needs_suffix_list 30 | 31 | 32 | # Suppress display of executed commands. 33 | $(VERBOSE).SILENT: 34 | 35 | 36 | # A target that is always out of date. 37 | cmake_force: 38 | 39 | .PHONY : cmake_force 40 | 41 | #============================================================================= 42 | # Set environment variables for the build. 43 | 44 | # The shell in which to execute make rules. 45 | SHELL = /bin/sh 46 | 47 | # The CMake executable. 48 | CMAKE_COMMAND = /usr/bin/cmake 49 | 50 | # The command to remove a file. 51 | RM = /usr/bin/cmake -E remove -f 52 | 53 | # Escaping for special characters. 54 | EQUALS = = 55 | 56 | # The top-level source directory on which CMake was run. 57 | CMAKE_SOURCE_DIR = /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp 58 | 59 | # The top-level build directory on which CMake was run. 60 | CMAKE_BINARY_DIR = /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build 61 | 62 | #============================================================================= 63 | # Target rules for target CMakeFiles/min_snap.dir 64 | 65 | # All Build rule for target. 66 | CMakeFiles/min_snap.dir/all: 67 | $(MAKE) -f CMakeFiles/min_snap.dir/build.make CMakeFiles/min_snap.dir/depend 68 | $(MAKE) -f CMakeFiles/min_snap.dir/build.make CMakeFiles/min_snap.dir/build 69 | @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles --progress-num=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 "Built target min_snap" 70 | .PHONY : CMakeFiles/min_snap.dir/all 71 | 72 | # Include target in all. 73 | all: CMakeFiles/min_snap.dir/all 74 | 75 | .PHONY : all 76 | 77 | # Build rule for subdir invocation for target. 78 | CMakeFiles/min_snap.dir/rule: cmake_check_build_system 79 | $(CMAKE_COMMAND) -E cmake_progress_start /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles 16 80 | $(MAKE) -f CMakeFiles/Makefile2 CMakeFiles/min_snap.dir/all 81 | $(CMAKE_COMMAND) -E cmake_progress_start /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles 0 82 | .PHONY : CMakeFiles/min_snap.dir/rule 83 | 84 | # Convenience name for target. 85 | min_snap: CMakeFiles/min_snap.dir/rule 86 | 87 | .PHONY : min_snap 88 | 89 | # clean rule for target. 90 | CMakeFiles/min_snap.dir/clean: 91 | $(MAKE) -f CMakeFiles/min_snap.dir/build.make CMakeFiles/min_snap.dir/clean 92 | .PHONY : CMakeFiles/min_snap.dir/clean 93 | 94 | # clean rule for target. 95 | clean: CMakeFiles/min_snap.dir/clean 96 | 97 | .PHONY : clean 98 | 99 | #============================================================================= 100 | # Special targets to cleanup operation of make. 101 | 102 | # Special rule to run CMake to check the build system integrity. 103 | # No rule that depends on this can have commands that come from listfiles 104 | # because they might be regenerated. 105 | cmake_check_build_system: 106 | $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 107 | .PHONY : cmake_check_build_system 108 | 109 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/TargetDirectories.txt: -------------------------------------------------------------------------------- 1 | /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/rebuild_cache.dir 2 | /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir 3 | /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/edit_cache.dir 4 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/cmake.check_cache: -------------------------------------------------------------------------------- 1 | # This file is generated by cmake for dependency checking of the CMakeCache.txt file 2 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/feature_tests.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/feature_tests.bin -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/feature_tests.c: -------------------------------------------------------------------------------- 1 | 2 | const char features[] = {"\n" 3 | "C_FEATURE:" 4 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 5 | "1" 6 | #else 7 | "0" 8 | #endif 9 | "c_function_prototypes\n" 10 | "C_FEATURE:" 11 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 12 | "1" 13 | #else 14 | "0" 15 | #endif 16 | "c_restrict\n" 17 | "C_FEATURE:" 18 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201000L 19 | "1" 20 | #else 21 | "0" 22 | #endif 23 | "c_static_assert\n" 24 | "C_FEATURE:" 25 | #if (__GNUC__ * 100 + __GNUC_MINOR__) >= 304 && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 26 | "1" 27 | #else 28 | "0" 29 | #endif 30 | "c_variadic_macros\n" 31 | 32 | }; 33 | 34 | int main(int argc, char** argv) { (void)argv; return features[argc]; } 35 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/DependInfo.cmake: -------------------------------------------------------------------------------- 1 | # The set of languages for which implicit dependencies are needed: 2 | set(CMAKE_DEPENDS_LANGUAGES 3 | "CXX" 4 | ) 5 | # The set of files for implicit dependencies of each language: 6 | set(CMAKE_DEPENDS_CHECK_CXX 7 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/alglibinternal.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/alglibinternal.cpp.o" 8 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/alglibmisc.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/alglibmisc.cpp.o" 9 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/ap.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/ap.cpp.o" 10 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/dataanalysis.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/dataanalysis.cpp.o" 11 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/diffequations.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/diffequations.cpp.o" 12 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/fasttransforms.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/fasttransforms.cpp.o" 13 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/integration.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/integration.cpp.o" 14 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/interpolation.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/interpolation.cpp.o" 15 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/linalg.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/linalg.cpp.o" 16 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/optimization.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/optimization.cpp.o" 17 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/solvers.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/solvers.cpp.o" 18 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/specialfunctions.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/specialfunctions.cpp.o" 19 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/ALGLIB/statistics.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/statistics.cpp.o" 20 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include/mymav.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/include/mymav.cpp.o" 21 | "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/src/min_snap.cpp" "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/CMakeFiles/min_snap.dir/src/min_snap.cpp.o" 22 | ) 23 | set(CMAKE_CXX_COMPILER_ID "GNU") 24 | 25 | # The include file search paths: 26 | set(CMAKE_CXX_TARGET_INCLUDE_PATH 27 | "../include" 28 | ) 29 | 30 | # Targets to which this target links. 31 | set(CMAKE_TARGET_LINKED_INFO_FILES 32 | ) 33 | 34 | # Fortran module output directory. 35 | set(CMAKE_Fortran_TARGET_MODULE_DIR "") 36 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/cmake_clean.cmake: -------------------------------------------------------------------------------- 1 | file(REMOVE_RECURSE 2 | "CMakeFiles/min_snap.dir/src/min_snap.cpp.o" 3 | "CMakeFiles/min_snap.dir/include/ALGLIB/alglibinternal.cpp.o" 4 | "CMakeFiles/min_snap.dir/include/ALGLIB/alglibmisc.cpp.o" 5 | "CMakeFiles/min_snap.dir/include/ALGLIB/ap.cpp.o" 6 | "CMakeFiles/min_snap.dir/include/ALGLIB/dataanalysis.cpp.o" 7 | "CMakeFiles/min_snap.dir/include/ALGLIB/diffequations.cpp.o" 8 | "CMakeFiles/min_snap.dir/include/ALGLIB/fasttransforms.cpp.o" 9 | "CMakeFiles/min_snap.dir/include/ALGLIB/integration.cpp.o" 10 | "CMakeFiles/min_snap.dir/include/ALGLIB/interpolation.cpp.o" 11 | "CMakeFiles/min_snap.dir/include/ALGLIB/linalg.cpp.o" 12 | "CMakeFiles/min_snap.dir/include/ALGLIB/optimization.cpp.o" 13 | "CMakeFiles/min_snap.dir/include/ALGLIB/solvers.cpp.o" 14 | "CMakeFiles/min_snap.dir/include/ALGLIB/specialfunctions.cpp.o" 15 | "CMakeFiles/min_snap.dir/include/ALGLIB/statistics.cpp.o" 16 | "CMakeFiles/min_snap.dir/include/mymav.cpp.o" 17 | "min_snap.pdb" 18 | "min_snap" 19 | ) 20 | 21 | # Per-language clean rules from dependency scanning. 22 | foreach(lang CXX) 23 | include(CMakeFiles/min_snap.dir/cmake_clean_${lang}.cmake OPTIONAL) 24 | endforeach() 25 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/flags.make: -------------------------------------------------------------------------------- 1 | # CMAKE generated file: DO NOT EDIT! 2 | # Generated by "Unix Makefiles" Generator, CMake Version 3.10 3 | 4 | # compile CXX with /usr/bin/c++ 5 | CXX_FLAGS = 6 | 7 | CXX_DEFINES = 8 | 9 | CXX_INCLUDES = -I/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/include 10 | 11 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/alglibinternal.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/alglibinternal.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/alglibmisc.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/alglibmisc.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/ap.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/ap.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/dataanalysis.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/dataanalysis.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/diffequations.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/diffequations.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/fasttransforms.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/fasttransforms.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/integration.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/integration.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/interpolation.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/interpolation.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/linalg.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/linalg.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/optimization.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/optimization.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/solvers.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/solvers.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/specialfunctions.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/specialfunctions.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/statistics.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/ALGLIB/statistics.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/include/mymav.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/include/mymav.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/link.txt: -------------------------------------------------------------------------------- 1 | /usr/bin/c++ -rdynamic CMakeFiles/min_snap.dir/src/min_snap.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/alglibinternal.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/alglibmisc.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/ap.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/dataanalysis.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/diffequations.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/fasttransforms.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/integration.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/interpolation.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/linalg.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/optimization.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/solvers.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/specialfunctions.cpp.o CMakeFiles/min_snap.dir/include/ALGLIB/statistics.cpp.o CMakeFiles/min_snap.dir/include/mymav.cpp.o -o min_snap 2 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/progress.make: -------------------------------------------------------------------------------- 1 | CMAKE_PROGRESS_1 = 1 2 | CMAKE_PROGRESS_2 = 2 3 | CMAKE_PROGRESS_3 = 3 4 | CMAKE_PROGRESS_4 = 4 5 | CMAKE_PROGRESS_5 = 5 6 | CMAKE_PROGRESS_6 = 6 7 | CMAKE_PROGRESS_7 = 7 8 | CMAKE_PROGRESS_8 = 8 9 | CMAKE_PROGRESS_9 = 9 10 | CMAKE_PROGRESS_10 = 10 11 | CMAKE_PROGRESS_11 = 11 12 | CMAKE_PROGRESS_12 = 12 13 | CMAKE_PROGRESS_13 = 13 14 | CMAKE_PROGRESS_14 = 14 15 | CMAKE_PROGRESS_15 = 15 16 | CMAKE_PROGRESS_16 = 16 17 | 18 | -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/min_snap.dir/src/min_snap.cpp.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/CMakeFiles/min_snap.dir/src/min_snap.cpp.o -------------------------------------------------------------------------------- /cpp/build/CMakeFiles/progress.marks: -------------------------------------------------------------------------------- 1 | 16 2 | -------------------------------------------------------------------------------- /cpp/build/cmake_install.cmake: -------------------------------------------------------------------------------- 1 | # Install script for directory: /home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp 2 | 3 | # Set the install prefix 4 | if(NOT DEFINED CMAKE_INSTALL_PREFIX) 5 | set(CMAKE_INSTALL_PREFIX "/usr/local") 6 | endif() 7 | string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") 8 | 9 | # Set the install configuration name. 10 | if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) 11 | if(BUILD_TYPE) 12 | string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" 13 | CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") 14 | else() 15 | set(CMAKE_INSTALL_CONFIG_NAME "") 16 | endif() 17 | message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") 18 | endif() 19 | 20 | # Set the component getting installed. 21 | if(NOT CMAKE_INSTALL_COMPONENT) 22 | if(COMPONENT) 23 | message(STATUS "Install component: \"${COMPONENT}\"") 24 | set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") 25 | else() 26 | set(CMAKE_INSTALL_COMPONENT) 27 | endif() 28 | endif() 29 | 30 | # Install shared libraries without execute permission? 31 | if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) 32 | set(CMAKE_INSTALL_SO_NO_EXE "1") 33 | endif() 34 | 35 | # Is this installation the result of a crosscompile? 36 | if(NOT DEFINED CMAKE_CROSSCOMPILING) 37 | set(CMAKE_CROSSCOMPILING "FALSE") 38 | endif() 39 | 40 | if(CMAKE_INSTALL_COMPONENT) 41 | set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") 42 | else() 43 | set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") 44 | endif() 45 | 46 | string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT 47 | "${CMAKE_INSTALL_MANIFEST_FILES}") 48 | file(WRITE "/home/jiahao/IROS_ADR_2018/MAV_Real_Time_Trajectory_Generator/cpp/build/${CMAKE_INSTALL_MANIFEST}" 49 | "${CMAKE_INSTALL_MANIFEST_CONTENT}") 50 | -------------------------------------------------------------------------------- /cpp/build/min_snap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/cpp/build/min_snap -------------------------------------------------------------------------------- /cpp/include/ALGLIB/stdafx.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /cpp/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 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") 20 | -------------------------------------------------------------------------------- /cpp/include/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLESKY_MODULE_H 9 | #define EIGEN_CHOLESKY_MODULE_H 10 | 11 | #include "Core" 12 | #include "Jacobi" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** \defgroup Cholesky_Module Cholesky module 17 | * 18 | * 19 | * 20 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 21 | * Those decompositions are also accessible via the following methods: 22 | * - MatrixBase::llt() 23 | * - MatrixBase::ldlt() 24 | * - SelfAdjointView::llt() 25 | * - SelfAdjointView::ldlt() 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | */ 31 | 32 | #include "src/Cholesky/LLT.h" 33 | #include "src/Cholesky/LDLT.h" 34 | #ifdef EIGEN_USE_LAPACKE 35 | #ifdef EIGEN_USE_MKL 36 | #include "mkl_lapacke.h" 37 | #else 38 | #include "src/misc/lapacke.h" 39 | #endif 40 | #include "src/Cholesky/LLT_LAPACKE.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_CHOLESKY_MODULE_H 46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 47 | -------------------------------------------------------------------------------- /cpp/include/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 9 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup CholmodSupport_Module CholmodSupport module 21 | * 22 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 23 | * It provides the two following main factorization classes: 24 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 25 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 26 | * 27 | * For the sake of completeness, this module also propose the two following classes: 28 | * - class CholmodSimplicialLLT 29 | * - class CholmodSimplicialLDLT 30 | * Note that these classes does not bring any particular advantage compared to the built-in 31 | * SimplicialLLT and SimplicialLDLT factorization classes. 32 | * 33 | * \code 34 | * #include 35 | * \endcode 36 | * 37 | * 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. 38 | * The dependencies depend on how cholmod has been compiled. 39 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 40 | * 41 | */ 42 | 43 | #include "src/CholmodSupport/CholmodSupport.h" 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 48 | 49 | -------------------------------------------------------------------------------- /cpp/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 | -------------------------------------------------------------------------------- /cpp/include/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /cpp/include/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_EIGENVALUES_MODULE_H 9 | #define EIGEN_EIGENVALUES_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Cholesky" 16 | #include "Jacobi" 17 | #include "Householder" 18 | #include "LU" 19 | #include "Geometry" 20 | 21 | /** \defgroup Eigenvalues_Module Eigenvalues module 22 | * 23 | * 24 | * 25 | * This module mainly provides various eigenvalue solvers. 26 | * This module also provides some MatrixBase methods, including: 27 | * - MatrixBase::eigenvalues(), 28 | * - MatrixBase::operatorNorm() 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/misc/RealSvd2x2.h" 36 | #include "src/Eigenvalues/Tridiagonalization.h" 37 | #include "src/Eigenvalues/RealSchur.h" 38 | #include "src/Eigenvalues/EigenSolver.h" 39 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 40 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 41 | #include "src/Eigenvalues/HessenbergDecomposition.h" 42 | #include "src/Eigenvalues/ComplexSchur.h" 43 | #include "src/Eigenvalues/ComplexEigenSolver.h" 44 | #include "src/Eigenvalues/RealQZ.h" 45 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 46 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 47 | #ifdef EIGEN_USE_LAPACKE 48 | #ifdef EIGEN_USE_MKL 49 | #include "mkl_lapacke.h" 50 | #else 51 | #include "src/misc/lapacke.h" 52 | #endif 53 | #include "src/Eigenvalues/RealSchur_LAPACKE.h" 54 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" 55 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_EIGENVALUES_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | -------------------------------------------------------------------------------- /cpp/include/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_GEOMETRY_MODULE_H 9 | #define EIGEN_GEOMETRY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SVD" 16 | #include "LU" 17 | #include 18 | 19 | /** \defgroup Geometry_Module Geometry module 20 | * 21 | * This module provides support for: 22 | * - fixed-size homogeneous transformations 23 | * - translation, scaling, 2D and 3D rotations 24 | * - \link Quaternion quaternions \endlink 25 | * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) 26 | * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) 27 | * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink 28 | * - \link AlignedBox axis aligned bounding boxes \endlink 29 | * - \link umeyama least-square transformation fitting \endlink 30 | * 31 | * \code 32 | * #include 33 | * \endcode 34 | */ 35 | 36 | #include "src/Geometry/OrthoMethods.h" 37 | #include "src/Geometry/EulerAngles.h" 38 | 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | // Use the SSE optimized version whenever possible. At the moment the 53 | // SSE version doesn't compile when AVX is enabled 54 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 55 | #include "src/Geometry/arch/Geometry_SSE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_GEOMETRY_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | 63 | -------------------------------------------------------------------------------- /cpp/include/Eigen/Householder: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 9 | #define EIGEN_HOUSEHOLDER_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Householder_Module Householder module 16 | * This module provides Householder transformations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/Householder/Householder.h" 24 | #include "src/Householder/HouseholderSequence.h" 25 | #include "src/Householder/BlockHouseholder.h" 26 | 27 | #include "src/Core/util/ReenableStupidWarnings.h" 28 | 29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 30 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 31 | -------------------------------------------------------------------------------- /cpp/include/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 9 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** 17 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 18 | * 19 | * 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. 20 | * Those solvers are accessible via the following classes: 21 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 22 | * - LeastSquaresConjugateGradient for rectangular least-square problems, 23 | * - BiCGSTAB for general square matrices. 24 | * 25 | * These iterative solvers are associated with some preconditioners: 26 | * - IdentityPreconditioner - not really useful 27 | * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. 28 | * - IncompleteLUT - incomplete LU factorization with dual thresholding 29 | * 30 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 31 | * 32 | \code 33 | #include 34 | \endcode 35 | */ 36 | 37 | #include "src/IterativeLinearSolvers/SolveWithGuess.h" 38 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 39 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 40 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 41 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" 42 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 43 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 44 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 49 | -------------------------------------------------------------------------------- /cpp/include/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_JACOBI_MODULE_H 9 | #define EIGEN_JACOBI_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Jacobi_Module Jacobi module 16 | * This module provides Jacobi and Givens rotations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | * 22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 23 | * - MatrixBase::applyOnTheLeft() 24 | * - MatrixBase::applyOnTheRight(). 25 | */ 26 | 27 | #include "src/Jacobi/Jacobi.h" 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_JACOBI_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | 34 | -------------------------------------------------------------------------------- /cpp/include/Eigen/LU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_LU_MODULE_H 9 | #define EIGEN_LU_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup LU_Module LU module 16 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 17 | * This module defines the following MatrixBase methods: 18 | * - MatrixBase::inverse() 19 | * - MatrixBase::determinant() 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/misc/Kernel.h" 27 | #include "src/misc/Image.h" 28 | #include "src/LU/FullPivLU.h" 29 | #include "src/LU/PartialPivLU.h" 30 | #ifdef EIGEN_USE_LAPACKE 31 | #ifdef EIGEN_USE_MKL 32 | #include "mkl_lapacke.h" 33 | #else 34 | #include "src/misc/lapacke.h" 35 | #endif 36 | #include "src/LU/PartialPivLU_LAPACKE.h" 37 | #endif 38 | #include "src/LU/Determinant.h" 39 | #include "src/LU/InverseImpl.h" 40 | 41 | // Use the SSE optimized version whenever possible. At the moment the 42 | // SSE version doesn't compile when AVX is enabled 43 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 44 | #include "src/LU/arch/Inverse_SSE.h" 45 | #endif 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_LU_MODULE_H 50 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 51 | -------------------------------------------------------------------------------- /cpp/include/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_METISSUPPORT_MODULE_H 9 | #define EIGEN_METISSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup MetisSupport_Module MetisSupport module 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 28 | */ 29 | 30 | 31 | #include "src/MetisSupport/MetisSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_METISSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /cpp/include/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 9 | #define EIGEN_ORDERINGMETHODS_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** 16 | * \defgroup OrderingMethods_Module OrderingMethods module 17 | * 18 | * This module is currently for internal use only 19 | * 20 | * It defines various built-in and external ordering methods for sparse matrices. 21 | * They are typically used to reduce the number of elements during 22 | * the sparse matrix decomposition (LLT, LU, QR). 23 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 24 | * those ordering methods and applied to the columns of the matrix. 25 | * Using for instance the sparse Cholesky decomposition, it is expected that 26 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 27 | * 28 | * 29 | * Usage : 30 | * \code 31 | * #include 32 | * \endcode 33 | * 34 | * A simple usage is as a template parameter in the sparse decomposition classes : 35 | * 36 | * \code 37 | * SparseLU > solver; 38 | * \endcode 39 | * 40 | * \code 41 | * SparseQR > solver; 42 | * \endcode 43 | * 44 | * It is possible as well to call directly a particular ordering method for your own purpose, 45 | * \code 46 | * AMDOrdering ordering; 47 | * PermutationMatrix perm; 48 | * SparseMatrix A; 49 | * //Fill the matrix ... 50 | * 51 | * ordering(A, perm); // Call AMD 52 | * \endcode 53 | * 54 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 55 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 56 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 57 | * If your matrix is already symmetric (at leat in structure), you can avoid that 58 | * by calling the method with a SelfAdjointView type. 59 | * 60 | * \code 61 | * // Call the ordering on the pattern of the lower triangular matrix A 62 | * ordering(A.selfadjointView(), perm); 63 | * \endcode 64 | */ 65 | 66 | #ifndef EIGEN_MPL2_ONLY 67 | #include "src/OrderingMethods/Amd.h" 68 | #endif 69 | 70 | #include "src/OrderingMethods/Ordering.h" 71 | #include "src/Core/util/ReenableStupidWarnings.h" 72 | 73 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 74 | -------------------------------------------------------------------------------- /cpp/include/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 9 | #define EIGEN_PASTIXSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | #ifdef complex 21 | #undef complex 22 | #endif 23 | 24 | /** \ingroup Support_modules 25 | * \defgroup PaStiXSupport_Module PaStiXSupport module 26 | * 27 | * This module provides an interface to the PaSTiX library. 28 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 29 | * It provides the two following main factorization classes: 30 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 31 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 32 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | * 38 | * 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. 39 | * The dependencies depend on how PaSTiX has been compiled. 40 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 41 | * 42 | */ 43 | 44 | #include "src/PaStiXSupport/PaStiXSupport.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 49 | -------------------------------------------------------------------------------- /cpp/include/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 9 | #define EIGEN_PARDISOSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup PardisoSupport_Module PardisoSupport module 19 | * 20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * 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. 27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 28 | * 29 | */ 30 | 31 | #include "src/PardisoSupport/PardisoSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /cpp/include/Eigen/QR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QR_MODULE_H 9 | #define EIGEN_QR_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Cholesky" 16 | #include "Jacobi" 17 | #include "Householder" 18 | 19 | /** \defgroup QR_Module QR module 20 | * 21 | * 22 | * 23 | * This module provides various QR decompositions 24 | * This module also provides some MatrixBase methods, including: 25 | * - MatrixBase::householderQr() 26 | * - MatrixBase::colPivHouseholderQr() 27 | * - MatrixBase::fullPivHouseholderQr() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/QR/HouseholderQR.h" 35 | #include "src/QR/FullPivHouseholderQR.h" 36 | #include "src/QR/ColPivHouseholderQR.h" 37 | #include "src/QR/CompleteOrthogonalDecomposition.h" 38 | #ifdef EIGEN_USE_LAPACKE 39 | #ifdef EIGEN_USE_MKL 40 | #include "mkl_lapacke.h" 41 | #else 42 | #include "src/misc/lapacke.h" 43 | #endif 44 | #include "src/QR/HouseholderQR_LAPACKE.h" 45 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_QR_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /cpp/include/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QTMALLOC_MODULE_H 9 | #define EIGEN_QTMALLOC_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | void *qMalloc(std::size_t size) 18 | { 19 | return Eigen::internal::aligned_malloc(size); 20 | } 21 | 22 | void qFree(void *ptr) 23 | { 24 | Eigen::internal::aligned_free(ptr); 25 | } 26 | 27 | void *qRealloc(void *ptr, std::size_t size) 28 | { 29 | void* newPtr = Eigen::internal::aligned_malloc(size); 30 | std::memcpy(newPtr, ptr, size); 31 | Eigen::internal::aligned_free(ptr); 32 | return newPtr; 33 | } 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | 39 | #endif // EIGEN_QTMALLOC_MODULE_H 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 41 | -------------------------------------------------------------------------------- /cpp/include/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 9 | #define EIGEN_SPQRSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SuiteSparseQR.hpp" 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup SPQRSupport_Module SuiteSparseQR module 19 | * 20 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * 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,...). 27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 28 | * 29 | */ 30 | 31 | #include "src/CholmodSupport/CholmodSupport.h" 32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /cpp/include/Eigen/SVD: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SVD_MODULE_H 9 | #define EIGEN_SVD_MODULE_H 10 | 11 | #include "QR" 12 | #include "Householder" 13 | #include "Jacobi" 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup SVD_Module SVD module 18 | * 19 | * 20 | * 21 | * This module provides SVD decomposition for matrices (both real and complex). 22 | * Two decomposition algorithms are provided: 23 | * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. 24 | * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. 25 | * These decompositions are accessible via the respective classes and following MatrixBase methods: 26 | * - MatrixBase::jacobiSvd() 27 | * - MatrixBase::bdcSvd() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/misc/RealSvd2x2.h" 35 | #include "src/SVD/UpperBidiagonalization.h" 36 | #include "src/SVD/SVDBase.h" 37 | #include "src/SVD/JacobiSVD.h" 38 | #include "src/SVD/BDCSVD.h" 39 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 40 | #ifdef EIGEN_USE_MKL 41 | #include "mkl_lapacke.h" 42 | #else 43 | #include "src/misc/lapacke.h" 44 | #endif 45 | #include "src/SVD/JacobiSVD_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SVD_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /cpp/include/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSE_MODULE_H 9 | #define EIGEN_SPARSE_MODULE_H 10 | 11 | /** \defgroup Sparse_Module Sparse meta-module 12 | * 13 | * Meta-module including all related modules: 14 | * - \ref SparseCore_Module 15 | * - \ref OrderingMethods_Module 16 | * - \ref SparseCholesky_Module 17 | * - \ref SparseLU_Module 18 | * - \ref SparseQR_Module 19 | * - \ref IterativeLinearSolvers_Module 20 | * 21 | \code 22 | #include 23 | \endcode 24 | */ 25 | 26 | #include "SparseCore" 27 | #include "OrderingMethods" 28 | #ifndef EIGEN_MPL2_ONLY 29 | #include "SparseCholesky" 30 | #endif 31 | #include "SparseLU" 32 | #include "SparseQR" 33 | #include "IterativeLinearSolvers" 34 | 35 | #endif // EIGEN_SPARSE_MODULE_H 36 | 37 | -------------------------------------------------------------------------------- /cpp/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/SparseCholesky/SimplicialCholesky.h" 38 | 39 | #ifndef EIGEN_MPL2_ONLY 40 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 46 | -------------------------------------------------------------------------------- /cpp/include/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSECORE_MODULE_H 9 | #define EIGEN_SPARSECORE_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | /** 22 | * \defgroup SparseCore_Module SparseCore module 23 | * 24 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 25 | * and operations. 26 | * 27 | * See the \ref TutorialSparse "Sparse tutorial" 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | * 33 | * This module depends on: Core. 34 | */ 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/SparseAssign.h" 39 | #include "src/SparseCore/CompressedStorage.h" 40 | #include "src/SparseCore/AmbiVector.h" 41 | #include "src/SparseCore/SparseCompressedBase.h" 42 | #include "src/SparseCore/SparseMatrix.h" 43 | #include "src/SparseCore/SparseMap.h" 44 | #include "src/SparseCore/MappedSparseMatrix.h" 45 | #include "src/SparseCore/SparseVector.h" 46 | #include "src/SparseCore/SparseRef.h" 47 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 48 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 49 | #include "src/SparseCore/SparseTranspose.h" 50 | #include "src/SparseCore/SparseBlock.h" 51 | #include "src/SparseCore/SparseDot.h" 52 | #include "src/SparseCore/SparseRedux.h" 53 | #include "src/SparseCore/SparseView.h" 54 | #include "src/SparseCore/SparseDiagonalProduct.h" 55 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 56 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 57 | #include "src/SparseCore/SparseProduct.h" 58 | #include "src/SparseCore/SparseDenseProduct.h" 59 | #include "src/SparseCore/SparseSelfAdjointView.h" 60 | #include "src/SparseCore/SparseTriangularView.h" 61 | #include "src/SparseCore/TriangularSolver.h" 62 | #include "src/SparseCore/SparsePermutation.h" 63 | #include "src/SparseCore/SparseFuzzy.h" 64 | #include "src/SparseCore/SparseSolverBase.h" 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSECORE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /cpp/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 | // Ordering interface 24 | #include "OrderingMethods" 25 | 26 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 27 | 28 | #include "src/SparseLU/SparseLU_Structs.h" 29 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 30 | #include "src/SparseLU/SparseLUImpl.h" 31 | #include "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseLU/SparseLU_Memory.h" 33 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 34 | #include "src/SparseLU/SparseLU_relax_snode.h" 35 | #include "src/SparseLU/SparseLU_pivotL.h" 36 | #include "src/SparseLU/SparseLU_panel_dfs.h" 37 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 38 | #include "src/SparseLU/SparseLU_panel_bmod.h" 39 | #include "src/SparseLU/SparseLU_column_dfs.h" 40 | #include "src/SparseLU/SparseLU_column_bmod.h" 41 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 42 | #include "src/SparseLU/SparseLU_pruneL.h" 43 | #include "src/SparseLU/SparseLU_Utils.h" 44 | #include "src/SparseLU/SparseLU.h" 45 | 46 | #endif // EIGEN_SPARSELU_MODULE_H 47 | -------------------------------------------------------------------------------- /cpp/include/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSEQR_MODULE_H 9 | #define EIGEN_SPARSEQR_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup SparseQR_Module SparseQR module 16 | * \brief Provides QR decomposition for sparse matrices 17 | * 18 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 19 | * The columns of the input matrix should be reordered to limit the fill-in during the 20 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 21 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 22 | * of built-in and external ordering methods. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | * 28 | * 29 | */ 30 | 31 | #include "OrderingMethods" 32 | #include "src/SparseCore/SparseColEtree.h" 33 | #include "src/SparseQR/SparseQR.h" 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /cpp/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 EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes 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 | -------------------------------------------------------------------------------- /cpp/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 EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes 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 | -------------------------------------------------------------------------------- /cpp/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 EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes 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 | -------------------------------------------------------------------------------- /cpp/include/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 9 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #ifdef EMPTY 16 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 17 | #endif 18 | 19 | typedef int int_t; 20 | #include 21 | #include 22 | #include 23 | 24 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 25 | // so we remove it in favor of a SUPERLU_EMPTY token. 26 | // If EMPTY was already defined then we don't undef it. 27 | 28 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 29 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 30 | #elif defined(EMPTY) 31 | # undef EMPTY 32 | #endif 33 | 34 | #define SUPERLU_EMPTY (-1) 35 | 36 | namespace Eigen { struct SluMatrix; } 37 | 38 | /** \ingroup Support_modules 39 | * \defgroup SuperLUSupport_Module SuperLUSupport module 40 | * 41 | * This module provides an interface to the SuperLU library. 42 | * It provides the following factorization class: 43 | * - class SuperLU: a supernodal sequential LU factorization. 44 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 45 | * 46 | * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. 47 | * 48 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 49 | * 50 | * \code 51 | * #include 52 | * \endcode 53 | * 54 | * 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. 55 | * The dependencies depend on how superlu has been compiled. 56 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 57 | * 58 | */ 59 | 60 | #include "src/SuperLUSupport/SuperLUSupport.h" 61 | 62 | #include "src/Core/util/ReenableStupidWarnings.h" 63 | 64 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 65 | -------------------------------------------------------------------------------- /cpp/include/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 9 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup UmfPackSupport_Module UmfPackSupport module 21 | * 22 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 23 | * It provides the following factorization class: 24 | * - class UmfPackLU: a multifrontal sequential LU factorization. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * 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. 31 | * The dependencies depend on how umfpack has been compiled. 32 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/UmfPackSupport/UmfPackSupport.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 41 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Cholesky/LLT_LAPACKE.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 LAPACKe 29 | * LLt decomposition based on LAPACKE_?potrf function. 30 | ******************************************************************************** 31 | */ 32 | 33 | #ifndef EIGEN_LLT_LAPACKE_H 34 | #define EIGEN_LLT_LAPACKE_H 35 | 36 | namespace Eigen { 37 | 38 | namespace internal { 39 | 40 | template struct lapacke_llt; 41 | 42 | #define EIGEN_LAPACKE_LLT(EIGTYPE, BLASTYPE, LAPACKE_PREFIX) \ 43 | template<> struct lapacke_llt \ 44 | { \ 45 | template \ 46 | static inline Index potrf(MatrixType& m, char uplo) \ 47 | { \ 48 | lapack_int matrix_order; \ 49 | lapack_int size, lda, info, StorageOrder; \ 50 | EIGTYPE* a; \ 51 | eigen_assert(m.rows()==m.cols()); \ 52 | /* Set up parameters for ?potrf */ \ 53 | size = convert_index(m.rows()); \ 54 | StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \ 55 | matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 56 | a = &(m.coeffRef(0,0)); \ 57 | lda = convert_index(m.outerStride()); \ 58 | \ 59 | info = LAPACKE_##LAPACKE_PREFIX##potrf( matrix_order, uplo, size, (BLASTYPE*)a, lda ); \ 60 | info = (info==0) ? -1 : info>0 ? info-1 : size; \ 61 | return info; \ 62 | } \ 63 | }; \ 64 | template<> struct llt_inplace \ 65 | { \ 66 | template \ 67 | static Index blocked(MatrixType& m) \ 68 | { \ 69 | return lapacke_llt::potrf(m, 'L'); \ 70 | } \ 71 | template \ 72 | static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ 73 | { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \ 74 | }; \ 75 | template<> struct llt_inplace \ 76 | { \ 77 | template \ 78 | static Index blocked(MatrixType& m) \ 79 | { \ 80 | return lapacke_llt::potrf(m, 'U'); \ 81 | } \ 82 | template \ 83 | static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ 84 | { \ 85 | Transpose matt(mat); \ 86 | return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); \ 87 | } \ 88 | }; 89 | 90 | EIGEN_LAPACKE_LLT(double, double, d) 91 | EIGEN_LAPACKE_LLT(float, float, s) 92 | EIGEN_LAPACKE_LLT(dcomplex, lapack_complex_double, z) 93 | EIGEN_LAPACKE_LLT(scomplex, lapack_complex_float, c) 94 | 95 | } // end namespace internal 96 | 97 | } // end namespace Eigen 98 | 99 | #endif // EIGEN_LLT_LAPACKE_H 100 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/Assign.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2007 Michael Olbrich 5 | // Copyright (C) 2006-2010 Benoit Jacob 6 | // Copyright (C) 2008 Gael Guennebaud 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla 9 | // Public License v. 2.0. If a copy of the MPL was not distributed 10 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 11 | 12 | #ifndef EIGEN_ASSIGN_H 13 | #define EIGEN_ASSIGN_H 14 | 15 | namespace Eigen { 16 | 17 | template 18 | template 19 | EIGEN_STRONG_INLINE Derived& DenseBase 20 | ::lazyAssign(const DenseBase& other) 21 | { 22 | enum{ 23 | SameType = internal::is_same::value 24 | }; 25 | 26 | EIGEN_STATIC_ASSERT_LVALUE(Derived) 27 | EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) 28 | EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 29 | 30 | eigen_assert(rows() == other.rows() && cols() == other.cols()); 31 | internal::call_assignment_no_alias(derived(),other.derived()); 32 | 33 | return derived(); 34 | } 35 | 36 | template 37 | template 38 | EIGEN_DEVICE_FUNC 39 | EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) 40 | { 41 | internal::call_assignment(derived(), other.derived()); 42 | return derived(); 43 | } 44 | 45 | template 46 | EIGEN_DEVICE_FUNC 47 | EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) 48 | { 49 | internal::call_assignment(derived(), other.derived()); 50 | return derived(); 51 | } 52 | 53 | template 54 | EIGEN_DEVICE_FUNC 55 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) 56 | { 57 | internal::call_assignment(derived(), other.derived()); 58 | return derived(); 59 | } 60 | 61 | template 62 | template 63 | EIGEN_DEVICE_FUNC 64 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) 65 | { 66 | internal::call_assignment(derived(), other.derived()); 67 | return derived(); 68 | } 69 | 70 | template 71 | template 72 | EIGEN_DEVICE_FUNC 73 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) 74 | { 75 | internal::call_assignment(derived(), other.derived()); 76 | return derived(); 77 | } 78 | 79 | template 80 | template 81 | EIGEN_DEVICE_FUNC 82 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) 83 | { 84 | other.derived().evalTo(derived()); 85 | return derived(); 86 | } 87 | 88 | } // end namespace Eigen 89 | 90 | #endif // EIGEN_ASSIGN_H 91 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/CwiseUnaryOp.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 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_CWISE_UNARY_OP_H 12 | #define EIGEN_CWISE_UNARY_OP_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | template 18 | struct traits > 19 | : traits 20 | { 21 | typedef typename result_of< 22 | UnaryOp(const typename XprType::Scalar&) 23 | >::type Scalar; 24 | typedef typename XprType::Nested XprTypeNested; 25 | typedef typename remove_reference::type _XprTypeNested; 26 | enum { 27 | Flags = _XprTypeNested::Flags & RowMajorBit 28 | }; 29 | }; 30 | } 31 | 32 | template 33 | class CwiseUnaryOpImpl; 34 | 35 | /** \class CwiseUnaryOp 36 | * \ingroup Core_Module 37 | * 38 | * \brief Generic expression where a coefficient-wise unary operator is applied to an expression 39 | * 40 | * \tparam UnaryOp template functor implementing the operator 41 | * \tparam XprType the type of the expression to which we are applying the unary operator 42 | * 43 | * This class represents an expression where a unary operator is applied to an expression. 44 | * It is the return type of all operations taking exactly 1 input expression, regardless of the 45 | * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix 46 | * is considered unary, because only the right-hand side is an expression, and its 47 | * return type is a specialization of CwiseUnaryOp. 48 | * 49 | * Most of the time, this is the only way that it is used, so you typically don't have to name 50 | * CwiseUnaryOp types explicitly. 51 | * 52 | * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp 53 | */ 54 | template 55 | class CwiseUnaryOp : public CwiseUnaryOpImpl::StorageKind>, internal::no_assignment_operator 56 | { 57 | public: 58 | 59 | typedef typename CwiseUnaryOpImpl::StorageKind>::Base Base; 60 | EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) 61 | typedef typename internal::ref_selector::type XprTypeNested; 62 | typedef typename internal::remove_all::type NestedExpression; 63 | 64 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 65 | explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) 66 | : m_xpr(xpr), m_functor(func) {} 67 | 68 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 69 | Index rows() const { return m_xpr.rows(); } 70 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 71 | Index cols() const { return m_xpr.cols(); } 72 | 73 | /** \returns the functor representing the unary operation */ 74 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 75 | const UnaryOp& functor() const { return m_functor; } 76 | 77 | /** \returns the nested expression */ 78 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 79 | const typename internal::remove_all::type& 80 | nestedExpression() const { return m_xpr; } 81 | 82 | /** \returns the nested expression */ 83 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 84 | typename internal::remove_all::type& 85 | nestedExpression() { return m_xpr; } 86 | 87 | protected: 88 | XprTypeNested m_xpr; 89 | const UnaryOp m_functor; 90 | }; 91 | 92 | // Generic API dispatcher 93 | template 94 | class CwiseUnaryOpImpl 95 | : public internal::generic_xpr_base >::type 96 | { 97 | public: 98 | typedef typename internal::generic_xpr_base >::type Base; 99 | }; 100 | 101 | } // end namespace Eigen 102 | 103 | #endif // EIGEN_CWISE_UNARY_OP_H 104 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/DiagonalProduct.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) 2007-2009 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_DIAGONALPRODUCT_H 12 | #define EIGEN_DIAGONALPRODUCT_H 13 | 14 | namespace Eigen { 15 | 16 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 17 | */ 18 | template 19 | template 20 | inline const Product 21 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 22 | { 23 | return Product(derived(),a_diagonal.derived()); 24 | } 25 | 26 | } // end namespace Eigen 27 | 28 | #endif // EIGEN_DIAGONALPRODUCT_H 29 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/Inverse.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 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_INVERSE_H 11 | #define EIGEN_INVERSE_H 12 | 13 | namespace Eigen { 14 | 15 | template class InverseImpl; 16 | 17 | namespace internal { 18 | 19 | template 20 | struct traits > 21 | : traits 22 | { 23 | typedef typename XprType::PlainObject PlainObject; 24 | typedef traits BaseTraits; 25 | enum { 26 | Flags = BaseTraits::Flags & RowMajorBit 27 | }; 28 | }; 29 | 30 | } // end namespace internal 31 | 32 | /** \class Inverse 33 | * 34 | * \brief Expression of the inverse of another expression 35 | * 36 | * \tparam XprType the type of the expression we are taking the inverse 37 | * 38 | * This class represents an abstract expression of A.inverse() 39 | * and most of the time this is the only way it is used. 40 | * 41 | */ 42 | template 43 | class Inverse : public InverseImpl::StorageKind> 44 | { 45 | public: 46 | typedef typename XprType::StorageIndex StorageIndex; 47 | typedef typename XprType::PlainObject PlainObject; 48 | typedef typename XprType::Scalar Scalar; 49 | typedef typename internal::ref_selector::type XprTypeNested; 50 | typedef typename internal::remove_all::type XprTypeNestedCleaned; 51 | typedef typename internal::ref_selector::type Nested; 52 | typedef typename internal::remove_all::type NestedExpression; 53 | 54 | explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr) 55 | : m_xpr(xpr) 56 | {} 57 | 58 | EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.rows(); } 59 | EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.cols(); } 60 | 61 | EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; } 62 | 63 | protected: 64 | XprTypeNested m_xpr; 65 | }; 66 | 67 | // Generic API dispatcher 68 | template 69 | class InverseImpl 70 | : public internal::generic_xpr_base >::type 71 | { 72 | public: 73 | typedef typename internal::generic_xpr_base >::type Base; 74 | typedef typename XprType::Scalar Scalar; 75 | private: 76 | 77 | Scalar coeff(Index row, Index col) const; 78 | Scalar coeff(Index i) const; 79 | }; 80 | 81 | namespace internal { 82 | 83 | /** \internal 84 | * \brief Default evaluator for Inverse expression. 85 | * 86 | * This default evaluator for Inverse expression simply evaluate the inverse into a temporary 87 | * by a call to internal::call_assignment_no_alias. 88 | * Therefore, inverse implementers only have to specialize Assignment, ...> for 89 | * there own nested expression. 90 | * 91 | * \sa class Inverse 92 | */ 93 | template 94 | struct unary_evaluator > 95 | : public evaluator::PlainObject> 96 | { 97 | typedef Inverse InverseType; 98 | typedef typename InverseType::PlainObject PlainObject; 99 | typedef evaluator Base; 100 | 101 | enum { Flags = Base::Flags | EvalBeforeNestingBit }; 102 | 103 | unary_evaluator(const InverseType& inv_xpr) 104 | : m_result(inv_xpr.rows(), inv_xpr.cols()) 105 | { 106 | ::new (static_cast(this)) Base(m_result); 107 | internal::call_assignment_no_alias(m_result, inv_xpr); 108 | } 109 | 110 | protected: 111 | PlainObject m_result; 112 | }; 113 | 114 | } // end namespace internal 115 | 116 | } // end namespace Eigen 117 | 118 | #endif // EIGEN_INVERSE_H 119 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/MathFunctionsImpl.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Pedro Gonnet (pedro.gonnet@gmail.com) 5 | // Copyright (C) 2016 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_MATHFUNCTIONSIMPL_H 12 | #define EIGEN_MATHFUNCTIONSIMPL_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | /** \internal \returns the hyperbolic tan of \a a (coeff-wise) 19 | Doesn't do anything fancy, just a 13/6-degree rational interpolant which 20 | is accurate up to a couple of ulp in the range [-9, 9], outside of which 21 | the tanh(x) = +/-1. 22 | 23 | This implementation works on both scalars and packets. 24 | */ 25 | template 26 | T generic_fast_tanh_float(const T& a_x) 27 | { 28 | // Clamp the inputs to the range [-9, 9] since anything outside 29 | // this range is +/-1.0f in single-precision. 30 | const T plus_9 = pset1(9.f); 31 | const T minus_9 = pset1(-9.f); 32 | // NOTE GCC prior to 6.3 might improperly optimize this max/min 33 | // step such that if a_x is nan, x will be either 9 or -9, 34 | // and tanh will return 1 or -1 instead of nan. 35 | // This is supposed to be fixed in gcc6.3, 36 | // see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867 37 | const T x = pmax(minus_9,pmin(plus_9,a_x)); 38 | // The monomial coefficients of the numerator polynomial (odd). 39 | const T alpha_1 = pset1(4.89352455891786e-03f); 40 | const T alpha_3 = pset1(6.37261928875436e-04f); 41 | const T alpha_5 = pset1(1.48572235717979e-05f); 42 | const T alpha_7 = pset1(5.12229709037114e-08f); 43 | const T alpha_9 = pset1(-8.60467152213735e-11f); 44 | const T alpha_11 = pset1(2.00018790482477e-13f); 45 | const T alpha_13 = pset1(-2.76076847742355e-16f); 46 | 47 | // The monomial coefficients of the denominator polynomial (even). 48 | const T beta_0 = pset1(4.89352518554385e-03f); 49 | const T beta_2 = pset1(2.26843463243900e-03f); 50 | const T beta_4 = pset1(1.18534705686654e-04f); 51 | const T beta_6 = pset1(1.19825839466702e-06f); 52 | 53 | // Since the polynomials are odd/even, we need x^2. 54 | const T x2 = pmul(x, x); 55 | 56 | // Evaluate the numerator polynomial p. 57 | T p = pmadd(x2, alpha_13, alpha_11); 58 | p = pmadd(x2, p, alpha_9); 59 | p = pmadd(x2, p, alpha_7); 60 | p = pmadd(x2, p, alpha_5); 61 | p = pmadd(x2, p, alpha_3); 62 | p = pmadd(x2, p, alpha_1); 63 | p = pmul(x, p); 64 | 65 | // Evaluate the denominator polynomial p. 66 | T q = pmadd(x2, beta_6, beta_4); 67 | q = pmadd(x2, q, beta_2); 68 | q = pmadd(x2, q, beta_0); 69 | 70 | // Divide the numerator by the denominator. 71 | return pdiv(p, q); 72 | } 73 | 74 | template 75 | EIGEN_STRONG_INLINE 76 | RealScalar positive_real_hypot(const RealScalar& x, const RealScalar& y) 77 | { 78 | EIGEN_USING_STD_MATH(sqrt); 79 | RealScalar p, qp; 80 | p = numext::maxi(x,y); 81 | if(p==RealScalar(0)) return RealScalar(0); 82 | qp = numext::mini(y,x) / p; 83 | return p * sqrt(RealScalar(1) + qp*qp); 84 | } 85 | 86 | template 87 | struct hypot_impl 88 | { 89 | typedef typename NumTraits::Real RealScalar; 90 | static inline RealScalar run(const Scalar& x, const Scalar& y) 91 | { 92 | EIGEN_USING_STD_MATH(abs); 93 | return positive_real_hypot(abs(x), abs(y)); 94 | } 95 | }; 96 | 97 | } // end namespace internal 98 | 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_MATHFUNCTIONSIMPL_H 102 | -------------------------------------------------------------------------------- /cpp/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 | namespace internal { 17 | template 18 | struct traits > : public traits 19 | {}; 20 | } 21 | 22 | /** \class NestByValue 23 | * \ingroup Core_Module 24 | * 25 | * \brief Expression which must be nested by value 26 | * 27 | * \tparam ExpressionType the type of the object of which we are requiring nesting-by-value 28 | * 29 | * This class is the return type of MatrixBase::nestByValue() 30 | * and most of the time this is the only way it is used. 31 | * 32 | * \sa MatrixBase::nestByValue() 33 | */ 34 | template class NestByValue 35 | : public internal::dense_xpr_base< NestByValue >::type 36 | { 37 | public: 38 | 39 | typedef typename internal::dense_xpr_base::type Base; 40 | EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) 41 | 42 | EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} 43 | 44 | EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); } 45 | EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); } 46 | EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); } 47 | EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); } 48 | 49 | EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const 50 | { 51 | return m_expression.coeff(row, col); 52 | } 53 | 54 | EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) 55 | { 56 | return m_expression.const_cast_derived().coeffRef(row, col); 57 | } 58 | 59 | EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const 60 | { 61 | return m_expression.coeff(index); 62 | } 63 | 64 | EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) 65 | { 66 | return m_expression.const_cast_derived().coeffRef(index); 67 | } 68 | 69 | template 70 | inline const PacketScalar packet(Index row, Index col) const 71 | { 72 | return m_expression.template packet(row, col); 73 | } 74 | 75 | template 76 | inline void writePacket(Index row, Index col, const PacketScalar& x) 77 | { 78 | m_expression.const_cast_derived().template writePacket(row, col, x); 79 | } 80 | 81 | template 82 | inline const PacketScalar packet(Index index) const 83 | { 84 | return m_expression.template packet(index); 85 | } 86 | 87 | template 88 | inline void writePacket(Index index, const PacketScalar& x) 89 | { 90 | m_expression.const_cast_derived().template writePacket(index, x); 91 | } 92 | 93 | EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } 94 | 95 | protected: 96 | const ExpressionType m_expression; 97 | }; 98 | 99 | /** \returns an expression of the temporary version of *this. 100 | */ 101 | template 102 | inline const NestByValue 103 | DenseBase::nestByValue() const 104 | { 105 | return NestByValue(derived()); 106 | } 107 | 108 | } // end namespace Eigen 109 | 110 | #endif // EIGEN_NESTBYVALUE_H 111 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/NoAlias.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 | // 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_NOALIAS_H 11 | #define EIGEN_NOALIAS_H 12 | 13 | namespace Eigen { 14 | 15 | /** \class NoAlias 16 | * \ingroup Core_Module 17 | * 18 | * \brief Pseudo expression providing an operator = assuming no aliasing 19 | * 20 | * \tparam ExpressionType the type of the object on which to do the lazy assignment 21 | * 22 | * This class represents an expression with special assignment operators 23 | * assuming no aliasing between the target expression and the source expression. 24 | * More precisely it alloas to bypass the EvalBeforeAssignBit flag of the source expression. 25 | * It is the return type of MatrixBase::noalias() 26 | * and most of the time this is the only way it is used. 27 | * 28 | * \sa MatrixBase::noalias() 29 | */ 30 | template class StorageBase> 31 | class NoAlias 32 | { 33 | public: 34 | typedef typename ExpressionType::Scalar Scalar; 35 | 36 | explicit NoAlias(ExpressionType& expression) : m_expression(expression) {} 37 | 38 | template 39 | EIGEN_DEVICE_FUNC 40 | EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) 41 | { 42 | call_assignment_no_alias(m_expression, other.derived(), internal::assign_op()); 43 | return m_expression; 44 | } 45 | 46 | template 47 | EIGEN_DEVICE_FUNC 48 | EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) 49 | { 50 | call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op()); 51 | return m_expression; 52 | } 53 | 54 | template 55 | EIGEN_DEVICE_FUNC 56 | EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) 57 | { 58 | call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op()); 59 | return m_expression; 60 | } 61 | 62 | EIGEN_DEVICE_FUNC 63 | ExpressionType& expression() const 64 | { 65 | return m_expression; 66 | } 67 | 68 | protected: 69 | ExpressionType& m_expression; 70 | }; 71 | 72 | /** \returns a pseudo expression of \c *this with an operator= assuming 73 | * no aliasing between \c *this and the source expression. 74 | * 75 | * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. 76 | * Currently, even though several expressions may alias, only product 77 | * expressions have this flag. Therefore, noalias() is only usefull when 78 | * the source expression contains a matrix product. 79 | * 80 | * Here are some examples where noalias is usefull: 81 | * \code 82 | * D.noalias() = A * B; 83 | * D.noalias() += A.transpose() * B; 84 | * D.noalias() -= 2 * A * B.adjoint(); 85 | * \endcode 86 | * 87 | * On the other hand the following example will lead to a \b wrong result: 88 | * \code 89 | * A.noalias() = A * B; 90 | * \endcode 91 | * because the result matrix A is also an operand of the matrix product. Therefore, 92 | * there is no alternative than evaluating A * B in a temporary, that is the default 93 | * behavior when you write: 94 | * \code 95 | * A = A * B; 96 | * \endcode 97 | * 98 | * \sa class NoAlias 99 | */ 100 | template 101 | NoAlias MatrixBase::noalias() 102 | { 103 | return NoAlias(derived()); 104 | } 105 | 106 | } // end namespace Eigen 107 | 108 | #endif // EIGEN_NOALIAS_H 109 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/SelfCwiseBinaryOp.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 | // 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_SELFCWISEBINARYOP_H 11 | #define EIGEN_SELFCWISEBINARYOP_H 12 | 13 | namespace Eigen { 14 | 15 | // TODO generalize the scalar type of 'other' 16 | 17 | template 18 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator*=(const Scalar& other) 19 | { 20 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op()); 21 | return derived(); 22 | } 23 | 24 | template 25 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator+=(const Scalar& other) 26 | { 27 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op()); 28 | return derived(); 29 | } 30 | 31 | template 32 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator-=(const Scalar& other) 33 | { 34 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op()); 35 | return derived(); 36 | } 37 | 38 | template 39 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator/=(const Scalar& other) 40 | { 41 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op()); 42 | return derived(); 43 | } 44 | 45 | } // end namespace Eigen 46 | 47 | #endif // EIGEN_SELFCWISEBINARYOP_H 48 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/Stride.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 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_STRIDE_H 11 | #define EIGEN_STRIDE_H 12 | 13 | namespace Eigen { 14 | 15 | /** \class Stride 16 | * \ingroup Core_Module 17 | * 18 | * \brief Holds strides information for Map 19 | * 20 | * This class holds the strides information for mapping arrays with strides with class Map. 21 | * 22 | * It holds two values: the inner stride and the outer stride. 23 | * 24 | * The inner stride is the pointer increment between two consecutive entries within a given row of a 25 | * row-major matrix or within a given column of a column-major matrix. 26 | * 27 | * The outer stride is the pointer increment between two consecutive rows of a row-major matrix or 28 | * between two consecutive columns of a column-major matrix. 29 | * 30 | * These two values can be passed either at compile-time as template parameters, or at runtime as 31 | * arguments to the constructor. 32 | * 33 | * Indeed, this class takes two template parameters: 34 | * \tparam _OuterStrideAtCompileTime the outer stride, or Dynamic if you want to specify it at runtime. 35 | * \tparam _InnerStrideAtCompileTime the inner stride, or Dynamic if you want to specify it at runtime. 36 | * 37 | * Here is an example: 38 | * \include Map_general_stride.cpp 39 | * Output: \verbinclude Map_general_stride.out 40 | * 41 | * \sa class InnerStride, class OuterStride, \ref TopicStorageOrders 42 | */ 43 | template 44 | class Stride 45 | { 46 | public: 47 | typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 48 | enum { 49 | InnerStrideAtCompileTime = _InnerStrideAtCompileTime, 50 | OuterStrideAtCompileTime = _OuterStrideAtCompileTime 51 | }; 52 | 53 | /** Default constructor, for use when strides are fixed at compile time */ 54 | EIGEN_DEVICE_FUNC 55 | Stride() 56 | : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime) 57 | { 58 | eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic); 59 | } 60 | 61 | /** Constructor allowing to pass the strides at runtime */ 62 | EIGEN_DEVICE_FUNC 63 | Stride(Index outerStride, Index innerStride) 64 | : m_outer(outerStride), m_inner(innerStride) 65 | { 66 | eigen_assert(innerStride>=0 && outerStride>=0); 67 | } 68 | 69 | /** Copy constructor */ 70 | EIGEN_DEVICE_FUNC 71 | Stride(const Stride& other) 72 | : m_outer(other.outer()), m_inner(other.inner()) 73 | {} 74 | 75 | /** \returns the outer stride */ 76 | EIGEN_DEVICE_FUNC 77 | inline Index outer() const { return m_outer.value(); } 78 | /** \returns the inner stride */ 79 | EIGEN_DEVICE_FUNC 80 | inline Index inner() const { return m_inner.value(); } 81 | 82 | protected: 83 | internal::variable_if_dynamic m_outer; 84 | internal::variable_if_dynamic m_inner; 85 | }; 86 | 87 | /** \brief Convenience specialization of Stride to specify only an inner stride 88 | * See class Map for some examples */ 89 | template 90 | class InnerStride : public Stride<0, Value> 91 | { 92 | typedef Stride<0, Value> Base; 93 | public: 94 | EIGEN_DEVICE_FUNC InnerStride() : Base() {} 95 | EIGEN_DEVICE_FUNC InnerStride(Index v) : Base(0, v) {} // FIXME making this explicit could break valid code 96 | }; 97 | 98 | /** \brief Convenience specialization of Stride to specify only an outer stride 99 | * See class Map for some examples */ 100 | template 101 | class OuterStride : public Stride 102 | { 103 | typedef Stride Base; 104 | public: 105 | EIGEN_DEVICE_FUNC OuterStride() : Base() {} 106 | EIGEN_DEVICE_FUNC OuterStride(Index v) : Base(v,0) {} // FIXME making this explicit could break valid code 107 | }; 108 | 109 | } // end namespace Eigen 110 | 111 | #endif // EIGEN_STRIDE_H 112 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/Swap.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2006-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_SWAP_H 11 | #define EIGEN_SWAP_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Overload default assignPacket behavior for swapping them 18 | template 19 | class generic_dense_assignment_kernel, Specialized> 20 | : public generic_dense_assignment_kernel, BuiltIn> 21 | { 22 | protected: 23 | typedef generic_dense_assignment_kernel, BuiltIn> Base; 24 | using Base::m_dst; 25 | using Base::m_src; 26 | using Base::m_functor; 27 | 28 | public: 29 | typedef typename Base::Scalar Scalar; 30 | typedef typename Base::DstXprType DstXprType; 31 | typedef swap_assign_op Functor; 32 | 33 | EIGEN_DEVICE_FUNC generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr) 34 | : Base(dst, src, func, dstExpr) 35 | {} 36 | 37 | template 38 | void assignPacket(Index row, Index col) 39 | { 40 | PacketType tmp = m_src.template packet(row,col); 41 | const_cast(m_src).template writePacket(row,col, m_dst.template packet(row,col)); 42 | m_dst.template writePacket(row,col,tmp); 43 | } 44 | 45 | template 46 | void assignPacket(Index index) 47 | { 48 | PacketType tmp = m_src.template packet(index); 49 | const_cast(m_src).template writePacket(index, m_dst.template packet(index)); 50 | m_dst.template writePacket(index,tmp); 51 | } 52 | 53 | // TODO find a simple way not to have to copy/paste this function from generic_dense_assignment_kernel, by simple I mean no CRTP (Gael) 54 | template 55 | void assignPacketByOuterInner(Index outer, Index inner) 56 | { 57 | Index row = Base::rowIndexByOuterInner(outer, inner); 58 | Index col = Base::colIndexByOuterInner(outer, inner); 59 | assignPacket(row, col); 60 | } 61 | }; 62 | 63 | } // namespace internal 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_SWAP_H 68 | -------------------------------------------------------------------------------- /cpp/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 | namespace internal { 17 | template 18 | struct traits > 19 | : public traits::Flags & RowMajorBit ? 1 : Size, 21 | traits::Flags & RowMajorBit ? Size : 1> > 22 | { 23 | }; 24 | } 25 | 26 | /** \class VectorBlock 27 | * \ingroup Core_Module 28 | * 29 | * \brief Expression of a fixed-size or dynamic-size sub-vector 30 | * 31 | * \tparam VectorType the type of the object in which we are taking a sub-vector 32 | * \tparam Size size of the sub-vector we are taking at compile time (optional) 33 | * 34 | * This class represents an expression of either a fixed-size or dynamic-size sub-vector. 35 | * It is the return type of DenseBase::segment(Index,Index) and DenseBase::segment(Index) and 36 | * most of the time this is the only way it is used. 37 | * 38 | * However, if you want to directly maniputate sub-vector expressions, 39 | * for instance if you want to write a function returning such an expression, you 40 | * will need to use this class. 41 | * 42 | * Here is an example illustrating the dynamic case: 43 | * \include class_VectorBlock.cpp 44 | * Output: \verbinclude class_VectorBlock.out 45 | * 46 | * \note Even though this expression has dynamic size, in the case where \a VectorType 47 | * has fixed size, this expression inherits a fixed maximal size which means that evaluating 48 | * it does not cause a dynamic memory allocation. 49 | * 50 | * Here is an example illustrating the fixed-size case: 51 | * \include class_FixedVectorBlock.cpp 52 | * Output: \verbinclude class_FixedVectorBlock.out 53 | * 54 | * \sa class Block, DenseBase::segment(Index,Index,Index,Index), DenseBase::segment(Index,Index) 55 | */ 56 | template class VectorBlock 57 | : public Block::Flags & RowMajorBit ? 1 : Size, 59 | internal::traits::Flags & RowMajorBit ? Size : 1> 60 | { 61 | typedef Block::Flags & RowMajorBit ? 1 : Size, 63 | internal::traits::Flags & RowMajorBit ? Size : 1> Base; 64 | enum { 65 | IsColVector = !(internal::traits::Flags & RowMajorBit) 66 | }; 67 | public: 68 | EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock) 69 | 70 | using Base::operator=; 71 | 72 | /** Dynamic-size constructor 73 | */ 74 | EIGEN_DEVICE_FUNC 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 | EIGEN_DEVICE_FUNC 86 | inline VectorBlock(VectorType& vector, Index start) 87 | : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start) 88 | { 89 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock); 90 | } 91 | }; 92 | 93 | 94 | } // end namespace Eigen 95 | 96 | #endif // EIGEN_VECTORBLOCK_H 97 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/arch/AVX/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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_TYPE_CASTING_AVX_H 11 | #define EIGEN_TYPE_CASTING_AVX_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // For now we use SSE to handle integers, so we can't use AVX instructions to cast 18 | // from int to float 19 | template <> 20 | struct type_casting_traits { 21 | enum { 22 | VectorizedCast = 0, 23 | SrcCoeffRatio = 1, 24 | TgtCoeffRatio = 1 25 | }; 26 | }; 27 | 28 | template <> 29 | struct type_casting_traits { 30 | enum { 31 | VectorizedCast = 0, 32 | SrcCoeffRatio = 1, 33 | TgtCoeffRatio = 1 34 | }; 35 | }; 36 | 37 | 38 | 39 | template<> EIGEN_STRONG_INLINE Packet8i pcast(const Packet8f& a) { 40 | return _mm256_cvtps_epi32(a); 41 | } 42 | 43 | template<> EIGEN_STRONG_INLINE Packet8f pcast(const Packet8i& a) { 44 | return _mm256_cvtepi32_ps(a); 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_TYPE_CASTING_AVX_H 52 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/arch/CUDA/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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_MATH_FUNCTIONS_CUDA_H 11 | #define EIGEN_MATH_FUNCTIONS_CUDA_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Make sure this is only available when targeting a GPU: we don't want to 18 | // introduce conflicts between these packet_traits definitions and the ones 19 | // we'll use on the host side (SSE, AVX, ...) 20 | #if defined(__CUDACC__) && defined(EIGEN_USE_GPU) 21 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 22 | float4 plog(const float4& a) 23 | { 24 | return make_float4(logf(a.x), logf(a.y), logf(a.z), logf(a.w)); 25 | } 26 | 27 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 28 | double2 plog(const double2& a) 29 | { 30 | using ::log; 31 | return make_double2(log(a.x), log(a.y)); 32 | } 33 | 34 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 35 | float4 plog1p(const float4& a) 36 | { 37 | return make_float4(log1pf(a.x), log1pf(a.y), log1pf(a.z), log1pf(a.w)); 38 | } 39 | 40 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 41 | double2 plog1p(const double2& a) 42 | { 43 | return make_double2(log1p(a.x), log1p(a.y)); 44 | } 45 | 46 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 47 | float4 pexp(const float4& a) 48 | { 49 | return make_float4(expf(a.x), expf(a.y), expf(a.z), expf(a.w)); 50 | } 51 | 52 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 53 | double2 pexp(const double2& a) 54 | { 55 | using ::exp; 56 | return make_double2(exp(a.x), exp(a.y)); 57 | } 58 | 59 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 60 | float4 psqrt(const float4& a) 61 | { 62 | return make_float4(sqrtf(a.x), sqrtf(a.y), sqrtf(a.z), sqrtf(a.w)); 63 | } 64 | 65 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 66 | double2 psqrt(const double2& a) 67 | { 68 | using ::sqrt; 69 | return make_double2(sqrt(a.x), sqrt(a.y)); 70 | } 71 | 72 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 73 | float4 prsqrt(const float4& a) 74 | { 75 | return make_float4(rsqrtf(a.x), rsqrtf(a.y), rsqrtf(a.z), rsqrtf(a.w)); 76 | } 77 | 78 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 79 | double2 prsqrt(const double2& a) 80 | { 81 | return make_double2(rsqrt(a.x), rsqrt(a.y)); 82 | } 83 | 84 | 85 | #endif 86 | 87 | } // end namespace internal 88 | 89 | } // end namespace Eigen 90 | 91 | #endif // EIGEN_MATH_FUNCTIONS_CUDA_H 92 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/arch/Default/ConjHelper.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Eigen, a lightweight C++ template library 3 | // for linear algebra. 4 | // 5 | // Copyright (C) 2017 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_ARCH_CONJ_HELPER_H 12 | #define EIGEN_ARCH_CONJ_HELPER_H 13 | 14 | #define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL) \ 15 | template<> struct conj_helper { \ 16 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const \ 17 | { return padd(c, pmul(x,y)); } \ 18 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_REAL& x, const PACKET_CPLX& y) const \ 19 | { return PACKET_CPLX(Eigen::internal::pmul(x, y.v)); } \ 20 | }; \ 21 | \ 22 | template<> struct conj_helper { \ 23 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const \ 24 | { return padd(c, pmul(x,y)); } \ 25 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_CPLX& x, const PACKET_REAL& y) const \ 26 | { return PACKET_CPLX(Eigen::internal::pmul(x.v, y)); } \ 27 | }; 28 | 29 | #endif // EIGEN_ARCH_CONJ_HELPER_H 30 | -------------------------------------------------------------------------------- /cpp/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 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/arch/NEON/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | /* The sin, cos, exp, and log functions of this file come from 9 | * Julien Pommier's sse math library: http://gruntthepeon.free.fr/ssemath/ 10 | */ 11 | 12 | #ifndef EIGEN_MATH_FUNCTIONS_NEON_H 13 | #define EIGEN_MATH_FUNCTIONS_NEON_H 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 20 | Packet4f pexp(const Packet4f& _x) 21 | { 22 | Packet4f x = _x; 23 | Packet4f tmp, fx; 24 | 25 | _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f); 26 | _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f); 27 | _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f); 28 | _EIGEN_DECLARE_CONST_Packet4f(exp_hi, 88.3762626647950f); 29 | _EIGEN_DECLARE_CONST_Packet4f(exp_lo, -88.3762626647949f); 30 | _EIGEN_DECLARE_CONST_Packet4f(cephes_LOG2EF, 1.44269504088896341f); 31 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C1, 0.693359375f); 32 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C2, -2.12194440e-4f); 33 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p0, 1.9875691500E-4f); 34 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p1, 1.3981999507E-3f); 35 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p2, 8.3334519073E-3f); 36 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p3, 4.1665795894E-2f); 37 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p4, 1.6666665459E-1f); 38 | _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p5, 5.0000001201E-1f); 39 | 40 | x = vminq_f32(x, p4f_exp_hi); 41 | x = vmaxq_f32(x, p4f_exp_lo); 42 | 43 | /* express exp(x) as exp(g + n*log(2)) */ 44 | fx = vmlaq_f32(p4f_half, x, p4f_cephes_LOG2EF); 45 | 46 | /* perform a floorf */ 47 | tmp = vcvtq_f32_s32(vcvtq_s32_f32(fx)); 48 | 49 | /* if greater, substract 1 */ 50 | Packet4ui mask = vcgtq_f32(tmp, fx); 51 | mask = vandq_u32(mask, vreinterpretq_u32_f32(p4f_1)); 52 | 53 | fx = vsubq_f32(tmp, vreinterpretq_f32_u32(mask)); 54 | 55 | tmp = vmulq_f32(fx, p4f_cephes_exp_C1); 56 | Packet4f z = vmulq_f32(fx, p4f_cephes_exp_C2); 57 | x = vsubq_f32(x, tmp); 58 | x = vsubq_f32(x, z); 59 | 60 | Packet4f y = vmulq_f32(p4f_cephes_exp_p0, x); 61 | z = vmulq_f32(x, x); 62 | y = vaddq_f32(y, p4f_cephes_exp_p1); 63 | y = vmulq_f32(y, x); 64 | y = vaddq_f32(y, p4f_cephes_exp_p2); 65 | y = vmulq_f32(y, x); 66 | y = vaddq_f32(y, p4f_cephes_exp_p3); 67 | y = vmulq_f32(y, x); 68 | y = vaddq_f32(y, p4f_cephes_exp_p4); 69 | y = vmulq_f32(y, x); 70 | y = vaddq_f32(y, p4f_cephes_exp_p5); 71 | 72 | y = vmulq_f32(y, z); 73 | y = vaddq_f32(y, x); 74 | y = vaddq_f32(y, p4f_1); 75 | 76 | /* build 2^n */ 77 | int32x4_t mm; 78 | mm = vcvtq_s32_f32(fx); 79 | mm = vaddq_s32(mm, p4i_0x7f); 80 | mm = vshlq_n_s32(mm, 23); 81 | Packet4f pow2n = vreinterpretq_f32_s32(mm); 82 | 83 | y = vmulq_f32(y, pow2n); 84 | return y; 85 | } 86 | 87 | } // end namespace internal 88 | 89 | } // end namespace Eigen 90 | 91 | #endif // EIGEN_MATH_FUNCTIONS_NEON_H 92 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/arch/SSE/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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_TYPE_CASTING_SSE_H 11 | #define EIGEN_TYPE_CASTING_SSE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | #ifndef EIGEN_VECTORIZE_AVX 18 | template <> 19 | struct type_casting_traits { 20 | enum { 21 | VectorizedCast = 1, 22 | SrcCoeffRatio = 1, 23 | TgtCoeffRatio = 1 24 | }; 25 | }; 26 | 27 | template <> 28 | struct type_casting_traits { 29 | enum { 30 | VectorizedCast = 1, 31 | SrcCoeffRatio = 1, 32 | TgtCoeffRatio = 1 33 | }; 34 | }; 35 | 36 | template <> 37 | struct type_casting_traits { 38 | enum { 39 | VectorizedCast = 1, 40 | SrcCoeffRatio = 2, 41 | TgtCoeffRatio = 1 42 | }; 43 | }; 44 | 45 | template <> 46 | struct type_casting_traits { 47 | enum { 48 | VectorizedCast = 1, 49 | SrcCoeffRatio = 1, 50 | TgtCoeffRatio = 2 51 | }; 52 | }; 53 | #endif 54 | 55 | template<> EIGEN_STRONG_INLINE Packet4i pcast(const Packet4f& a) { 56 | return _mm_cvttps_epi32(a); 57 | } 58 | 59 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet4i& a) { 60 | return _mm_cvtepi32_ps(a); 61 | } 62 | 63 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet2d& a, const Packet2d& b) { 64 | return _mm_shuffle_ps(_mm_cvtpd_ps(a), _mm_cvtpd_ps(b), (1 << 2) | (1 << 6)); 65 | } 66 | 67 | template<> EIGEN_STRONG_INLINE Packet2d pcast(const Packet4f& a) { 68 | // Simply discard the second half of the input 69 | return _mm_cvtps_pd(a); 70 | } 71 | 72 | 73 | } // end namespace internal 74 | 75 | } // end namespace Eigen 76 | 77 | #endif // EIGEN_TYPE_CASTING_SSE_H 78 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/functors/TernaryFunctors.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 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_TERNARY_FUNCTORS_H 11 | #define EIGEN_TERNARY_FUNCTORS_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | //---------- associative ternary functors ---------- 18 | 19 | 20 | 21 | } // end namespace internal 22 | 23 | } // end namespace Eigen 24 | 25 | #endif // EIGEN_TERNARY_FUNCTORS_H 26 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Core/products/SelfadjointRank2Update.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 | // 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_SELFADJOINTRANK2UPTADE_H 11 | #define EIGEN_SELFADJOINTRANK2UPTADE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu' 18 | * It corresponds to the Level2 syr2 BLAS routine 19 | */ 20 | 21 | template 22 | struct selfadjoint_rank2_update_selector; 23 | 24 | template 25 | struct selfadjoint_rank2_update_selector 26 | { 27 | static void run(Scalar* mat, Index stride, const UType& u, const VType& v, const Scalar& alpha) 28 | { 29 | const Index size = u.size(); 30 | for (Index i=0; i >(mat+stride*i+i, size-i) += 33 | (numext::conj(alpha) * numext::conj(u.coeff(i))) * v.tail(size-i) 34 | + (alpha * numext::conj(v.coeff(i))) * u.tail(size-i); 35 | } 36 | } 37 | }; 38 | 39 | template 40 | struct selfadjoint_rank2_update_selector 41 | { 42 | static void run(Scalar* mat, Index stride, const UType& u, const VType& v, const Scalar& alpha) 43 | { 44 | const Index size = u.size(); 45 | for (Index i=0; i >(mat+stride*i, i+1) += 47 | (numext::conj(alpha) * numext::conj(u.coeff(i))) * v.head(i+1) 48 | + (alpha * numext::conj(v.coeff(i))) * u.head(i+1); 49 | } 50 | }; 51 | 52 | template struct conj_expr_if 53 | : conditional::Scalar>,T> > {}; 55 | 56 | } // end namespace internal 57 | 58 | template 59 | template 60 | SelfAdjointView& SelfAdjointView 61 | ::rankUpdate(const MatrixBase& u, const MatrixBase& v, const Scalar& alpha) 62 | { 63 | typedef internal::blas_traits UBlasTraits; 64 | typedef typename UBlasTraits::DirectLinearAccessType ActualUType; 65 | typedef typename internal::remove_all::type _ActualUType; 66 | typename internal::add_const_on_value_type::type actualU = UBlasTraits::extract(u.derived()); 67 | 68 | typedef internal::blas_traits VBlasTraits; 69 | typedef typename VBlasTraits::DirectLinearAccessType ActualVType; 70 | typedef typename internal::remove_all::type _ActualVType; 71 | typename internal::add_const_on_value_type::type actualV = VBlasTraits::extract(v.derived()); 72 | 73 | // If MatrixType is row major, then we use the routine for lower triangular in the upper triangular case and 74 | // vice versa, and take the complex conjugate of all coefficients and vector entries. 75 | 76 | enum { IsRowMajor = (internal::traits::Flags&RowMajorBit) ? 1 : 0 }; 77 | Scalar actualAlpha = alpha * UBlasTraits::extractScalarFactor(u.derived()) 78 | * numext::conj(VBlasTraits::extractScalarFactor(v.derived())); 79 | if (IsRowMajor) 80 | actualAlpha = numext::conj(actualAlpha); 81 | 82 | typedef typename internal::remove_all::type>::type UType; 83 | typedef typename internal::remove_all::type>::type VType; 84 | internal::selfadjoint_rank2_update_selector 86 | ::run(_expression().const_cast_derived().data(),_expression().outerStride(),UType(actualU),VType(actualV),actualAlpha); 87 | 88 | return *this; 89 | } 90 | 91 | } // end namespace Eigen 92 | 93 | #endif // EIGEN_SELFADJOINTRANK2UPTADE_H 94 | -------------------------------------------------------------------------------- /cpp/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 | // 4503 - decorated name length exceeded, name was truncated 14 | // 4512 - assignment operator could not be generated 15 | // 4522 - 'class' : multiple assignment operators specified 16 | // 4700 - uninitialized local variable 'xyz' used 17 | // 4714 - function marked as __forceinline not inlined 18 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 19 | // 4800 - 'type' : forcing value to bool 'true' or 'false' (performance warning) 20 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 21 | #pragma warning( push ) 22 | #endif 23 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4503 4512 4522 4700 4714 4717 4800) 24 | 25 | #elif defined __INTEL_COMPILER 26 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 27 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 28 | // typedef that may be a reference type. 29 | // 279 - controlling expression is constant 30 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 31 | // 1684 - conversion from pointer to same-sized integral type (potential portability problem) 32 | // 2259 - non-pointer conversion from "Eigen::Index={ptrdiff_t={long}}" to "int" may lose significant bits 33 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 34 | #pragma warning push 35 | #endif 36 | #pragma warning disable 2196 279 1684 2259 37 | 38 | #elif defined __clang__ 39 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 40 | // this is really a stupid warning as it warns on compile-time expressions involving enums 41 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 42 | #pragma clang diagnostic push 43 | #endif 44 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 45 | 46 | #elif defined __GNUC__ && __GNUC__>=6 47 | 48 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 49 | #pragma GCC diagnostic push 50 | #endif 51 | #pragma GCC diagnostic ignored "-Wignored-attributes" 52 | 53 | #endif 54 | 55 | #if defined __NVCC__ 56 | // Disable the "statement is unreachable" message 57 | #pragma diag_suppress code_is_unreachable 58 | // Disable the "dynamic initialization in unreachable code" message 59 | #pragma diag_suppress initialization_not_reachable 60 | // Disable the "invalid error number" message that we get with older versions of nvcc 61 | #pragma diag_suppress 1222 62 | // Disable the "calling a __host__ function from a __host__ __device__ function is not allowed" messages (yes, there are many of them and they seem to change with every version of the compiler) 63 | #pragma diag_suppress 2527 64 | #pragma diag_suppress 2529 65 | #pragma diag_suppress 2651 66 | #pragma diag_suppress 2653 67 | #pragma diag_suppress 2668 68 | #pragma diag_suppress 2669 69 | #pragma diag_suppress 2670 70 | #pragma diag_suppress 2671 71 | #pragma diag_suppress 2735 72 | #pragma diag_suppress 2737 73 | #endif 74 | 75 | #endif // not EIGEN_WARNINGS_DISABLED 76 | -------------------------------------------------------------------------------- /cpp/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 | -------------------------------------------------------------------------------- /cpp/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 | #elif defined __GNUC__ && __GNUC__>=6 12 | #pragma GCC diagnostic pop 13 | #endif 14 | 15 | #if defined __NVCC__ 16 | // Don't reenable the diagnostic messages, as it turns out these messages need 17 | // to be disabled at the point of the template instantiation (i.e the user code) 18 | // otherwise they'll be triggered by nvcc. 19 | // #pragma diag_default code_is_unreachable 20 | // #pragma diag_default initialization_not_reachable 21 | // #pragma diag_default 2651 22 | // #pragma diag_default 2653 23 | #endif 24 | 25 | #endif 26 | 27 | #endif // EIGEN_WARNINGS_DISABLED 28 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Eigenvalues/RealSchur_LAPACKE.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 LAPACKe 29 | * Real Schur needed to real unsymmetrical eigenvalues/eigenvectors. 30 | ******************************************************************************** 31 | */ 32 | 33 | #ifndef EIGEN_REAL_SCHUR_LAPACKE_H 34 | #define EIGEN_REAL_SCHUR_LAPACKE_H 35 | 36 | namespace Eigen { 37 | 38 | /** \internal Specialization for the data types supported by LAPACKe */ 39 | 40 | #define EIGEN_LAPACKE_SCHUR_REAL(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, LAPACKE_PREFIX_U, EIGCOLROW, LAPACKE_COLROW) \ 41 | template<> template inline \ 42 | RealSchur >& \ 43 | RealSchur >::compute(const EigenBase& matrix, bool computeU) \ 44 | { \ 45 | eigen_assert(matrix.cols() == matrix.rows()); \ 46 | \ 47 | lapack_int n = internal::convert_index(matrix.cols()), sdim, info; \ 48 | lapack_int matrix_order = LAPACKE_COLROW; \ 49 | char jobvs, sort='N'; \ 50 | LAPACK_##LAPACKE_PREFIX_U##_SELECT2 select = 0; \ 51 | jobvs = (computeU) ? 'V' : 'N'; \ 52 | m_matU.resize(n, n); \ 53 | lapack_int ldvs = internal::convert_index(m_matU.outerStride()); \ 54 | m_matT = matrix; \ 55 | lapack_int lda = internal::convert_index(m_matT.outerStride()); \ 56 | Matrix wr, wi; \ 57 | wr.resize(n, 1); wi.resize(n, 1); \ 58 | info = LAPACKE_##LAPACKE_PREFIX##gees( matrix_order, jobvs, sort, select, n, (LAPACKE_TYPE*)m_matT.data(), lda, &sdim, (LAPACKE_TYPE*)wr.data(), (LAPACKE_TYPE*)wi.data(), (LAPACKE_TYPE*)m_matU.data(), ldvs ); \ 59 | if(info == 0) \ 60 | m_info = Success; \ 61 | else \ 62 | m_info = NoConvergence; \ 63 | \ 64 | m_isInitialized = true; \ 65 | m_matUisUptodate = computeU; \ 66 | return *this; \ 67 | \ 68 | } 69 | 70 | EIGEN_LAPACKE_SCHUR_REAL(double, double, d, D, ColMajor, LAPACK_COL_MAJOR) 71 | EIGEN_LAPACKE_SCHUR_REAL(float, float, s, S, ColMajor, LAPACK_COL_MAJOR) 72 | EIGEN_LAPACKE_SCHUR_REAL(double, double, d, D, RowMajor, LAPACK_ROW_MAJOR) 73 | EIGEN_LAPACKE_SCHUR_REAL(float, float, s, S, RowMajor, LAPACK_ROW_MAJOR) 74 | 75 | } // end namespace Eigen 76 | 77 | #endif // EIGEN_REAL_SCHUR_LAPACKE_H 78 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.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 LAPACKe 29 | * Self-adjoint eigenvalues/eigenvectors. 30 | ******************************************************************************** 31 | */ 32 | 33 | #ifndef EIGEN_SAEIGENSOLVER_LAPACKE_H 34 | #define EIGEN_SAEIGENSOLVER_LAPACKE_H 35 | 36 | namespace Eigen { 37 | 38 | /** \internal Specialization for the data types supported by LAPACKe */ 39 | 40 | #define EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, EIGCOLROW ) \ 41 | template<> template inline \ 42 | SelfAdjointEigenSolver >& \ 43 | SelfAdjointEigenSolver >::compute(const EigenBase& matrix, int options) \ 44 | { \ 45 | eigen_assert(matrix.cols() == matrix.rows()); \ 46 | eigen_assert((options&~(EigVecMask|GenEigMask))==0 \ 47 | && (options&EigVecMask)!=EigVecMask \ 48 | && "invalid option parameter"); \ 49 | bool computeEigenvectors = (options&ComputeEigenvectors)==ComputeEigenvectors; \ 50 | lapack_int n = internal::convert_index(matrix.cols()), lda, info; \ 51 | m_eivalues.resize(n,1); \ 52 | m_subdiag.resize(n-1); \ 53 | m_eivec = matrix; \ 54 | \ 55 | if(n==1) \ 56 | { \ 57 | m_eivalues.coeffRef(0,0) = numext::real(m_eivec.coeff(0,0)); \ 58 | if(computeEigenvectors) m_eivec.setOnes(n,n); \ 59 | m_info = Success; \ 60 | m_isInitialized = true; \ 61 | m_eigenvectorsOk = computeEigenvectors; \ 62 | return *this; \ 63 | } \ 64 | \ 65 | lda = internal::convert_index(m_eivec.outerStride()); \ 66 | char jobz, uplo='L'/*, range='A'*/; \ 67 | jobz = computeEigenvectors ? 'V' : 'N'; \ 68 | \ 69 | info = LAPACKE_##LAPACKE_NAME( LAPACK_COL_MAJOR, jobz, uplo, n, (LAPACKE_TYPE*)m_eivec.data(), lda, (LAPACKE_RTYPE*)m_eivalues.data() ); \ 70 | m_info = (info==0) ? Success : NoConvergence; \ 71 | m_isInitialized = true; \ 72 | m_eigenvectorsOk = computeEigenvectors; \ 73 | return *this; \ 74 | } 75 | 76 | #define EIGEN_LAPACKE_EIG_SELFADJ(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME ) \ 77 | EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, ColMajor ) \ 78 | EIGEN_LAPACKE_EIG_SELFADJ_2(EIGTYPE, LAPACKE_TYPE, LAPACKE_RTYPE, LAPACKE_NAME, RowMajor ) 79 | 80 | EIGEN_LAPACKE_EIG_SELFADJ(double, double, double, dsyev) 81 | EIGEN_LAPACKE_EIG_SELFADJ(float, float, float, ssyev) 82 | EIGEN_LAPACKE_EIG_SELFADJ(dcomplex, lapack_complex_double, double, zheev) 83 | EIGEN_LAPACKE_EIG_SELFADJ(scomplex, lapack_complex_float, float, cheev) 84 | 85 | } // end namespace Eigen 86 | 87 | #endif // EIGEN_SAEIGENSOLVER_H 88 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/Geometry/EulerAngles.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_EULERANGLES_H 11 | #define EIGEN_EULERANGLES_H 12 | 13 | namespace Eigen { 14 | 15 | /** \geometry_module \ingroup Geometry_Module 16 | * 17 | * 18 | * \returns the Euler-angles of the rotation matrix \c *this using the convention defined by the triplet (\a a0,\a a1,\a a2) 19 | * 20 | * Each of the three parameters \a a0,\a a1,\a a2 represents the respective rotation axis as an integer in {0,1,2}. 21 | * For instance, in: 22 | * \code Vector3f ea = mat.eulerAngles(2, 0, 2); \endcode 23 | * "2" represents the z axis and "0" the x axis, etc. The returned angles are such that 24 | * we have the following equality: 25 | * \code 26 | * mat == AngleAxisf(ea[0], Vector3f::UnitZ()) 27 | * * AngleAxisf(ea[1], Vector3f::UnitX()) 28 | * * AngleAxisf(ea[2], Vector3f::UnitZ()); \endcode 29 | * This corresponds to the right-multiply conventions (with right hand side frames). 30 | * 31 | * The returned angles are in the ranges [0:pi]x[-pi:pi]x[-pi:pi]. 32 | * 33 | * \sa class AngleAxis 34 | */ 35 | template 36 | EIGEN_DEVICE_FUNC inline Matrix::Scalar,3,1> 37 | MatrixBase::eulerAngles(Index a0, Index a1, Index a2) const 38 | { 39 | EIGEN_USING_STD_MATH(atan2) 40 | EIGEN_USING_STD_MATH(sin) 41 | EIGEN_USING_STD_MATH(cos) 42 | /* Implemented from Graphics Gems IV */ 43 | EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3) 44 | 45 | Matrix res; 46 | typedef Matrix Vector2; 47 | 48 | const Index odd = ((a0+1)%3 == a1) ? 0 : 1; 49 | const Index i = a0; 50 | const Index j = (a0 + 1 + odd)%3; 51 | const Index k = (a0 + 2 - odd)%3; 52 | 53 | if (a0==a2) 54 | { 55 | res[0] = atan2(coeff(j,i), coeff(k,i)); 56 | if((odd && res[0]Scalar(0))) 57 | { 58 | if(res[0] > Scalar(0)) { 59 | res[0] -= Scalar(EIGEN_PI); 60 | } 61 | else { 62 | res[0] += Scalar(EIGEN_PI); 63 | } 64 | Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm(); 65 | res[1] = -atan2(s2, coeff(i,i)); 66 | } 67 | else 68 | { 69 | Scalar s2 = Vector2(coeff(j,i), coeff(k,i)).norm(); 70 | res[1] = atan2(s2, coeff(i,i)); 71 | } 72 | 73 | // With a=(0,1,0), we have i=0; j=1; k=2, and after computing the first two angles, 74 | // we can compute their respective rotation, and apply its inverse to M. Since the result must 75 | // be a rotation around x, we have: 76 | // 77 | // c2 s1.s2 c1.s2 1 0 0 78 | // 0 c1 -s1 * M = 0 c3 s3 79 | // -s2 s1.c2 c1.c2 0 -s3 c3 80 | // 81 | // Thus: m11.c1 - m21.s1 = c3 & m12.c1 - m22.s1 = s3 82 | 83 | Scalar s1 = sin(res[0]); 84 | Scalar c1 = cos(res[0]); 85 | res[2] = atan2(c1*coeff(j,k)-s1*coeff(k,k), c1*coeff(j,j) - s1 * coeff(k,j)); 86 | } 87 | else 88 | { 89 | res[0] = atan2(coeff(j,k), coeff(k,k)); 90 | Scalar c2 = Vector2(coeff(i,i), coeff(i,j)).norm(); 91 | if((odd && res[0]Scalar(0))) { 92 | if(res[0] > Scalar(0)) { 93 | res[0] -= Scalar(EIGEN_PI); 94 | } 95 | else { 96 | res[0] += Scalar(EIGEN_PI); 97 | } 98 | res[1] = atan2(-coeff(i,k), -c2); 99 | } 100 | else 101 | res[1] = atan2(-coeff(i,k), c2); 102 | Scalar s1 = sin(res[0]); 103 | Scalar c1 = cos(res[0]); 104 | res[2] = atan2(s1*coeff(k,i)-c1*coeff(j,i), c1*coeff(j,j) - s1 * coeff(k,j)); 105 | } 106 | if (!odd) 107 | res = -res; 108 | 109 | return res; 110 | } 111 | 112 | } // end namespace Eigen 113 | 114 | #endif // EIGEN_EULERANGLES_H 115 | -------------------------------------------------------------------------------- /cpp/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_eval::type Nested; 96 | return internal::determinant_impl::type>::run(derived()); 97 | } 98 | 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_DETERMINANT_H 102 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/LU/PartialPivLU_LAPACKE.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 LAPACKe 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 | namespace Eigen { 37 | 38 | namespace internal { 39 | 40 | /** \internal Specialization for the data types supported by LAPACKe */ 41 | 42 | #define EIGEN_LAPACKE_LU_PARTPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX) \ 43 | template \ 44 | struct partial_lu_impl \ 45 | { \ 46 | /* \internal performs the LU decomposition in-place of the matrix represented */ \ 47 | static lapack_int blocked_lu(Index rows, Index cols, EIGTYPE* lu_data, Index luStride, lapack_int* row_transpositions, lapack_int& nb_transpositions, lapack_int maxBlockSize=256) \ 48 | { \ 49 | EIGEN_UNUSED_VARIABLE(maxBlockSize);\ 50 | lapack_int matrix_order, first_zero_pivot; \ 51 | lapack_int m, n, lda, *ipiv, info; \ 52 | EIGTYPE* a; \ 53 | /* Set up parameters for ?getrf */ \ 54 | matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 55 | lda = convert_index(luStride); \ 56 | a = lu_data; \ 57 | ipiv = row_transpositions; \ 58 | m = convert_index(rows); \ 59 | n = convert_index(cols); \ 60 | nb_transpositions = 0; \ 61 | \ 62 | info = LAPACKE_##LAPACKE_PREFIX##getrf( matrix_order, m, n, (LAPACKE_TYPE*)a, lda, ipiv ); \ 63 | \ 64 | for(int i=0;i= 0); \ 67 | /* something should be done with nb_transpositions */ \ 68 | \ 69 | first_zero_pivot = info; \ 70 | return first_zero_pivot; \ 71 | } \ 72 | }; 73 | 74 | EIGEN_LAPACKE_LU_PARTPIV(double, double, d) 75 | EIGEN_LAPACKE_LU_PARTPIV(float, float, s) 76 | EIGEN_LAPACKE_LU_PARTPIV(dcomplex, lapack_complex_double, z) 77 | EIGEN_LAPACKE_LU_PARTPIV(scomplex, lapack_complex_float, c) 78 | 79 | } // end namespace internal 80 | 81 | } // end namespace Eigen 82 | 83 | #endif // EIGEN_PARTIALLU_LAPACK_H 84 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/QR/HouseholderQR_LAPACKE.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 LAPACKe 29 | * Householder QR decomposition of a matrix w/o pivoting based on 30 | * LAPACKE_?geqrf function. 31 | ******************************************************************************** 32 | */ 33 | 34 | #ifndef EIGEN_QR_LAPACKE_H 35 | #define EIGEN_QR_LAPACKE_H 36 | 37 | namespace Eigen { 38 | 39 | namespace internal { 40 | 41 | /** \internal Specialization for the data types supported by LAPACKe */ 42 | 43 | #define EIGEN_LAPACKE_QR_NOPIV(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX) \ 44 | template \ 45 | struct householder_qr_inplace_blocked \ 46 | { \ 47 | static void run(MatrixQR& mat, HCoeffs& hCoeffs, Index = 32, \ 48 | typename MatrixQR::Scalar* = 0) \ 49 | { \ 50 | lapack_int m = (lapack_int) mat.rows(); \ 51 | lapack_int n = (lapack_int) mat.cols(); \ 52 | lapack_int lda = (lapack_int) mat.outerStride(); \ 53 | lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 54 | LAPACKE_##LAPACKE_PREFIX##geqrf( matrix_order, m, n, (LAPACKE_TYPE*)mat.data(), lda, (LAPACKE_TYPE*)hCoeffs.data()); \ 55 | hCoeffs.adjointInPlace(); \ 56 | } \ 57 | }; 58 | 59 | EIGEN_LAPACKE_QR_NOPIV(double, double, d) 60 | EIGEN_LAPACKE_QR_NOPIV(float, float, s) 61 | EIGEN_LAPACKE_QR_NOPIV(dcomplex, lapack_complex_double, z) 62 | EIGEN_LAPACKE_QR_NOPIV(scomplex, lapack_complex_float, c) 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_QR_LAPACKE_H 69 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/SparseCore/MappedSparseMatrix.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 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_MAPPED_SPARSEMATRIX_H 11 | #define EIGEN_MAPPED_SPARSEMATRIX_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated Use Map > 16 | * \class MappedSparseMatrix 17 | * 18 | * \brief Sparse matrix 19 | * 20 | * \param _Scalar the scalar type, i.e. the type of the coefficients 21 | * 22 | * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. 23 | * 24 | */ 25 | namespace internal { 26 | template 27 | struct traits > : traits > 28 | {}; 29 | } // end namespace internal 30 | 31 | template 32 | class MappedSparseMatrix 33 | : public Map > 34 | { 35 | typedef Map > Base; 36 | 37 | public: 38 | 39 | typedef typename Base::StorageIndex StorageIndex; 40 | typedef typename Base::Scalar Scalar; 41 | 42 | inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) 43 | : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) 44 | {} 45 | 46 | /** Empty destructor */ 47 | inline ~MappedSparseMatrix() {} 48 | }; 49 | 50 | namespace internal { 51 | 52 | template 53 | struct evaluator > 54 | : evaluator > > 55 | { 56 | typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType; 57 | typedef evaluator > Base; 58 | 59 | evaluator() : Base() {} 60 | explicit evaluator(const XprType &mat) : Base(mat) {} 61 | }; 62 | 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_MAPPED_SPARSEMATRIX_H 68 | -------------------------------------------------------------------------------- /cpp/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 | internal::evaluator thisEval(derived()); 30 | typename internal::evaluator::InnerIterator i(thisEval, 0); 31 | Scalar res(0); 32 | while (i) 33 | { 34 | res += numext::conj(i.value()) * other.coeff(i.index()); 35 | ++i; 36 | } 37 | return res; 38 | } 39 | 40 | template 41 | template 42 | typename internal::traits::Scalar 43 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 44 | { 45 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 46 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 47 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 48 | EIGEN_STATIC_ASSERT((internal::is_same::value), 49 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 50 | 51 | eigen_assert(size() == other.size()); 52 | 53 | internal::evaluator thisEval(derived()); 54 | typename internal::evaluator::InnerIterator i(thisEval, 0); 55 | 56 | internal::evaluator otherEval(other.derived()); 57 | typename internal::evaluator::InnerIterator j(otherEval, 0); 58 | 59 | Scalar res(0); 60 | while (i && j) 61 | { 62 | if (i.index()==j.index()) 63 | { 64 | res += numext::conj(i.value()) * j.value(); 65 | ++i; ++j; 66 | } 67 | else if (i.index() 76 | inline typename NumTraits::Scalar>::Real 77 | SparseMatrixBase::squaredNorm() const 78 | { 79 | return numext::real((*this).cwiseAbs2().sum()); 80 | } 81 | 82 | template 83 | inline typename NumTraits::Scalar>::Real 84 | SparseMatrixBase::norm() const 85 | { 86 | using std::sqrt; 87 | return sqrt(squaredNorm()); 88 | } 89 | 90 | template 91 | inline typename NumTraits::Scalar>::Real 92 | SparseMatrixBase::blueNorm() const 93 | { 94 | return internal::blueNorm_impl(*this); 95 | } 96 | } // end namespace Eigen 97 | 98 | #endif // EIGEN_SPARSE_DOT_H 99 | -------------------------------------------------------------------------------- /cpp/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-2014 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 | namespace Eigen { 14 | 15 | template 16 | template 17 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 18 | { 19 | const typename internal::nested_eval::type actualA(derived()); 20 | typename internal::conditional::type, 22 | const PlainObject>::type actualB(other.derived()); 23 | 24 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 25 | } 26 | 27 | } // end namespace Eigen 28 | 29 | #endif // EIGEN_SPARSE_FUZZY_H 30 | -------------------------------------------------------------------------------- /cpp/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-2014 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 | internal::evaluator thisEval(derived()); 22 | for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) 24 | res += iter.value(); 25 | return res; 26 | } 27 | 28 | template 29 | typename internal::traits >::Scalar 30 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | if(this->isCompressed()) 34 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 35 | else 36 | return Base::sum(); 37 | } 38 | 39 | template 40 | typename internal::traits >::Scalar 41 | SparseVector<_Scalar,_Options,_Index>::sum() const 42 | { 43 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 44 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 45 | } 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_SPARSEREDUX_H 50 | -------------------------------------------------------------------------------- /cpp/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-2015 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 | namespace internal { 16 | template 17 | class SparseTransposeImpl 18 | : public SparseMatrixBase > 19 | {}; 20 | 21 | template 22 | class SparseTransposeImpl 23 | : public SparseCompressedBase > 24 | { 25 | typedef SparseCompressedBase > Base; 26 | public: 27 | using Base::derived; 28 | typedef typename Base::Scalar Scalar; 29 | typedef typename Base::StorageIndex StorageIndex; 30 | 31 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 32 | 33 | inline const Scalar* valuePtr() const { return derived().nestedExpression().valuePtr(); } 34 | inline const StorageIndex* innerIndexPtr() const { return derived().nestedExpression().innerIndexPtr(); } 35 | inline const StorageIndex* outerIndexPtr() const { return derived().nestedExpression().outerIndexPtr(); } 36 | inline const StorageIndex* innerNonZeroPtr() const { return derived().nestedExpression().innerNonZeroPtr(); } 37 | 38 | inline Scalar* valuePtr() { return derived().nestedExpression().valuePtr(); } 39 | inline StorageIndex* innerIndexPtr() { return derived().nestedExpression().innerIndexPtr(); } 40 | inline StorageIndex* outerIndexPtr() { return derived().nestedExpression().outerIndexPtr(); } 41 | inline StorageIndex* innerNonZeroPtr() { return derived().nestedExpression().innerNonZeroPtr(); } 42 | }; 43 | } 44 | 45 | template class TransposeImpl 46 | : public internal::SparseTransposeImpl 47 | { 48 | protected: 49 | typedef internal::SparseTransposeImpl Base; 50 | }; 51 | 52 | namespace internal { 53 | 54 | template 55 | struct unary_evaluator, IteratorBased> 56 | : public evaluator_base > 57 | { 58 | typedef typename evaluator::InnerIterator EvalIterator; 59 | public: 60 | typedef Transpose XprType; 61 | 62 | inline Index nonZerosEstimate() const { 63 | return m_argImpl.nonZerosEstimate(); 64 | } 65 | 66 | class InnerIterator : public EvalIterator 67 | { 68 | public: 69 | EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& unaryOp, Index outer) 70 | : EvalIterator(unaryOp.m_argImpl,outer) 71 | {} 72 | 73 | Index row() const { return EvalIterator::col(); } 74 | Index col() const { return EvalIterator::row(); } 75 | }; 76 | 77 | enum { 78 | CoeffReadCost = evaluator::CoeffReadCost, 79 | Flags = XprType::Flags 80 | }; 81 | 82 | explicit unary_evaluator(const XprType& op) :m_argImpl(op.nestedExpression()) {} 83 | 84 | protected: 85 | evaluator m_argImpl; 86 | }; 87 | 88 | } // end namespace internal 89 | 90 | } // end namespace Eigen 91 | 92 | #endif // EIGEN_SPARSETRANSPOSE_H 93 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/SparseLU/SparseLUImpl.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 | #ifndef SPARSELU_IMPL_H 10 | #define SPARSELU_IMPL_H 11 | 12 | namespace Eigen { 13 | namespace internal { 14 | 15 | /** \ingroup SparseLU_Module 16 | * \class SparseLUImpl 17 | * Base class for sparseLU 18 | */ 19 | template 20 | class SparseLUImpl 21 | { 22 | public: 23 | typedef Matrix ScalarVector; 24 | typedef Matrix IndexVector; 25 | typedef Matrix ScalarMatrix; 26 | typedef Map > MappedMatrixBlock; 27 | typedef typename ScalarVector::RealScalar RealScalar; 28 | typedef Ref > BlockScalarVector; 29 | typedef Ref > BlockIndexVector; 30 | typedef LU_GlobalLU_t GlobalLU_t; 31 | typedef SparseMatrix MatrixType; 32 | 33 | protected: 34 | template 35 | Index expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions); 36 | Index memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu); 37 | template 38 | Index memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions); 39 | void heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end); 40 | void relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end); 41 | Index snode_dfs(const Index jcol, const Index kcol,const MatrixType& mat, IndexVector& xprune, IndexVector& marker, GlobalLU_t& glu); 42 | Index snode_bmod (const Index jcol, const Index fsupc, ScalarVector& dense, GlobalLU_t& glu); 43 | Index pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu); 44 | template 45 | void dfs_kernel(const StorageIndex jj, IndexVector& perm_r, 46 | Index& nseg, IndexVector& panel_lsub, IndexVector& segrep, 47 | Ref repfnz_col, IndexVector& xprune, Ref marker, IndexVector& parent, 48 | IndexVector& xplore, GlobalLU_t& glu, Index& nextl_col, Index krow, Traits& traits); 49 | void panel_dfs(const Index m, const Index w, const Index jcol, MatrixType& A, IndexVector& perm_r, Index& nseg, ScalarVector& dense, IndexVector& panel_lsub, IndexVector& segrep, IndexVector& repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu); 50 | 51 | void panel_bmod(const Index m, const Index w, const Index jcol, const Index nseg, ScalarVector& dense, ScalarVector& tempv, IndexVector& segrep, IndexVector& repfnz, GlobalLU_t& glu); 52 | Index column_dfs(const Index m, const Index jcol, IndexVector& perm_r, Index maxsuper, Index& nseg, BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu); 53 | Index column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu); 54 | Index copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu); 55 | void pruneL(const Index jcol, const IndexVector& perm_r, const Index pivrow, const Index nseg, const IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, GlobalLU_t& glu); 56 | void countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu); 57 | void fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu); 58 | 59 | template 60 | friend struct column_dfs_traits; 61 | }; 62 | 63 | } // end namespace internal 64 | } // namespace Eigen 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /cpp/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 | StorageIndex 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 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/SparseLU/SparseLU_copy_to_ucol.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 | * NOTE: This file is the modified version of [s,d,c,z]copy_to_ucol.c file in SuperLU 12 | 13 | * -- SuperLU routine (version 2.0) -- 14 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 15 | * and Lawrence Berkeley National Lab. 16 | * November 15, 1997 17 | * 18 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 19 | * 20 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 21 | * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 22 | * 23 | * Permission is hereby granted to use or copy this program for any 24 | * purpose, provided the above notices are retained on all copies. 25 | * Permission to modify the code and to distribute modified code is 26 | * granted, provided the above notices are retained, and a notice that 27 | * the code was modified is included with the above copyright notice. 28 | */ 29 | #ifndef SPARSELU_COPY_TO_UCOL_H 30 | #define SPARSELU_COPY_TO_UCOL_H 31 | 32 | namespace Eigen { 33 | namespace internal { 34 | 35 | /** 36 | * \brief Performs numeric block updates (sup-col) in topological order 37 | * 38 | * \param jcol current column to update 39 | * \param nseg Number of segments in the U part 40 | * \param segrep segment representative ... 41 | * \param repfnz First nonzero column in each row ... 42 | * \param perm_r Row permutation 43 | * \param dense Store the full representation of the column 44 | * \param glu Global LU data. 45 | * \return 0 - successful return 46 | * > 0 - number of bytes allocated when run out of space 47 | * 48 | */ 49 | template 50 | Index SparseLUImpl::copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, 51 | BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu) 52 | { 53 | Index ksub, krep, ksupno; 54 | 55 | Index jsupno = glu.supno(jcol); 56 | 57 | // For each nonzero supernode segment of U[*,j] in topological order 58 | Index k = nseg - 1, i; 59 | StorageIndex nextu = glu.xusub(jcol); 60 | Index kfnz, isub, segsize; 61 | Index new_next,irow; 62 | Index fsupc, mem; 63 | for (ksub = 0; ksub < nseg; ksub++) 64 | { 65 | krep = segrep(k); k--; 66 | ksupno = glu.supno(krep); 67 | if (jsupno != ksupno ) // should go into ucol(); 68 | { 69 | kfnz = repfnz(krep); 70 | if (kfnz != emptyIdxLU) 71 | { // Nonzero U-segment 72 | fsupc = glu.xsup(ksupno); 73 | isub = glu.xlsub(fsupc) + kfnz - fsupc; 74 | segsize = krep - kfnz + 1; 75 | new_next = nextu + segsize; 76 | while (new_next > glu.nzumax) 77 | { 78 | mem = memXpand(glu.ucol, glu.nzumax, nextu, UCOL, glu.num_expansions); 79 | if (mem) return mem; 80 | mem = memXpand(glu.usub, glu.nzumax, nextu, USUB, glu.num_expansions); 81 | if (mem) return mem; 82 | 83 | } 84 | 85 | for (i = 0; i < segsize; i++) 86 | { 87 | irow = glu.lsub(isub); 88 | glu.usub(nextu) = perm_r(irow); // Unlike the L part, the U part is stored in its final order 89 | glu.ucol(nextu) = dense(irow); 90 | dense(irow) = Scalar(0.0); 91 | nextu++; 92 | isub++; 93 | } 94 | 95 | } // end nonzero U-segment 96 | 97 | } // end if jsupno 98 | 99 | } // end for each segment 100 | glu.xusub(jcol + 1) = nextu; // close U(*,jcol) 101 | return 0; 102 | } 103 | 104 | } // namespace internal 105 | } // end namespace Eigen 106 | 107 | #endif // SPARSELU_COPY_TO_UCOL_H 108 | -------------------------------------------------------------------------------- /cpp/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 parent; 52 | relax_end.setConstant(emptyIdxLU); 53 | descendants.setZero(); 54 | for (Index 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 (Index 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) = StorageIndex(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 | -------------------------------------------------------------------------------- /cpp/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 std::size_t size_type; 26 | typedef std::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 | #if EIGEN_COMP_MSVC 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 | -------------------------------------------------------------------------------- /cpp/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 | 42 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 43 | : m_dec(dec), m_rank(dec.rank()), 44 | m_cols(m_rank == 0 ? 1 : m_rank), 45 | m_originalMatrix(originalMatrix) 46 | {} 47 | 48 | inline Index rows() const { return m_dec.rows(); } 49 | inline Index cols() const { return m_cols; } 50 | inline Index rank() const { return m_rank; } 51 | inline const DecompositionType& dec() const { return m_dec; } 52 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 53 | 54 | template inline void evalTo(Dest& dst) const 55 | { 56 | static_cast*>(this)->evalTo(dst); 57 | } 58 | 59 | protected: 60 | const DecompositionType& m_dec; 61 | Index m_rank, m_cols; 62 | const MatrixType& m_originalMatrix; 63 | }; 64 | 65 | } // end namespace internal 66 | 67 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 68 | typedef typename DecompositionType::MatrixType MatrixType; \ 69 | typedef typename MatrixType::Scalar Scalar; \ 70 | typedef typename MatrixType::RealScalar RealScalar; \ 71 | typedef Eigen::internal::image_retval_base Base; \ 72 | using Base::dec; \ 73 | using Base::originalMatrix; \ 74 | using Base::rank; \ 75 | using Base::rows; \ 76 | using Base::cols; \ 77 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 78 | : Base(dec, originalMatrix) {} 79 | 80 | } // end namespace Eigen 81 | 82 | #endif // EIGEN_MISC_IMAGE_H 83 | -------------------------------------------------------------------------------- /cpp/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 | 43 | explicit kernel_retval_base(const DecompositionType& dec) 44 | : m_dec(dec), 45 | m_rank(dec.rank()), 46 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 47 | {} 48 | 49 | inline Index rows() const { return m_dec.cols(); } 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 | 54 | template inline void evalTo(Dest& dst) const 55 | { 56 | static_cast*>(this)->evalTo(dst); 57 | } 58 | 59 | protected: 60 | const DecompositionType& m_dec; 61 | Index m_rank, m_cols; 62 | }; 63 | 64 | } // end namespace internal 65 | 66 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 67 | typedef typename DecompositionType::MatrixType MatrixType; \ 68 | typedef typename MatrixType::Scalar Scalar; \ 69 | typedef typename MatrixType::RealScalar RealScalar; \ 70 | typedef Eigen::internal::kernel_retval_base Base; \ 71 | using Base::dec; \ 72 | using Base::rank; \ 73 | using Base::rows; \ 74 | using Base::cols; \ 75 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 76 | 77 | } // end namespace Eigen 78 | 79 | #endif // EIGEN_MISC_KERNEL_H 80 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/misc/RealSvd2x2.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Benoit Jacob 5 | // Copyright (C) 2013-2016 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_REALSVD2X2_H 12 | #define EIGEN_REALSVD2X2_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, 20 | JacobiRotation *j_left, 21 | JacobiRotation *j_right) 22 | { 23 | using std::sqrt; 24 | using std::abs; 25 | Matrix m; 26 | m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), 27 | numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); 28 | JacobiRotation rot1; 29 | RealScalar t = m.coeff(0,0) + m.coeff(1,1); 30 | RealScalar d = m.coeff(1,0) - m.coeff(0,1); 31 | 32 | if(abs(d) < (std::numeric_limits::min)()) 33 | { 34 | rot1.s() = RealScalar(0); 35 | rot1.c() = RealScalar(1); 36 | } 37 | else 38 | { 39 | // If d!=0, then t/d cannot overflow because the magnitude of the 40 | // entries forming d are not too small compared to the ones forming t. 41 | RealScalar u = t / d; 42 | RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); 43 | rot1.s() = RealScalar(1) / tmp; 44 | rot1.c() = u / tmp; 45 | } 46 | m.applyOnTheLeft(0,1,rot1); 47 | j_right->makeJacobi(m,0,1); 48 | *j_left = rot1 * j_right->transpose(); 49 | } 50 | 51 | } // end namespace internal 52 | 53 | } // end namespace Eigen 54 | 55 | #endif // EIGEN_REALSVD2X2_H 56 | -------------------------------------------------------------------------------- /cpp/include/Eigen/src/misc/lapacke_mangling.h: -------------------------------------------------------------------------------- 1 | #ifndef LAPACK_HEADER_INCLUDED 2 | #define LAPACK_HEADER_INCLUDED 3 | 4 | #ifndef LAPACK_GLOBAL 5 | #if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_) 6 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 7 | #elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER) 8 | #define LAPACK_GLOBAL(lcname,UCNAME) UCNAME 9 | #elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE) 10 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname 11 | #else 12 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 13 | #endif 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /cpp/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 included into the body of the base classes supporting matrix specific coefficient-wise functions. 12 | // This include MatrixBase and SparseMatrixBase. 13 | 14 | 15 | typedef CwiseUnaryOp, const Derived> CwiseAbsReturnType; 16 | typedef CwiseUnaryOp, const Derived> CwiseAbs2ReturnType; 17 | typedef CwiseUnaryOp, const Derived> CwiseSqrtReturnType; 18 | typedef CwiseUnaryOp, const Derived> CwiseSignReturnType; 19 | typedef CwiseUnaryOp, const Derived> CwiseInverseReturnType; 20 | 21 | /// \returns an expression of the coefficient-wise absolute value of \c *this 22 | /// 23 | /// Example: \include MatrixBase_cwiseAbs.cpp 24 | /// Output: \verbinclude MatrixBase_cwiseAbs.out 25 | /// 26 | EIGEN_DOC_UNARY_ADDONS(cwiseAbs,absolute value) 27 | /// 28 | /// \sa cwiseAbs2() 29 | /// 30 | EIGEN_DEVICE_FUNC 31 | EIGEN_STRONG_INLINE const CwiseAbsReturnType 32 | cwiseAbs() const { return CwiseAbsReturnType(derived()); } 33 | 34 | /// \returns an expression of the coefficient-wise squared absolute value of \c *this 35 | /// 36 | /// Example: \include MatrixBase_cwiseAbs2.cpp 37 | /// Output: \verbinclude MatrixBase_cwiseAbs2.out 38 | /// 39 | EIGEN_DOC_UNARY_ADDONS(cwiseAbs2,squared absolute value) 40 | /// 41 | /// \sa cwiseAbs() 42 | /// 43 | EIGEN_DEVICE_FUNC 44 | EIGEN_STRONG_INLINE const CwiseAbs2ReturnType 45 | cwiseAbs2() const { return CwiseAbs2ReturnType(derived()); } 46 | 47 | /// \returns an expression of the coefficient-wise square root of *this. 48 | /// 49 | /// Example: \include MatrixBase_cwiseSqrt.cpp 50 | /// Output: \verbinclude MatrixBase_cwiseSqrt.out 51 | /// 52 | EIGEN_DOC_UNARY_ADDONS(cwiseSqrt,square-root) 53 | /// 54 | /// \sa cwisePow(), cwiseSquare() 55 | /// 56 | EIGEN_DEVICE_FUNC 57 | inline const CwiseSqrtReturnType 58 | cwiseSqrt() const { return CwiseSqrtReturnType(derived()); } 59 | 60 | /// \returns an expression of the coefficient-wise signum of *this. 61 | /// 62 | /// Example: \include MatrixBase_cwiseSign.cpp 63 | /// Output: \verbinclude MatrixBase_cwiseSign.out 64 | /// 65 | EIGEN_DOC_UNARY_ADDONS(cwiseSign,sign function) 66 | /// 67 | EIGEN_DEVICE_FUNC 68 | inline const CwiseSignReturnType 69 | cwiseSign() const { return CwiseSignReturnType(derived()); } 70 | 71 | 72 | /// \returns an expression of the coefficient-wise inverse of *this. 73 | /// 74 | /// Example: \include MatrixBase_cwiseInverse.cpp 75 | /// Output: \verbinclude MatrixBase_cwiseInverse.out 76 | /// 77 | EIGEN_DOC_UNARY_ADDONS(cwiseInverse,inverse) 78 | /// 79 | /// \sa cwiseProduct() 80 | /// 81 | EIGEN_DEVICE_FUNC 82 | inline const CwiseInverseReturnType 83 | cwiseInverse() const { return CwiseInverseReturnType(derived()); } 84 | 85 | 86 | -------------------------------------------------------------------------------- /cpp/include/mymav.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | mymav::mymav() 6 | { 7 | position << 0,0,0; 8 | angle << 0,0,0; 9 | speed << 0,0,0; 10 | } 11 | 12 | mymav::mymav(float x, float y, float z, float yaw, float pitch, float roll, float vx, float vy, float vz) 13 | { 14 | position << x,y,z; 15 | angle << yaw,pitch,roll; 16 | speed << vx,vy,vz; 17 | } 18 | 19 | void mymav::info() 20 | { 21 | printf("\nObject's information:"); 22 | printf("\n\tposition\t%+0.3f\t%+0.3f\t%+0.3f",position(0),position(1),position(2)); 23 | printf("\n\tangle\t\t%+0.3f\t%+0.3f\t%+0.3f",angle(0),angle(1),angle(2)); 24 | printf("\n\tspeed\t\t%+0.3f\t%+0.3f\t%+0.3f",speed(0),speed(1),speed(2)); 25 | } 26 | -------------------------------------------------------------------------------- /cpp/include/mymav.h: -------------------------------------------------------------------------------- 1 | #ifndef MYMAV_H 2 | #define MYMAV_H 3 | 4 | #include 5 | 6 | class mymav 7 | { 8 | public: 9 | // components 10 | Eigen::Vector3d position; // x, y, z 11 | Eigen::Vector3d angle; // yaw, pitch, roll 12 | Eigen::Vector3d speed; // in body frame 13 | 14 | // constructor 15 | mymav(); 16 | mymav(float x, float y, float z, float yaw, float pitch, float roll, float vx, float vy, float vz); 17 | 18 | // print info 19 | void info(); 20 | }; 21 | 22 | class control_input 23 | { 24 | public: 25 | double throttle; 26 | double yaw; 27 | double pitch; 28 | double roll; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /dynamic_mav.m: -------------------------------------------------------------------------------- 1 | function obj = dynamic_mav(obj,u,ts) 2 | g = 9.80665; 3 | m = 0.53263; % kg 4 | for i = 1:50 5 | rotm = eul2rotm(obj.angle); 6 | % limit the change rate (assume 90 degree in 1 second) 7 | d = u(2) - obj.angle(1); 8 | d = mod(d+pi, 2*pi) - pi; 9 | if abs(d) >= 1/2 * pi / (1/ts*50) 10 | d = abs(d)/d * 1/2 * pi / (1/ts*50); 11 | end 12 | obj.angle(1) = obj.angle(1) + d; 13 | d = u(3) - obj.angle(2); 14 | d = mod(d+pi, 2*pi) - pi; 15 | if abs(d) >= 1/2 * pi / (1/ts*50) 16 | d = abs(d)/d * 1/2 * pi / (1/ts*50); 17 | end 18 | obj.angle(2) = obj.angle(2) + d; 19 | d = u(4) - obj.angle(3); 20 | d = mod(d+pi, 2*pi) - pi; 21 | if abs(d) >= 1/2 * pi / (1/ts*50) 22 | d = abs(d)/d * 1/2 * pi / (1/ts*50); 23 | end 24 | obj.angle(3) = obj.angle(3) + d; 25 | Kf = 0.5 * eye(3); 26 | % A = [zeros(6,3),[eye(3);zeros(3,3)]]; % ideal model 27 | A = [zeros(6,3),[eye(3);-rotm*Kf*rotm']]; 28 | B = [zeros(3,2);[rotm*[0;0;1],[0;0;-1]]]; 29 | C = [eye(3),zeros(3,3)]; 30 | D = zeros(3,2); 31 | A_d = eye(6) + A * ts / 50; 32 | B_d = B * ts / 50; 33 | states = [obj.position';rotm * obj.speed']; 34 | states = A_d * states + B_d * [u(1)/m;g]; 35 | % states(4:6) = states(4:6) + normrnd(0,1.5,3,1) * ts; 36 | obj.position = states(1:3)'; 37 | obj.speed = (eul2rotm(obj.angle)' * states(4:6))'; % store body frame speed 38 | if obj.position(3) < 0 39 | obj.position(3) = 0; 40 | obj.angle(2:3) = [0,0]; 41 | obj.speed = [0,0,0]; % body frame 42 | end 43 | end 44 | end -------------------------------------------------------------------------------- /images/control_input.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/images/control_input.png -------------------------------------------------------------------------------- /images/find_best_time_interval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/images/find_best_time_interval.png -------------------------------------------------------------------------------- /images/moving_target_result.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/images/moving_target_result.gif -------------------------------------------------------------------------------- /images/result.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0Jiahao/MAV_Real_Time_Trajectory_Generator/bc221152603fccea7051ec24ad82fd9695845942/images/result.gif -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | clear; clc; close all; 2 | mav.position = [3,3,6]; % xyz-axis 3 | mav.angle = [0,0,0]; 4 | mav.speed = [1,1,0]; % body frame 5 | tgt.position = [-3,-3,5]; % xyz-axis 6 | tgt.angle = [-pi/2,0,0]; 7 | % sampling time 8 | ts = 0.05; 9 | g = 9.80665; 10 | m = 0.53263; % kg 11 | % control input u = (T,yaw,pitch,roll) 12 | % yaw anti-clockwise; pitch forward; roll right 13 | % definition of yaw, pitch, row see https://en.wikipedia.org/wiki/Aircraft_principal_axes 14 | u = [m*g,0,0,0]; % initialization of control input 15 | t = 0; 16 | while norm(tgt.position - mav.position) > 0.10 17 | mav = dynamic_mav(mav,u,ts); 18 | [waypoints,path_c,opt_time] = time_optimal_path_planner(mav,tgt,ts); 19 | u = mav_controller(mav,tgt,path_c,ts); 20 | subplot(1,2,1); 21 | plot_3d_obj(mav); hold on; 22 | plot_3d_obj(tgt); 23 | plot_path(waypoints,path_c,opt_time); hold off; 24 | time = num2str(t); 25 | if length(time) == 3 26 | time = [time,'0']'; 27 | elseif length(time) == 1 28 | time = [time,'.00']; 29 | end 30 | title(['t=',reshape(time,1,4),'s']); 31 | subplot(1,2,2); 32 | plot_2d_obj(mav); 33 | title(['z=',num2str(mav.position(3)),'m']); 34 | set(gcf,'position',[250 0 1200 500]); 35 | pause(0); 36 | t = t + ts; 37 | % GIF 38 | h = figure(1); 39 | frame = getframe(h); 40 | im = frame2im(frame); 41 | [imind,cm] = rgb2ind(im,256); 42 | % Write to the GIF File 43 | if t == ts 44 | imwrite(imind,cm,'result.gif','gif', 'Loopcount',inf,'DelayTime',ts); 45 | else 46 | imwrite(imind,cm,'result.gif','gif','WriteMode','append','DelayTime',ts); 47 | end 48 | end 49 | 50 | -------------------------------------------------------------------------------- /mav_controller.m: -------------------------------------------------------------------------------- 1 | function u = mav_controller(obj,tgt,path_c,ts) 2 | u = zeros(1,4); 3 | m = 0.53263; % kg 4 | g = 9.80665; 5 | t = ts; 6 | % desired acceleration 7 | x_pp = 12 * path_c(1) * t^2 + 6 * path_c(2) * t + 2 * path_c(3); 8 | y_pp = 12 * path_c(6) * t^2 + 6 * path_c(7) * t + 2 * path_c(8); 9 | z_pp = 12 * path_c(11) * t^2 + 6 * path_c(12) * t + 2 * path_c(13); 10 | % xb,yb,zb 11 | t = [x_pp;y_pp;z_pp+g]; 12 | zb = t/norm(t); 13 | toward = atan2(tgt.position(2)-obj.position(2),tgt.position(1)-obj.position(1)); 14 | d = toward - obj.angle(1); 15 | d = mod(d+pi, 2*pi) - pi; 16 | if abs(d) >= 1/2 * pi / (1/ts) 17 | d = abs(d)/d * 1/2 * pi / (1/ts); 18 | end 19 | yaw = obj.angle(1) + d; 20 | xc = [cos(yaw);sin(yaw);0]; 21 | yb = cross(zb,xc)/norm(cross(zb,xc)); 22 | xb = cross(yb,zb); 23 | rotm = [xb,yb,zb]; 24 | u(2:4) = rotm2eul(rotm); 25 | u(1) = m * norm(t); % discrete time signal fault the performance 26 | end -------------------------------------------------------------------------------- /moving_target.m: -------------------------------------------------------------------------------- 1 | clear; clc; close all; 2 | mav.position = [3,3,6]; % xyz-axis 3 | mav.angle = [0,0,0]; 4 | mav.speed = [1,1,0]; % body frame 5 | tgt.position = [-3,-3,5]; % xyz-axis 6 | tgt.angle = [-pi/2,0,0]; 7 | % sampling time 8 | ts = 0.05; 9 | g = 9.80665; 10 | m = 0.53263; % kg 11 | % control input u = (T,yaw,pitch,roll) 12 | % yaw anti-clockwise; pitch forward; roll right 13 | % definition of yaw, pitch, row see https://en.wikipedia.org/wiki/Aircraft_principal_axes 14 | u = [m*g,0,0,0]; % initialization of control input 15 | t = 0; 16 | while norm(tgt.position - mav.position) > 0.10 17 | ttt = tgt; 18 | coeff = log(norm(tgt.position - mav.position)+1); 19 | ttt.position = tgt.position + coeff * 0.2 * [sin(10*t),sin(8*t),sin(5*t)]; 20 | ttt.angle = tgt.angle + coeff * 0.2 * [sin(6*t),sin(7*t),sin(8*t)]; 21 | mav = dynamic_mav(mav,u,ts); 22 | [waypoints,path_c,opt_time] = time_optimal_path_planner(mav,ttt,ts); 23 | u = mav_controller(mav,ttt,path_c,ts); 24 | subplot(1,2,1); 25 | plot_3d_obj(mav); hold on; 26 | plot_3d_obj(ttt); 27 | plot_path(waypoints,path_c,opt_time); hold off; 28 | time = num2str(t); 29 | if length(time) == 3 30 | time = [time,'0']'; 31 | elseif length(time) == 1 32 | time = [time,'.00']; 33 | end 34 | title(['t=',reshape(time,1,4),'s']); 35 | subplot(1,2,2); 36 | plot_2d_obj(mav); 37 | title(['z=',num2str(mav.position(3)),'m']); 38 | set(gcf,'position',[250 0 1200 500]); 39 | pause(0); 40 | t = t + ts; 41 | % GIF 42 | h = figure(1); 43 | frame = getframe(h); 44 | im = frame2im(frame); 45 | [imind,cm] = rgb2ind(im,256); 46 | % Write to the GIF File 47 | if t == ts 48 | imwrite(imind,cm,'moving_target_result.gif','gif', 'Loopcount',inf,'DelayTime',ts); 49 | else 50 | imwrite(imind,cm,'moving_target_result.gif','gif','WriteMode','append','DelayTime',ts); 51 | end 52 | end -------------------------------------------------------------------------------- /path_planner.m: -------------------------------------------------------------------------------- 1 | function [waypoints,path_c] = path_planner(obj,tgt,time) 2 | waypoints = cell(2,1); 3 | waypoints{1}.position = obj.position; % start point 4 | waypoints{1}.heading = obj.angle(1); 5 | waypoints{1}.speed = (eul2rotm(obj.angle) * obj.speed')'; % world frame 6 | waypoints{1}.time = 0; 7 | waypoints{2}.position = tgt.position; % final point 8 | waypoints{2}.heading = tgt.angle(1); 9 | waypoints{2}.time = time; 10 | % construct QP 11 | r_xyz = 1; r_yaw = 1; % regularization 12 | H = zeros(18,18); % 5 * 3 + 3 (4th order for xyz & 2nd order for yaw) 13 | H(1,1) = r_xyz; 14 | H(6,6) = r_xyz; 15 | H(11,11) = 10000*r_xyz; 16 | H(16,16) = r_yaw; 17 | f = zeros(1,18); 18 | Aeq = []; 19 | beq = []; 20 | % start & final constraints (equality) 21 | for i = 1:numel(waypoints) 22 | Aeq = [Aeq;[waypoints{i}.time^4,waypoints{i}.time^3,waypoints{i}.time^2,waypoints{i}.time,1,zeros(1,13)]]; % x 23 | Aeq = [Aeq;[zeros(1,5),waypoints{i}.time^4,waypoints{i}.time^3,waypoints{i}.time^2,waypoints{i}.time,1,zeros(1,8)]]; % y 24 | Aeq = [Aeq;[zeros(1,10),waypoints{i}.time^4,waypoints{i}.time^3,waypoints{i}.time^2,waypoints{i}.time,1,zeros(1,3)]]; % z 25 | Aeq = [Aeq;[zeros(1,15),waypoints{i}.time^2,waypoints{i}.time,1]]; % yaw 26 | beq = [beq;waypoints{i}.position(1);waypoints{i}.position(2);waypoints{i}.position(3);waypoints{i}.heading]; 27 | end 28 | % velocity of the start point 29 | Aeq = [Aeq;[4*waypoints{1}.time^3,3*waypoints{1}.time^2,2*waypoints{1}.time,1,0,zeros(1,13)]]; % x' 30 | Aeq = [Aeq;[zeros(1,5),4*waypoints{1}.time^3,3*waypoints{1}.time^2,2*waypoints{1}.time,1,0,zeros(1,8)]]; % y' 31 | Aeq = [Aeq;[zeros(1,10),4*waypoints{1}.time^3,3*waypoints{1}.time^2,2*waypoints{1}.time,1,0,zeros(1,3)]]; % z' 32 | beq = [beq;waypoints{1}.speed(1);waypoints{1}.speed(2);waypoints{1}.speed(3)]; 33 | % velocity of the final point 34 | Aeq = [Aeq;[cos(waypoints{2}.heading)*[4*waypoints{2}.time^3,3*waypoints{2}.time^2,2*waypoints{2}.time,1,0],sin(waypoints{2}.heading)*[4*waypoints{2}.time^3,3*waypoints{2}.time^2,2*waypoints{2}.time,1,0],zeros(1,8)]]; 35 | Aeq = [Aeq;[sin(waypoints{2}.heading)*[4*waypoints{2}.time^3,3*waypoints{2}.time^2,2*waypoints{2}.time,1,0],-cos(waypoints{2}.heading)*[4*waypoints{2}.time^3,3*waypoints{2}.time^2,2*waypoints{2}.time,1,0],zeros(1,8)]]; % y' 36 | Aeq = [Aeq;[zeros(1,10),4*waypoints{2}.time^3,3*waypoints{2}.time^2,2*waypoints{2}.time,1,0,zeros(1,3)]]; % z' 37 | beq = [beq;0.5;0;0]; 38 | %% solving quadratic problem 39 | options = optimoptions('quadprog','Display','off'); 40 | x0 = zeros(18,1); 41 | path_c = quadprog(H,f,[],[],Aeq,beq,[],[],x0,options); 42 | end -------------------------------------------------------------------------------- /plot_2d_obj.m: -------------------------------------------------------------------------------- 1 | function plot_2d_obj(obj) 2 | hold on; 3 | scatter(obj.position(1),obj.position(2),5,'filled','MarkerEdgeColor',[0 0 0],'MarkerFaceColor',[0 0 0]); 4 | hold off; 5 | axis equal; 6 | grid on; 7 | xlim([-10,10]); xlabel('x'); 8 | ylim([-10,10]); ylabel('y'); 9 | end -------------------------------------------------------------------------------- /plot_3d_obj.m: -------------------------------------------------------------------------------- 1 | function plot_3d_obj(obj) 2 | scatter3(obj.position(1),obj.position(2),obj.position(3),5,'filled','MarkerEdgeColor',[0 0 0],'MarkerFaceColor',[0 0 0]); 3 | rotm = eul2rotm(obj.angle); 4 | oPt = obj.position; 5 | xPt = (obj.position + (rotm * [1,0,0]')') ; 6 | yPt = (obj.position + (rotm * [0,1,0]')'); 7 | zPt = (obj.position + (rotm * [0,0,1]')'); 8 | line([oPt(1) xPt(1)],[oPt(2) xPt(2)],[oPt(3) xPt(3)],'Color','red'); 9 | line([oPt(1) yPt(1)],[oPt(2) yPt(2)],[oPt(3) yPt(3)],'Color','green'); 10 | line([oPt(1) zPt(1)],[oPt(2) zPt(2)],[oPt(3) zPt(3)],'Color','blue'); 11 | axis equal; 12 | xlim([-10,10]); xlabel('x'); 13 | ylim([-10,10]); ylabel('y'); 14 | zlim([0,20]); zlabel('z'); 15 | end 16 | -------------------------------------------------------------------------------- /plot_path.m: -------------------------------------------------------------------------------- 1 | function plot_path(waypoints,path_c,time) 2 | hold on; 3 | for i = 1:numel(waypoints) 4 | scatter3(waypoints{i}.position(1),waypoints{i}.position(2),waypoints{i}.position(3),5,'filled','MarkerEdgeColor',[0 0 0],'MarkerFaceColor',[0 0 0]); 5 | end 6 | t = 0:0.01:time; 7 | x = path_c(1) * t.^4 + path_c(2) * t.^3 + path_c(3) * t.^2 + path_c(4) * t + path_c(5); 8 | y = path_c(6) * t.^4 + path_c(7) * t.^3 + path_c(8) * t.^2 + path_c(9) * t + path_c(10); 9 | z = path_c(11) * t.^4 + path_c(12) * t.^3 + path_c(13) * t.^2 + path_c(14) * t + path_c(15); 10 | yaw = path_c(16) * t.^2 + path_c(17) * t + path_c(18); 11 | plot3(x,y,z,'k'); axis equal; 12 | hold off; 13 | end -------------------------------------------------------------------------------- /time_optimal_path_planner.m: -------------------------------------------------------------------------------- 1 | function [waypoints,path_c,opt_time] = time_optimal_path_planner(mav,tgt,ts) 2 | g = 9.80665; 3 | time = exp(-2.5:0.1:3); 4 | tic; 5 | for i = 1:length(time) 6 | [waypoints,path_c] = path_planner(mav,tgt,time(i)); 7 | % x = path_c(1) * t.^4 + path_c(2) * t.^3 + path_c(3) * t.^2 + path_c(4) * t + path_c(5); 8 | % y = path_c(6) * t.^4 + path_c(7) * t.^3 + path_c(8) * t.^2 + path_c(9) * t + path_c(10); 9 | % z = path_c(11) * t.^4 + path_c(12) * t.^3 + path_c(13) * t.^2 + path_c(14) * t + path_c(15); 10 | % x_p = 4 * path_c(1) * t.^3 + 3 * path_c(2) * t.^2 + 2 * path_c(3) * t + path_c(4); 11 | % y_p = 4 * path_c(6) * t.^3 + 3 * path_c(7) * t.^2 + 2 * path_c(8) * t + path_c(9); 12 | % z_p = 4 * path_c(11) * t.^3 + 3 * path_c(12) * t.^2 + 2 * path_c(13) * t + path_c(14); 13 | x_pp = 2 * path_c(3); 14 | y_pp = 2 * path_c(8); 15 | % acceleration on xy-plane 16 | xy_pp = sqrt(x_pp.^2 + y_pp.^2); 17 | % acceleration on z-axis 18 | z_pp = 2 * path_c(13) + g; 19 | % we only use the first frame because it only generate control input at the next single sampling time 20 | pitch = atan2(xy_pp,z_pp); 21 | opt_time = time(i); 22 | if abs(pitch) <= pi/12 23 | break; 24 | end 25 | end 26 | toc; 27 | end 28 | 29 | --------------------------------------------------------------------------------