├── .gitattributes
├── .gitignore
├── AndroidManifest.xml
├── README.md
├── gen
└── com
│ └── cllin
│ └── matrixcomputation
│ ├── BuildConfig.java
│ ├── R.java
│ └── computation
│ └── ScriptC_multiplication.java
├── ic_launcher-web.png
├── jni
├── Android.mk
├── Application.mk
├── Eigen
│ ├── CMakeLists.txt
│ ├── Cholesky
│ ├── Core
│ ├── Dense
│ ├── Eigen
│ ├── Eigenvalues
│ ├── Geometry
│ ├── Householder
│ ├── Jacobi
│ ├── LU
│ ├── QR
│ ├── SVD
│ └── src
│ │ ├── CMakeLists.txt
│ │ ├── Cholesky
│ │ ├── CMakeLists.txt
│ │ ├── LDLT.h
│ │ ├── LLT.h
│ │ └── LLT_MKL.h
│ │ ├── Core
│ │ ├── Array.h
│ │ ├── ArrayBase.h
│ │ ├── ArrayWrapper.h
│ │ ├── Assign.h
│ │ ├── Assign_MKL.h
│ │ ├── BandMatrix.h
│ │ ├── Block.h
│ │ ├── BooleanRedux.h
│ │ ├── CMakeLists.txt
│ │ ├── CommaInitializer.h
│ │ ├── CwiseBinaryOp.h
│ │ ├── CwiseNullaryOp.h
│ │ ├── CwiseUnaryOp.h
│ │ ├── CwiseUnaryView.h
│ │ ├── DenseBase.h
│ │ ├── DenseCoeffsBase.h
│ │ ├── DenseStorage.h
│ │ ├── Diagonal.h
│ │ ├── DiagonalMatrix.h
│ │ ├── DiagonalProduct.h
│ │ ├── Dot.h
│ │ ├── EigenBase.h
│ │ ├── Flagged.h
│ │ ├── ForceAlignedAccess.h
│ │ ├── Functors.h
│ │ ├── Fuzzy.h
│ │ ├── GeneralProduct.h
│ │ ├── GenericPacketMath.h
│ │ ├── GlobalFunctions.h
│ │ ├── IO.h
│ │ ├── Map.h
│ │ ├── MapBase.h
│ │ ├── MathFunctions.h
│ │ ├── Matrix.h
│ │ ├── MatrixBase.h
│ │ ├── NestByValue.h
│ │ ├── NoAlias.h
│ │ ├── NumTraits.h
│ │ ├── PermutationMatrix.h
│ │ ├── PlainObjectBase.h
│ │ ├── Product.h
│ │ ├── ProductBase.h
│ │ ├── Random.h
│ │ ├── Redux.h
│ │ ├── Replicate.h
│ │ ├── ReturnByValue.h
│ │ ├── Reverse.h
│ │ ├── Select.h
│ │ ├── SelfAdjointView.h
│ │ ├── SelfCwiseBinaryOp.h
│ │ ├── SolveTriangular.h
│ │ ├── StableNorm.h
│ │ ├── Stride.h
│ │ ├── Swap.h
│ │ ├── Transpose.h
│ │ ├── Transpositions.h
│ │ ├── TriangularMatrix.h
│ │ ├── VectorBlock.h
│ │ ├── VectorwiseOp.h
│ │ ├── Visitor.h
│ │ ├── arch
│ │ │ ├── AltiVec
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── Complex.h
│ │ │ │ └── PacketMath.h
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Default
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── Settings.h
│ │ │ ├── NEON
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── Complex.h
│ │ │ │ └── PacketMath.h
│ │ │ └── SSE
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── Complex.h
│ │ │ │ ├── MathFunctions.h
│ │ │ │ └── PacketMath.h
│ │ ├── products
│ │ │ ├── CMakeLists.txt
│ │ │ ├── CoeffBasedProduct.h
│ │ │ ├── GeneralBlockPanelKernel.h
│ │ │ ├── GeneralMatrixMatrix.h
│ │ │ ├── GeneralMatrixMatrixTriangular.h
│ │ │ ├── GeneralMatrixMatrixTriangular_MKL.h
│ │ │ ├── GeneralMatrixMatrix_MKL.h
│ │ │ ├── GeneralMatrixVector.h
│ │ │ ├── GeneralMatrixVector_MKL.h
│ │ │ ├── Parallelizer.h
│ │ │ ├── SelfadjointMatrixMatrix.h
│ │ │ ├── SelfadjointMatrixMatrix_MKL.h
│ │ │ ├── SelfadjointMatrixVector.h
│ │ │ ├── SelfadjointMatrixVector_MKL.h
│ │ │ ├── SelfadjointProduct.h
│ │ │ ├── SelfadjointRank2Update.h
│ │ │ ├── TriangularMatrixMatrix.h
│ │ │ ├── TriangularMatrixMatrix_MKL.h
│ │ │ ├── TriangularMatrixVector.h
│ │ │ ├── TriangularMatrixVector_MKL.h
│ │ │ ├── TriangularSolverMatrix.h
│ │ │ ├── TriangularSolverMatrix_MKL.h
│ │ │ └── TriangularSolverVector.h
│ │ └── util
│ │ │ ├── BlasUtil.h
│ │ │ ├── CMakeLists.txt
│ │ │ ├── Constants.h
│ │ │ ├── DisableStupidWarnings.h
│ │ │ ├── ForwardDeclarations.h
│ │ │ ├── MKL_support.h
│ │ │ ├── Macros.h
│ │ │ ├── Memory.h
│ │ │ ├── Meta.h
│ │ │ ├── NonMPL2.h
│ │ │ ├── ReenableStupidWarnings.h
│ │ │ ├── StaticAssert.h
│ │ │ └── XprHelper.h
│ │ ├── Eigenvalues
│ │ ├── CMakeLists.txt
│ │ ├── ComplexEigenSolver.h
│ │ ├── ComplexSchur.h
│ │ ├── ComplexSchur_MKL.h
│ │ ├── EigenSolver.h
│ │ ├── GeneralizedSelfAdjointEigenSolver.h
│ │ ├── HessenbergDecomposition.h
│ │ ├── MatrixBaseEigenvalues.h
│ │ ├── RealSchur.h
│ │ ├── RealSchur_MKL.h
│ │ ├── SelfAdjointEigenSolver.h
│ │ ├── SelfAdjointEigenSolver_MKL.h
│ │ └── Tridiagonalization.h
│ │ ├── Geometry
│ │ ├── AlignedBox.h
│ │ ├── AngleAxis.h
│ │ ├── CMakeLists.txt
│ │ ├── EulerAngles.h
│ │ ├── Homogeneous.h
│ │ ├── Hyperplane.h
│ │ ├── OrthoMethods.h
│ │ ├── ParametrizedLine.h
│ │ ├── Quaternion.h
│ │ ├── Rotation2D.h
│ │ ├── RotationBase.h
│ │ ├── Scaling.h
│ │ ├── Transform.h
│ │ ├── Translation.h
│ │ ├── Umeyama.h
│ │ └── arch
│ │ │ ├── CMakeLists.txt
│ │ │ └── Geometry_SSE.h
│ │ ├── Householder
│ │ ├── BlockHouseholder.h
│ │ ├── CMakeLists.txt
│ │ ├── Householder.h
│ │ └── HouseholderSequence.h
│ │ ├── Jacobi
│ │ ├── CMakeLists.txt
│ │ └── Jacobi.h
│ │ ├── LU
│ │ ├── CMakeLists.txt
│ │ ├── Determinant.h
│ │ ├── FullPivLU.h
│ │ ├── Inverse.h
│ │ ├── PartialPivLU.h
│ │ ├── PartialPivLU_MKL.h
│ │ └── arch
│ │ │ ├── CMakeLists.txt
│ │ │ └── Inverse_SSE.h
│ │ ├── QR
│ │ ├── CMakeLists.txt
│ │ ├── ColPivHouseholderQR.h
│ │ ├── ColPivHouseholderQR_MKL.h
│ │ ├── FullPivHouseholderQR.h
│ │ ├── HouseholderQR.h
│ │ └── HouseholderQR_MKL.h
│ │ ├── SVD
│ │ ├── CMakeLists.txt
│ │ ├── JacobiSVD.h
│ │ ├── JacobiSVD_MKL.h
│ │ └── UpperBidiagonalization.h
│ │ ├── misc
│ │ ├── CMakeLists.txt
│ │ ├── Image.h
│ │ ├── Kernel.h
│ │ ├── Solve.h
│ │ ├── SparseSolve.h
│ │ └── blas.h
│ │ └── plugins
│ │ ├── ArrayCwiseBinaryOps.h
│ │ ├── ArrayCwiseUnaryOps.h
│ │ ├── BlockMethods.h
│ │ ├── CMakeLists.txt
│ │ ├── CommonCwiseBinaryOps.h
│ │ ├── CommonCwiseUnaryOps.h
│ │ ├── MatrixCwiseBinaryOps.h
│ │ └── MatrixCwiseUnaryOps.h
├── MatrixFromEigen.cpp
└── MatrixFromNative.cpp
├── libs
├── android-support-v4.jar
├── armeabi
│ ├── libmatrixfromeigen.so
│ ├── libmatrixfromnative.so
│ └── libopencv_core.a
└── opencvlibrary-2.4.6.jar
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── layout
│ ├── activity_benchmark.xml
│ ├── checkbox_implementations.xml
│ ├── checkbox_matixsizes.xml
│ └── separator.xml
├── menu
│ └── main.xml
├── values-sw600dp
│ └── dimens.xml
├── values-sw720dp-land
│ └── dimens.xml
├── values-v11
│ └── styles.xml
├── values-v14
│ └── styles.xml
└── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── cllin
└── matrixcomputation
├── activity
├── BenchmarkActivity.java
└── BenchmarkApplication.java
├── benchmark
└── MatrixComputationBenchmark.java
├── computation
├── EigenMatrixComputation.java
├── JavaMatrixComputation.java
├── MatrixComputation.java
├── OpenCVMatrixComputation.java
├── RenderScriptComputation.java
├── SuperMatrixComputation.java
└── multiplication.rs
├── data
├── BenchmarkResult.java
└── Script.java
├── runnable
└── BenchmarkRunnable.java
└── utility
├── MatrixFactory.java
├── RecordWriter.java
└── TimeRecorder.java
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #################
2 | ## Eclipse
3 | #################
4 |
5 | *.pydevproject
6 | .project
7 | .metadata
8 | bin/
9 | tmp/
10 | *.tmp
11 | *.bak
12 | *.swp
13 | *~.nib
14 | local.properties
15 | .classpath
16 | .settings/
17 | .loadpath
18 |
19 | # External tool builders
20 | .externalToolBuilders/
21 |
22 | # Locally stored "Eclipse launch configurations"
23 | *.launch
24 |
25 | # CDT-specific
26 | .cproject
27 |
28 | # PDT-specific
29 | .buildpath
30 |
31 |
32 | #################
33 | ## Visual Studio
34 | #################
35 |
36 | ## Ignore Visual Studio temporary files, build results, and
37 | ## files generated by popular Visual Studio add-ons.
38 |
39 | # User-specific files
40 | *.suo
41 | *.user
42 | *.sln.docstates
43 |
44 | # Build results
45 |
46 | [Dd]ebug/
47 | [Rr]elease/
48 | x64/
49 | build/
50 | [Bb]in/
51 | [Oo]bj/
52 |
53 | # MSTest test Results
54 | [Tt]est[Rr]esult*/
55 | [Bb]uild[Ll]og.*
56 |
57 | *_i.c
58 | *_p.c
59 | *.ilk
60 | *.meta
61 | *.obj
62 | *.pch
63 | *.pdb
64 | *.pgc
65 | *.pgd
66 | *.rsp
67 | *.sbr
68 | *.tlb
69 | *.tli
70 | *.tlh
71 | *.tmp
72 | *.tmp_proj
73 | *.log
74 | *.vspscc
75 | *.vssscc
76 | .builds
77 | *.pidb
78 | *.log
79 | *.scc
80 |
81 | # Visual C++ cache files
82 | ipch/
83 | *.aps
84 | *.ncb
85 | *.opensdf
86 | *.sdf
87 | *.cachefile
88 |
89 | # Visual Studio profiler
90 | *.psess
91 | *.vsp
92 | *.vspx
93 |
94 | # Guidance Automation Toolkit
95 | *.gpState
96 |
97 | # ReSharper is a .NET coding add-in
98 | _ReSharper*/
99 | *.[Rr]e[Ss]harper
100 |
101 | # TeamCity is a build add-in
102 | _TeamCity*
103 |
104 | # DotCover is a Code Coverage Tool
105 | *.dotCover
106 |
107 | # NCrunch
108 | *.ncrunch*
109 | .*crunch*.local.xml
110 |
111 | # Installshield output folder
112 | [Ee]xpress/
113 |
114 | # DocProject is a documentation generator add-in
115 | DocProject/buildhelp/
116 | DocProject/Help/*.HxT
117 | DocProject/Help/*.HxC
118 | DocProject/Help/*.hhc
119 | DocProject/Help/*.hhk
120 | DocProject/Help/*.hhp
121 | DocProject/Help/Html2
122 | DocProject/Help/html
123 |
124 | # Click-Once directory
125 | publish/
126 |
127 | # Publish Web Output
128 | *.Publish.xml
129 | *.pubxml
130 |
131 | # NuGet Packages Directory
132 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line
133 | #packages/
134 |
135 | # Windows Azure Build Output
136 | csx
137 | *.build.csdef
138 |
139 | # Windows Store app package directory
140 | AppPackages/
141 |
142 | # Others
143 | sql/
144 | *.Cache
145 | ClientBin/
146 | [Ss]tyle[Cc]op.*
147 | ~$*
148 | *~
149 | *.dbmdl
150 | *.[Pp]ublish.xml
151 | *.pfx
152 | *.publishsettings
153 |
154 | # RIA/Silverlight projects
155 | Generated_Code/
156 |
157 | # Backup & report files from converting an old project file to a newer
158 | # Visual Studio version. Backup files are not needed, because we have git ;-)
159 | _UpgradeReport_Files/
160 | Backup*/
161 | UpgradeLog*.XML
162 | UpgradeLog*.htm
163 |
164 | # SQL Server files
165 | App_Data/*.mdf
166 | App_Data/*.ldf
167 |
168 | #############
169 | ## Windows detritus
170 | #############
171 |
172 | # Windows image file caches
173 | Thumbs.db
174 | ehthumbs.db
175 |
176 | # Folder config file
177 | Desktop.ini
178 |
179 | # Recycle Bin used on file shares
180 | $RECYCLE.BIN/
181 |
182 | # Mac crap
183 | .DS_Store
184 |
185 |
186 | #############
187 | ## Python
188 | #############
189 |
190 | *.py[co]
191 |
192 | # Packages
193 | *.egg
194 | *.egg-info
195 | dist/
196 | build/
197 | eggs/
198 | parts/
199 | var/
200 | sdist/
201 | develop-eggs/
202 | .installed.cfg
203 |
204 | # Installer logs
205 | pip-log.txt
206 |
207 | # Unit test / coverage reports
208 | .coverage
209 | .tox
210 |
211 | #Translations
212 | *.mo
213 |
214 | #Mr Developer
215 | .mr.developer.cfg
216 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
21 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MatrixComputation
2 |
3 | *The project performs a benchmark test for matrices computation in Java, C++, Eigen, OpenCV, RenderScript on Android platform*
4 |
5 | *The purpose of this application is not to compare the performance of algorithms performing matrix multiplication. All computations are implemented in naive way*
6 |
7 | ======
8 | ### CONTENT
9 | 1. [Application Manifest] (#1)
10 | 2. [Java] (#2)
11 | 3. [C++] (#3)
12 | 4. [OpenCV] (#4)
13 | 5. [Eigen] (#5)
14 | 6. [RenderScript] (#6)
15 | 7. [Contacts] (#7)
16 |
17 | ======
18 | ### APPLICATION MANIFEST
19 | - Target SDK Version: 19
20 | - Minimum SDK Version: 16
21 | - Uses Permission
22 | - android.permission.READ_EXTERNAL_STORAGE
23 | - android.permission.WRITE_EXTERNAL_STORAGE
24 | - android.permission.READ_LOGS
25 |
26 |
27 | ### Java
28 | This is the simplest way to perform matrices computation on Android devices. Yet, the performance is the worst among all approaches demonstrated in this application.
29 |
30 | ### C++
31 | This approach is faster than Java. Note that [Java Native Interface](http://docs.oracle.com/javase/7/docs/technotes/guides/jni/) is needed in order to run native code in Android applications.
32 |
33 | ### OpenCV
34 | [OpenCV](http://opencv.org/) is common library for mathematic computations. Details and tutorial about [OpenCV on Android] (http://opencv.org/platforms/android.html) can be found [here] (http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html).
35 | ***NOTE*** *OpenCV is not available in release 1.2*
36 |
37 | ### Eigen
38 | [Eigen] (http://eigen.tuxfamily.org/index.php?title=Main_Page) is another choice for computation. Eigen usually outperform OpenCV on Android devices.
39 |
40 | ### RenderScript
41 | [RenderScript] (http://developer.android.com/guide/topics/renderscript/compute.html) is a framework for running computationally intensive tasks at high performance on Android, usually used for image processing on Android devices. It accelerates the computation by running on GPUs. Please note that RenderScript is device-dependent. Version problem limits the compatibility of RenderScript.
42 |
43 | ======
44 | ### Contacts
45 | Ching-Lun Lin,
46 | clallenlin@sv.cmu.edu, 2014
47 |
--------------------------------------------------------------------------------
/gen/com/cllin/matrixcomputation/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package com.cllin.matrixcomputation;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cllin/MatrixComputation/ad9fb0f956883905458e1c3a5112db615d34a2ca/ic_launcher-web.png
--------------------------------------------------------------------------------
/jni/Android.mk:
--------------------------------------------------------------------------------
1 | LOCAL_PATH := $(call my-dir)
2 |
3 | # Build a shared library from MatrixFromNative.cpp
4 | include $(CLEAR_VARS)
5 | LOCAL_MODULE := matrixfromnative
6 | LOCAL_SRC_FILES := MatrixFromNative.cpp
7 | LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
8 | include $(BUILD_SHARED_LIBRARY)
9 |
10 | # Eigen
11 | include $(CLEAR_VARS)
12 | LOCAL_MODULE := matrixfromeigen
13 | LOCAL_SRC_FILES := MatrixFromEigen.cpp
14 | LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
15 | include $(BUILD_SHARED_LIBRARY)
16 |
17 | # RenderScript
18 | LOCAL_PATH := $(call my-dir)
19 | include $(CLEAR_VARS)
20 | LOCAL_MODULE_TAGS := optional
21 | LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
22 | LOCAL_PACKAGE_NAME := MatrixMultiplicationRS
23 | include $(BUILD_PACKAGE)
--------------------------------------------------------------------------------
/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_STL := stlport_static
--------------------------------------------------------------------------------
/jni/Eigen/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | include(RegexUtils)
2 | test_escape_string_as_regex()
3 |
4 | file(GLOB Eigen_directory_files "*")
5 |
6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
7 |
8 | foreach(f ${Eigen_directory_files})
9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src")
10 | list(APPEND Eigen_directory_files_to_install ${f})
11 | endif()
12 | endforeach(f ${Eigen_directory_files})
13 |
14 | install(FILES
15 | ${Eigen_directory_files_to_install}
16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel
17 | )
18 |
19 | add_subdirectory(src)
20 |
--------------------------------------------------------------------------------
/jni/Eigen/Cholesky:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_CHOLESKY_MODULE_H
2 | #define EIGEN_CHOLESKY_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup Cholesky_Module Cholesky module
9 | *
10 | *
11 | *
12 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices.
13 | * Those decompositions are accessible via the following MatrixBase methods:
14 | * - MatrixBase::llt(),
15 | * - MatrixBase::ldlt()
16 | *
17 | * \code
18 | * #include
19 | * \endcode
20 | */
21 |
22 | #include "src/misc/Solve.h"
23 | #include "src/Cholesky/LLT.h"
24 | #include "src/Cholesky/LDLT.h"
25 | #ifdef EIGEN_USE_LAPACKE
26 | #include "src/Cholesky/LLT_MKL.h"
27 | #endif
28 |
29 | #include "src/Core/util/ReenableStupidWarnings.h"
30 |
31 | #endif // EIGEN_CHOLESKY_MODULE_H
32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
33 |
--------------------------------------------------------------------------------
/jni/Eigen/Dense:
--------------------------------------------------------------------------------
1 | #include "Core"
2 | #include "LU"
3 | #include "Cholesky"
4 | #include "QR"
5 | #include "SVD"
6 | #include "Geometry"
7 | #include "Eigenvalues"
--------------------------------------------------------------------------------
/jni/Eigen/Eigen:
--------------------------------------------------------------------------------
1 | #include "Dense"
2 | //#include "Sparse"
3 |
--------------------------------------------------------------------------------
/jni/Eigen/Eigenvalues:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_EIGENVALUES_MODULE_H
2 | #define EIGEN_EIGENVALUES_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include "Cholesky"
9 | #include "Jacobi"
10 | #include "Householder"
11 | #include "LU"
12 | #include "Geometry"
13 |
14 | /** \defgroup Eigenvalues_Module Eigenvalues module
15 | *
16 | *
17 | *
18 | * This module mainly provides various eigenvalue solvers.
19 | * This module also provides some MatrixBase methods, including:
20 | * - MatrixBase::eigenvalues(),
21 | * - MatrixBase::operatorNorm()
22 | *
23 | * \code
24 | * #include
25 | * \endcode
26 | */
27 |
28 | #include "src/Eigenvalues/Tridiagonalization.h"
29 | #include "src/Eigenvalues/RealSchur.h"
30 | #include "src/Eigenvalues/EigenSolver.h"
31 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h"
32 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h"
33 | #include "src/Eigenvalues/HessenbergDecomposition.h"
34 | #include "src/Eigenvalues/ComplexSchur.h"
35 | #include "src/Eigenvalues/ComplexEigenSolver.h"
36 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h"
37 | #ifdef EIGEN_USE_LAPACKE
38 | #include "src/Eigenvalues/RealSchur_MKL.h"
39 | #include "src/Eigenvalues/ComplexSchur_MKL.h"
40 | #include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h"
41 | #endif
42 |
43 | #include "src/Core/util/ReenableStupidWarnings.h"
44 |
45 | #endif // EIGEN_EIGENVALUES_MODULE_H
46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
47 |
--------------------------------------------------------------------------------
/jni/Eigen/Geometry:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_GEOMETRY_MODULE_H
2 | #define EIGEN_GEOMETRY_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include "SVD"
9 | #include "LU"
10 | #include
11 |
12 | #ifndef M_PI
13 | #define M_PI 3.14159265358979323846
14 | #endif
15 |
16 | /** \defgroup Geometry_Module Geometry module
17 | *
18 | *
19 | *
20 | * This module provides support for:
21 | * - fixed-size homogeneous transformations
22 | * - translation, scaling, 2D and 3D rotations
23 | * - quaternions
24 | * - \ref MatrixBase::cross() "cross product"
25 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation"
26 | * - some linear components: parametrized-lines and hyperplanes
27 | *
28 | * \code
29 | * #include
30 | * \endcode
31 | */
32 |
33 | #include "src/Geometry/OrthoMethods.h"
34 | #include "src/Geometry/EulerAngles.h"
35 |
36 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
37 | #include "src/Geometry/Homogeneous.h"
38 | #include "src/Geometry/RotationBase.h"
39 | #include "src/Geometry/Rotation2D.h"
40 | #include "src/Geometry/Quaternion.h"
41 | #include "src/Geometry/AngleAxis.h"
42 | #include "src/Geometry/Transform.h"
43 | #include "src/Geometry/Translation.h"
44 | #include "src/Geometry/Scaling.h"
45 | #include "src/Geometry/Hyperplane.h"
46 | #include "src/Geometry/ParametrizedLine.h"
47 | #include "src/Geometry/AlignedBox.h"
48 | #include "src/Geometry/Umeyama.h"
49 |
50 | #if defined EIGEN_VECTORIZE_SSE
51 | #include "src/Geometry/arch/Geometry_SSE.h"
52 | #endif
53 | #endif
54 |
55 | #ifdef EIGEN2_SUPPORT
56 | #include "src/Eigen2Support/Geometry/All.h"
57 | #endif
58 |
59 | #include "src/Core/util/ReenableStupidWarnings.h"
60 |
61 | #endif // EIGEN_GEOMETRY_MODULE_H
62 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
63 |
64 |
--------------------------------------------------------------------------------
/jni/Eigen/Householder:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H
2 | #define EIGEN_HOUSEHOLDER_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup Householder_Module Householder module
9 | * This module provides Householder transformations.
10 | *
11 | * \code
12 | * #include
13 | * \endcode
14 | */
15 |
16 | #include "src/Householder/Householder.h"
17 | #include "src/Householder/HouseholderSequence.h"
18 | #include "src/Householder/BlockHouseholder.h"
19 |
20 | #include "src/Core/util/ReenableStupidWarnings.h"
21 |
22 | #endif // EIGEN_HOUSEHOLDER_MODULE_H
23 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
24 |
--------------------------------------------------------------------------------
/jni/Eigen/Jacobi:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_JACOBI_MODULE_H
2 | #define EIGEN_JACOBI_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup Jacobi_Module Jacobi module
9 | * This module provides Jacobi and Givens rotations.
10 | *
11 | * \code
12 | * #include
13 | * \endcode
14 | *
15 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation:
16 | * - MatrixBase::applyOnTheLeft()
17 | * - MatrixBase::applyOnTheRight().
18 | */
19 |
20 | #include "src/Jacobi/Jacobi.h"
21 |
22 | #include "src/Core/util/ReenableStupidWarnings.h"
23 |
24 | #endif // EIGEN_JACOBI_MODULE_H
25 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
26 |
27 |
--------------------------------------------------------------------------------
/jni/Eigen/LU:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_LU_MODULE_H
2 | #define EIGEN_LU_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | /** \defgroup LU_Module LU module
9 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant.
10 | * This module defines the following MatrixBase methods:
11 | * - MatrixBase::inverse()
12 | * - MatrixBase::determinant()
13 | *
14 | * \code
15 | * #include
16 | * \endcode
17 | */
18 |
19 | #include "src/misc/Solve.h"
20 | #include "src/misc/Kernel.h"
21 | #include "src/misc/Image.h"
22 | #include "src/LU/FullPivLU.h"
23 | #include "src/LU/PartialPivLU.h"
24 | #ifdef EIGEN_USE_LAPACKE
25 | #include "src/LU/PartialPivLU_MKL.h"
26 | #endif
27 | #include "src/LU/Determinant.h"
28 | #include "src/LU/Inverse.h"
29 |
30 | #if defined EIGEN_VECTORIZE_SSE
31 | #include "src/LU/arch/Inverse_SSE.h"
32 | #endif
33 |
34 | #ifdef EIGEN2_SUPPORT
35 | #include "src/Eigen2Support/LU.h"
36 | #endif
37 |
38 | #include "src/Core/util/ReenableStupidWarnings.h"
39 |
40 | #endif // EIGEN_LU_MODULE_H
41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
42 |
--------------------------------------------------------------------------------
/jni/Eigen/QR:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_QR_MODULE_H
2 | #define EIGEN_QR_MODULE_H
3 |
4 | #include "Core"
5 |
6 | #include "src/Core/util/DisableStupidWarnings.h"
7 |
8 | #include "Cholesky"
9 | #include "Jacobi"
10 | #include "Householder"
11 |
12 | /** \defgroup QR_Module QR module
13 | *
14 | *
15 | *
16 | * This module provides various QR decompositions
17 | * This module also provides some MatrixBase methods, including:
18 | * - MatrixBase::qr(),
19 | *
20 | * \code
21 | * #include
22 | * \endcode
23 | */
24 |
25 | #include "src/misc/Solve.h"
26 | #include "src/QR/HouseholderQR.h"
27 | #include "src/QR/FullPivHouseholderQR.h"
28 | #include "src/QR/ColPivHouseholderQR.h"
29 | #ifdef EIGEN_USE_LAPACKE
30 | #include "src/QR/HouseholderQR_MKL.h"
31 | #include "src/QR/ColPivHouseholderQR_MKL.h"
32 | #endif
33 |
34 | #ifdef EIGEN2_SUPPORT
35 | #include "src/Eigen2Support/QR.h"
36 | #endif
37 |
38 | #include "src/Core/util/ReenableStupidWarnings.h"
39 |
40 | #ifdef EIGEN2_SUPPORT
41 | #include "Eigenvalues"
42 | #endif
43 |
44 | #endif // EIGEN_QR_MODULE_H
45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
46 |
--------------------------------------------------------------------------------
/jni/Eigen/SVD:
--------------------------------------------------------------------------------
1 | #ifndef EIGEN_SVD_MODULE_H
2 | #define EIGEN_SVD_MODULE_H
3 |
4 | #include "QR"
5 | #include "Householder"
6 | #include "Jacobi"
7 |
8 | #include "src/Core/util/DisableStupidWarnings.h"
9 |
10 | /** \defgroup SVD_Module SVD module
11 | *
12 | *
13 | *
14 | * This module provides SVD decomposition for matrices (both real and complex).
15 | * This decomposition is accessible via the following MatrixBase method:
16 | * - MatrixBase::jacobiSvd()
17 | *
18 | * \code
19 | * #include
20 | * \endcode
21 | */
22 |
23 | #include "src/misc/Solve.h"
24 | #include "src/SVD/JacobiSVD.h"
25 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
26 | #include "src/SVD/JacobiSVD_MKL.h"
27 | #endif
28 | #include "src/SVD/UpperBidiagonalization.h"
29 |
30 | #ifdef EIGEN2_SUPPORT
31 | #include "src/Eigen2Support/SVD.h"
32 | #endif
33 |
34 | #include "src/Core/util/ReenableStupidWarnings.h"
35 |
36 | #endif // EIGEN_SVD_MODULE_H
37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */
38 |
--------------------------------------------------------------------------------
/jni/Eigen/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | file(GLOB Eigen_src_subdirectories "*")
2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
3 | foreach(f ${Eigen_src_subdirectories})
4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" )
5 | add_subdirectory(${f})
6 | endif()
7 | endforeach()
8 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Cholesky/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h")
2 |
3 | INSTALL(FILES
4 | ${Eigen_Cholesky_SRCS}
5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel
6 | )
7 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Cholesky/LLT_MKL.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2011, Intel Corporation. All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification,
5 | are permitted provided that the following conditions are met:
6 |
7 | * Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright notice,
10 | this list of conditions and the following disclaimer in the documentation
11 | and/or other materials provided with the distribution.
12 | * Neither the name of Intel Corporation nor the names of its contributors may
13 | be used to endorse or promote products derived from this software without
14 | specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
27 | ********************************************************************************
28 | * Content : Eigen bindings to Intel(R) MKL
29 | * LLt decomposition based on LAPACKE_?potrf function.
30 | ********************************************************************************
31 | */
32 |
33 | #ifndef EIGEN_LLT_MKL_H
34 | #define EIGEN_LLT_MKL_H
35 |
36 | #include "Eigen/src/Core/util/MKL_support.h"
37 | #include
38 |
39 | namespace Eigen {
40 |
41 | namespace internal {
42 |
43 | template struct mkl_llt;
44 |
45 | #define EIGEN_MKL_LLT(EIGTYPE, MKLTYPE, MKLPREFIX) \
46 | template<> struct mkl_llt \
47 | { \
48 | template \
49 | static inline typename MatrixType::Index potrf(MatrixType& m, char uplo) \
50 | { \
51 | lapack_int matrix_order; \
52 | lapack_int size, lda, info, StorageOrder; \
53 | EIGTYPE* a; \
54 | eigen_assert(m.rows()==m.cols()); \
55 | /* Set up parameters for ?potrf */ \
56 | size = m.rows(); \
57 | StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \
58 | matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \
59 | a = &(m.coeffRef(0,0)); \
60 | lda = m.outerStride(); \
61 | \
62 | info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \
63 | info = (info==0) ? Success : NumericalIssue; \
64 | return info; \
65 | } \
66 | }; \
67 | template<> struct llt_inplace \
68 | { \
69 | template \
70 | static typename MatrixType::Index blocked(MatrixType& m) \
71 | { \
72 | return mkl_llt::potrf(m, 'L'); \
73 | } \
74 | template \
75 | static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
76 | { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \
77 | }; \
78 | template<> struct llt_inplace \
79 | { \
80 | template \
81 | static typename MatrixType::Index blocked(MatrixType& m) \
82 | { \
83 | return mkl_llt::potrf(m, 'U'); \
84 | } \
85 | template \
86 | static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \
87 | { \
88 | Transpose matt(mat); \
89 | return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); \
90 | } \
91 | };
92 |
93 | EIGEN_MKL_LLT(double, double, d)
94 | EIGEN_MKL_LLT(float, float, s)
95 | EIGEN_MKL_LLT(dcomplex, MKL_Complex16, z)
96 | EIGEN_MKL_LLT(scomplex, MKL_Complex8, c)
97 |
98 | } // end namespace internal
99 |
100 | } // end namespace Eigen
101 |
102 | #endif // EIGEN_LLT_MKL_H
103 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/BooleanRedux.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_ALLANDANY_H
11 | #define EIGEN_ALLANDANY_H
12 |
13 | namespace Eigen {
14 |
15 | namespace internal {
16 |
17 | template
18 | struct all_unroller
19 | {
20 | enum {
21 | col = (UnrollCount-1) / Derived::RowsAtCompileTime,
22 | row = (UnrollCount-1) % Derived::RowsAtCompileTime
23 | };
24 |
25 | static inline bool run(const Derived &mat)
26 | {
27 | return all_unroller::run(mat) && mat.coeff(row, col);
28 | }
29 | };
30 |
31 | template
32 | struct all_unroller
33 | {
34 | static inline bool run(const Derived &mat) { return mat.coeff(0, 0); }
35 | };
36 |
37 | template
38 | struct all_unroller
39 | {
40 | static inline bool run(const Derived &) { return false; }
41 | };
42 |
43 | template
44 | struct any_unroller
45 | {
46 | enum {
47 | col = (UnrollCount-1) / Derived::RowsAtCompileTime,
48 | row = (UnrollCount-1) % Derived::RowsAtCompileTime
49 | };
50 |
51 | static inline bool run(const Derived &mat)
52 | {
53 | return any_unroller::run(mat) || mat.coeff(row, col);
54 | }
55 | };
56 |
57 | template
58 | struct any_unroller
59 | {
60 | static inline bool run(const Derived &mat) { return mat.coeff(0, 0); }
61 | };
62 |
63 | template
64 | struct any_unroller
65 | {
66 | static inline bool run(const Derived &) { return false; }
67 | };
68 |
69 | } // end namespace internal
70 |
71 | /** \returns true if all coefficients are true
72 | *
73 | * Example: \include MatrixBase_all.cpp
74 | * Output: \verbinclude MatrixBase_all.out
75 | *
76 | * \sa any(), Cwise::operator<()
77 | */
78 | template
79 | inline bool DenseBase::all() const
80 | {
81 | enum {
82 | unroll = SizeAtCompileTime != Dynamic
83 | && CoeffReadCost != Dynamic
84 | && NumTraits::AddCost != Dynamic
85 | && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT
86 | };
87 | if(unroll)
88 | return internal::all_unroller::run(derived());
91 | else
92 | {
93 | for(Index j = 0; j < cols(); ++j)
94 | for(Index i = 0; i < rows(); ++i)
95 | if (!coeff(i, j)) return false;
96 | return true;
97 | }
98 | }
99 |
100 | /** \returns true if at least one coefficient is true
101 | *
102 | * \sa all()
103 | */
104 | template
105 | inline bool DenseBase::any() const
106 | {
107 | enum {
108 | unroll = SizeAtCompileTime != Dynamic
109 | && CoeffReadCost != Dynamic
110 | && NumTraits::AddCost != Dynamic
111 | && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT
112 | };
113 | if(unroll)
114 | return internal::any_unroller::run(derived());
117 | else
118 | {
119 | for(Index j = 0; j < cols(); ++j)
120 | for(Index i = 0; i < rows(); ++i)
121 | if (coeff(i, j)) return true;
122 | return false;
123 | }
124 | }
125 |
126 | /** \returns the number of coefficients which evaluate to true
127 | *
128 | * \sa all(), any()
129 | */
130 | template
131 | inline typename DenseBase::Index DenseBase::count() const
132 | {
133 | return derived().template cast().template cast().sum();
134 | }
135 |
136 | } // end namespace Eigen
137 |
138 | #endif // EIGEN_ALLANDANY_H
139 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | FILE(GLOB Eigen_Core_SRCS "*.h")
2 |
3 | INSTALL(FILES
4 | ${Eigen_Core_SRCS}
5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel
6 | )
7 |
8 | ADD_SUBDIRECTORY(products)
9 | ADD_SUBDIRECTORY(util)
10 | ADD_SUBDIRECTORY(arch)
11 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/CommaInitializer.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_COMMAINITIALIZER_H
12 | #define EIGEN_COMMAINITIALIZER_H
13 |
14 | namespace Eigen {
15 |
16 | /** \class CommaInitializer
17 | * \ingroup Core_Module
18 | *
19 | * \brief Helper class used by the comma initializer operator
20 | *
21 | * This class is internally used to implement the comma initializer feature. It is
22 | * the return type of MatrixBase::operator<<, and most of the time this is the only
23 | * way it is used.
24 | *
25 | * \sa \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished()
26 | */
27 | template
28 | struct CommaInitializer
29 | {
30 | typedef typename XprType::Scalar Scalar;
31 | typedef typename XprType::Index Index;
32 |
33 | inline CommaInitializer(XprType& xpr, const Scalar& s)
34 | : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1)
35 | {
36 | m_xpr.coeffRef(0,0) = s;
37 | }
38 |
39 | template
40 | inline CommaInitializer(XprType& xpr, const DenseBase& other)
41 | : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows())
42 | {
43 | m_xpr.block(0, 0, other.rows(), other.cols()) = other;
44 | }
45 |
46 | /* inserts a scalar value in the target matrix */
47 | CommaInitializer& operator,(const Scalar& s)
48 | {
49 | if (m_col==m_xpr.cols())
50 | {
51 | m_row+=m_currentBlockRows;
52 | m_col = 0;
53 | m_currentBlockRows = 1;
54 | eigen_assert(m_row
66 | CommaInitializer& operator,(const DenseBase& other)
67 | {
68 | if(other.cols()==0 || other.rows()==0)
69 | return *this;
70 | if (m_col==m_xpr.cols())
71 | {
72 | m_row+=m_currentBlockRows;
73 | m_col = 0;
74 | m_currentBlockRows = other.rows();
75 | eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows()
76 | && "Too many rows passed to comma initializer (operator<<)");
77 | }
78 | eigen_assert(m_col
84 | (m_row, m_col) = other;
85 | else
86 | m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other;
87 | m_col += other.cols();
88 | return *this;
89 | }
90 |
91 | inline ~CommaInitializer()
92 | {
93 | eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows()
94 | && m_col == m_xpr.cols()
95 | && "Too few coefficients passed to comma initializer (operator<<)");
96 | }
97 |
98 | /** \returns the built matrix once all its coefficients have been set.
99 | * Calling finished is 100% optional. Its purpose is to write expressions
100 | * like this:
101 | * \code
102 | * quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished());
103 | * \endcode
104 | */
105 | inline XprType& finished() { return m_xpr; }
106 |
107 | XprType& m_xpr; // target expression
108 | Index m_row; // current row id
109 | Index m_col; // current col id
110 | Index m_currentBlockRows; // current block height
111 | };
112 |
113 | /** \anchor MatrixBaseCommaInitRef
114 | * Convenient operator to set the coefficients of a matrix.
115 | *
116 | * The coefficients must be provided in a row major order and exactly match
117 | * the size of the matrix. Otherwise an assertion is raised.
118 | *
119 | * Example: \include MatrixBase_set.cpp
120 | * Output: \verbinclude MatrixBase_set.out
121 | *
122 | * \sa CommaInitializer::finished(), class CommaInitializer
123 | */
124 | template
125 | inline CommaInitializer DenseBase::operator<< (const Scalar& s)
126 | {
127 | return CommaInitializer(*static_cast(this), s);
128 | }
129 |
130 | /** \sa operator<<(const Scalar&) */
131 | template
132 | template
133 | inline CommaInitializer
134 | DenseBase::operator<<(const DenseBase& other)
135 | {
136 | return CommaInitializer(*static_cast(this), other);
137 | }
138 |
139 | } // end namespace Eigen
140 |
141 | #endif // EIGEN_COMMAINITIALIZER_H
142 |
--------------------------------------------------------------------------------
/jni/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-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_CWISE_UNARY_OP_H
12 | #define EIGEN_CWISE_UNARY_OP_H
13 |
14 | namespace Eigen {
15 |
16 | /** \class CwiseUnaryOp
17 | * \ingroup Core_Module
18 | *
19 | * \brief Generic expression where a coefficient-wise unary operator is applied to an expression
20 | *
21 | * \param UnaryOp template functor implementing the operator
22 | * \param XprType the type of the expression to which we are applying the unary operator
23 | *
24 | * This class represents an expression where a unary operator is applied to an expression.
25 | * It is the return type of all operations taking exactly 1 input expression, regardless of the
26 | * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix
27 | * is considered unary, because only the right-hand side is an expression, and its
28 | * return type is a specialization of CwiseUnaryOp.
29 | *
30 | * Most of the time, this is the only way that it is used, so you typically don't have to name
31 | * CwiseUnaryOp types explicitly.
32 | *
33 | * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp
34 | */
35 |
36 | namespace internal {
37 | template
38 | struct traits >
39 | : traits
40 | {
41 | typedef typename result_of<
42 | UnaryOp(typename XprType::Scalar)
43 | >::type Scalar;
44 | typedef typename XprType::Nested XprTypeNested;
45 | typedef typename remove_reference::type _XprTypeNested;
46 | enum {
47 | Flags = _XprTypeNested::Flags & (
48 | HereditaryBits | LinearAccessBit | AlignedBit
49 | | (functor_traits::PacketAccess ? PacketAccessBit : 0)),
50 | CoeffReadCost = _XprTypeNested::CoeffReadCost + functor_traits::Cost
51 | };
52 | };
53 | }
54 |
55 | template
56 | class CwiseUnaryOpImpl;
57 |
58 | template
59 | class CwiseUnaryOp : internal::no_assignment_operator,
60 | public CwiseUnaryOpImpl::StorageKind>
61 | {
62 | public:
63 |
64 | typedef typename CwiseUnaryOpImpl::StorageKind>::Base Base;
65 | EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp)
66 |
67 | inline CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp())
68 | : m_xpr(xpr), m_functor(func) {}
69 |
70 | EIGEN_STRONG_INLINE Index rows() const { return m_xpr.rows(); }
71 | EIGEN_STRONG_INLINE Index cols() const { return m_xpr.cols(); }
72 |
73 | /** \returns the functor representing the unary operation */
74 | const UnaryOp& functor() const { return m_functor; }
75 |
76 | /** \returns the nested expression */
77 | const typename internal::remove_all::type&
78 | nestedExpression() const { return m_xpr; }
79 |
80 | /** \returns the nested expression */
81 | typename internal::remove_all::type&
82 | nestedExpression() { return m_xpr.const_cast_derived(); }
83 |
84 | protected:
85 | typename XprType::Nested m_xpr;
86 | const UnaryOp m_functor;
87 | };
88 |
89 | // This is the generic implementation for dense storage.
90 | // It can be used for any expression types implementing the dense concept.
91 | template
92 | class CwiseUnaryOpImpl
93 | : public internal::dense_xpr_base >::type
94 | {
95 | public:
96 |
97 | typedef CwiseUnaryOp Derived;
98 | typedef typename internal::dense_xpr_base >::type Base;
99 | EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
100 |
101 | EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const
102 | {
103 | return derived().functor()(derived().nestedExpression().coeff(row, col));
104 | }
105 |
106 | template
107 | EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const
108 | {
109 | return derived().functor().packetOp(derived().nestedExpression().template packet(row, col));
110 | }
111 |
112 | EIGEN_STRONG_INLINE const Scalar coeff(Index index) const
113 | {
114 | return derived().functor()(derived().nestedExpression().coeff(index));
115 | }
116 |
117 | template
118 | EIGEN_STRONG_INLINE PacketScalar packet(Index index) const
119 | {
120 | return derived().functor().packetOp(derived().nestedExpression().template packet(index));
121 | }
122 | };
123 |
124 | } // end namespace Eigen
125 |
126 | #endif // EIGEN_CWISE_UNARY_OP_H
127 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/Flagged.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_FLAGGED_H
11 | #define EIGEN_FLAGGED_H
12 |
13 | namespace Eigen {
14 |
15 | /** \class Flagged
16 | * \ingroup Core_Module
17 | *
18 | * \brief Expression with modified flags
19 | *
20 | * \param ExpressionType the type of the object of which we are modifying the flags
21 | * \param Added the flags added to the expression
22 | * \param Removed the flags removed from the expression (has priority over Added).
23 | *
24 | * This class represents an expression whose flags have been modified.
25 | * It is the return type of MatrixBase::flagged()
26 | * and most of the time this is the only way it is used.
27 | *
28 | * \sa MatrixBase::flagged()
29 | */
30 |
31 | namespace internal {
32 | template
33 | struct traits > : traits
34 | {
35 | enum { Flags = (ExpressionType::Flags | Added) & ~Removed };
36 | };
37 | }
38 |
39 | template class Flagged
40 | : public MatrixBase >
41 | {
42 | public:
43 |
44 | typedef MatrixBase Base;
45 |
46 | EIGEN_DENSE_PUBLIC_INTERFACE(Flagged)
47 | typedef typename internal::conditional::ret,
48 | ExpressionType, const ExpressionType&>::type ExpressionTypeNested;
49 | typedef typename ExpressionType::InnerIterator InnerIterator;
50 |
51 | inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {}
52 |
53 | inline Index rows() const { return m_matrix.rows(); }
54 | inline Index cols() const { return m_matrix.cols(); }
55 | inline Index outerStride() const { return m_matrix.outerStride(); }
56 | inline Index innerStride() const { return m_matrix.innerStride(); }
57 |
58 | inline CoeffReturnType coeff(Index row, Index col) const
59 | {
60 | return m_matrix.coeff(row, col);
61 | }
62 |
63 | inline CoeffReturnType coeff(Index index) const
64 | {
65 | return m_matrix.coeff(index);
66 | }
67 |
68 | inline const Scalar& coeffRef(Index row, Index col) const
69 | {
70 | return m_matrix.const_cast_derived().coeffRef(row, col);
71 | }
72 |
73 | inline const Scalar& coeffRef(Index index) const
74 | {
75 | return m_matrix.const_cast_derived().coeffRef(index);
76 | }
77 |
78 | inline Scalar& coeffRef(Index row, Index col)
79 | {
80 | return m_matrix.const_cast_derived().coeffRef(row, col);
81 | }
82 |
83 | inline Scalar& coeffRef(Index index)
84 | {
85 | return m_matrix.const_cast_derived().coeffRef(index);
86 | }
87 |
88 | template
89 | inline const PacketScalar packet(Index row, Index col) const
90 | {
91 | return m_matrix.template packet(row, col);
92 | }
93 |
94 | template
95 | inline void writePacket(Index row, Index col, const PacketScalar& x)
96 | {
97 | m_matrix.const_cast_derived().template writePacket(row, col, x);
98 | }
99 |
100 | template
101 | inline const PacketScalar packet(Index index) const
102 | {
103 | return m_matrix.template packet(index);
104 | }
105 |
106 | template
107 | inline void writePacket(Index index, const PacketScalar& x)
108 | {
109 | m_matrix.const_cast_derived().template writePacket(index, x);
110 | }
111 |
112 | const ExpressionType& _expression() const { return m_matrix; }
113 |
114 | template
115 | typename ExpressionType::PlainObject solveTriangular(const MatrixBase& other) const;
116 |
117 | template
118 | void solveTriangularInPlace(const MatrixBase& other) const;
119 |
120 | protected:
121 | ExpressionTypeNested m_matrix;
122 | };
123 |
124 | /** \returns an expression of *this with added and removed flags
125 | *
126 | * This is mostly for internal use.
127 | *
128 | * \sa class Flagged
129 | */
130 | template
131 | template
132 | inline const Flagged
133 | DenseBase::flagged() const
134 | {
135 | return derived();
136 | }
137 |
138 | } // end namespace Eigen
139 |
140 | #endif // EIGEN_FLAGGED_H
141 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/ForceAlignedAccess.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_FORCEALIGNEDACCESS_H
11 | #define EIGEN_FORCEALIGNEDACCESS_H
12 |
13 | namespace Eigen {
14 |
15 | /** \class ForceAlignedAccess
16 | * \ingroup Core_Module
17 | *
18 | * \brief Enforce aligned packet loads and stores regardless of what is requested
19 | *
20 | * \param ExpressionType the type of the object of which we are forcing aligned packet access
21 | *
22 | * This class is the return type of MatrixBase::forceAlignedAccess()
23 | * and most of the time this is the only way it is used.
24 | *
25 | * \sa MatrixBase::forceAlignedAccess()
26 | */
27 |
28 | namespace internal {
29 | template
30 | struct traits > : public traits
31 | {};
32 | }
33 |
34 | template class ForceAlignedAccess
35 | : public internal::dense_xpr_base< ForceAlignedAccess >::type
36 | {
37 | public:
38 |
39 | typedef typename internal::dense_xpr_base::type Base;
40 | EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess)
41 |
42 | inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {}
43 |
44 | inline Index rows() const { return m_expression.rows(); }
45 | inline Index cols() const { return m_expression.cols(); }
46 | inline Index outerStride() const { return m_expression.outerStride(); }
47 | inline Index innerStride() const { return m_expression.innerStride(); }
48 |
49 | inline const CoeffReturnType coeff(Index row, Index col) const
50 | {
51 | return m_expression.coeff(row, col);
52 | }
53 |
54 | inline Scalar& coeffRef(Index row, Index col)
55 | {
56 | return m_expression.const_cast_derived().coeffRef(row, col);
57 | }
58 |
59 | inline const CoeffReturnType coeff(Index index) const
60 | {
61 | return m_expression.coeff(index);
62 | }
63 |
64 | 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 | operator const ExpressionType&() const { return m_expression; }
94 |
95 | protected:
96 | const ExpressionType& m_expression;
97 |
98 | private:
99 | ForceAlignedAccess& operator=(const ForceAlignedAccess&);
100 | };
101 |
102 | /** \returns an expression of *this with forced aligned access
103 | * \sa forceAlignedAccessIf(),class ForceAlignedAccess
104 | */
105 | template
106 | inline const ForceAlignedAccess
107 | MatrixBase::forceAlignedAccess() const
108 | {
109 | return ForceAlignedAccess(derived());
110 | }
111 |
112 | /** \returns an expression of *this with forced aligned access
113 | * \sa forceAlignedAccessIf(), class ForceAlignedAccess
114 | */
115 | template
116 | inline ForceAlignedAccess
117 | MatrixBase::forceAlignedAccess()
118 | {
119 | return ForceAlignedAccess(derived());
120 | }
121 |
122 | /** \returns an expression of *this with forced aligned access if \a Enable is true.
123 | * \sa forceAlignedAccess(), class ForceAlignedAccess
124 | */
125 | template
126 | template
127 | inline typename internal::add_const_on_value_type,Derived&>::type>::type
128 | MatrixBase::forceAlignedAccessIf() const
129 | {
130 | return derived();
131 | }
132 |
133 | /** \returns an expression of *this with forced aligned access if \a Enable is true.
134 | * \sa forceAlignedAccess(), class ForceAlignedAccess
135 | */
136 | template
137 | template
138 | inline typename internal::conditional,Derived&>::type
139 | MatrixBase::forceAlignedAccessIf()
140 | {
141 | return derived();
142 | }
143 |
144 | } // end namespace Eigen
145 |
146 | #endif // EIGEN_FORCEALIGNEDACCESS_H
147 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/GlobalFunctions.h:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // Copyright (C) 2010 Gael Guennebaud
5 | // Copyright (C) 2010 Benoit Jacob
6 | //
7 | // This Source Code Form is subject to the terms of the Mozilla
8 | // Public License v. 2.0. If a copy of the MPL was not distributed
9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 |
11 | #ifndef EIGEN_GLOBAL_FUNCTIONS_H
12 | #define EIGEN_GLOBAL_FUNCTIONS_H
13 |
14 | #define EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(NAME,FUNCTOR) \
15 | template \
16 | inline const Eigen::CwiseUnaryOp, const Derived> \
17 | NAME(const Eigen::ArrayBase& x) { \
18 | return x.derived(); \
19 | }
20 |
21 | #define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \
22 | \
23 | template \
24 | struct NAME##_retval > \
25 | { \
26 | typedef const Eigen::CwiseUnaryOp, const Derived> type; \
27 | }; \
28 | template \
29 | struct NAME##_impl > \
30 | { \
31 | static inline typename NAME##_retval >::type run(const Eigen::ArrayBase& x) \
32 | { \
33 | return x.derived(); \
34 | } \
35 | };
36 |
37 |
38 | namespace std
39 | {
40 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(real,scalar_real_op)
41 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,scalar_imag_op)
42 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,scalar_sin_op)
43 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,scalar_cos_op)
44 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(asin,scalar_asin_op)
45 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(acos,scalar_acos_op)
46 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(tan,scalar_tan_op)
47 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,scalar_exp_op)
48 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,scalar_log_op)
49 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(abs,scalar_abs_op)
50 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sqrt,scalar_sqrt_op)
51 |
52 | template
53 | inline const Eigen::CwiseUnaryOp, const Derived>
54 | pow(const Eigen::ArrayBase& x, const typename Derived::Scalar& exponent) {
55 | return x.derived().pow(exponent);
56 | }
57 |
58 | template
59 | inline const Eigen::CwiseBinaryOp, const Derived, const Derived>
60 | pow(const Eigen::ArrayBase& x, const Eigen::ArrayBase& exponents)
61 | {
62 | return Eigen::CwiseBinaryOp, const Derived, const Derived>(
63 | x.derived(),
64 | exponents.derived()
65 | );
66 | }
67 | }
68 |
69 | namespace Eigen
70 | {
71 | /**
72 | * \brief Component-wise division of a scalar by array elements.
73 | **/
74 | template
75 | inline const Eigen::CwiseUnaryOp, const Derived>
76 | operator/(typename Derived::Scalar s, const Eigen::ArrayBase& a)
77 | {
78 | return Eigen::CwiseUnaryOp, const Derived>(
79 | a.derived(),
80 | Eigen::internal::scalar_inverse_mult_op(s)
81 | );
82 | }
83 |
84 | namespace internal
85 | {
86 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op)
87 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op)
88 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sin,scalar_sin_op)
89 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(cos,scalar_cos_op)
90 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(asin,scalar_asin_op)
91 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(acos,scalar_acos_op)
92 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(tan,scalar_tan_op)
93 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(exp,scalar_exp_op)
94 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(log,scalar_log_op)
95 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs,scalar_abs_op)
96 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs2,scalar_abs2_op)
97 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sqrt,scalar_sqrt_op)
98 | }
99 | }
100 |
101 | // TODO: cleanly disable those functions that are not supported on Array (internal::real_ref, internal::random, internal::isApprox...)
102 |
103 | #endif // EIGEN_GLOBAL_FUNCTIONS_H
104 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/NestByValue.h:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // Copyright (C) 2008 Gael Guennebaud
5 | // Copyright (C) 2006-2008 Benoit Jacob
6 | //
7 | // This Source Code Form is subject to the terms of the Mozilla
8 | // Public License v. 2.0. If a copy of the MPL was not distributed
9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 |
11 | #ifndef EIGEN_NESTBYVALUE_H
12 | #define EIGEN_NESTBYVALUE_H
13 |
14 | namespace Eigen {
15 |
16 | /** \class NestByValue
17 | * \ingroup Core_Module
18 | *
19 | * \brief Expression which must be nested by value
20 | *
21 | * \param ExpressionType the type of the object of which we are requiring nesting-by-value
22 | *
23 | * This class is the return type of MatrixBase::nestByValue()
24 | * and most of the time this is the only way it is used.
25 | *
26 | * \sa MatrixBase::nestByValue()
27 | */
28 |
29 | namespace internal {
30 | template
31 | struct traits > : public traits
32 | {};
33 | }
34 |
35 | template class NestByValue
36 | : public internal::dense_xpr_base< NestByValue >::type
37 | {
38 | public:
39 |
40 | typedef typename internal::dense_xpr_base::type Base;
41 | EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
42 |
43 | inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
44 |
45 | inline Index rows() const { return m_expression.rows(); }
46 | inline Index cols() const { return m_expression.cols(); }
47 | inline Index outerStride() const { return m_expression.outerStride(); }
48 | inline Index innerStride() const { return m_expression.innerStride(); }
49 |
50 | inline const CoeffReturnType coeff(Index row, Index col) const
51 | {
52 | return m_expression.coeff(row, col);
53 | }
54 |
55 | inline Scalar& coeffRef(Index row, Index col)
56 | {
57 | return m_expression.const_cast_derived().coeffRef(row, col);
58 | }
59 |
60 | inline const CoeffReturnType coeff(Index index) const
61 | {
62 | return m_expression.coeff(index);
63 | }
64 |
65 | inline Scalar& coeffRef(Index index)
66 | {
67 | return m_expression.const_cast_derived().coeffRef(index);
68 | }
69 |
70 | template
71 | inline const PacketScalar packet(Index row, Index col) const
72 | {
73 | return m_expression.template packet(row, col);
74 | }
75 |
76 | template
77 | inline void writePacket(Index row, Index col, const PacketScalar& x)
78 | {
79 | m_expression.const_cast_derived().template writePacket(row, col, x);
80 | }
81 |
82 | template
83 | inline const PacketScalar packet(Index index) const
84 | {
85 | return m_expression.template packet(index);
86 | }
87 |
88 | template
89 | inline void writePacket(Index index, const PacketScalar& x)
90 | {
91 | m_expression.const_cast_derived().template writePacket(index, x);
92 | }
93 |
94 | operator const ExpressionType&() const { return m_expression; }
95 |
96 | protected:
97 | const ExpressionType m_expression;
98 | };
99 |
100 | /** \returns an expression of the temporary version of *this.
101 | */
102 | template
103 | inline const NestByValue
104 | DenseBase::nestByValue() const
105 | {
106 | return NestByValue(derived());
107 | }
108 |
109 | } // end namespace Eigen
110 |
111 | #endif // EIGEN_NESTBYVALUE_H
112 |
--------------------------------------------------------------------------------
/jni/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 | * \param 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 | typedef typename ExpressionType::Scalar Scalar;
34 | public:
35 | NoAlias(ExpressionType& expression) : m_expression(expression) {}
36 |
37 | /** Behaves like MatrixBase::lazyAssign(other)
38 | * \sa MatrixBase::lazyAssign() */
39 | template
40 | EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other)
41 | { return internal::assign_selector::run(m_expression,other.derived()); }
42 |
43 | /** \sa MatrixBase::operator+= */
44 | template
45 | EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other)
46 | {
47 | typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder;
48 | SelfAdder tmp(m_expression);
49 | typedef typename internal::nested::type OtherDerivedNested;
50 | typedef typename internal::remove_all::type _OtherDerivedNested;
51 | internal::assign_selector::run(tmp,OtherDerivedNested(other.derived()));
52 | return m_expression;
53 | }
54 |
55 | /** \sa MatrixBase::operator-= */
56 | template
57 | EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other)
58 | {
59 | typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder;
60 | SelfAdder tmp(m_expression);
61 | typedef typename internal::nested::type OtherDerivedNested;
62 | typedef typename internal::remove_all::type _OtherDerivedNested;
63 | internal::assign_selector::run(tmp,OtherDerivedNested(other.derived()));
64 | return m_expression;
65 | }
66 |
67 | #ifndef EIGEN_PARSED_BY_DOXYGEN
68 | template
69 | EIGEN_STRONG_INLINE ExpressionType& operator+=(const ProductBase& other)
70 | { other.derived().addTo(m_expression); return m_expression; }
71 |
72 | template
73 | EIGEN_STRONG_INLINE ExpressionType& operator-=(const ProductBase& other)
74 | { other.derived().subTo(m_expression); return m_expression; }
75 |
76 | template
77 | EIGEN_STRONG_INLINE ExpressionType& operator+=(const CoeffBasedProduct& other)
78 | { return m_expression.derived() += CoeffBasedProduct(other.lhs(), other.rhs()); }
79 |
80 | template
81 | EIGEN_STRONG_INLINE ExpressionType& operator-=(const CoeffBasedProduct& other)
82 | { return m_expression.derived() -= CoeffBasedProduct(other.lhs(), other.rhs()); }
83 | #endif
84 |
85 | protected:
86 | ExpressionType& m_expression;
87 | };
88 |
89 | /** \returns a pseudo expression of \c *this with an operator= assuming
90 | * no aliasing between \c *this and the source expression.
91 | *
92 | * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag.
93 | * Currently, even though several expressions may alias, only product
94 | * expressions have this flag. Therefore, noalias() is only usefull when
95 | * the source expression contains a matrix product.
96 | *
97 | * Here are some examples where noalias is usefull:
98 | * \code
99 | * D.noalias() = A * B;
100 | * D.noalias() += A.transpose() * B;
101 | * D.noalias() -= 2 * A * B.adjoint();
102 | * \endcode
103 | *
104 | * On the other hand the following example will lead to a \b wrong result:
105 | * \code
106 | * A.noalias() = A * B;
107 | * \endcode
108 | * because the result matrix A is also an operand of the matrix product. Therefore,
109 | * there is no alternative than evaluating A * B in a temporary, that is the default
110 | * behavior when you write:
111 | * \code
112 | * A = A * B;
113 | * \endcode
114 | *
115 | * \sa class NoAlias
116 | */
117 | template
118 | NoAlias MatrixBase::noalias()
119 | {
120 | return derived();
121 | }
122 |
123 | } // end namespace Eigen
124 |
125 | #endif // EIGEN_NOALIAS_H
126 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/Product.h:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // Copyright (C) 2008-2011 Gael Guennebaud
5 | //
6 | // This Source Code Form is subject to the terms of the Mozilla Public
7 | // License, v. 2.0. If a copy of the MPL was not distributed with this
8 | // file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 |
10 | #ifndef EIGEN_PRODUCT_H
11 | #define EIGEN_PRODUCT_H
12 |
13 | template class Product;
14 | template class ProductImpl;
15 |
16 | /** \class Product
17 | * \ingroup Core_Module
18 | *
19 | * \brief Expression of the product of two arbitrary matrices or vectors
20 | *
21 | * \param Lhs the type of the left-hand side expression
22 | * \param Rhs the type of the right-hand side expression
23 | *
24 | * This class represents an expression of the product of two arbitrary matrices.
25 | *
26 | */
27 |
28 | namespace internal {
29 | template
30 | struct traits >
31 | {
32 | typedef MatrixXpr XprKind;
33 | typedef typename remove_all::type LhsCleaned;
34 | typedef typename remove_all::type RhsCleaned;
35 | typedef typename scalar_product_traits::Scalar, typename traits::Scalar>::ReturnType Scalar;
36 | typedef typename promote_storage_type::StorageKind,
37 | typename traits::StorageKind>::ret StorageKind;
38 | typedef typename promote_index_type::Index,
39 | typename traits::Index>::type Index;
40 | enum {
41 | RowsAtCompileTime = LhsCleaned::RowsAtCompileTime,
42 | ColsAtCompileTime = RhsCleaned::ColsAtCompileTime,
43 | MaxRowsAtCompileTime = LhsCleaned::MaxRowsAtCompileTime,
44 | MaxColsAtCompileTime = RhsCleaned::MaxColsAtCompileTime,
45 | Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0), // TODO should be no storage order
46 | CoeffReadCost = 0 // TODO CoeffReadCost should not be part of the expression traits
47 | };
48 | };
49 | } // end namespace internal
50 |
51 |
52 | template
53 | class Product : public ProductImpl::StorageKind,
54 | typename internal::traits::StorageKind>::ret>
55 | {
56 | public:
57 |
58 | typedef typename ProductImpl<
59 | Lhs, Rhs,
60 | typename internal::promote_storage_type::ret>::Base Base;
62 | EIGEN_GENERIC_PUBLIC_INTERFACE(Product)
63 |
64 | typedef typename Lhs::Nested LhsNested;
65 | typedef typename Rhs::Nested RhsNested;
66 | typedef typename internal::remove_all::type LhsNestedCleaned;
67 | typedef typename internal::remove_all::type RhsNestedCleaned;
68 |
69 | Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs)
70 | {
71 | eigen_assert(lhs.cols() == rhs.rows()
72 | && "invalid matrix product"
73 | && "if you wanted a coeff-wise or a dot product use the respective explicit functions");
74 | }
75 |
76 | inline Index rows() const { return m_lhs.rows(); }
77 | inline Index cols() const { return m_rhs.cols(); }
78 |
79 | const LhsNestedCleaned& lhs() const { return m_lhs; }
80 | const RhsNestedCleaned& rhs() const { return m_rhs; }
81 |
82 | protected:
83 |
84 | const LhsNested m_lhs;
85 | const RhsNested m_rhs;
86 | };
87 |
88 | template
89 | class ProductImpl : public internal::dense_xpr_base >::type
90 | {
91 | typedef Product Derived;
92 | public:
93 |
94 | typedef typename internal::dense_xpr_base >::type Base;
95 | EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
96 | };
97 |
98 | #endif // EIGEN_PRODUCT_H
99 |
--------------------------------------------------------------------------------
/jni/Eigen/src/Core/ReturnByValue.h:
--------------------------------------------------------------------------------
1 | // This file is part of Eigen, a lightweight C++ template library
2 | // for linear algebra.
3 | //
4 | // Copyright (C) 2009-2010 Gael Guennebaud
5 | // Copyright (C) 2009-2010 Benoit Jacob
6 | //
7 | // This Source Code Form is subject to the terms of the Mozilla
8 | // Public License v. 2.0. If a copy of the MPL was not distributed
9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 |
11 | #ifndef EIGEN_RETURNBYVALUE_H
12 | #define EIGEN_RETURNBYVALUE_H
13 |
14 | namespace Eigen {
15 |
16 | /** \class ReturnByValue
17 | * \ingroup Core_Module
18 | *
19 | */
20 |
21 | namespace internal {
22 |
23 | template
24 | struct traits >
25 | : public traits::ReturnType>
26 | {
27 | enum {
28 | // We're disabling the DirectAccess because e.g. the constructor of
29 | // the Block-with-DirectAccess expression requires to have a coeffRef method.
30 | // Also, we don't want to have to implement the stride stuff.
31 | Flags = (traits::ReturnType>::Flags
32 | | EvalBeforeNestingBit) & ~DirectAccessBit
33 | };
34 | };
35 |
36 | /* The ReturnByValue object doesn't even have a coeff() method.
37 | * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix.
38 | * So internal::nested always gives the plain return matrix type.
39 | *
40 | * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ??
41 | */
42 | template