├── src ├── Eigen │ ├── Eigen │ ├── src │ │ ├── Core │ │ │ ├── util │ │ │ │ ├── NonMPL2.h │ │ │ │ └── ReenableStupidWarnings.h │ │ │ ├── functors │ │ │ │ └── TernaryFunctors.h │ │ │ ├── arch │ │ │ │ ├── HIP │ │ │ │ │ └── hcc │ │ │ │ │ │ └── math_constants.h │ │ │ │ ├── NEON │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── AVX │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── Default │ │ │ │ │ ├── Settings.h │ │ │ │ │ └── ConjHelper.h │ │ │ │ ├── SSE │ │ │ │ │ └── TypeCasting.h │ │ │ │ ├── SYCL │ │ │ │ │ └── TypeCasting.h │ │ │ │ └── GPU │ │ │ │ │ └── MathFunctions.h │ │ │ ├── DiagonalProduct.h │ │ │ ├── SelfCwiseBinaryOp.h │ │ │ ├── Swap.h │ │ │ └── Assign.h │ │ ├── EulerAngles │ │ │ └── CMakeLists.txt │ │ ├── misc │ │ │ ├── lapacke_mangling.h │ │ │ ├── RealSvd2x2.h │ │ │ ├── Kernel.h │ │ │ └── Image.h │ │ ├── NonLinearOptimization │ │ │ ├── r1mpyq.h │ │ │ ├── rwupdt.h │ │ │ ├── chkder.h │ │ │ ├── covar.h │ │ │ └── fdjac1.h │ │ ├── SparseCore │ │ │ ├── SparseFuzzy.h │ │ │ ├── SparseRedux.h │ │ │ └── MappedSparseMatrix.h │ │ ├── SparseLU │ │ │ ├── SparseLU_Utils.h │ │ │ └── SparseLU_relax_snode.h │ │ ├── LevenbergMarquardt │ │ │ ├── CopyrightMINPACK.txt │ │ │ └── LMcovar.h │ │ ├── MatrixFunctions │ │ │ └── StemFunction.h │ │ ├── IterativeSolvers │ │ │ └── IncompleteLU.h │ │ ├── StlSupport │ │ │ └── details.h │ │ ├── QR │ │ │ └── HouseholderQR_LAPACKE.h │ │ ├── plugins │ │ │ └── MatrixCwiseUnaryOps.h │ │ ├── SpecialFunctions │ │ │ └── SpecialFunctionsHalf.h │ │ └── MoreVectorization │ │ │ └── MathFunctions.h │ ├── Dense │ ├── CXX11 │ │ ├── src │ │ │ ├── Tensor │ │ │ │ ├── TensorDeviceCuda.h │ │ │ │ ├── TensorReductionCuda.h │ │ │ │ ├── TensorContractionCuda.h │ │ │ │ ├── TensorGpuHipCudaUndefines.h │ │ │ │ ├── TensorGlobalFunctions.h │ │ │ │ ├── TensorMacros.h │ │ │ │ ├── TensorDevice.h │ │ │ │ ├── TensorIO.h │ │ │ │ └── TensorInitializer.h │ │ │ └── ThreadPool │ │ │ │ ├── ThreadYield.h │ │ │ │ ├── ThreadCancel.h │ │ │ │ ├── ThreadEnvironment.h │ │ │ │ ├── ThreadPoolInterface.h │ │ │ │ ├── Barrier.h │ │ │ │ └── ThreadLocal.h │ │ ├── CMakeLists.txt │ │ ├── TensorSymmetry │ │ └── ThreadPool │ ├── README.md │ ├── MoreVectorization │ ├── StdList │ ├── COPYING.README │ ├── StdDeque │ ├── StdVector │ ├── Householder │ ├── ArpackSupport │ ├── Sparse │ ├── Jacobi │ ├── Skyline │ ├── KroneckerProduct │ ├── QtAlignedMalloc │ ├── MetisSupport │ ├── Splines │ ├── PardisoSupport │ ├── INSTALL │ ├── EulerAngles │ ├── SPQRSupport │ ├── SparseQR │ ├── AutoDiff │ ├── Cholesky │ ├── LevenbergMarquardt │ ├── QR │ ├── UmfPackSupport │ ├── SparseExtra │ ├── KLUSupport │ ├── SparseCholesky │ ├── COPYING.BSD │ ├── IterativeSolvers │ ├── LU │ ├── SVD │ ├── SpecialFunctions │ ├── PaStiXSupport │ ├── NumericalDiff │ ├── SparseLU │ ├── Eigenvalues │ ├── CholmodSupport │ ├── IterativeLinearSolvers │ ├── Geometry │ ├── COPYING.MINPACK │ ├── SuperLUSupport │ ├── SparseCore │ └── OrderingMethods ├── plugin.hpp ├── plugin.cpp ├── tfdsp │ ├── util.hpp │ ├── sampleRate.cpp │ ├── noise.hpp │ └── nonlinear.hpp ├── models │ └── VanDerPoleODE.hpp └── components.hpp ├── doc └── modules.png ├── .gitattributes ├── .idea ├── misc.xml ├── vcs.xml ├── modules.xml ├── TriggerFish.iml └── codeStyles │ └── Project.xml ├── tests └── PythonTests │ ├── Wrapper │ └── Wrapper.vcxproj.user │ ├── ConsoleApp │ ├── ConsoleApp.vcxproj.user │ └── ConsoleApp.cpp │ ├── PythonTests │ ├── VCA_tests.py │ ├── vanDerPole.py │ └── PythonTests.pyproj │ └── PythonTests.sln ├── .gitignore ├── .vscode ├── launch.json ├── settings.json ├── tasks.json └── c_cpp_properties.json ├── Makefile ├── plugin.json ├── .travis.yml └── LICENSE.txt /src/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /doc/modules.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JTriggerFish/TriggerFish-VCV/HEAD/doc/modules.png -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | tests/PythonTests/ConsoleApp/* diff 2 | *.cpp diff 3 | *.h diff 4 | *.hpp diff 5 | *.c diff 6 | * text=auto 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Eigen/src/EulerAngles/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EulerAngles_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EulerAngles_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/EulerAngles COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /tests/PythonTests/Wrapper/Wrapper.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | 6 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__clang__) || defined(__GNUC__) 3 | #warning "Deprecated header file, please either include the main Eigen/CXX11/Tensor header or the respective TensorDeviceGpu.h file" 4 | #endif 5 | 6 | #include "TensorDeviceGpu.h" 7 | -------------------------------------------------------------------------------- /tests/PythonTests/ConsoleApp/ConsoleApp.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorReductionCuda.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__clang__) || defined(__GNUC__) 3 | #warning "Deprecated header file, please either include the main Eigen/CXX11/Tensor header or the respective TensorReductionGpu.h file" 4 | #endif 5 | 6 | #include "TensorReductionGpu.h" 7 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorContractionCuda.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__clang__) || defined(__GNUC__) 3 | #warning "Deprecated header file, please either include the main Eigen/CXX11/Tensor header or the respective TensorContractionGpu.h file" 4 | #endif 5 | 6 | #include "TensorContractionGpu.h" 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/TriggerFish.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /tests/PythonTests/.vs 3 | /tests/PythonTests/Wrapper/Debug 4 | /tests/PythonTests/Wrapper/x64 5 | /tests/PythonTests/ConsoleApp/x64 6 | /tests/PythonTests/x64 7 | /dist 8 | /plugin.dylib 9 | /plugin.dll 10 | /plugin.so 11 | .DS_Store 12 | tests/PythonTests/PythonTests/*.html 13 | tests/PythonTests/PythonTests/__pycache__/ 14 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Eigen_CXX11_HEADERS Tensor TensorSymmetry ThreadPool) 2 | 3 | install(FILES 4 | ${Eigen_CXX11_HEADERS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/CXX11 COMPONENT Devel 6 | ) 7 | 8 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/CXX11 COMPONENT Devel FILES_MATCHING PATTERN "*.h") 9 | -------------------------------------------------------------------------------- /src/plugin.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | 5 | using namespace rack; 6 | 7 | // Forward-declare the Plugin, defined in Template.cpp 8 | extern Plugin *pluginInstance; 9 | 10 | // Forward-declare each Model, defined in each module source file 11 | extern Model *modelTfVCA; 12 | extern Model *modelTfSlop; 13 | extern Model *modelTfSlop4; 14 | extern Model *modelTfVDPO; 15 | -------------------------------------------------------------------------------- /src/Eigen/README.md: -------------------------------------------------------------------------------- 1 | **Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms.** 2 | 3 | For more information go to http://eigen.tuxfamily.org/. 4 | 5 | For ***pull request*** please only use the official repository at https://bitbucket.org/eigen/eigen. 6 | 7 | For ***bug reports*** and ***feature requests*** go to http://eigen.tuxfamily.org/bz. 8 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Debug", 9 | "type": "gdb", 10 | "request": "launch", 11 | "target": "./bin/executable", 12 | "cwd": "${workspaceRoot}" 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /src/plugin.cpp: -------------------------------------------------------------------------------- 1 | #include "plugin.hpp" 2 | 3 | Plugin *pluginInstance; 4 | 5 | void init(Plugin *p) 6 | { 7 | pluginInstance = p; 8 | 9 | // Add all Models defined throughout the pluginInstance 10 | p->addModel(modelTfVCA); 11 | p->addModel(modelTfSlop); 12 | p->addModel(modelTfSlop4); 13 | p->addModel(modelTfVDPO); 14 | 15 | // Any other pluginInstance initialization may go here. 16 | // As an alternative, consider lazy-loading assets and lookup tables when your module is created to reduce startup times of Rack. 17 | } 18 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/tfdsp/util.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | template 4 | class enable_down_cast 5 | { 6 | private: 7 | typedef enable_down_cast Base; 8 | 9 | public: 10 | Derived const *Self() const 11 | { 12 | // casting "down" the inheritance hierarchy 13 | return static_cast(this); 14 | } 15 | 16 | Derived *Self() 17 | { 18 | return static_cast(this); 19 | } 20 | 21 | protected: 22 | // disable deletion of Derived* through Base* 23 | // enable deletion of Base* through Derived* 24 | ~enable_down_cast() = default; // C++11 only, use ~enable_down_cast() {} in C++98 25 | }; 26 | -------------------------------------------------------------------------------- /src/Eigen/MoreVectorization: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_MOREVECTORIZATION_MODULE_H 10 | #define EIGEN_MOREVECTORIZATION_MODULE_H 11 | 12 | #include 13 | 14 | namespace Eigen { 15 | 16 | /** 17 | * \defgroup MoreVectorization More vectorization module 18 | */ 19 | 20 | } 21 | 22 | #include "src/MoreVectorization/MathFunctions.h" 23 | 24 | #endif // EIGEN_MOREVECTORIZATION_MODULE_H 25 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "C_Cpp.intelliSenseEngine": "Default", 3 | "files.associations": { 4 | "cmath": "cpp", 5 | "array": "cpp", 6 | "__bit_reference": "cpp", 7 | "__functional_base": "cpp", 8 | "atomic": "cpp", 9 | "bitset": "cpp", 10 | "chrono": "cpp", 11 | "functional": "cpp", 12 | "iterator": "cpp", 13 | "limits": "cpp", 14 | "memory": "cpp", 15 | "random": "cpp", 16 | "ratio": "cpp", 17 | "system_error": "cpp", 18 | "tuple": "cpp", 19 | "type_traits": "cpp", 20 | "vector": "cpp", 21 | "initializer_list": "cpp", 22 | "string_view": "cpp", 23 | "utility": "cpp" 24 | } 25 | } -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/Core/arch/HIP/hcc/math_constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * math_constants.h - 3 | * HIP equivalent of the CUDA header of the same name 4 | */ 5 | 6 | #ifndef __MATH_CONSTANTS_H__ 7 | #define __MATH_CONSTANTS_H__ 8 | 9 | /* single precision constants */ 10 | 11 | #define HIPRT_INF_F __int_as_float(0x7f800000) 12 | #define HIPRT_NAN_F __int_as_float(0x7fffffff) 13 | #define HIPRT_MIN_DENORM_F __int_as_float(0x00000001) 14 | #define HIPRT_MAX_NORMAL_F __int_as_float(0x7f7fffff) 15 | #define HIPRT_NEG_ZERO_F __int_as_float(0x80000000) 16 | #define HIPRT_ZERO_F 0.0f 17 | #define HIPRT_ONE_F 1.0f 18 | 19 | /* double precision constants */ 20 | #define HIPRT_INF __hiloint2double(0x7ff00000, 0x00000000) 21 | #define HIPRT_NAN __hiloint2double(0xfff80000, 0x00000000) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/ThreadPool/ThreadYield.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 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_CXX11_THREADPOOL_THREAD_YIELD_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 12 | 13 | // Try to come up with a portable way to yield 14 | #if EIGEN_COMP_GNUC && EIGEN_GNUC_AT_MOST(4, 7) 15 | #define EIGEN_THREAD_YIELD() sched_yield() 16 | #else 17 | #define EIGEN_THREAD_YIELD() std::this_thread::yield() 18 | #endif 19 | 20 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 21 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/COPYING.README: -------------------------------------------------------------------------------- 1 | Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links: 2 | http://www.mozilla.org/MPL/2.0/ 3 | http://www.mozilla.org/MPL/2.0/FAQ.html 4 | 5 | Some files contain third-party code under BSD or LGPL licenses, whence the other 6 | COPYING.* files here. 7 | 8 | All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later. 9 | For this reason, the COPYING.LGPL file contains the LGPL 2.1 text. 10 | 11 | If you want to guarantee that the Eigen code that you are #including is licensed 12 | under the MPL2 and possibly more permissive licenses (like BSD), #define this 13 | preprocessor symbol: 14 | EIGEN_MPL2_ONLY 15 | For example, with most compilers, you could add this to your project CXXFLAGS: 16 | -DEIGEN_MPL2_ONLY 17 | This will cause a compilation error to be generated if you #include any code that is 18 | LGPL licensed. 19 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/ThreadPool/ThreadCancel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 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_CXX11_THREADPOOL_THREAD_CANCEL_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_CANCEL_H 12 | 13 | // Try to come up with a portable way to cancel a thread 14 | #if EIGEN_OS_GNULINUX 15 | #define EIGEN_THREAD_CANCEL(t) \ 16 | pthread_cancel(t.native_handle()); 17 | #define EIGEN_SUPPORTS_THREAD_CANCELLATION 1 18 | #else 19 | #define EIGEN_THREAD_CANCEL(t) 20 | #endif 21 | 22 | 23 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_CANCEL_H 24 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/ArpackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_ARPACKSUPPORT_MODULE_H 10 | #define EIGEN_ARPACKSUPPORT_MODULE_H 11 | 12 | #include 13 | 14 | /** \defgroup ArpackSupport_Module Arpack support module 15 | * 16 | * This module provides a wrapper to Arpack, a library for sparse eigenvalue decomposition. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include "src/Eigenvalues/ArpackSelfAdjointEigenSolver.h" 27 | 28 | #include 29 | 30 | #endif // EIGEN_ARPACKSUPPORT_MODULE_H 31 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 32 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/Skyline: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_SKYLINE_MODULE_H 10 | #define EIGEN_SKYLINE_MODULE_H 11 | 12 | 13 | #include "Eigen/Core" 14 | 15 | #include "Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * \defgroup Skyline_Module Skyline module 24 | * 25 | * 26 | * 27 | * 28 | */ 29 | 30 | #include "src/Skyline/SkylineUtil.h" 31 | #include "src/Skyline/SkylineMatrixBase.h" 32 | #include "src/Skyline/SkylineStorage.h" 33 | #include "src/Skyline/SkylineMatrix.h" 34 | #include "src/Skyline/SkylineInplaceLU.h" 35 | #include "src/Skyline/SkylineProduct.h" 36 | 37 | #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif // EIGEN_SKYLINE_MODULE_H 40 | -------------------------------------------------------------------------------- /src/Eigen/KroneckerProduct: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_KRONECKER_PRODUCT_MODULE_H 10 | #define EIGEN_KRONECKER_PRODUCT_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 15 | 16 | #include "../../Eigen/src/SparseCore/SparseUtil.h" 17 | 18 | namespace Eigen { 19 | 20 | /** 21 | * \defgroup KroneckerProduct_Module KroneckerProduct module 22 | * 23 | * This module contains an experimental Kronecker product implementation. 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | */ 29 | 30 | } // namespace Eigen 31 | 32 | #include "src/KroneckerProduct/KroneckerTensorProduct.h" 33 | 34 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_KRONECKER_PRODUCT_MODULE_H 37 | -------------------------------------------------------------------------------- /src/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 | EIGEN_DEVICE_FUNC 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 | -------------------------------------------------------------------------------- /src/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED_2 2 | // "DisableStupidWarnings.h" was included twice recursively: Do not reenable warnings yet! 3 | # undef EIGEN_WARNINGS_DISABLED_2 4 | 5 | #elif defined(EIGEN_WARNINGS_DISABLED) 6 | #undef EIGEN_WARNINGS_DISABLED 7 | 8 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 9 | #ifdef _MSC_VER 10 | #pragma warning( pop ) 11 | #elif defined __INTEL_COMPILER 12 | #pragma warning pop 13 | #elif defined __clang__ 14 | #pragma clang diagnostic pop 15 | #elif defined __GNUC__ 16 | #pragma GCC diagnostic pop 17 | #endif 18 | 19 | #if defined __NVCC__ 20 | // Don't reenable the diagnostic messages, as it turns out these messages need 21 | // to be disabled at the point of the template instantiation (i.e the user code) 22 | // otherwise they'll be triggered by nvcc. 23 | // #pragma diag_default code_is_unreachable 24 | // #pragma diag_default initialization_not_reachable 25 | // #pragma diag_default 2651 26 | // #pragma diag_default 2653 27 | #endif 28 | 29 | #endif 30 | 31 | #endif // EIGEN_WARNINGS_DISABLED 32 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/Splines: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 20010-2011 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_SPLINES_MODULE_H 11 | #define EIGEN_SPLINES_MODULE_H 12 | 13 | namespace Eigen 14 | { 15 | /** 16 | * \defgroup Splines_Module Spline and spline fitting module 17 | * 18 | * This module provides a simple multi-dimensional spline class while 19 | * offering most basic functionality to fit a spline to point sets. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | } 26 | 27 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 28 | 29 | #include "src/Splines/SplineFwd.h" 30 | #include "src/Splines/Spline.h" 31 | #include "src/Splines/SplineFitting.h" 32 | 33 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_SPLINES_MODULE_H 36 | -------------------------------------------------------------------------------- /src/Eigen/src/NonLinearOptimization/r1mpyq.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | // TODO : move this to GivensQR once there's such a thing in Eigen 6 | 7 | template 8 | void r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector > &v_givens, const std::vector > &w_givens) 9 | { 10 | typedef DenseIndex Index; 11 | 12 | /* apply the first set of givens rotations to a. */ 13 | for (Index j = n-2; j>=0; --j) 14 | for (Index i = 0; i 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 | -------------------------------------------------------------------------------- /src/models/VanDerPoleODE.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Eigen/Dense" 3 | #include "../tfdsp/filters.hpp" 4 | using namespace Eigen; 5 | 6 | namespace ode 7 | { 8 | /** 9 | * \brief The classic Van der Pole 2d ODE 10 | */ 11 | template 12 | struct VanDerPoleODE 13 | { 14 | //Damping parameter 15 | Scalar _mu{ Scalar(0.1) }; 16 | //Radian frequency ( 2* pi * f) 17 | Scalar _w{ Scalar(200 * 2 * PI) }; 18 | 19 | explicit VanDerPoleODE(Scalar mu, Scalar w) 20 | : _mu(mu), _w(w) 21 | { 22 | } 23 | VanDerPoleODE() {}; 24 | 25 | /** 26 | * \brief 27 | * \param y current state 28 | * \param x forcing input 29 | * \return Derivative 30 | */ 31 | Matrix DyDt(const Matrix &y, Scalar x) const 32 | { 33 | Matrix deriv; 34 | deriv << y(1), 35 | _mu * (Scalar(1.0) - y(0)*y(0)) * y(1) * _w + _w * _w * (x - y(0)); 36 | return deriv; 37 | } 38 | Matrix Jacobian(const Matrix &y, Scalar x) const 39 | { 40 | Matrix J; 41 | J << Scalar(0.0), Scalar(1.0), 42 | -Scalar(2.0)*_mu*y(0)*y(1)*_w - _w * _w, _mu * (Scalar(1.0) - y(0)*y(0)) *_w; 43 | return J; 44 | } 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # If RACK_DIR is not defined when calling the Makefile, default to two directories above 2 | RACK_DIR ?= ../.. 3 | 4 | 5 | # Must follow the format in the Naming section of 6 | # https://vcvrack.com/manual/PluginDevelopmentTutorial.html 7 | SLUG = TriggerFish-Elements 8 | 9 | # Must follow the format in the Versioning section of 10 | # https://vcvrack.com/manual/PluginDevelopmentTutorial.html 11 | VERSION = 2.0 12 | 13 | 14 | # FLAGS will be passed to both the C and C++ compiler 15 | FLAGS += -std=c++17 #-faligned-allocation -faligned-new# -fopt-info-loop-optimized # -fopt-info-vec-missed 16 | CFLAGS += 17 | CXXFLAGS += -Isrc -Isrc/dsp -Isrc/models 18 | 19 | # Careful about linking to shared libraries, since you can't assume much about the user's environment and library search path. 20 | # Static libraries are fine. 21 | LDFLAGS += 22 | 23 | # Add .cpp and .c files to the build 24 | SOURCES += $(wildcard src/*.cpp src/tfdsp/*.cpp src/models/*.cpp) 25 | 26 | # Add files to the ZIP package when running `make dist` 27 | # The compiled plugin is automatically added. 28 | DISTRIBUTABLES += $(wildcard LICENSE*) res 29 | 30 | # Include the VCV Rack plugin Makefile framework 31 | include $(RACK_DIR)/plugin.mk 32 | ifdef ARCH_MAC 33 | #CC=gcc-8 34 | #CXX=g++-8 35 | endif 36 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/components.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "componentlibrary.hpp" 3 | #include 4 | #include 5 | #include "rack.hpp" 6 | #include 7 | 8 | using namespace std; 9 | 10 | namespace rack 11 | { 12 | 13 | struct TfSlider : SVGSlider 14 | { 15 | TfSlider() 16 | { 17 | Vec margin = Vec(4, 4); 18 | maxHandlePos = Vec(-1.5, -8).plus(margin); 19 | minHandlePos = Vec(-1.5, 104).plus(margin); 20 | background->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/slider.svg")); 21 | background->wrap(); 22 | background->box.pos = margin; 23 | box.size = background->box.size.plus(margin.mult(2)); 24 | handle->svg = APP->window->loadSvg(asset::plugin(pluginInstance, "res/sliderHandle.svg")); 25 | handle->wrap(); 26 | } 27 | }; 28 | struct TfCvKnob : RoundBlackKnob 29 | { 30 | TfCvKnob() 31 | { 32 | shadow->blurRadius = 2; 33 | } 34 | }; 35 | struct TfLargeAudioKnob : Davies1900hLargeBlackKnob 36 | { 37 | TfLargeAudioKnob() 38 | { 39 | shadow->blurRadius = 4; 40 | } 41 | }; 42 | struct TfAudioKob : Davies1900hBlackKnob 43 | { 44 | TfAudioKob() 45 | { 46 | shadow->blurRadius = 4; 47 | } 48 | }; 49 | struct TfTrimpot : Trimpot 50 | { 51 | TfTrimpot() 52 | { 53 | shadow->blurRadius = 1; 54 | } 55 | }; 56 | 57 | } // namespace rack 58 | -------------------------------------------------------------------------------- /src/Eigen/INSTALL: -------------------------------------------------------------------------------- 1 | Installation instructions for Eigen 2 | *********************************** 3 | 4 | Explanation before starting 5 | *************************** 6 | 7 | Eigen consists only of header files, hence there is nothing to compile 8 | before you can use it. Moreover, these header files do not depend on your 9 | platform, they are the same for everybody. 10 | 11 | Method 1. Installing without using CMake 12 | **************************************** 13 | 14 | You can use right away the headers in the Eigen/ subdirectory. In order 15 | to install, just copy this Eigen/ subdirectory to your favorite location. 16 | If you also want the unsupported features, copy the unsupported/ 17 | subdirectory too. 18 | 19 | Method 2. Installing using CMake 20 | ******************************** 21 | 22 | Let's call this directory 'source_dir' (where this INSTALL file is). 23 | Before starting, create another directory which we will call 'build_dir'. 24 | 25 | Do: 26 | 27 | cd build_dir 28 | cmake source_dir 29 | make install 30 | 31 | The "make install" step may require administrator privileges. 32 | 33 | You can adjust the installation destination (the "prefix") 34 | by passing the -DCMAKE_INSTALL_PREFIX=myprefix option to cmake, as is 35 | explained in the message that cmake prints at the end. 36 | -------------------------------------------------------------------------------- /src/Eigen/EulerAngles: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Tal Hadad 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_MODULE_H 11 | #define EIGEN_EULERANGLES_MODULE_H 12 | 13 | 14 | #include "Eigen/Core" 15 | #include "Eigen/Geometry" 16 | 17 | #include "Eigen/src/Core/util/DisableStupidWarnings.h" 18 | 19 | namespace Eigen { 20 | 21 | /** 22 | * \defgroup EulerAngles_Module EulerAngles module 23 | * \brief This module provides generic euler angles rotation. 24 | * 25 | * Euler angles are a way to represent 3D rotation. 26 | * 27 | * In order to use this module in your code, include this header: 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * See \ref EulerAngles for more information. 33 | * 34 | */ 35 | 36 | } 37 | 38 | #include "src/EulerAngles/EulerSystem.h" 39 | #include "src/EulerAngles/EulerAngles.h" 40 | 41 | #include "Eigen/src/Core/util/ReenableStupidWarnings.h" 42 | 43 | #endif // EIGEN_EULERANGLES_MODULE_H 44 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/Core/arch/NEON/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2018 Rasmus Munk Larsen 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_NEON_H 11 | #define EIGEN_TYPE_CASTING_NEON_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template <> 18 | struct type_casting_traits { 19 | enum { 20 | VectorizedCast = 1, 21 | SrcCoeffRatio = 1, 22 | TgtCoeffRatio = 1 23 | }; 24 | }; 25 | 26 | template <> 27 | struct type_casting_traits { 28 | enum { 29 | VectorizedCast = 1, 30 | SrcCoeffRatio = 1, 31 | TgtCoeffRatio = 1 32 | }; 33 | }; 34 | 35 | 36 | template<> EIGEN_STRONG_INLINE Packet4i pcast(const Packet4f& a) { 37 | return vcvtq_s32_f32(a); 38 | } 39 | 40 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet4i& a) { 41 | return vcvtq_f32_s32(a); 42 | } 43 | 44 | } // end namespace internal 45 | 46 | } // end namespace Eigen 47 | 48 | #endif // EIGEN_TYPE_CASTING_NEON_H 49 | -------------------------------------------------------------------------------- /src/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 "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseQR/SparseQR.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "slug": "TriggerFish-Elements", 3 | "name": "TriggerFish-Elements", 4 | "version": "2.0.0", 5 | "license": "BSD-3-Clause", 6 | "brand": "TriggerFish", 7 | "author": "JTriggerFish", 8 | "authorEmail": "FastTriggerFish@gmail.com", 9 | "authorUrl": "", 10 | "pluginUrl": "https://github.com/JTriggerFish/TriggerFish-VCV", 11 | "manualUrl": "https://github.com/JTriggerFish/TriggerFish-VCV", 12 | "sourceUrl": "https://github.com/JTriggerFish/TriggerFish-VCV", 13 | "donateUrl": "https://paypal.me/jtriggerfish", 14 | "changelogUrl": "", 15 | "modules": [ 16 | { 17 | "slug": "TfSlop", 18 | "name": "Slop", 19 | "description": "Slop", 20 | "tags": [ 21 | "Noise" 22 | ] 23 | }, 24 | { 25 | "slug": "TfSlop4", 26 | "name": "Slop4", 27 | "description": "Slop", 28 | "tags": [ 29 | "Noise" 30 | ] 31 | }, 32 | { 33 | "slug": "TfVDPO", 34 | "name": "VDPO", 35 | "description": "Van Der Pol Oscillator", 36 | "tags": [ 37 | "Oscillator" 38 | ] 39 | }, 40 | { 41 | "slug": "TfVCA", 42 | "name": "TFVCA", 43 | "description": "analog modelled VCA that is loosely based on the minimoog's circuit", 44 | "tags": [ 45 | "Voltage-controlled amplifier" 46 | ] 47 | } 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.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 | // Copyright (C) 2018 Deven Desai 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 | #if defined(EIGEN_CXX11_TENSOR_GPU_HIP_CUDA_DEFINES_H) 12 | 13 | #undef gpuStream_t 14 | #undef gpuDeviceProp_t 15 | #undef gpuError_t 16 | #undef gpuSuccess 17 | #undef gpuErrorNotReady 18 | #undef gpuGetDeviceCount 19 | #undef gpuGetErrorString 20 | #undef gpuGetDeviceProperties 21 | #undef gpuStreamDefault 22 | #undef gpuGetDevice 23 | #undef gpuSetDevice 24 | #undef gpuMalloc 25 | #undef gpuFree 26 | #undef gpuMemsetAsync 27 | #undef gpuMemcpyAsync 28 | #undef gpuMemcpyDeviceToDevice 29 | #undef gpuMemcpyDeviceToHost 30 | #undef gpuMemcpyHostToDevice 31 | #undef gpuStreamQuery 32 | #undef gpuSharedMemConfig 33 | #undef gpuDeviceSetSharedMemConfig 34 | #undef gpuStreamSynchronize 35 | #undef gpuDeviceSynchronize 36 | #undef gpuMemcpy 37 | 38 | #undef EIGEN_CXX11_TENSOR_GPU_HIP_CUDA_DEFINES_H 39 | 40 | #endif // EIGEN_CXX11_TENSOR_GPU_HIP_CUDA_DEFINES_H 41 | -------------------------------------------------------------------------------- /src/tfdsp/sampleRate.cpp: -------------------------------------------------------------------------------- 1 | #include "sampleRate.hpp" 2 | 3 | 4 | namespace tfdsp { 5 | 6 | X2Resampler_Order5* CreateX2Resampler_Butterworth5() 7 | { 8 | Eigen::Array directCoeffs; 9 | Eigen::Array delayedCoeffs; 10 | 11 | directCoeffs << 1.0 / (5 + 2 * std::sqrt(5)); 12 | delayedCoeffs << 5 - 2 * std::sqrt(5); 13 | 14 | return new PolyphaseIIR_X2Resampler<1, 1>(directCoeffs, delayedCoeffs); 15 | } 16 | X2Resampler_Order7* CreateX2Resampler_Chebychev7() 17 | { 18 | Eigen::Array directCoeffs; 19 | Eigen::Array delayedCoeffs; 20 | directCoeffs << 0.081430023176616115, 0.70977080010248506; 21 | delayedCoeffs << 0.31565984021666094; 22 | return new PolyphaseIIR_X2Resampler<2, 1>(directCoeffs, delayedCoeffs); 23 | } 24 | X2Resampler_Order9* CreateX2Resampler_Chebychev9() 25 | { 26 | Eigen::Array directCoeffs; 27 | Eigen::Array delayedCoeffs; 28 | directCoeffs << 0.079866426236357438, 0.54532365107113168; 29 | delayedCoeffs << 0.28382934487410966, 0.83441189148073658; 30 | return new PolyphaseIIR_X2Resampler<2, 2>(directCoeffs, delayedCoeffs); 31 | } 32 | DummyResampler* CreateDummyResampler() 33 | { 34 | return new DummyResampler(); 35 | } 36 | X4Resampler_Order7* CreateX4Resampler_Cheby7() 37 | { 38 | return new X4Resampler_Order7(CreateX2Resampler_Chebychev7); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/Eigen/AutoDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_AUTODIFF_MODULE 11 | #define EIGEN_AUTODIFF_MODULE 12 | 13 | namespace Eigen { 14 | 15 | /** 16 | * \defgroup AutoDiff_Module Auto Diff module 17 | * 18 | * This module features forward automatic differentation via a simple 19 | * templated scalar type wrapper AutoDiffScalar. 20 | * 21 | * Warning : this should NOT be confused with numerical differentiation, which 22 | * is a different method and has its own module in Eigen : \ref NumericalDiff_Module. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | //@{ 29 | 30 | } 31 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 32 | 33 | 34 | #include "src/AutoDiff/AutoDiffScalar.h" 35 | // #include "src/AutoDiff/AutoDiffVector.h" 36 | #include "src/AutoDiff/AutoDiffJacobian.h" 37 | 38 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 39 | 40 | 41 | 42 | namespace Eigen { 43 | //@} 44 | } 45 | 46 | #endif // EIGEN_AUTODIFF_MODULE 47 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.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_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 12 | 13 | namespace Eigen { 14 | 15 | struct StlThreadEnvironment { 16 | struct Task { 17 | std::function f; 18 | }; 19 | 20 | // EnvThread constructor must start the thread, 21 | // destructor must join the thread. 22 | class EnvThread { 23 | public: 24 | EnvThread(std::function f) : thr_(std::move(f)) {} 25 | ~EnvThread() { thr_.join(); } 26 | // This function is called when the threadpool is cancelled. 27 | void OnCancel() { } 28 | 29 | private: 30 | std::thread thr_; 31 | }; 32 | 33 | EnvThread* CreateThread(std::function f) { return new EnvThread(std::move(f)); } 34 | Task CreateTask(std::function f) { return Task{std::move(f)}; } 35 | void ExecuteTask(const Task& t) { t.f(); } 36 | }; 37 | 38 | } // namespace Eigen 39 | 40 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 41 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | 3 | cache: 4 | directories: 5 | - /tmp/Rack 6 | #before_cache: 7 | #- rm -fr /tmp/Rack/plugins/sdr 8 | 9 | addons: 10 | homebrew: 11 | packages: 12 | - jq 13 | - python 14 | - libtool 15 | 16 | matrix: 17 | include: 18 | - os: linux 19 | addons: 20 | apt: 21 | sources: 22 | - ubuntu-toolchain-r-test 23 | packages: 24 | - g++-7 25 | env: 26 | - MATRIX_EVAL="sudo apt install git curl cmake libx11-dev libglu1-mesa-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev zlib1g-dev libasound2-dev libgtk2.0-dev libjack-jackd2-dev jq;CC=gcc-7 && CXX=g++-7" 27 | - os: osx 28 | osx_image: xcode11.3 29 | env: 30 | - MATRIX_EVAL="" 31 | 32 | before_install: 33 | - eval "${MATRIX_EVAL}" 34 | 35 | before_script: 36 | - git clone --branch=v1 https://github.com/VCVRack/Rack.git /tmp/Rack || cd /tmp/Rack && git pull 37 | - cd /tmp/Rack 38 | - git submodule update --init --recursive 39 | - if [ $TRAVIS_OS_NAME == linux ]; then export ; fi 40 | - make dep -j4 #> /dev/null 41 | - make clean 42 | - make -j4 43 | - rm -rf /tmp/Rack/plugins/sdr || true 44 | - cp -r $TRAVIS_BUILD_DIR /tmp/Rack/plugins/sdr 45 | 46 | script: 47 | - cd /tmp/Rack/plugins/sdr && make dist 48 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/LevenbergMarquardt: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 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_LEVENBERGMARQUARDT_MODULE 11 | #define EIGEN_LEVENBERGMARQUARDT_MODULE 12 | 13 | // #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | /** 23 | * \defgroup LevenbergMarquardt_Module Levenberg-Marquardt module 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | * 29 | * 30 | */ 31 | 32 | #include "Eigen/SparseCore" 33 | 34 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 35 | 36 | #ifndef EIGEN_PARSED_BY_DOXYGEN 37 | 38 | #include "src/LevenbergMarquardt/LMqrsolv.h" 39 | #include "src/LevenbergMarquardt/LMcovar.h" 40 | #include "src/LevenbergMarquardt/LMpar.h" 41 | 42 | #endif 43 | 44 | #include "src/LevenbergMarquardt/LevenbergMarquardt.h" 45 | #include "src/LevenbergMarquardt/LMonestep.h" 46 | 47 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_LEVENBERGMARQUARDT_MODULE 50 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/TensorSymmetry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2013 Christian Seiler 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_CXX11_TENSORSYMMETRY_MODULE 11 | #define EIGEN_CXX11_TENSORSYMMETRY_MODULE 12 | 13 | #include 14 | 15 | #include 16 | 17 | #include "src/util/CXX11Meta.h" 18 | 19 | /** \defgroup CXX11_TensorSymmetry_Module Tensor Symmetry Module 20 | * 21 | * This module provides a classes that allow for the definition of 22 | * symmetries w.r.t. tensor indices. 23 | * 24 | * Including this module will implicitly include the Tensor module. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | */ 30 | 31 | #include "src/TensorSymmetry/util/TemplateGroupTheory.h" 32 | #include "src/TensorSymmetry/Symmetry.h" 33 | #include "src/TensorSymmetry/StaticSymmetry.h" 34 | #include "src/TensorSymmetry/DynamicSymmetry.h" 35 | 36 | #include 37 | 38 | #endif // EIGEN_CXX11_TENSORSYMMETRY_MODULE 39 | 40 | /* 41 | * kate: space-indent on; indent-width 2; mixedindent off; indent-mode cstyle; 42 | */ 43 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Builds application", 6 | "type": "shell", 7 | "command": "make", 8 | "windows":{ 9 | "command": "make", 10 | "options": { 11 | "cwd": "${workspaceRoot}", 12 | "env": { 13 | "PATH": "C:\\msys64\\usr\\bin\\;C:\\msys64\\mingw64\\bin" 14 | } 15 | } 16 | }, 17 | "options": { 18 | "cwd": "${workspaceRoot}", 19 | }, 20 | "group": { 21 | "kind": "build", 22 | "isDefault": true 23 | }, 24 | "presentation": { 25 | "echo": true, 26 | "reveal": "always", 27 | "focus": false, 28 | "panel": "shared" 29 | }, 30 | "args": ["-j8"], 31 | "problemMatcher": { 32 | "owner": "cpp", 33 | "fileLocation": ["absolute"], 34 | "pattern": { 35 | "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", 36 | "file": 1, 37 | "line": 2, 38 | "column": 3, 39 | "severity": 4, 40 | "message": 5 41 | } 42 | } 43 | } 44 | ] 45 | } -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2018 TriggerFish Audio 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 12 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.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_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | /** \cpp11 \returns an expression of the coefficient-wise betainc(\a x, \a a, \a b) to the given tensors. 16 | * 17 | * This function computes the regularized incomplete beta function (integral). 18 | * 19 | */ 20 | template 21 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const 22 | TensorCwiseTernaryOp, 23 | const ADerived, const BDerived, const XDerived> 24 | betainc(const ADerived& a, const BDerived& b, const XDerived& x) { 25 | return TensorCwiseTernaryOp< 26 | internal::scalar_betainc_op, const ADerived, 27 | const BDerived, const XDerived>( 28 | a, b, x, internal::scalar_betainc_op()); 29 | } 30 | 31 | } // end namespace Eigen 32 | 33 | #endif // EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 34 | -------------------------------------------------------------------------------- /tests/PythonTests/PythonTests/VCA_tests.py: -------------------------------------------------------------------------------- 1 | from itertools import islice 2 | from random import random 3 | from time import perf_counter 4 | from scipy import signal 5 | from scipy.signal import * 6 | import triggerfishvcv 7 | import numpy as np 8 | from plotting import * 9 | 10 | 11 | def getModelOutputs(time,x, models,fs): 12 | cv = np.full(len(x),1.) 13 | responses = [] 14 | for m in models: 15 | vcaMethod = getattr(triggerfishvcv, m) 16 | y = vcaMethod(x,cv,fs) 17 | responses += [y] 18 | return responses 19 | 20 | 21 | 22 | if __name__ == "__main__": 23 | #print(np.get_include()) 24 | fs = 48000 * 1 25 | N = 10 * fs 26 | time = np.arange(N) / float(fs) 27 | 28 | x = 5*chirp(time, f0 = 0, t1 = time[-1], f1 = 24000) 29 | #x = np.where(time >= 1.0, x, 0) 30 | models = ["vca_OTA_noOversampling", "vca_OTA_butterworth5", "vca_OTA_cheby7", "vca_OTA_x4_cheby7"] 31 | models += ["vca_Transistor_noOversampling", "vca_Transistor_butterworth5", "vca_Transistor_cheby7", "vca_Transistor_x4_cheby7"] 32 | 33 | ys = getModelOutputs(time, x,models,fs) 34 | 35 | MultiPlotBokeh(spectrogramBokeh, fs, time, x, ys, models) 36 | #MultiPlotBokeh(powerSpectralDensity, fs, time, x, ys, models) 37 | 38 | N = 1000 39 | time = np.arange(N) / float(fs) 40 | #x = 10* np.where(time >0.0, 0.0, 1.0) # Impulse 41 | x = 3* np.where(time >0.0, 1.0, 0.0) # Heaviside 42 | ys = getModelOutputs(time, x,models) 43 | MultiPlotBokeh(timeResponse, fs, time, x, ys, models) 44 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.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_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 12 | 13 | namespace Eigen { 14 | 15 | // This defines an interface that ThreadPoolDevice can take to use 16 | // custom thread pools underneath. 17 | class ThreadPoolInterface { 18 | public: 19 | // Submits a closure to be run by a thread in the pool. 20 | virtual void Schedule(std::function fn) = 0; 21 | 22 | // If implemented, stop processing the closures that have been enqueued. 23 | // Currently running closures may still be processed. 24 | // If not implemented, does nothing. 25 | virtual void Cancel() {} 26 | 27 | // Returns the number of threads in the pool. 28 | virtual int NumThreads() const = 0; 29 | 30 | // Returns a logical thread index between 0 and NumThreads() - 1 if called 31 | // from one of the threads in the pool. Returns -1 otherwise. 32 | virtual int CurrentThreadId() const = 0; 33 | 34 | virtual ~ThreadPoolInterface() {} 35 | }; 36 | 37 | } // namespace Eigen 38 | 39 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 40 | -------------------------------------------------------------------------------- /src/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 "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/SparseExtra: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_EXTRA_MODULE_H 11 | #define EIGEN_SPARSE_EXTRA_MODULE_H 12 | 13 | #include "../../Eigen/Sparse" 14 | 15 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef EIGEN_GOOGLEHASH_SUPPORT 26 | #include 27 | #endif 28 | 29 | /** 30 | * \defgroup SparseExtra_Module SparseExtra module 31 | * 32 | * This module contains some experimental features extending the sparse module. 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | */ 38 | 39 | 40 | #include "src/SparseExtra/DynamicSparseMatrix.h" 41 | #include "src/SparseExtra/BlockOfDynamicSparseMatrix.h" 42 | #include "src/SparseExtra/RandomSetter.h" 43 | 44 | #include "src/SparseExtra/MarketIO.h" 45 | 46 | #if !defined(_WIN32) 47 | #include 48 | #include "src/SparseExtra/MatrixMarketIterator.h" 49 | #endif 50 | 51 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 52 | 53 | #endif // EIGEN_SPARSE_EXTRA_MODULE_H 54 | -------------------------------------------------------------------------------- /src/Eigen/KLUSupport: -------------------------------------------------------------------------------- 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_KLUSUPPORT_MODULE_H 9 | #define EIGEN_KLUSUPPORT_MODULE_H 10 | 11 | #include 12 | 13 | #include 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup KLUSupport_Module KLUSupport module 22 | * 23 | * This module provides an interface to the KLU library which is part of the suitesparse package. 24 | * It provides the following factorization class: 25 | * - class KLU: a sparse LU factorization, well-suited for circuit simulation. 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | * 31 | * In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. 32 | * The dependencies depend on how umfpack has been compiled. 33 | * For a cmake based project, you can use our FindKLU.cmake module to help you in this task. 34 | * 35 | */ 36 | 37 | #include "src/KLUSupport/KLUSupport.h" 38 | 39 | #include 40 | 41 | #endif // EIGEN_KLUSUPPORT_MODULE_H 42 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/NonLinearOptimization/rwupdt.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void rwupdt( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const Matrix< Scalar, Dynamic, 1> &w, 9 | Matrix< Scalar, Dynamic, 1> &b, 10 | Scalar alpha) 11 | { 12 | typedef DenseIndex Index; 13 | 14 | const Index n = r.cols(); 15 | eigen_assert(r.rows()>=n); 16 | std::vector > givens(n); 17 | 18 | /* Local variables */ 19 | Scalar temp, rowj; 20 | 21 | /* Function Body */ 22 | for (Index j = 0; j < n; ++j) { 23 | rowj = w[j]; 24 | 25 | /* apply the previous transformations to */ 26 | /* r(i,j), i=0,1,...,j-1, and to w(j). */ 27 | for (Index i = 0; i < j; ++i) { 28 | temp = givens[i].c() * r(i,j) + givens[i].s() * rowj; 29 | rowj = -givens[i].s() * r(i,j) + givens[i].c() * rowj; 30 | r(i,j) = temp; 31 | } 32 | 33 | /* determine a givens rotation which eliminates w(j). */ 34 | givens[j].makeGivens(-r(j,j), rowj); 35 | 36 | if (rowj == 0.) 37 | continue; // givens[j] is identity 38 | 39 | /* apply the current transformation to r(j,j), b(j), and alpha. */ 40 | r(j,j) = givens[j].c() * r(j,j) + givens[j].s() * rowj; 41 | temp = givens[j].c() * b[j] + givens[j].s() * alpha; 42 | alpha = -givens[j].s() * b[j] + givens[j].c() * alpha; 43 | b[j] = temp; 44 | } 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | -------------------------------------------------------------------------------- /src/Eigen/COPYING.BSD: -------------------------------------------------------------------------------- 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 | */ -------------------------------------------------------------------------------- /src/Eigen/IterativeSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_ITERATIVE_SOLVERS_MODULE_H 11 | #define EIGEN_ITERATIVE_SOLVERS_MODULE_H 12 | 13 | #include 14 | #include "../../Eigen/Jacobi" 15 | #include "../../Eigen/Householder" 16 | 17 | /** 18 | * \defgroup IterativeSolvers_Module Iterative solvers module 19 | * This module aims to provide various iterative linear and non linear solver algorithms. 20 | * It currently provides: 21 | * - a constrained conjugate gradient 22 | * - a Householder GMRES implementation 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | //@{ 28 | 29 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 30 | 31 | #ifndef EIGEN_MPL2_ONLY 32 | #include "src/IterativeSolvers/IterationController.h" 33 | #include "src/IterativeSolvers/ConstrainedConjGrad.h" 34 | #endif 35 | 36 | #include "src/IterativeSolvers/IncompleteLU.h" 37 | #include "src/IterativeSolvers/GMRES.h" 38 | #include "src/IterativeSolvers/DGMRES.h" 39 | //#include "src/IterativeSolvers/SSORPreconditioner.h" 40 | #include "src/IterativeSolvers/MINRES.h" 41 | 42 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 43 | 44 | //@} 45 | 46 | #endif // EIGEN_ITERATIVE_SOLVERS_MODULE_H 47 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorMacros.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_CXX11_TENSOR_TENSOR_META_MACROS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H 12 | 13 | 14 | /** use this macro in sfinae selection in templated functions 15 | * 16 | * template::value , int >::type = 0 18 | * > 19 | * void foo(){} 20 | * 21 | * becomes => 22 | * 23 | * template::value ) 25 | * > 26 | * void foo(){} 27 | */ 28 | 29 | // SFINAE requires variadic templates 30 | #if !defined(EIGEN_GPUCC) 31 | #if EIGEN_HAS_VARIADIC_TEMPLATES 32 | // SFINAE doesn't work for gcc <= 4.7 33 | #ifdef EIGEN_COMP_GNUC 34 | #if EIGEN_GNUC_AT_LEAST(4,8) 35 | #define EIGEN_HAS_SFINAE 36 | #endif 37 | #else 38 | #define EIGEN_HAS_SFINAE 39 | #endif 40 | #endif 41 | #endif 42 | 43 | #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \ 44 | typename internal::enable_if< ( __condition__ ) , int >::type = 0 45 | 46 | 47 | #if EIGEN_HAS_CONSTEXPR 48 | #define EIGEN_CONSTEXPR constexpr 49 | #else 50 | #define EIGEN_CONSTEXPR 51 | #endif 52 | 53 | 54 | #if EIGEN_OS_WIN || EIGEN_OS_WIN64 55 | #define EIGEN_SLEEP(n) Sleep(n) 56 | #elif EIGEN_OS_GNULINUX 57 | #define EIGEN_SLEEP(n) usleep(n * 1000); 58 | #else 59 | #define EIGEN_SLEEP(n) sleep(std::max(1, n/1000)) 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/SpecialFunctions: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 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_SPECIALFUNCTIONS_MODULE 11 | #define EIGEN_SPECIALFUNCTIONS_MODULE 12 | 13 | #include 14 | 15 | #include "../../Eigen/Core" 16 | 17 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 18 | 19 | namespace Eigen { 20 | 21 | /** 22 | * \defgroup SpecialFunctions_Module Special math functions module 23 | * 24 | * This module features additional coefficient-wise math functions available 25 | * within the numext:: namespace for the scalar version, and as method and/or free 26 | * functions of Array. Those include: 27 | * 28 | * - erf 29 | * - erfc 30 | * - lgamma 31 | * - igamma 32 | * - igamma_der_a 33 | * - gamma_sample_der_alpha 34 | * - igammac 35 | * - digamma 36 | * - polygamma 37 | * - zeta 38 | * - betainc 39 | * - i0e 40 | * - i1e 41 | * 42 | * \code 43 | * #include 44 | * \endcode 45 | */ 46 | //@{ 47 | 48 | } 49 | 50 | #include "src/SpecialFunctions/SpecialFunctionsImpl.h" 51 | #include "src/SpecialFunctions/SpecialFunctionsPacketMath.h" 52 | #include "src/SpecialFunctions/SpecialFunctionsHalf.h" 53 | #include "src/SpecialFunctions/SpecialFunctionsFunctors.h" 54 | #include "src/SpecialFunctions/SpecialFunctionsArrayAPI.h" 55 | 56 | #if defined EIGEN_VECTORIZE_GPU 57 | #include "src/SpecialFunctions/arch/GPU/GpuSpecialFunctions.h" 58 | #endif 59 | 60 | namespace Eigen { 61 | //@} 62 | } 63 | 64 | 65 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 66 | 67 | #endif // EIGEN_SPECIALFUNCTIONS_MODULE 68 | -------------------------------------------------------------------------------- /src/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 | * This wrapper resuires PaStiX version 5.x compiled without MPI support. 40 | * The dependencies depend on how PaSTiX has been compiled. 41 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 42 | * 43 | */ 44 | 45 | #include "src/PaStiXSupport/PaStiXSupport.h" 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 50 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/tfdsp/noise.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include "filters.hpp" 6 | 7 | 8 | /** 9 | * References: 10 | * -Pinking filter for pink noise : https://ccrma.stanford.edu/~jos/sasp/Example_Synthesis_1_F_Noise.html 11 | */ 12 | 13 | namespace tfdsp 14 | { 15 | class WhiteNoiseSource 16 | { 17 | private: 18 | std::random_device _seed{}; 19 | std::minstd_rand _rng; 20 | std::normal_distribution _gaussian{ 0.0, 1.0 }; 21 | public: 22 | WhiteNoiseSource() : _rng(_seed()) 23 | { 24 | } 25 | float Step() 26 | { 27 | return _gaussian(_rng); 28 | } 29 | }; 30 | 31 | class PinkNoiseSource 32 | { 33 | private: 34 | WhiteNoiseSource _white{}; 35 | FirstOrderLowPassZdf _filter; 36 | std::array _x{}; 37 | std::array _y{}; 38 | std::array _a{{ 1.0f, -2.494956002f, 2.017265875f, -0.522189400f }}; 39 | std::array _b{{ 0.049922035, -0.095993537, 0.050612699, -0.004408786 }}; 40 | public: 41 | PinkNoiseSource() {} 42 | 43 | float Filter3dbPerOctave(float x) 44 | { 45 | _x[0] = x; 46 | auto y = _b[0] * _x[0]; 47 | for(std::size_t i=1; i < 4; ++i) 48 | y += _b[i] * _x[i] - _a[i] * _y[i]; 49 | 50 | _y[0] = y; 51 | for(std::size_t i=3; i > 0; --i) 52 | { 53 | _x[i] = _x[i - 1]; 54 | _y[i] = _y[i - 1]; 55 | } 56 | return y; 57 | } 58 | 59 | float Step() 60 | { 61 | auto x = _white.Step(); 62 | return Filter3dbPerOctave(x); 63 | } 64 | }; 65 | class detune 66 | { 67 | public: 68 | /* 69 | Return a detuned v/oct value such that after being converted to a frequency 70 | by f(vOct) = f0 * pow(2, vOct), f( output ) = f(vOct) + det 71 | */ 72 | static double linear(double vOct, double det, double f0 = 261.63) 73 | { 74 | static const double ln2 = std::log(2.0); 75 | double v = det / f0 + std::exp(vOct * ln2); 76 | v = std::max(1.0e-8, v); 77 | return std::log(v) / ln2; 78 | } 79 | }; 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/Eigen/NumericalDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 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_NUMERICALDIFF_MODULE 11 | #define EIGEN_NUMERICALDIFF_MODULE 12 | 13 | #include 14 | 15 | namespace Eigen { 16 | 17 | /** 18 | * \defgroup NumericalDiff_Module Numerical differentiation module 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | * 24 | * See http://en.wikipedia.org/wiki/Numerical_differentiation 25 | * 26 | * Warning : this should NOT be confused with automatic differentiation, which 27 | * is a different method and has its own module in Eigen : \ref 28 | * AutoDiff_Module. 29 | * 30 | * Currently only "Forward" and "Central" schemes are implemented. Those 31 | * are basic methods, and there exist some more elaborated way of 32 | * computing such approximates. They are implemented using both 33 | * proprietary and free software, and usually requires linking to an 34 | * external library. It is very easy for you to write a functor 35 | * using such software, and the purpose is quite orthogonal to what we 36 | * want to achieve with Eigen. 37 | * 38 | * This is why we will not provide wrappers for every great numerical 39 | * differentiation software that exist, but should rather stick with those 40 | * basic ones, that still are useful for testing. 41 | * 42 | * Also, the \ref NonLinearOptimization_Module needs this in order to 43 | * provide full features compatibility with the original (c)minpack 44 | * package. 45 | * 46 | */ 47 | } 48 | 49 | //@{ 50 | 51 | #include "src/NumericalDiff/NumericalDiff.h" 52 | 53 | //@} 54 | 55 | 56 | #endif // EIGEN_NUMERICALDIFF_MODULE 57 | -------------------------------------------------------------------------------- /src/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/Core/util/DisableStupidWarnings.h" 27 | 28 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 29 | 30 | #include "src/SparseLU/SparseLU_Structs.h" 31 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 32 | #include "src/SparseLU/SparseLUImpl.h" 33 | #include "src/SparseCore/SparseColEtree.h" 34 | #include "src/SparseLU/SparseLU_Memory.h" 35 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 36 | #include "src/SparseLU/SparseLU_relax_snode.h" 37 | #include "src/SparseLU/SparseLU_pivotL.h" 38 | #include "src/SparseLU/SparseLU_panel_dfs.h" 39 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 40 | #include "src/SparseLU/SparseLU_panel_bmod.h" 41 | #include "src/SparseLU/SparseLU_column_dfs.h" 42 | #include "src/SparseLU/SparseLU_column_bmod.h" 43 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 44 | #include "src/SparseLU/SparseLU_pruneL.h" 45 | #include "src/SparseLU/SparseLU_Utils.h" 46 | #include "src/SparseLU/SparseLU.h" 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SPARSELU_MODULE_H 51 | -------------------------------------------------------------------------------- /src/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 "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | #include "LU" 17 | #include "Geometry" 18 | 19 | #include "src/Core/util/DisableStupidWarnings.h" 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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/NonLinearOptimization/chkder.h: -------------------------------------------------------------------------------- 1 | #define chkder_log10e 0.43429448190325182765 2 | #define chkder_factor 100. 3 | 4 | namespace Eigen { 5 | 6 | namespace internal { 7 | 8 | template 9 | void chkder( 10 | const Matrix< Scalar, Dynamic, 1 > &x, 11 | const Matrix< Scalar, Dynamic, 1 > &fvec, 12 | const Matrix< Scalar, Dynamic, Dynamic > &fjac, 13 | Matrix< Scalar, Dynamic, 1 > &xp, 14 | const Matrix< Scalar, Dynamic, 1 > &fvecp, 15 | int mode, 16 | Matrix< Scalar, Dynamic, 1 > &err 17 | ) 18 | { 19 | using std::sqrt; 20 | using std::abs; 21 | using std::log; 22 | 23 | typedef DenseIndex Index; 24 | 25 | const Scalar eps = sqrt(NumTraits::epsilon()); 26 | const Scalar epsf = chkder_factor * NumTraits::epsilon(); 27 | const Scalar epslog = chkder_log10e * log(eps); 28 | Scalar temp; 29 | 30 | const Index m = fvec.size(), n = x.size(); 31 | 32 | if (mode != 2) { 33 | /* mode = 1. */ 34 | xp.resize(n); 35 | for (Index j = 0; j < n; ++j) { 36 | temp = eps * abs(x[j]); 37 | if (temp == 0.) 38 | temp = eps; 39 | xp[j] = x[j] + temp; 40 | } 41 | } 42 | else { 43 | /* mode = 2. */ 44 | err.setZero(m); 45 | for (Index j = 0; j < n; ++j) { 46 | temp = abs(x[j]); 47 | if (temp == 0.) 48 | temp = 1.; 49 | err += temp * fjac.col(j); 50 | } 51 | for (Index i = 0; i < m; ++i) { 52 | temp = 1.; 53 | if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i])) 54 | temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i])); 55 | err[i] = 1.; 56 | if (temp > NumTraits::epsilon() && temp < eps) 57 | err[i] = (chkder_log10e * log(temp) - epslog) / epslog; 58 | if (temp >= eps) 59 | err[i] = 0.; 60 | } 61 | } 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/ThreadPool/Barrier.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2018 Rasmus Munk Larsen 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 | // Barrier is an object that allows one or more threads to wait until 11 | // Notify has been called a specified number of times. 12 | 13 | #ifndef EIGEN_CXX11_THREADPOOL_BARRIER_H 14 | #define EIGEN_CXX11_THREADPOOL_BARRIER_H 15 | 16 | namespace Eigen { 17 | 18 | class Barrier { 19 | public: 20 | Barrier(unsigned int count) : state_(count << 1), notified_(false) { 21 | eigen_assert(((count << 1) >> 1) == count); 22 | } 23 | ~Barrier() { eigen_plain_assert((state_ >> 1) == 0); } 24 | 25 | void Notify() { 26 | unsigned int v = state_.fetch_sub(2, std::memory_order_acq_rel) - 2; 27 | if (v != 1) { 28 | eigen_assert(((v + 2) & ~1) != 0); 29 | return; // either count has not dropped to 0, or waiter is not waiting 30 | } 31 | std::unique_lock l(mu_); 32 | eigen_assert(!notified_); 33 | notified_ = true; 34 | cv_.notify_all(); 35 | } 36 | 37 | void Wait() { 38 | unsigned int v = state_.fetch_or(1, std::memory_order_acq_rel); 39 | if ((v >> 1) == 0) return; 40 | std::unique_lock l(mu_); 41 | while (!notified_) { 42 | cv_.wait(l); 43 | } 44 | } 45 | 46 | private: 47 | std::mutex mu_; 48 | std::condition_variable cv_; 49 | std::atomic state_; // low bit is waiter flag 50 | bool notified_; 51 | }; 52 | 53 | // Notification is an object that allows a user to to wait for another 54 | // thread to signal a notification that an event has occurred. 55 | // 56 | // Multiple threads can wait on the same Notification object, 57 | // but only one caller must call Notify() on the object. 58 | struct Notification : Barrier { 59 | Notification() : Barrier(1){}; 60 | }; 61 | 62 | } // namespace Eigen 63 | 64 | #endif // EIGEN_CXX11_THREADPOOL_BARRIER_H 65 | -------------------------------------------------------------------------------- /src/Eigen/src/NonLinearOptimization/covar.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void covar( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const VectorXi &ipvt, 9 | Scalar tol = std::sqrt(NumTraits::epsilon()) ) 10 | { 11 | using std::abs; 12 | typedef DenseIndex Index; 13 | 14 | /* Local variables */ 15 | Index i, j, k, l, ii, jj; 16 | bool sing; 17 | Scalar temp; 18 | 19 | /* Function Body */ 20 | const Index n = r.cols(); 21 | const Scalar tolr = tol * abs(r(0,0)); 22 | Matrix< Scalar, Dynamic, 1 > wa(n); 23 | eigen_assert(ipvt.size()==n); 24 | 25 | /* form the inverse of r in the full upper triangle of r. */ 26 | l = -1; 27 | for (k = 0; k < n; ++k) 28 | if (abs(r(k,k)) > tolr) { 29 | r(k,k) = 1. / r(k,k); 30 | for (j = 0; j <= k-1; ++j) { 31 | temp = r(k,k) * r(j,k); 32 | r(j,k) = 0.; 33 | r.col(k).head(j+1) -= r.col(j).head(j+1) * temp; 34 | } 35 | l = k; 36 | } 37 | 38 | /* form the full upper triangle of the inverse of (r transpose)*r */ 39 | /* in the full upper triangle of r. */ 40 | for (k = 0; k <= l; ++k) { 41 | for (j = 0; j <= k-1; ++j) 42 | r.col(j).head(j+1) += r.col(k).head(j+1) * r(j,k); 43 | r.col(k).head(k+1) *= r(k,k); 44 | } 45 | 46 | /* form the full lower triangle of the covariance matrix */ 47 | /* in the strict lower triangle of r and in wa. */ 48 | for (j = 0; j < n; ++j) { 49 | jj = ipvt[j]; 50 | sing = j > l; 51 | for (i = 0; i <= j; ++i) { 52 | if (sing) 53 | r(i,j) = 0.; 54 | ii = ipvt[i]; 55 | if (ii > jj) 56 | r(ii,jj) = r(i,j); 57 | if (ii < jj) 58 | r(jj,ii) = r(i,j); 59 | } 60 | wa[jj] = r(j,j); 61 | } 62 | 63 | /* symmetrize the covariance matrix in r. */ 64 | r.topLeftCorner(n,n).template triangularView() = r.topLeftCorner(n,n).transpose(); 65 | r.diagonal() = wa; 66 | } 67 | 68 | } // end namespace internal 69 | 70 | } // end namespace Eigen 71 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 "SVD" 14 | #include "LU" 15 | #include 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 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 | -------------------------------------------------------------------------------- /src/Eigen/COPYING.MINPACK: -------------------------------------------------------------------------------- 1 | Minpack Copyright Notice (1999) University of Chicago. All rights reserved 2 | 3 | Redistribution and use in source and binary forms, with or 4 | without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | 16 | 3. The end-user documentation included with the 17 | redistribution, if any, must include the following 18 | acknowledgment: 19 | 20 | "This product includes software developed by the 21 | University of Chicago, as Operator of Argonne National 22 | Laboratory. 23 | 24 | Alternately, this acknowledgment may appear in the software 25 | itself, if and wherever such third-party acknowledgments 26 | normally appear. 27 | 28 | 4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" 29 | WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE 30 | UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND 31 | THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES 33 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE 34 | OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY 35 | OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR 36 | USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF 37 | THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) 38 | DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION 39 | UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL 40 | BE CORRECTED. 41 | 42 | 5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT 43 | HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF 44 | ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, 45 | INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF 46 | ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF 47 | PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER 48 | SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT 49 | (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, 50 | EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE 51 | POSSIBILITY OF SUCH LOSS OR DAMAGES. 52 | 53 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/LevenbergMarquardt/CopyrightMINPACK.txt: -------------------------------------------------------------------------------- 1 | Minpack Copyright Notice (1999) University of Chicago. All rights reserved 2 | 3 | Redistribution and use in source and binary forms, with or 4 | without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | 16 | 3. The end-user documentation included with the 17 | redistribution, if any, must include the following 18 | acknowledgment: 19 | 20 | "This product includes software developed by the 21 | University of Chicago, as Operator of Argonne National 22 | Laboratory. 23 | 24 | Alternately, this acknowledgment may appear in the software 25 | itself, if and wherever such third-party acknowledgments 26 | normally appear. 27 | 28 | 4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" 29 | WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE 30 | UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND 31 | THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES 33 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE 34 | OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY 35 | OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR 36 | USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF 37 | THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) 38 | DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION 39 | UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL 40 | BE CORRECTED. 41 | 42 | 5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT 43 | HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF 44 | ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, 45 | INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF 46 | ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF 47 | PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER 48 | SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT 49 | (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, 50 | EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE 51 | POSSIBILITY OF SUCH LOSS OR DAMAGES. 52 | 53 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/ThreadPool: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 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_CXX11_THREADPOOL_MODULE 11 | #define EIGEN_CXX11_THREADPOOL_MODULE 12 | 13 | #include "../../../Eigen/Core" 14 | 15 | #include 16 | 17 | /** \defgroup CXX11_ThreadPool_Module C++11 ThreadPool Module 18 | * 19 | * This module provides 2 threadpool implementations 20 | * - a simple reference implementation 21 | * - a faster non blocking implementation 22 | * 23 | * This module requires C++11. 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | */ 29 | 30 | 31 | // The code depends on CXX11, so only include the module if the 32 | // compiler supports it. 33 | #if __cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include "src/util/CXX11Meta.h" 48 | #include "src/util/MaxSizeVector.h" 49 | 50 | #include "src/ThreadPool/ThreadLocal.h" 51 | #ifndef EIGEN_THREAD_LOCAL 52 | // There are non-parenthesized calls to "max" in the header, 53 | // which trigger a check in test/main.h causing compilation to fail. 54 | // We work around the check here by removing the check for max in 55 | // the case where we have to emulate thread_local. 56 | #ifdef max 57 | #undef max 58 | #endif 59 | #include 60 | #endif 61 | #include "src/ThreadPool/ThreadYield.h" 62 | #include "src/ThreadPool/ThreadCancel.h" 63 | #include "src/ThreadPool/EventCount.h" 64 | #include "src/ThreadPool/RunQueue.h" 65 | #include "src/ThreadPool/ThreadPoolInterface.h" 66 | #include "src/ThreadPool/ThreadEnvironment.h" 67 | #include "src/ThreadPool/Barrier.h" 68 | #include "src/ThreadPool/NonBlockingThreadPool.h" 69 | 70 | #endif 71 | 72 | #include 73 | 74 | #endif // EIGEN_CXX11_THREADPOOL_MODULE 75 | -------------------------------------------------------------------------------- /tests/PythonTests/ConsoleApp/ConsoleApp.cpp: -------------------------------------------------------------------------------- 1 | // ConsoleApp.cpp : This file contains the 'main' function. Program execution begins and ends there. 2 | // 3 | #include 4 | #include "../../../src/dsp/filters.hpp" 5 | #include "../../../src/dsp/sampleRate.hpp" 6 | #include "../../../src/models/VCAcore.hpp" 7 | #include "../../../src/models/VdpOscillator.hpp" 8 | 9 | int main() 10 | { 11 | 12 | auto vcaNoOversampling = std::unique_ptr>{ new VCA_OTACore(dsp::CreateDummyResampler) }; 13 | auto vca2xButterWorth = std::unique_ptr>{ new VCA_OTACore(dsp::CreateX2Resampler_Butterworth5) }; 14 | auto vca2xCheby7 = std::unique_ptr>{ new VCA_OTACore(dsp::CreateX2Resampler_Chebychev7) }; 15 | auto vca2xCheby9 = std::unique_ptr>{ new VCA_OTACore(dsp::CreateX2Resampler_Chebychev9) }; 16 | 17 | auto vca2x_Tr_Cheby7 = std::unique_ptr>{ new VCA_TransistorCore(dsp::CreateX2Resampler_Chebychev7) }; 18 | 19 | auto sampleRate = 48000.0; 20 | 21 | VdpOscillator vdpo2x{ dsp::CreateX2Resampler_Chebychev7 }; 22 | VdpOscillator vdpo4x{ dsp::CreateX4Resampler_Cheby7 }; 23 | 24 | vdpo2x.SetSampleRate(sampleRate); 25 | vdpo4x.SetSampleRate(sampleRate); 26 | 27 | auto T = 10.0; 28 | 29 | auto phase = 0.0; 30 | auto t = 0.0; 31 | 32 | auto f = 120.0; 33 | auto a = 5.0; 34 | 35 | vca2xCheby7->SetSampleRate(sampleRate); 36 | vca2x_Tr_Cheby7->SetSampleRate(sampleRate); 37 | 38 | std::vector out( size_t(T*sampleRate) ); 39 | 40 | size_t i = 0; 41 | auto mu = 3.0; 42 | auto w = 2 * PI * 1200; 43 | 44 | //auto w = 2 * PI * 3500; 45 | //auto wInc = 2 * PI * (4200-3500) / (T*sampleRate); 46 | while(t < T) 47 | { 48 | auto x = a * std::sin(2 * PI * phase); 49 | ////auto y = vca2xCheby7->Step(x, 1.0); 50 | auto y = vca2x_Tr_Cheby7->Step(x, 1.0, 1.0); 51 | 52 | //auto y = vdpo2x.Step(0, mu, w); 53 | //auto y = vdpo4x.Step(0, mu, w); 54 | out[i] = y; 55 | //if(out[i] >= 12.0 || out[i] <= -12.0) 56 | //{ 57 | // auto breakHere = 0; 58 | //} 59 | 60 | i++; 61 | //w += wInc; 62 | t += 1.0 / sampleRate; 63 | phase += f / sampleRate; 64 | if (phase >= 1.0) 65 | phase -= 1.0; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /tests/PythonTests/PythonTests/vanDerPole.py: -------------------------------------------------------------------------------- 1 | from itertools import islice 2 | from random import random 3 | from time import perf_counter 4 | from scipy import signal 5 | from scipy.signal import * 6 | import numpy as np 7 | import scipy 8 | import scipy.integrate 9 | from scipy.interpolate import interp1d 10 | import triggerfishvcv 11 | from plotting import * 12 | 13 | """ 14 | w in radian / sec 15 | """ 16 | def vanderPol_numpy(t,xt, mu, w): 17 | x = interp1d(t,xt, fill_value="extrapolate") 18 | def func(y,t): 19 | input = x(t) 20 | return np.array([y[1], mu * (1.0 - y[0] ** 2) * y[1] * w - y[0] * w ** 2 + w**2 * input]) 21 | 22 | return func 23 | 24 | 25 | def getModelOutputs_numpy(time, x, mus, w): 26 | outputs = [] 27 | initVals = [0,1.0] 28 | for mu in mus: 29 | f = vanderPol_numPy(time, x, mu, w) 30 | y = scipy.integrate.odeint(f, initVals, time)[:,0] 31 | outputs = outputs + [y] 32 | 33 | return outputs 34 | 35 | def getModelOutputs(time, x, mu, ws, fs): 36 | outputs = [] 37 | for m in mu: 38 | mus = np.full(len(time), m) 39 | y = triggerfishvcv.vdpO(x, mus, ws, fs) 40 | outputs = outputs + [y] 41 | 42 | return outputs 43 | 44 | if __name__ == "__main__": 45 | #print(np.get_include()) 46 | fs = 48000 * 1 47 | #N = 10 * fs 48 | N = 10 * fs 49 | time = np.arange(N) / float(fs) 50 | 51 | fmax = 4200 52 | 53 | x = 0.0*chirp(time, f0 = 0, t1 = time[-1], f1 = fmax) 54 | #ws = 2* np.pi * np.linspace(fmax/3, fmax/3, len(time)) 55 | ws = 2* np.pi * np.linspace(0, fmax, len(time)) 56 | #ws = 2* np.pi * np.append(np.linspace(0.0, fmax, len(time)/2), np.linspace(fmax, 0.0, len(time)/2)) 57 | #x = np.where(time >= 1.0, x, 0) 58 | 59 | #muVals = np.linspace(1.0,3.0,4) 60 | muVals = [0.1, 0.5, 3.0,8.53] 61 | 62 | models = ['mu=' + str(m) for m in muVals] 63 | f = 1200 64 | 65 | ys = getModelOutputs(time, x, muVals, ws, fs) 66 | MultiPlotBokeh(spectrogramBokeh, fs, time, x, ys, models) 67 | #MultiPlotBokeh(powerSpectralDensity, fs, time, x, ys, models) 68 | 69 | N = fs * 1 70 | time = np.arange(N) / float(fs) 71 | #x = 10* np.where(time >0.0, 0.0, 1.0) # Impulse 72 | #x = 5* np.where(time >0.0, 1.0, 0.0) # Heaviside 73 | f = 100 74 | x = 5.0* np.sin(time * 2 * np.pi * f/10) 75 | ys = getModelOutputs(time, x, muVals, 2 * np.pi * f) 76 | MultiPlotBokeh(timeResponse, fs, time, x, ys, models) 77 | 78 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /tests/PythonTests/PythonTests/PythonTests.pyproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Debug 4 | 2.0 5 | 30f3301a-820f-409d-b085-f8181112bba7 6 | . 7 | vanDerPole.py 8 | 9 | 10 | . 11 | . 12 | PythonTests 13 | PythonTests 14 | Standard Python launcher 15 | True 16 | False 17 | Global|ContinuumAnalytics|Anaconda36-64 18 | 19 | 20 | true 21 | false 22 | 23 | 24 | true 25 | false 26 | 27 | 28 | 29 | Code 30 | 31 | 32 | Code 33 | 34 | 35 | 36 | 37 | 38 | Wrapper 39 | {b01b5ecb-6daa-46d1-9e9d-aeb4b9513896} 40 | True 41 | 42 | 43 | 44 | 45 | 46 | 47 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "MingGW", 5 | "intelliSenseMode": "clang-x64", 6 | "cStandard": "c11", 7 | "cppStandard": "c++17", 8 | "compilerPath": "C:/msys64/mingw64/bin/gcc.exe", 9 | "includePath": [ 10 | "${workspaceFolder}", 11 | "${workspaceFolder}/*", 12 | "${workspaceFolder}/../../include", 13 | "${workspaceFolder}/../../dep/include", 14 | "${workspaceFolder}/Eigen", 15 | "${workspaceFolder}/Eigen/src/*" 16 | ], 17 | "defines": [ 18 | "_DEBUG", 19 | "UNICODE" 20 | ], 21 | "browse": { 22 | "path": [ 23 | "${workspaceFolder}", 24 | "${workspaceFolder}/*", 25 | "${workspaceFolder}/dsp", 26 | "${workspaceFolder}/models", 27 | "${workspaceFolder}/dep", 28 | "${workspaceFolder}/Eigen", 29 | "${workspaceFolder}/Eigen/src/*", 30 | "${workspaceFolder}/../../*" 31 | ], 32 | "limitSymbolsToIncludedHeaders": true, 33 | "databaseFilename": "" 34 | } 35 | }, 36 | { 37 | "name": "Mac", 38 | "intelliSenseMode": "clang-x64", 39 | "includePath": [ 40 | "${workspaceFolder}", 41 | "${workspaceFolder}/*", 42 | "${workspaceFolder}/../../include", 43 | "${workspaceFolder}/../../dep/include" 44 | ], 45 | "defines": [ 46 | "_DEBUG", 47 | "UNICODE" 48 | ], 49 | "macFrameworkPath": [ "/System/Library/Frameworks" ], 50 | "browse": { 51 | "path": [ 52 | "${workspaceFolder}", 53 | "${workspaceFolder}/*", 54 | "${workspaceFolder}/dsp", 55 | "${workspaceFolder}/models", 56 | "${workspaceFolder}/dep", 57 | "${workspaceFolder}/../../*" 58 | ], 59 | "limitSymbolsToIncludedHeaders": true, 60 | "databaseFilename": "" 61 | }, 62 | "cStandard": "c11", 63 | "cppStandard": "c++17" 64 | } 65 | ], 66 | "version": 4 67 | } 68 | -------------------------------------------------------------------------------- /src/Eigen/src/NonLinearOptimization/fdjac1.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | DenseIndex fdjac1( 7 | const FunctorType &Functor, 8 | Matrix< Scalar, Dynamic, 1 > &x, 9 | Matrix< Scalar, Dynamic, 1 > &fvec, 10 | Matrix< Scalar, Dynamic, Dynamic > &fjac, 11 | DenseIndex ml, DenseIndex mu, 12 | Scalar epsfcn) 13 | { 14 | using std::sqrt; 15 | using std::abs; 16 | 17 | typedef DenseIndex Index; 18 | 19 | /* Local variables */ 20 | Scalar h; 21 | Index j, k; 22 | Scalar eps, temp; 23 | Index msum; 24 | int iflag; 25 | Index start, length; 26 | 27 | /* Function Body */ 28 | const Scalar epsmch = NumTraits::epsilon(); 29 | const Index n = x.size(); 30 | eigen_assert(fvec.size()==n); 31 | Matrix< Scalar, Dynamic, 1 > wa1(n); 32 | Matrix< Scalar, Dynamic, 1 > wa2(n); 33 | 34 | eps = sqrt((std::max)(epsfcn,epsmch)); 35 | msum = ml + mu + 1; 36 | if (msum >= n) { 37 | /* computation of dense approximate jacobian. */ 38 | for (j = 0; j < n; ++j) { 39 | temp = x[j]; 40 | h = eps * abs(temp); 41 | if (h == 0.) 42 | h = eps; 43 | x[j] = temp + h; 44 | iflag = Functor(x, wa1); 45 | if (iflag < 0) 46 | return iflag; 47 | x[j] = temp; 48 | fjac.col(j) = (wa1-fvec)/h; 49 | } 50 | 51 | }else { 52 | /* computation of banded approximate jacobian. */ 53 | for (k = 0; k < msum; ++k) { 54 | for (j = k; (msum<0) ? (j>n): (jn): (j(0,j-mu); 69 | length = (std::min)(n-1, j+ml) - start + 1; 70 | fjac.col(j).segment(start, length) = ( wa1.segment(start, length)-fvec.segment(start, length))/h; 71 | } 72 | } 73 | } 74 | return 0; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/ThreadPool/ThreadLocal.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 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_CXX11_THREADPOOL_THREAD_LOCAL_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 12 | 13 | #if EIGEN_MAX_CPP_VER >= 11 && \ 14 | ((EIGEN_COMP_GNUC && EIGEN_GNUC_AT_LEAST(4, 8)) || \ 15 | __has_feature(cxx_thread_local)) 16 | #define EIGEN_THREAD_LOCAL static thread_local 17 | #endif 18 | 19 | // Disable TLS for Apple and Android builds with older toolchains. 20 | #if defined(__APPLE__) 21 | // Included for TARGET_OS_IPHONE, __IPHONE_OS_VERSION_MIN_REQUIRED, 22 | // __IPHONE_8_0. 23 | #include 24 | #include 25 | #endif 26 | // Checks whether C++11's `thread_local` storage duration specifier is 27 | // supported. 28 | #if defined(__apple_build_version__) && \ 29 | ((__apple_build_version__ < 8000042) || \ 30 | (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)) 31 | // Notes: Xcode's clang did not support `thread_local` until version 32 | // 8, and even then not for all iOS < 9.0. 33 | #undef EIGEN_THREAD_LOCAL 34 | 35 | #elif defined(__ANDROID__) && EIGEN_COMP_CLANG 36 | // There are platforms for which TLS should not be used even though the compiler 37 | // makes it seem like it's supported (Android NDK < r12b for example). 38 | // This is primarily because of linker problems and toolchain misconfiguration: 39 | // TLS isn't supported until NDK r12b per 40 | // https://developer.android.com/ndk/downloads/revision_history.html 41 | // Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in 42 | // . For NDK < r16, users should define these macros, 43 | // e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11. 44 | #if __has_include() 45 | #include 46 | #endif // __has_include() 47 | #if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \ 48 | defined(__NDK_MINOR__) && \ 49 | ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1))) 50 | #undef EIGEN_THREAD_LOCAL 51 | #endif 52 | #endif // defined(__ANDROID__) && defined(__clang__) 53 | 54 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 55 | -------------------------------------------------------------------------------- /src/Eigen/src/MatrixFunctions/StemFunction.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010, 2013 Jitse Niesen 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_STEM_FUNCTION 11 | #define EIGEN_STEM_FUNCTION 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \brief The exponential function (and its derivatives). */ 18 | template 19 | Scalar stem_function_exp(Scalar x, int) 20 | { 21 | using std::exp; 22 | return exp(x); 23 | } 24 | 25 | /** \brief Cosine (and its derivatives). */ 26 | template 27 | Scalar stem_function_cos(Scalar x, int n) 28 | { 29 | using std::cos; 30 | using std::sin; 31 | Scalar res; 32 | 33 | switch (n % 4) { 34 | case 0: 35 | res = std::cos(x); 36 | break; 37 | case 1: 38 | res = -std::sin(x); 39 | break; 40 | case 2: 41 | res = -std::cos(x); 42 | break; 43 | case 3: 44 | res = std::sin(x); 45 | break; 46 | } 47 | return res; 48 | } 49 | 50 | /** \brief Sine (and its derivatives). */ 51 | template 52 | Scalar stem_function_sin(Scalar x, int n) 53 | { 54 | using std::cos; 55 | using std::sin; 56 | Scalar res; 57 | 58 | switch (n % 4) { 59 | case 0: 60 | res = std::sin(x); 61 | break; 62 | case 1: 63 | res = std::cos(x); 64 | break; 65 | case 2: 66 | res = -std::sin(x); 67 | break; 68 | case 3: 69 | res = -std::cos(x); 70 | break; 71 | } 72 | return res; 73 | } 74 | 75 | /** \brief Hyperbolic cosine (and its derivatives). */ 76 | template 77 | Scalar stem_function_cosh(Scalar x, int n) 78 | { 79 | using std::cosh; 80 | using std::sinh; 81 | Scalar res; 82 | 83 | switch (n % 2) { 84 | case 0: 85 | res = std::cosh(x); 86 | break; 87 | case 1: 88 | res = std::sinh(x); 89 | break; 90 | } 91 | return res; 92 | } 93 | 94 | /** \brief Hyperbolic sine (and its derivatives). */ 95 | template 96 | Scalar stem_function_sinh(Scalar x, int n) 97 | { 98 | using std::cosh; 99 | using std::sinh; 100 | Scalar res; 101 | 102 | switch (n % 2) { 103 | case 0: 104 | res = std::sinh(x); 105 | break; 106 | case 1: 107 | res = std::cosh(x); 108 | break; 109 | } 110 | return res; 111 | } 112 | 113 | } // end namespace internal 114 | 115 | } // end namespace Eigen 116 | 117 | #endif // EIGEN_STEM_FUNCTION 118 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/LevenbergMarquardt/LMcovar.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This code initially comes from MINPACK whose original authors are: 5 | // Copyright Jorge More - Argonne National Laboratory 6 | // Copyright Burt Garbow - Argonne National Laboratory 7 | // Copyright Ken Hillstrom - Argonne National Laboratory 8 | // 9 | // This Source Code Form is subject to the terms of the Minpack license 10 | // (a BSD-like license) described in the campaigned CopyrightMINPACK.txt file. 11 | 12 | #ifndef EIGEN_LMCOVAR_H 13 | #define EIGEN_LMCOVAR_H 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | template 20 | void covar( 21 | Matrix< Scalar, Dynamic, Dynamic > &r, 22 | const VectorXi& ipvt, 23 | Scalar tol = std::sqrt(NumTraits::epsilon()) ) 24 | { 25 | using std::abs; 26 | /* Local variables */ 27 | Index i, j, k, l, ii, jj; 28 | bool sing; 29 | Scalar temp; 30 | 31 | /* Function Body */ 32 | const Index n = r.cols(); 33 | const Scalar tolr = tol * abs(r(0,0)); 34 | Matrix< Scalar, Dynamic, 1 > wa(n); 35 | eigen_assert(ipvt.size()==n); 36 | 37 | /* form the inverse of r in the full upper triangle of r. */ 38 | l = -1; 39 | for (k = 0; k < n; ++k) 40 | if (abs(r(k,k)) > tolr) { 41 | r(k,k) = 1. / r(k,k); 42 | for (j = 0; j <= k-1; ++j) { 43 | temp = r(k,k) * r(j,k); 44 | r(j,k) = 0.; 45 | r.col(k).head(j+1) -= r.col(j).head(j+1) * temp; 46 | } 47 | l = k; 48 | } 49 | 50 | /* form the full upper triangle of the inverse of (r transpose)*r */ 51 | /* in the full upper triangle of r. */ 52 | for (k = 0; k <= l; ++k) { 53 | for (j = 0; j <= k-1; ++j) 54 | r.col(j).head(j+1) += r.col(k).head(j+1) * r(j,k); 55 | r.col(k).head(k+1) *= r(k,k); 56 | } 57 | 58 | /* form the full lower triangle of the covariance matrix */ 59 | /* in the strict lower triangle of r and in wa. */ 60 | for (j = 0; j < n; ++j) { 61 | jj = ipvt[j]; 62 | sing = j > l; 63 | for (i = 0; i <= j; ++i) { 64 | if (sing) 65 | r(i,j) = 0.; 66 | ii = ipvt[i]; 67 | if (ii > jj) 68 | r(ii,jj) = r(i,j); 69 | if (ii < jj) 70 | r(jj,ii) = r(i,j); 71 | } 72 | wa[jj] = r(j,j); 73 | } 74 | 75 | /* symmetrize the covariance matrix in r. */ 76 | r.topLeftCorner(n,n).template triangularView() = r.topLeftCorner(n,n).transpose(); 77 | r.diagonal() = wa; 78 | } 79 | 80 | } // end namespace internal 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_LMCOVAR_H 85 | -------------------------------------------------------------------------------- /src/tfdsp/nonlinear.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "../Eigen/Dense" 3 | #include 4 | 5 | /** 6 | * Mid point discrete gradients for integration of ODEs with nonlinear functions 7 | * References: 8 | * [1] : REDUCING THE ALIASING OF NONLINEAR WAVESHAPING USING CONTINUOUS-TIME CONVOLUTION, Julian Parker et al, DAFX 16 9 | * [2] : Geometric intergration using discrete gradients, R. McLahlan, G.R.W Quispel, Nicolas Robidoux, 1998 10 | */ 11 | namespace DiscreteGradient2 12 | { 13 | template 14 | struct _TanhEpsilon 15 | { 16 | static constexpr Float Value = 1.0e-12; 17 | }; 18 | template<> 19 | struct _TanhEpsilon 20 | { 21 | static constexpr float Value = 1.0e-6f; 22 | }; 23 | template<> 24 | struct _TanhEpsilon 25 | { 26 | static constexpr double Value = 1.0e-12; 27 | }; 28 | 29 | template 30 | class Tanh 31 | { 32 | private: 33 | static constexpr Float eps = _TanhEpsilon::Value; 34 | static Float ValueLarge(const Float x, const Float xPrev) 35 | { 36 | return std::log(std::cosh(x) / std::cosh(xPrev)) / (x - xPrev); 37 | } 38 | 39 | public: 40 | static Float Value(const Float x, const Float xPrev) 41 | { 42 | return std::abs(x - xPrev) <= eps ? 43 | std::tanh(0.5*(x + xPrev)) : 44 | ValueLarge(x, xPrev); 45 | } 46 | static Eigen::Array Value(const Eigen::Array&x, const Eigen::Array& xPrev) 47 | { 48 | const Eigen::Array epsV = Eigen::Array::Constant(eps); 49 | //Ternary operator as expressed in eigen: 50 | return (Eigen::abs(x - xPrev) <= epsV).select( 51 | Eigen::tanh(0.5*(x + xPrev)), 52 | Eigen::log(Eigen::cosh(x) / Eigen::cosh(xPrev)) / (x - xPrev)); 53 | } 54 | static Float Derivative(const Float x, const Float xPrev) 55 | { 56 | if (std::abs(x - xPrev) <= eps) 57 | { 58 | auto t = std::tanh(0.5*(x + xPrev)); 59 | return 0.5*(1.0 - t * t); 60 | } 61 | return (std::tanh(x) - ValueLarge(x, xPrev)) / (x - xPrev); 62 | } 63 | }; 64 | template 65 | class TanhBlock 66 | { 67 | private: 68 | Eigen::Array _x1; 69 | public: 70 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW 71 | TanhBlock() 72 | { 73 | _x1 = Eigen::Array::Zero(); 74 | } 75 | Eigen::Array Process(const Eigen::Array& x) 76 | { 77 | //_x1 is the z^-1 or lag(1) operator on the input 78 | _x1.template segment(1) = x.template segment(0); 79 | Eigen::Array y = Tanh::Value(x, _x1); 80 | //Need to keep the last element for when called on the next block 81 | _x1(0) = x(blockSize - 1); 82 | return y; 83 | } 84 | }; 85 | 86 | } -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorDevice.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_CXX11_TENSOR_TENSOR_DEVICE_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H 12 | 13 | namespace Eigen { 14 | 15 | /** \class TensorDevice 16 | * \ingroup CXX11_Tensor_Module 17 | * 18 | * \brief Pseudo expression providing an operator = that will evaluate its argument 19 | * on the specified computing 'device' (GPU, thread pool, ...) 20 | * 21 | * Example: 22 | * C.device(EIGEN_GPU) = A + B; 23 | * 24 | * Todo: operator *= and /=. 25 | */ 26 | 27 | template class TensorDevice { 28 | public: 29 | TensorDevice(const DeviceType& device, ExpressionType& expression) : m_device(device), m_expression(expression) {} 30 | 31 | template 32 | EIGEN_STRONG_INLINE TensorDevice& operator=(const OtherDerived& other) { 33 | typedef TensorAssignOp Assign; 34 | Assign assign(m_expression, other); 35 | internal::TensorExecutor::run(assign, m_device); 36 | return *this; 37 | } 38 | 39 | template 40 | EIGEN_STRONG_INLINE TensorDevice& operator+=(const OtherDerived& other) { 41 | typedef typename OtherDerived::Scalar Scalar; 42 | typedef TensorCwiseBinaryOp, const ExpressionType, const OtherDerived> Sum; 43 | Sum sum(m_expression, other); 44 | typedef TensorAssignOp Assign; 45 | Assign assign(m_expression, sum); 46 | internal::TensorExecutor::run(assign, m_device); 47 | return *this; 48 | } 49 | 50 | template 51 | EIGEN_STRONG_INLINE TensorDevice& operator-=(const OtherDerived& other) { 52 | typedef typename OtherDerived::Scalar Scalar; 53 | typedef TensorCwiseBinaryOp, const ExpressionType, const OtherDerived> Difference; 54 | Difference difference(m_expression, other); 55 | typedef TensorAssignOp Assign; 56 | Assign assign(m_expression, difference); 57 | internal::TensorExecutor::run(assign, m_device); 58 | return *this; 59 | } 60 | 61 | protected: 62 | const DeviceType& m_device; 63 | ExpressionType& m_expression; 64 | }; 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_CXX11_TENSOR_TENSOR_DEVICE_H 69 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorIO.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_CXX11_TENSOR_TENSOR_IO_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_IO_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // Print the tensor as a 2d matrix 18 | template 19 | struct TensorPrinter { 20 | static void run (std::ostream& os, const Tensor& tensor) { 21 | typedef typename internal::remove_const::type Scalar; 22 | typedef typename Tensor::Index Index; 23 | const Index total_size = internal::array_prod(tensor.dimensions()); 24 | if (total_size > 0) { 25 | const Index first_dim = Eigen::internal::array_get<0>(tensor.dimensions()); 26 | static const int layout = Tensor::Layout; 27 | Map > matrix(const_cast(tensor.data()), first_dim, total_size/first_dim); 28 | os << matrix; 29 | } 30 | } 31 | }; 32 | 33 | 34 | // Print the tensor as a vector 35 | template 36 | struct TensorPrinter { 37 | static void run (std::ostream& os, const Tensor& tensor) { 38 | typedef typename internal::remove_const::type Scalar; 39 | typedef typename Tensor::Index Index; 40 | const Index total_size = internal::array_prod(tensor.dimensions()); 41 | if (total_size > 0) { 42 | Map > array(const_cast(tensor.data()), total_size); 43 | os << array; 44 | } 45 | } 46 | }; 47 | 48 | 49 | // Print the tensor as a scalar 50 | template 51 | struct TensorPrinter { 52 | static void run (std::ostream& os, const Tensor& tensor) { 53 | os << tensor.coeff(0); 54 | } 55 | }; 56 | } 57 | 58 | template 59 | std::ostream& operator << (std::ostream& os, const TensorBase& expr) { 60 | typedef TensorEvaluator, DefaultDevice> Evaluator; 61 | typedef typename Evaluator::Dimensions Dimensions; 62 | 63 | // Evaluate the expression if needed 64 | TensorForcedEvalOp eval = expr.eval(); 65 | Evaluator tensor(eval, DefaultDevice()); 66 | tensor.evalSubExprsIfNeeded(NULL); 67 | 68 | // Print the result 69 | static const int rank = internal::array_size::value; 70 | internal::TensorPrinter::run(os, tensor); 71 | 72 | // Cleanup. 73 | tensor.cleanup(); 74 | return os; 75 | } 76 | 77 | } // end namespace Eigen 78 | 79 | #endif // EIGEN_CXX11_TENSOR_TENSOR_IO_H 80 | -------------------------------------------------------------------------------- /src/Eigen/src/IterativeSolvers/IncompleteLU.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Gael Guennebaud 5 | // 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_INCOMPLETE_LU_H 11 | #define EIGEN_INCOMPLETE_LU_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | class IncompleteLU : public SparseSolverBase > 17 | { 18 | protected: 19 | typedef SparseSolverBase > Base; 20 | using Base::m_isInitialized; 21 | 22 | typedef _Scalar Scalar; 23 | typedef Matrix Vector; 24 | typedef typename Vector::Index Index; 25 | typedef SparseMatrix FactorType; 26 | 27 | public: 28 | typedef Matrix MatrixType; 29 | 30 | IncompleteLU() {} 31 | 32 | template 33 | IncompleteLU(const MatrixType& mat) 34 | { 35 | compute(mat); 36 | } 37 | 38 | Index rows() const { return m_lu.rows(); } 39 | Index cols() const { return m_lu.cols(); } 40 | 41 | template 42 | IncompleteLU& compute(const MatrixType& mat) 43 | { 44 | m_lu = mat; 45 | int size = mat.cols(); 46 | Vector diag(size); 47 | for(int i=0; i 78 | void _solve_impl(const Rhs& b, Dest& x) const 79 | { 80 | x = m_lu.template triangularView().solve(b); 81 | x = m_lu.template triangularView().solve(x); 82 | } 83 | 84 | protected: 85 | FactorType m_lu; 86 | }; 87 | 88 | } // end namespace Eigen 89 | 90 | #endif // EIGEN_INCOMPLETE_LU_H 91 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/Core/arch/SYCL/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Mehdi Goli Codeplay Software Ltd. 5 | // Ralph Potter Codeplay Software Ltd. 6 | // Luke Iwanski Codeplay Software Ltd. 7 | // Contact: 8 | // 9 | // This Source Code Form is subject to the terms of the Mozilla 10 | // Public License v. 2.0. If a copy of the MPL was not distributed 11 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 12 | 13 | /***************************************************************** 14 | * TypeCasting.h 15 | * 16 | * \brief: 17 | * TypeCasting 18 | * 19 | *****************************************************************/ 20 | 21 | #ifndef EIGEN_TYPE_CASTING_SYCL_H 22 | #define EIGEN_TYPE_CASTING_SYCL_H 23 | 24 | namespace Eigen { 25 | 26 | namespace internal { 27 | #ifdef __SYCL_DEVICE_ONLY__ 28 | template <> 29 | struct type_casting_traits { 30 | enum { 31 | VectorizedCast = 1, 32 | SrcCoeffRatio = 1, 33 | TgtCoeffRatio = 1 34 | }; 35 | }; 36 | 37 | template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_int4 pcast(const cl::sycl::cl_float4& a) { 38 | return a. template convert(); 39 | } 40 | 41 | 42 | template <> 43 | struct type_casting_traits { 44 | enum { 45 | VectorizedCast = 1, 46 | SrcCoeffRatio = 1, 47 | TgtCoeffRatio = 1 48 | }; 49 | }; 50 | 51 | template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pcast(const cl::sycl::cl_int4& a) { 52 | return a. template convert(); 53 | } 54 | 55 | template <> 56 | struct type_casting_traits { 57 | enum { 58 | VectorizedCast = 1, 59 | SrcCoeffRatio = 2, 60 | TgtCoeffRatio = 1 61 | }; 62 | }; 63 | 64 | template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 pcast(const cl::sycl::cl_double2& a, const cl::sycl::cl_double2& b) { 65 | auto a1=a. template convert(); 66 | auto b1=b. template convert(); 67 | return cl::sycl::float4(a1.x(), a1.y(), b1.x(), b1.y()); 68 | } 69 | 70 | template <> 71 | struct type_casting_traits { 72 | enum { 73 | VectorizedCast = 1, 74 | SrcCoeffRatio = 1, 75 | TgtCoeffRatio = 2 76 | }; 77 | }; 78 | 79 | template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_double2 pcast(const cl::sycl::cl_float4& a) { 80 | // Simply discard the second half of the input 81 | return cl::sycl::cl_double2(a.x(), a.y()); 82 | } 83 | 84 | #endif 85 | } // end namespace internal 86 | 87 | } // end namespace Eigen 88 | 89 | #endif // EIGEN_TYPE_CASTING_SYCL_H 90 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/CXX11/src/Tensor/TensorInitializer.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_CXX11_TENSOR_TENSOR_INITIALIZER_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_INITIALIZER_H 12 | 13 | #if EIGEN_HAS_VARIADIC_TEMPLATES 14 | 15 | #include 16 | 17 | namespace Eigen { 18 | 19 | /** \class TensorInitializer 20 | * \ingroup CXX11_Tensor_Module 21 | * 22 | * \brief Helper template to initialize Tensors from std::initializer_lists. 23 | */ 24 | namespace internal { 25 | 26 | template 27 | struct Initializer { 28 | typedef std::initializer_list< 29 | typename Initializer::InitList> InitList; 30 | 31 | static void run(TensorEvaluator& tensor, 32 | Eigen::array::Index, traits::NumDimensions>* indices, 33 | const InitList& vals) { 34 | int i = 0; 35 | for (auto v : vals) { 36 | (*indices)[traits::NumDimensions - N] = i++; 37 | Initializer::run(tensor, indices, v); 38 | } 39 | } 40 | }; 41 | 42 | template 43 | struct Initializer { 44 | typedef std::initializer_list::Scalar> InitList; 45 | 46 | static void run(TensorEvaluator& tensor, 47 | Eigen::array::Index, traits::NumDimensions>* indices, 48 | const InitList& vals) { 49 | int i = 0; 50 | // There is likely a faster way to do that than iterating. 51 | for (auto v : vals) { 52 | (*indices)[traits::NumDimensions - 1] = i++; 53 | tensor.coeffRef(*indices) = v; 54 | } 55 | } 56 | }; 57 | 58 | template 59 | struct Initializer { 60 | typedef typename traits::Scalar InitList; 61 | 62 | static void run(TensorEvaluator& tensor, 63 | Eigen::array::Index, traits::NumDimensions>*, 64 | const InitList& v) { 65 | tensor.coeffRef(0) = v; 66 | } 67 | }; 68 | 69 | 70 | template 71 | void initialize_tensor(TensorEvaluator& tensor, 72 | const typename Initializer::NumDimensions>::InitList& vals) { 73 | Eigen::array::Index, traits::NumDimensions> indices; 74 | Initializer::NumDimensions>::run(tensor, &indices, vals); 75 | } 76 | 77 | } // namespace internal 78 | } // namespace Eigen 79 | 80 | #endif // EIGEN_HAS_VARIADIC_TEMPLATES 81 | 82 | #endif // EIGEN_CXX11_TENSOR_TENSOR_INITIALIZER_H 83 | -------------------------------------------------------------------------------- /src/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_DEVICE_FUNC 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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/Core/arch/GPU/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_GPU_H 11 | #define EIGEN_MATH_FUNCTIONS_GPU_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(EIGEN_GPUCC) && 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 pexpm1(const float4& a) 61 | { 62 | return make_float4(expm1f(a.x), expm1f(a.y), expm1f(a.z), expm1f(a.w)); 63 | } 64 | 65 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 66 | double2 pexpm1(const double2& a) 67 | { 68 | return make_double2(expm1(a.x), expm1(a.y)); 69 | } 70 | 71 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 72 | float4 psqrt(const float4& a) 73 | { 74 | return make_float4(sqrtf(a.x), sqrtf(a.y), sqrtf(a.z), sqrtf(a.w)); 75 | } 76 | 77 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 78 | double2 psqrt(const double2& a) 79 | { 80 | using ::sqrt; 81 | return make_double2(sqrt(a.x), sqrt(a.y)); 82 | } 83 | 84 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 85 | float4 prsqrt(const float4& a) 86 | { 87 | return make_float4(rsqrtf(a.x), rsqrtf(a.y), rsqrtf(a.z), rsqrtf(a.w)); 88 | } 89 | 90 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 91 | double2 prsqrt(const double2& a) 92 | { 93 | return make_double2(rsqrt(a.x), rsqrt(a.y)); 94 | } 95 | 96 | 97 | #endif 98 | 99 | } // end namespace internal 100 | 101 | } // end namespace Eigen 102 | 103 | #endif // EIGEN_MATH_FUNCTIONS_GPU_H 104 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/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 | -------------------------------------------------------------------------------- /src/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.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 | #ifndef EIGEN_SPECIALFUNCTIONS_HALF_H 9 | #define EIGEN_SPECIALFUNCTIONS_HALF_H 10 | 11 | namespace Eigen { 12 | namespace numext { 13 | 14 | #if EIGEN_HAS_C99_MATH 15 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half lgamma(const Eigen::half& a) { 16 | return Eigen::half(Eigen::numext::lgamma(static_cast(a))); 17 | } 18 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half digamma(const Eigen::half& a) { 19 | return Eigen::half(Eigen::numext::digamma(static_cast(a))); 20 | } 21 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half zeta(const Eigen::half& x, const Eigen::half& q) { 22 | return Eigen::half(Eigen::numext::zeta(static_cast(x), static_cast(q))); 23 | } 24 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half polygamma(const Eigen::half& n, const Eigen::half& x) { 25 | return Eigen::half(Eigen::numext::polygamma(static_cast(n), static_cast(x))); 26 | } 27 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erf(const Eigen::half& a) { 28 | return Eigen::half(Eigen::numext::erf(static_cast(a))); 29 | } 30 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half erfc(const Eigen::half& a) { 31 | return Eigen::half(Eigen::numext::erfc(static_cast(a))); 32 | } 33 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma(const Eigen::half& a, const Eigen::half& x) { 34 | return Eigen::half(Eigen::numext::igamma(static_cast(a), static_cast(x))); 35 | } 36 | template <> 37 | EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igamma_der_a(const Eigen::half& a, const Eigen::half& x) { 38 | return Eigen::half(Eigen::numext::igamma_der_a(static_cast(a), static_cast(x))); 39 | } 40 | template <> 41 | EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half gamma_sample_der_alpha(const Eigen::half& alpha, const Eigen::half& sample) { 42 | return Eigen::half(Eigen::numext::gamma_sample_der_alpha(static_cast(alpha), static_cast(sample))); 43 | } 44 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half igammac(const Eigen::half& a, const Eigen::half& x) { 45 | return Eigen::half(Eigen::numext::igammac(static_cast(a), static_cast(x))); 46 | } 47 | template<> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half betainc(const Eigen::half& a, const Eigen::half& b, const Eigen::half& x) { 48 | return Eigen::half(Eigen::numext::betainc(static_cast(a), static_cast(b), static_cast(x))); 49 | } 50 | template <> 51 | EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half i0e(const Eigen::half& x) { 52 | return Eigen::half(Eigen::numext::i0e(static_cast(x))); 53 | } 54 | template <> 55 | EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Eigen::half i1e(const Eigen::half& x) { 56 | return Eigen::half(Eigen::numext::i1e(static_cast(x))); 57 | } 58 | #endif 59 | 60 | } // end namespace numext 61 | } // end namespace Eigen 62 | 63 | #endif // EIGEN_SPECIALFUNCTIONS_HALF_H 64 | -------------------------------------------------------------------------------- /tests/PythonTests/PythonTests.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27703.2047 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "PythonTests", "PythonTests\PythonTests.pyproj", "{30F3301A-820F-409D-B085-F8181112BBA7}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wrapper", "Wrapper\Wrapper.vcxproj", "{B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleApp", "ConsoleApp\ConsoleApp.vcxproj", "{A3AC2D40-6D23-44E7-848E-E08E25105714}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Debug|x64 = Debug|x64 16 | Debug|x86 = Debug|x86 17 | Release|Any CPU = Release|Any CPU 18 | Release|x64 = Release|x64 19 | Release|x86 = Release|x86 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {30F3301A-820F-409D-B085-F8181112BBA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {30F3301A-820F-409D-B085-F8181112BBA7}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {30F3301A-820F-409D-B085-F8181112BBA7}.Debug|x86.ActiveCfg = Debug|Any CPU 25 | {30F3301A-820F-409D-B085-F8181112BBA7}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {30F3301A-820F-409D-B085-F8181112BBA7}.Release|x64.ActiveCfg = Release|Any CPU 27 | {30F3301A-820F-409D-B085-F8181112BBA7}.Release|x86.ActiveCfg = Release|Any CPU 28 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Debug|Any CPU.ActiveCfg = Debug|Win32 29 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Debug|x64.ActiveCfg = Debug|x64 30 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Debug|x64.Build.0 = Debug|x64 31 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Debug|x86.ActiveCfg = Debug|Win32 32 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Debug|x86.Build.0 = Debug|Win32 33 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Release|Any CPU.ActiveCfg = Release|Win32 34 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Release|x64.ActiveCfg = Release|x64 35 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Release|x64.Build.0 = Release|x64 36 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Release|x86.ActiveCfg = Release|Win32 37 | {B01B5ECB-6DAA-46D1-9E9D-AEB4B9513896}.Release|x86.Build.0 = Release|Win32 38 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Debug|Any CPU.ActiveCfg = Debug|Win32 39 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Debug|x64.ActiveCfg = Debug|x64 40 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Debug|x64.Build.0 = Debug|x64 41 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Debug|x86.ActiveCfg = Debug|Win32 42 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Debug|x86.Build.0 = Debug|Win32 43 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Release|Any CPU.ActiveCfg = Release|Win32 44 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Release|x64.ActiveCfg = Release|x64 45 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Release|x64.Build.0 = Release|x64 46 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Release|x86.ActiveCfg = Release|Win32 47 | {A3AC2D40-6D23-44E7-848E-E08E25105714}.Release|x86.Build.0 = Release|Win32 48 | EndGlobalSection 49 | GlobalSection(SolutionProperties) = preSolution 50 | HideSolutionNode = FALSE 51 | EndGlobalSection 52 | GlobalSection(ExtensibilityGlobals) = postSolution 53 | SolutionGuid = {32259364-2BF9-4840-AEBC-2E8D43ECB5CF} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /src/Eigen/src/MoreVectorization/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Rohit Garg 5 | // Copyright (C) 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_MOREVECTORIZATION_MATHFUNCTIONS_H 12 | #define EIGEN_MOREVECTORIZATION_MATHFUNCTIONS_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | /** \internal \returns the arcsin of \a a (coeff-wise) */ 19 | template inline static Packet pasin(Packet a) { return std::asin(a); } 20 | 21 | #ifdef EIGEN_VECTORIZE_SSE 22 | 23 | template<> EIGEN_DONT_INLINE Packet4f pasin(Packet4f x) 24 | { 25 | _EIGEN_DECLARE_CONST_Packet4f(half, 0.5); 26 | _EIGEN_DECLARE_CONST_Packet4f(minus_half, -0.5); 27 | _EIGEN_DECLARE_CONST_Packet4f(3half, 1.5); 28 | 29 | _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(sign_mask, 0x80000000); 30 | 31 | _EIGEN_DECLARE_CONST_Packet4f(pi, 3.141592654); 32 | _EIGEN_DECLARE_CONST_Packet4f(pi_over_2, 3.141592654*0.5); 33 | 34 | _EIGEN_DECLARE_CONST_Packet4f(asin1, 4.2163199048E-2); 35 | _EIGEN_DECLARE_CONST_Packet4f(asin2, 2.4181311049E-2); 36 | _EIGEN_DECLARE_CONST_Packet4f(asin3, 4.5470025998E-2); 37 | _EIGEN_DECLARE_CONST_Packet4f(asin4, 7.4953002686E-2); 38 | _EIGEN_DECLARE_CONST_Packet4f(asin5, 1.6666752422E-1); 39 | 40 | Packet4f a = pabs(x);//got the absolute value 41 | 42 | Packet4f sign_bit= _mm_and_ps(x, p4f_sign_mask);//extracted the sign bit 43 | 44 | Packet4f z1,z2;//will need them during computation 45 | 46 | 47 | //will compute the two branches for asin 48 | //so first compare with half 49 | 50 | Packet4f branch_mask= _mm_cmpgt_ps(a, p4f_half);//this is to select which branch to take 51 | //both will be taken, and finally results will be merged 52 | //the branch for values >0.5 53 | 54 | { 55 | //the core series expansion 56 | z1=pmadd(p4f_minus_half,a,p4f_half); 57 | Packet4f x1=psqrt(z1); 58 | Packet4f s1=pmadd(p4f_asin1, z1, p4f_asin2); 59 | Packet4f s2=pmadd(s1, z1, p4f_asin3); 60 | Packet4f s3=pmadd(s2,z1, p4f_asin4); 61 | Packet4f s4=pmadd(s3,z1, p4f_asin5); 62 | Packet4f temp=pmul(s4,z1);//not really a madd but a mul by z so that the next term can be a madd 63 | z1=pmadd(temp,x1,x1); 64 | z1=padd(z1,z1); 65 | z1=psub(p4f_pi_over_2,z1); 66 | } 67 | 68 | { 69 | //the core series expansion 70 | Packet4f x2=a; 71 | z2=pmul(x2,x2); 72 | Packet4f s1=pmadd(p4f_asin1, z2, p4f_asin2); 73 | Packet4f s2=pmadd(s1, z2, p4f_asin3); 74 | Packet4f s3=pmadd(s2,z2, p4f_asin4); 75 | Packet4f s4=pmadd(s3,z2, p4f_asin5); 76 | Packet4f temp=pmul(s4,z2);//not really a madd but a mul by z so that the next term can be a madd 77 | z2=pmadd(temp,x2,x2); 78 | } 79 | 80 | /* select the correct result from the two branch evaluations */ 81 | z1 = _mm_and_ps(branch_mask, z1); 82 | z2 = _mm_andnot_ps(branch_mask, z2); 83 | Packet4f z = _mm_or_ps(z1,z2); 84 | 85 | /* update the sign */ 86 | return _mm_xor_ps(z, sign_bit); 87 | } 88 | 89 | #endif // EIGEN_VECTORIZE_SSE 90 | 91 | } // end namespace internal 92 | 93 | } // end namespace Eigen 94 | 95 | #endif // EIGEN_MOREVECTORIZATION_MATHFUNCTIONS_H 96 | --------------------------------------------------------------------------------