-
Notifications
You must be signed in to change notification settings - Fork 45
Linear algebra: Expose the remaining classes listed in Eigen documentation (decompositions and solvers) #571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lucas-Haubert
wants to merge
40
commits into
stack-of-tasks:devel
Choose a base branch
from
Lucas-Haubert:topic/linear_algebra
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
9d7a86f
decompositions: Expose classes
Lucas-Haubert 8b90832
readme: added lucas haubert
Lucas-Haubert c40e851
decompositions: SVDBase, BDCSVD, JacobiSVD
Lucas-Haubert ed21792
eigenvalues: Expose classes
Lucas-Haubert 16ce327
solvers: BiCGSTAB
Lucas-Haubert 9b9f045
unittest: Comments about permutationP and permutationQ in FullPivLU
Lucas-Haubert 36c7dc7
unittest: PartialPivLU reconstructedMatrix to retrieve the original m…
Lucas-Haubert e554c92
Added comments and setThreshold default option in SVDBase
Lucas-Haubert d03cbad
solvers: Completed tests
Lucas-Haubert 6e9e972
decompositions: comments and rewrites
Lucas-Haubert 57773d3
decompositions: Put ordering option AMD in SparseQR
Lucas-Haubert 116f2d8
decompositions: Fixed computation options in BDCSVD
Lucas-Haubert 18ef377
decompositions: Rewrite comments in constructors in BDCSVD and JacobiSVD
Lucas-Haubert e206461
Set COLAMD Ordering in SParseQR
Lucas-Haubert e1cb1e9
decompositions: Completed tests
Lucas-Haubert f105185
Add IncompleteCholesky and IncompleteLUT
Lucas-Haubert 13ebd36
Added all preconditioners in solvers
Lucas-Haubert 04a9ba6
Clean code: Set the same nomenclature of files for exposed classes an…
Lucas-Haubert 8ac770c
Set Eigen::Lower everywhere for UpLo template option
Lucas-Haubert 8646127
Switch MINRES, IncompleteLUT and IncompleteCholesky in eigenpy.solver…
Lucas-Haubert 4be9e81
Optional arguments with bp::optional
Lucas-Haubert 62daa7c
README: Remove the 'SVD and QR to be added', but enounce them
Lucas-Haubert bede0bf
CI: Fix test_JacobiSVD
Lucas-Haubert 4996734
is_approx: Put is_approx and set the precision
Lucas-Haubert f401316
Add const in some lambda functions on Solver& to stick to definition
Lucas-Haubert 167045a
Add matrixQ in SparseQR
Lucas-Haubert de37894
Add actual date in copyrights
Lucas-Haubert edc5dcb
Add methods matrixU and matrixL in SParseLU
Lucas-Haubert 0098cdb
Capital letters in header names in sparse decompositions
Lucas-Haubert 4c347f8
CMakeLists: Added FullPivLU and PartialPivLU headers
Lucas-Haubert 8fbf5be
Removed outpassed guards regarding eigen version in decompositions an…
Lucas-Haubert d102a88
Include guards: Set name that corresopnds to directory
Lucas-Haubert 5ddd754
Include guards: Updated date in copyright
Lucas-Haubert fd712e4
MINRES: Backward compatibility to call from eigenpy and eigenpy.solvers
Lucas-Haubert 029c81f
Split solvers.cpp into separated .cpp as in decompositions
Lucas-Haubert 25ffb23
fwd:hpp: Corrected definition of macro EIGENPY_PRAGMA_DEPRECATED_HEAD…
Lucas-Haubert 681bfc5
Add back compatibility headers due to changes in name and directory o…
Lucas-Haubert 8cca598
unittest: Simplify test_GeneralizedEigenSolver to reduce computation …
Lucas-Haubert db47b32
Back compatibility accelerate.hpp
Lucas-Haubert 89a07eb
unittest: Reduced computation time of tests
Lucas-Haubert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule cmake
updated
14 files
+3 −3 | .pre-commit-config.yaml | |
+10 −6 | CMakeLists.txt | |
+1 −1 | cmake_uninstall.cmake.in | |
+9 −9 | flake.lock | |
+16 −7 | header.cmake | |
+17 −5 | ide.cmake | |
+1 −1 | idl.cmake | |
+4 −97 | package.xml | |
+1 −1 | pkg-config.cmake | |
+2 −30 | post-project.cmake | |
+7 −1 | python.cmake | |
+1 −1 | ros.cmake | |
+27 −34 | ros2.cmake | |
+1 −2 | stubs.cmake |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright 2025 INRIA | ||
*/ | ||
|
||
#ifndef __eigenpy_decompositions_bdcsvd_hpp__ | ||
#define __eigenpy_decompositions_bdcsvd_hpp__ | ||
|
||
#include <Eigen/SVD> | ||
#include <Eigen/Core> | ||
|
||
#include "eigenpy/eigenpy.hpp" | ||
#include "eigenpy/utils/scalar-name.hpp" | ||
#include "eigenpy/eigen/EigenBase.hpp" | ||
#include "eigenpy/decompositions/SVDBase.hpp" | ||
|
||
namespace eigenpy { | ||
|
||
template <typename _MatrixType> | ||
struct BDCSVDVisitor | ||
: public boost::python::def_visitor<BDCSVDVisitor<_MatrixType>> { | ||
typedef _MatrixType MatrixType; | ||
typedef Eigen::BDCSVD<MatrixType> Solver; | ||
typedef typename MatrixType::Scalar Scalar; | ||
|
||
template <class PyClass> | ||
void visit(PyClass &cl) const { | ||
cl.def(bp::init<>(bp::arg("self"), "Default constructor")) | ||
.def(bp::init<Eigen::DenseIndex, Eigen::DenseIndex, | ||
bp::optional<unsigned int>>( | ||
bp::args("self", "rows", "cols", "computationOptions "), | ||
"Default Constructor with memory preallocation. ")) | ||
.def(bp::init<MatrixType, bp::optional<unsigned int>>( | ||
bp::args("self", "matrix", "computationOptions "), | ||
"Constructor performing the decomposition of given matrix.")) | ||
|
||
.def("cols", &Solver::cols, bp::arg("self"), | ||
"Returns the number of columns. ") | ||
.def("compute", | ||
(Solver & (Solver::*)(const MatrixType &matrix)) & Solver::compute, | ||
bp::args("self", "matrix"), | ||
"Method performing the decomposition of given matrix. Computes " | ||
"Thin/Full " | ||
"unitaries U/V if specified using the Options template parameter " | ||
"or the class constructor. ", | ||
bp::return_self<>()) | ||
.def("compute", | ||
(Solver & (Solver::*)(const MatrixType &matrix, | ||
unsigned int computationOptions)) & | ||
Solver::compute, | ||
bp::args("self", "matrix", "computationOptions"), | ||
"Method performing the decomposition of given matrix, as " | ||
"specified by the computationOptions parameter. ", | ||
bp::return_self<>()) | ||
.def("rows", &Solver::rows, bp::arg("self"), | ||
"Returns the number of rows. ") | ||
.def("setSwitchSize", &Solver::setSwitchSize, bp::args("self", "s")) | ||
|
||
.def(SVDBaseVisitor<Solver>()); | ||
} | ||
|
||
static void expose() { | ||
static const std::string classname = | ||
"BDCSVD_" + scalar_name<Scalar>::shortname(); | ||
expose(classname); | ||
} | ||
|
||
static void expose(const std::string &name) { | ||
bp::class_<Solver, boost::noncopyable>( | ||
name.c_str(), | ||
"Class Bidiagonal Divide and Conquer SVD.\n\n" | ||
"This class first reduces the input matrix to bi-diagonal form using " | ||
"class " | ||
"UpperBidiagonalization, and then performs a divide-and-conquer " | ||
"diagonalization. " | ||
"Small blocks are diagonalized using class JacobiSVD. You can control " | ||
"the " | ||
"switching size with the setSwitchSize() method, default is 16. For " | ||
"small matrice " | ||
"(<16), it is thus preferable to directly use JacobiSVD. For larger " | ||
"ones, BDCSVD " | ||
"is highly recommended and can several order of magnitude faster.\n\n" | ||
"Warming: this algorithm is unlikely to provide accurate result when " | ||
"compiled with " | ||
"unsafe math optimizations. For instance, this concerns Intel's " | ||
"compiler (ICC), which " | ||
"performs such optimization by default unless you compile with the " | ||
"-fp-model precise " | ||
"option. Likewise, the -ffast-math option of GCC or clang will " | ||
"significantly degrade the " | ||
"accuracy.", | ||
bp::no_init) | ||
.def(BDCSVDVisitor()) | ||
.def(IdVisitor<Solver>()); | ||
} | ||
}; | ||
|
||
} // namespace eigenpy | ||
|
||
#endif // ifndef __eigenpy_decompositions_bdcsvd_hpp__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright 2025 INRIA | ||
*/ | ||
|
||
#ifndef __eigenpy_decompositions_complex_eigen_solver_hpp__ | ||
#define __eigenpy_decompositions_complex_eigen_solver_hpp__ | ||
|
||
#include <Eigen/Core> | ||
#include <Eigen/Eigenvalues> | ||
|
||
#include "eigenpy/eigen-to-python.hpp" | ||
#include "eigenpy/eigenpy.hpp" | ||
#include "eigenpy/utils/scalar-name.hpp" | ||
|
||
namespace eigenpy { | ||
|
||
template <typename _MatrixType> | ||
struct ComplexEigenSolverVisitor : public boost::python::def_visitor< | ||
ComplexEigenSolverVisitor<_MatrixType>> { | ||
typedef _MatrixType MatrixType; | ||
typedef typename MatrixType::Scalar Scalar; | ||
typedef Eigen::ComplexEigenSolver<MatrixType> Solver; | ||
|
||
template <class PyClass> | ||
void visit(PyClass& cl) const { | ||
cl.def(bp::init<>("Default constructor")) | ||
.def(bp::init<Eigen::DenseIndex>( | ||
bp::arg("size"), "Default constructor with memory preallocation")) | ||
.def(bp::init<MatrixType, bp::optional<bool>>( | ||
bp::args("matrix", "compute_eigen_vectors"), | ||
"Computes eigendecomposition of given matrix")) | ||
|
||
.def("eigenvalues", &Solver::eigenvalues, bp::arg("self"), | ||
"Returns the eigenvalues of given matrix.", | ||
bp::return_internal_reference<>()) | ||
.def("eigenvectors", &Solver::eigenvectors, bp::arg("self"), | ||
"Returns the eigenvectors of given matrix.", | ||
bp::return_internal_reference<>()) | ||
|
||
.def("compute", &ComplexEigenSolverVisitor::compute_proxy<MatrixType>, | ||
bp::args("self", "matrix"), | ||
"Computes the eigendecomposition of given matrix.", | ||
bp::return_self<>()) | ||
.def("compute", | ||
(Solver & | ||
(Solver::*)(const Eigen::EigenBase<MatrixType>& matrix, bool)) & | ||
Solver::compute, | ||
bp::args("self", "matrix", "compute_eigen_vectors"), | ||
"Computes the eigendecomposition of given matrix.", | ||
bp::return_self<>()) | ||
|
||
.def("info", &Solver::info, bp::arg("self"), | ||
"NumericalIssue if the input contains INF or NaN values or " | ||
"overflow occured. Returns Success otherwise.") | ||
|
||
.def("getMaxIterations", &Solver::getMaxIterations, bp::arg("self"), | ||
"Returns the maximum number of iterations.") | ||
.def("setMaxIterations", &Solver::setMaxIterations, | ||
bp::args("self", "max_iter"), | ||
"Sets the maximum number of iterations allowed.", | ||
bp::return_self<>()); | ||
} | ||
|
||
static void expose() { | ||
static const std::string classname = | ||
"ComplexEigenSolver" + scalar_name<Scalar>::shortname(); | ||
expose(classname); | ||
} | ||
|
||
static void expose(const std::string& name) { | ||
bp::class_<Solver>(name.c_str(), bp::no_init) | ||
.def(ComplexEigenSolverVisitor()) | ||
.def(IdVisitor<Solver>()); | ||
} | ||
|
||
private: | ||
template <typename MatrixType> | ||
static Solver& compute_proxy(Solver& self, | ||
const Eigen::EigenBase<MatrixType>& matrix) { | ||
return self.compute(matrix); | ||
} | ||
}; | ||
|
||
} // namespace eigenpy | ||
|
||
#endif // ifndef __eigenpy_decompositions_complex_eigen_solver_hpp__ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.