Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
rev: v0.13.3
hooks:
- id: ruff
args:
Expand All @@ -18,15 +18,15 @@ repos:
hooks:
- id: cmake-format
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.2
rev: v0.24.3
hooks:
- id: toml-sort-fix
exclude: pixi.toml|dockgen.toml
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v20.1.7
rev: v21.1.2
hooks:
- id: clang-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
56 changes: 28 additions & 28 deletions include/eigenpy/alignment.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ struct aligned_storage {

template <class Data>
struct aligned_instance {
PyObject_VAR_HEAD PyObject *dict;
PyObject *weakrefs;
boost::python::instance_holder *objects;
PyObject_VAR_HEAD PyObject* dict;
PyObject* weakrefs;
boost::python::instance_holder* objects;

typename aligned_storage<sizeof(Data)>::type storage;
};

inline void *aligned_malloc(
inline void* aligned_malloc(
std::size_t size, std::size_t alignment = EIGENPY_DEFAULT_ALIGN_BYTES) {
void *original = std::malloc(size + alignment);
void* original = std::malloc(size + alignment);
if (original == 0) return 0;
if (is_aligned(original, alignment)) return original;
void *aligned =
reinterpret_cast<void *>((reinterpret_cast<std::size_t>(original) &
~(std::size_t(alignment - 1))) +
alignment);
*(reinterpret_cast<void **>(aligned) - 1) = original;
void* aligned =
reinterpret_cast<void*>((reinterpret_cast<std::size_t>(original) &
~(std::size_t(alignment - 1))) +
alignment);
*(reinterpret_cast<void**>(aligned) - 1) = original;
return aligned;
}

Expand All @@ -52,50 +52,50 @@ namespace detail {
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows,
int MaxCols>
struct referent_storage<
Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> &> {
Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>&> {
typedef Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> T;
typedef
typename eigenpy::aligned_storage<referent_size<T &>::value>::type type;
typename eigenpy::aligned_storage<referent_size<T&>::value>::type type;
};

template <typename Scalar, int Rows, int Cols, int Options, int MaxRows,
int MaxCols>
struct referent_storage<
const Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> &> {
const Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>&> {
typedef Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> T;
typedef
typename eigenpy::aligned_storage<referent_size<T &>::value>::type type;
typename eigenpy::aligned_storage<referent_size<T&>::value>::type type;
};

#ifdef EIGENPY_WITH_TENSOR_SUPPORT
template <typename Scalar, int Rank, int Options, typename IndexType>
struct referent_storage<Eigen::Tensor<Scalar, Rank, Options, IndexType> &> {
struct referent_storage<Eigen::Tensor<Scalar, Rank, Options, IndexType>&> {
typedef Eigen::Tensor<Scalar, Rank, Options, IndexType> T;
typedef
typename eigenpy::aligned_storage<referent_size<T &>::value>::type type;
typename eigenpy::aligned_storage<referent_size<T&>::value>::type type;
};

template <typename Scalar, int Rank, int Options, typename IndexType>
struct referent_storage<
const Eigen::Tensor<Scalar, Rank, Options, IndexType> &> {
const Eigen::Tensor<Scalar, Rank, Options, IndexType>&> {
typedef Eigen::Tensor<Scalar, Rank, Options, IndexType> T;
typedef
typename eigenpy::aligned_storage<referent_size<T &>::value>::type type;
typename eigenpy::aligned_storage<referent_size<T&>::value>::type type;
};
#endif

template <typename Scalar, int Options>
struct referent_storage<Eigen::Quaternion<Scalar, Options> &> {
struct referent_storage<Eigen::Quaternion<Scalar, Options>&> {
typedef Eigen::Quaternion<Scalar, Options> T;
typedef
typename eigenpy::aligned_storage<referent_size<T &>::value>::type type;
typename eigenpy::aligned_storage<referent_size<T&>::value>::type type;
};

template <typename Scalar, int Options>
struct referent_storage<const Eigen::Quaternion<Scalar, Options> &> {
struct referent_storage<const Eigen::Quaternion<Scalar, Options>&> {
typedef Eigen::Quaternion<Scalar, Options> T;
typedef
typename eigenpy::aligned_storage<referent_size<T &>::value>::type type;
typename eigenpy::aligned_storage<referent_size<T&>::value>::type type;
};

} // namespace detail
Expand All @@ -119,10 +119,10 @@ namespace eigenpy {

template <class T>
struct call_destructor {
static void run(void *bytes) {
static void run(void* bytes) {
typedef typename boost::remove_const<
typename boost::remove_reference<T>::type>::type T_;
static_cast<T_ *>((void *)bytes)->~T_();
static_cast<T_*>((void*)bytes)->~T_();
}
};

Expand All @@ -143,22 +143,22 @@ struct rvalue_from_python_data

// The usual constructor
rvalue_from_python_data(
::boost::python::converter::rvalue_from_python_stage1_data const
&_stage1) {
::boost::python::converter::rvalue_from_python_stage1_data const&
_stage1) {
this->stage1 = _stage1;
}

// This constructor just sets m_convertible -- used by
// implicitly_convertible<> to perform the final step of the
// conversion, where the construct() function is already known.
rvalue_from_python_data(void *convertible) {
rvalue_from_python_data(void* convertible) {
this->stage1.convertible = convertible;
}

// Destroys any object constructed in the storage.
~rvalue_from_python_data() {
if (this->stage1.convertible == this->storage.bytes) {
void *storage = reinterpret_cast<void *>(this->storage.bytes);
void* storage = reinterpret_cast<void*>(this->storage.bytes);
call_destructor<T>::run(storage);
}
}
Expand Down
10 changes: 5 additions & 5 deletions include/eigenpy/decompositions/BDCSVD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct BDCSVDVisitor
typedef typename MatrixType::Scalar Scalar;

template <class PyClass>
void visit(PyClass &cl) const {
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>>(
Expand All @@ -37,7 +37,7 @@ struct BDCSVDVisitor
"Returns the number of columns. ")
.def(
"compute",
+[](Solver &self, const MatrixType &matrix) -> Solver & {
+[](Solver& self, const MatrixType& matrix) -> Solver& {
return self.compute(matrix);
},
bp::args("self", "matrix"),
Expand All @@ -48,8 +48,8 @@ struct BDCSVDVisitor
bp::return_self<>())
.def(
"compute",
+[](Solver &self, const MatrixType &matrix,
unsigned int computationOptions) -> Solver & {
+[](Solver& self, const MatrixType& matrix,
unsigned int computationOptions) -> Solver& {
return self.compute(matrix, computationOptions);
},
bp::args("self", "matrix", "computationOptions"),
Expand All @@ -69,7 +69,7 @@ struct BDCSVDVisitor
expose(classname);
}

static void expose(const std::string &name) {
static void expose(const std::string& name) {
bp::class_<Solver, boost::noncopyable>(
name.c_str(),
"Class Bidiagonal Divide and Conquer SVD.\n\n"
Expand Down
12 changes: 6 additions & 6 deletions include/eigenpy/decompositions/ColPivHouseholderQR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct ColPivHouseholderQRSolverVisitor
typedef Solver Self;

template <class PyClass>
void visit(PyClass &cl) const {
void visit(PyClass& cl) const {
cl.def(bp::init<>(bp::arg("self"),
"Default constructor.\n"
"The default constructor is useful in cases in which the "
Expand Down Expand Up @@ -107,7 +107,7 @@ struct ColPivHouseholderQRSolverVisitor
"you can control by calling setThreshold(threshold).")

.def("setThreshold",
(Self & (Self::*)(const RealScalar &)) & Self::setThreshold,
(Self & (Self::*)(const RealScalar&)) & Self::setThreshold,
bp::args("self", "threshold"),
"Allows to prescribe a threshold to be used by certain methods, "
"such as rank(), who need to determine when pivots are to be "
Expand Down Expand Up @@ -138,7 +138,7 @@ struct ColPivHouseholderQRSolverVisitor

.def(
"compute",
(Solver & (Solver::*)(const Eigen::EigenBase<MatrixType> &matrix)) &
(Solver & (Solver::*)(const Eigen::EigenBase<MatrixType>& matrix)) &
Solver::compute,
bp::args("self", "matrix"),
"Computes the QR factorization of given matrix.",
Expand All @@ -159,7 +159,7 @@ struct ColPivHouseholderQRSolverVisitor
expose(classname);
}

static void expose(const std::string &name) {
static void expose(const std::string& name) {
bp::class_<Solver>(
name.c_str(),
"This class performs a rank-revealing QR decomposition of a matrix A "
Expand All @@ -178,10 +178,10 @@ struct ColPivHouseholderQRSolverVisitor

private:
template <typename MatrixOrVector>
static MatrixOrVector solve(const Solver &self, const MatrixOrVector &vec) {
static MatrixOrVector solve(const Solver& self, const MatrixOrVector& vec) {
return self.solve(vec);
}
static MatrixXs inverse(const Self &self) { return self.inverse(); }
static MatrixXs inverse(const Self& self) { return self.inverse(); }
};

} // namespace eigenpy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct CompleteOrthogonalDecompositionSolverVisitor
typedef Solver Self;

template <class PyClass>
void visit(PyClass &cl) const {
void visit(PyClass& cl) const {
cl.def(bp::init<>(bp::arg("self"),
"Default constructor.\n"
"The default constructor is useful in cases in which the "
Expand Down Expand Up @@ -117,7 +117,7 @@ struct CompleteOrthogonalDecompositionSolverVisitor
"you can control by calling setThreshold(threshold).")

.def("setThreshold",
(Self & (Self::*)(const RealScalar &)) & Self::setThreshold,
(Self & (Self::*)(const RealScalar&)) & Self::setThreshold,
bp::args("self", "threshold"),
"Allows to prescribe a threshold to be used by certain methods, "
"such as rank(), who need to determine when pivots are to be "
Expand Down Expand Up @@ -152,7 +152,7 @@ struct CompleteOrthogonalDecompositionSolverVisitor

.def(
"compute",
(Solver & (Solver::*)(const Eigen::EigenBase<MatrixType> &matrix)) &
(Solver & (Solver::*)(const Eigen::EigenBase<MatrixType>& matrix)) &
Solver::compute,
bp::args("self", "matrix"),
"Computes the complete orthogonal factorization of given matrix.",
Expand All @@ -174,7 +174,7 @@ struct CompleteOrthogonalDecompositionSolverVisitor
expose(classname);
}

static void expose(const std::string &name) {
static void expose(const std::string& name) {
bp::class_<Solver>(
name.c_str(),
"This class performs a rank-revealing complete orthogonal "
Expand All @@ -190,10 +190,10 @@ struct CompleteOrthogonalDecompositionSolverVisitor

private:
template <typename MatrixOrVector>
static MatrixOrVector solve(const Solver &self, const MatrixOrVector &vec) {
static MatrixOrVector solve(const Solver& self, const MatrixOrVector& vec) {
return self.solve(vec);
}
static MatrixXs pseudoInverse(const Self &self) {
static MatrixXs pseudoInverse(const Self& self) {
return self.pseudoInverse();
}
};
Expand Down
12 changes: 6 additions & 6 deletions include/eigenpy/decompositions/FullPivHouseholderQR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct FullPivHouseholderQRSolverVisitor
typedef Solver Self;

template <class PyClass>
void visit(PyClass &cl) const {
void visit(PyClass& cl) const {
cl.def(bp::init<>(bp::arg("self"),
"Default constructor.\n"
"The default constructor is useful in cases in which the "
Expand Down Expand Up @@ -103,7 +103,7 @@ struct FullPivHouseholderQRSolverVisitor
"you can control by calling setThreshold(threshold).")

.def("setThreshold",
(Self & (Self::*)(const RealScalar &)) & Self::setThreshold,
(Self & (Self::*)(const RealScalar&)) & Self::setThreshold,
bp::args("self", "threshold"),
"Allows to prescribe a threshold to be used by certain methods, "
"such as rank(), who need to determine when pivots are to be "
Expand Down Expand Up @@ -131,7 +131,7 @@ struct FullPivHouseholderQRSolverVisitor

.def(
"compute",
(Solver & (Solver::*)(const Eigen::EigenBase<MatrixType> &matrix)) &
(Solver & (Solver::*)(const Eigen::EigenBase<MatrixType>& matrix)) &
Solver::compute,
bp::args("self", "matrix"),
"Computes the QR factorization of given matrix.",
Expand All @@ -152,7 +152,7 @@ struct FullPivHouseholderQRSolverVisitor
expose(classname);
}

static void expose(const std::string &name) {
static void expose(const std::string& name) {
bp::class_<Solver>(
name.c_str(),
"This class performs a rank-revealing QR decomposition of a matrix A "
Expand All @@ -172,10 +172,10 @@ struct FullPivHouseholderQRSolverVisitor

private:
template <typename MatrixOrVector>
static MatrixOrVector solve(const Solver &self, const MatrixOrVector &vec) {
static MatrixOrVector solve(const Solver& self, const MatrixOrVector& vec) {
return self.solve(vec);
}
static MatrixXs inverse(const Self &self) { return self.inverse(); }
static MatrixXs inverse(const Self& self) { return self.inverse(); }
};

} // namespace eigenpy
Expand Down
Loading
Loading