Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 25, 2024
1 parent 42832f1 commit dbc28e3
Show file tree
Hide file tree
Showing 19 changed files with 170 additions and 193 deletions.
121 changes: 55 additions & 66 deletions include/proxsuite/linalg/dense/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ static_assert(sizeof(f64) == 8, "f64 should be 64 bits");
LDLT_FN_IMPL3(fnmadd, Prefix, Suffix); /* (-a * b + c) */

#define LDLT_LOAD_STORE(Prefix, Suffix) \
VEG_INLINE static auto load_unaligned( \
ScalarType const* ptr) noexcept -> Pack \
VEG_INLINE static auto load_unaligned(ScalarType const* ptr) noexcept \
-> Pack \
{ \
return Pack{ simde_mm##Prefix##_loadu_##Suffix(ptr) }; \
} \
Expand Down Expand Up @@ -560,9 +560,8 @@ elem_addr(T* ptr,

template<typename Mat>
auto
matrix_elem_addr(Mat&& mat,
isize row,
isize col) noexcept -> decltype(mat.data())
matrix_elem_addr(Mat&& mat, isize row, isize col) noexcept
-> decltype(mat.data())
{
return util::elem_addr<!bool(
proxsuite::linalg::veg::uncvref_t<Mat>::IsRowMajor)>( //
Expand All @@ -575,38 +574,34 @@ matrix_elem_addr(Mat&& mat,

template<typename T>
auto
col(T&& mat, isize col_idx) noexcept ->
typename _detail::RowColAccessImpl<
!bool(proxsuite::linalg::veg::uncvref_t<T>::IsRowMajor)>::template Col<T>
col(T&& mat, isize col_idx) noexcept -> typename _detail::RowColAccessImpl<
!bool(proxsuite::linalg::veg::uncvref_t<T>::IsRowMajor)>::template Col<T>
{
return _detail::RowColAccessImpl<!bool(
proxsuite::linalg::veg::uncvref_t<T>::IsRowMajor)>::col(mat, col_idx);
}
template<typename T>
auto
row(T&& mat, isize row_idx) noexcept ->
typename _detail::RowColAccessImpl<
!bool(proxsuite::linalg::veg::uncvref_t<T>::IsRowMajor)>::template Row<T>
row(T&& mat, isize row_idx) noexcept -> typename _detail::RowColAccessImpl<
!bool(proxsuite::linalg::veg::uncvref_t<T>::IsRowMajor)>::template Row<T>
{
return _detail::RowColAccessImpl<!bool(
proxsuite::linalg::veg::uncvref_t<T>::IsRowMajor)>::row(mat, row_idx);
}

template<typename Mat>
auto
trans(Mat&& mat) noexcept
-> Eigen::Map< //
_detail::const_if<
_detail::ptr_is_const<decltype(mat.data())>::value,
Eigen::Matrix< //
typename proxsuite::linalg::veg::uncvref_t<Mat>::Scalar,
proxsuite::linalg::veg::uncvref_t<Mat>::ColsAtCompileTime,
proxsuite::linalg::veg::uncvref_t<Mat>::RowsAtCompileTime,
bool(proxsuite::linalg::veg::uncvref_t<Mat>::IsRowMajor)
? Eigen::ColMajor
: Eigen::RowMajor>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
trans(Mat&& mat) noexcept -> Eigen::Map< //
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
Eigen::Matrix< //
typename proxsuite::linalg::veg::uncvref_t<Mat>::Scalar,
proxsuite::linalg::veg::uncvref_t<Mat>::ColsAtCompileTime,
proxsuite::linalg::veg::uncvref_t<Mat>::RowsAtCompileTime,
bool(proxsuite::linalg::veg::uncvref_t<Mat>::IsRowMajor)
? Eigen::ColMajor
: Eigen::RowMajor>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
{
return {
mat.data(),
Expand All @@ -621,16 +616,15 @@ trans(Mat&& mat) noexcept

template<typename Mat>
auto
diagonal(Mat&& mat) noexcept
-> Eigen::Map< //
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
Eigen::Matrix< //
typename proxsuite::linalg::veg::uncvref_t<Mat>::Scalar,
Eigen::Dynamic,
1,
Eigen::ColMajor>>,
Eigen::Unaligned,
Eigen::InnerStride<Eigen::Dynamic>>
diagonal(Mat&& mat) noexcept -> Eigen::Map< //
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
Eigen::Matrix< //
typename proxsuite::linalg::veg::uncvref_t<Mat>::Scalar,
Eigen::Dynamic,
1,
Eigen::ColMajor>>,
Eigen::Unaligned,
Eigen::InnerStride<Eigen::Dynamic>>
{
VEG_DEBUG_ASSERT( //
mat.rows() == mat.cols());
Expand Down Expand Up @@ -667,12 +661,11 @@ submatrix(Mat&& mat,

template<typename Mat>
auto
to_view(Mat&& mat) noexcept
-> Eigen::Map<_detail::const_if<
_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedAll<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
to_view(Mat&& mat) noexcept -> Eigen::Map<
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedAll<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
{
return {
mat.data(),
Expand All @@ -687,12 +680,11 @@ to_view(Mat&& mat) noexcept

template<typename Mat>
auto
to_view_dyn_rows(Mat&& mat) noexcept
-> Eigen::Map<_detail::const_if<
_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedRows<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
to_view_dyn_rows(Mat&& mat) noexcept -> Eigen::Map<
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedRows<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
{
return {
mat.data(),
Expand All @@ -707,12 +699,11 @@ to_view_dyn_rows(Mat&& mat) noexcept

template<typename Mat>
auto
to_view_dyn_cols(Mat&& mat) noexcept
-> Eigen::Map<_detail::const_if<
_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedCols<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
to_view_dyn_cols(Mat&& mat) noexcept -> Eigen::Map<
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedCols<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
{
return {
mat.data(),
Expand Down Expand Up @@ -747,12 +738,11 @@ to_view_dyn(Mat&& mat) noexcept

template<typename Mat>
auto
subrows(Mat&& mat, isize row_start, isize nrows) noexcept
-> Eigen::Map<_detail::const_if<
_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedRows<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
subrows(Mat&& mat, isize row_start, isize nrows) noexcept -> Eigen::Map<
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedRows<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
{
return {
util::elem_addr<!bool(proxsuite::linalg::veg::uncvref_t<Mat>::IsRowMajor)>(
Expand All @@ -768,12 +758,11 @@ subrows(Mat&& mat, isize row_start, isize nrows) noexcept

template<typename Mat>
auto
subcols(Mat&& mat, isize col_start, isize ncols) noexcept
-> Eigen::Map<_detail::const_if<
_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedCols<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
subcols(Mat&& mat, isize col_start, isize ncols) noexcept -> Eigen::Map<
_detail::const_if<_detail::ptr_is_const<decltype(mat.data())>::value,
_detail::OwnedCols<proxsuite::linalg::veg::uncvref_t<Mat>>>,
Eigen::Unaligned,
_detail::StrideOf<proxsuite::linalg::veg::uncvref_t<Mat>>>
{
return {
util::elem_addr<!bool(proxsuite::linalg::veg::uncvref_t<Mat>::IsRowMajor)>(
Expand Down Expand Up @@ -859,8 +848,8 @@ temp_mat_req(proxsuite::linalg::veg::Tag<T> /*tag*/,

template<typename T>
auto
temp_vec_req(proxsuite::linalg::veg::Tag<T> /*tag*/,
isize rows) noexcept -> proxsuite::linalg::veg::dynstack::StackReq
temp_vec_req(proxsuite::linalg::veg::Tag<T> /*tag*/, isize rows) noexcept
-> proxsuite::linalg::veg::dynstack::StackReq
{
return {
rows * isize{ sizeof(T) },
Expand Down
4 changes: 2 additions & 2 deletions include/proxsuite/linalg/dense/factorize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ factorize_recursive(Mat&& mat,

template<typename T>
auto
factorize_req(proxsuite::linalg::veg::Tag<T> tag,
isize n) noexcept -> proxsuite::linalg::veg::dynstack::StackReq
factorize_req(proxsuite::linalg::veg::Tag<T> tag, isize n) noexcept
-> proxsuite::linalg::veg::dynstack::StackReq
{
return proxsuite::linalg::dense::factorize_blocked_req(tag, n, 128) |
proxsuite::linalg::dense::factorize_recursive_req(tag, n);
Expand Down
24 changes: 12 additions & 12 deletions include/proxsuite/linalg/dense/ldlt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,23 +614,23 @@ struct Ldlt
auto dim() const noexcept -> isize { return perm.len(); }

auto ld_col() const noexcept -> Eigen::Map< //
ColMat const,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
ColMat const,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
{
return { ld_storage.ptr(), dim(), dim(), stride };
}
auto ld_col_mut() noexcept -> Eigen::Map< //
ColMat,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
ColMat,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
{
return { ld_storage.ptr_mut(), dim(), dim(), stride };
}
auto ld_row() const noexcept -> Eigen::Map< //
RowMat const,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
RowMat const,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
{
return {
ld_storage.ptr(),
Expand All @@ -640,9 +640,9 @@ struct Ldlt
};
}
auto ld_row_mut() noexcept -> Eigen::Map< //
RowMat,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
RowMat,
Eigen::Unaligned,
Eigen::OuterStride<DYN>>
{
return {
ld_storage.ptr_mut(),
Expand Down
13 changes: 6 additions & 7 deletions include/proxsuite/linalg/sparse/factorize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ dense_ltsolve(DenseVecMut<T> x, MatRef<T, I> l) noexcept(false)
*/
template<typename I>
auto
etree_req(proxsuite::linalg::veg::Tag<I> /*tag*/,
isize n) noexcept -> proxsuite::linalg::veg::dynstack::StackReq
etree_req(proxsuite::linalg::veg::Tag<I> /*tag*/, isize n) noexcept
-> proxsuite::linalg::veg::dynstack::StackReq
{
return { n * isize{ sizeof(I) }, alignof(I) };
}
Expand Down Expand Up @@ -456,8 +456,8 @@ postorder_depth_first_search( //
*/
template<typename I>
auto
postorder_req(proxsuite::linalg::veg::Tag<I> /*tag*/,
isize n) noexcept -> proxsuite::linalg::veg::dynstack::StackReq
postorder_req(proxsuite::linalg::veg::Tag<I> /*tag*/, isize n) noexcept
-> proxsuite::linalg::veg::dynstack::StackReq
{
return { (3 * n) * isize(sizeof(I)), alignof(I) };
}
Expand Down Expand Up @@ -716,9 +716,8 @@ column_counts(I* counts,

template<typename I>
auto
amd_req(proxsuite::linalg::veg::Tag<I> /*tag*/,
isize /*n*/,
isize nnz) noexcept -> proxsuite::linalg::veg::dynstack::StackReq
amd_req(proxsuite::linalg::veg::Tag<I> /*tag*/, isize /*n*/, isize nnz) noexcept
-> proxsuite::linalg::veg::dynstack::StackReq
{
return { nnz * isize{ sizeof(char) }, alignof(char) };
}
Expand Down
8 changes: 4 additions & 4 deletions include/proxsuite/linalg/veg/internal/dyn_index.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ struct binary_traits<Fix<0>, Dyn> : binary_traits<Dyn, Dyn>
{
using Mul = Fix<0>;
VEG_NODISCARD
constexpr VEG_INLINE static auto mul_fn(Fix<0> /*a*/,
Dyn /*b*/) VEG_NOEXCEPT -> Mul
constexpr VEG_INLINE static auto mul_fn(Fix<0> /*a*/, Dyn /*b*/) VEG_NOEXCEPT
-> Mul
{
return {};
}
Expand All @@ -234,8 +234,8 @@ template<isize N>
struct binary_traits<Dyn, Fix<N>> : binary_traits<Dyn, Dyn>
{
using Mul = typename binary_traits<Fix<N>, Dyn>::Mul;
VEG_INLINE static constexpr auto mul_fn(Dyn a,
Fix<N> /*b*/) VEG_NOEXCEPT -> Mul
VEG_INLINE static constexpr auto mul_fn(Dyn a, Fix<N> /*b*/) VEG_NOEXCEPT
-> Mul
{
return binary_traits<Fix<N>, Dyn>::mul_fn({}, a);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,7 @@ HEDLEY_DIAGNOSTIC_POP
#else
#include <stdint.h>
#define HEDLEY_IS_CONSTEXPR_(expr) \
_Generic((1 ? (void*)((intptr_t) * 0) : (int*)0), int*: 1, void*: 0)
_Generic((1 ? (void*)((intptr_t)*0) : (int*)0), int*: 1, void*: 0)
#endif
#elif defined(HEDLEY_GCC_VERSION) || defined(HEDLEY_INTEL_VERSION) || \
defined(HEDLEY_TINYC_VERSION) || defined(HEDLEY_TI_ARMCL_VERSION) || \
Expand Down
24 changes: 11 additions & 13 deletions include/proxsuite/linalg/veg/internal/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,11 @@
Name, \
(__VA_ARGS__), \
::proxsuite::linalg::veg::meta::bool_constant<__VA_ARGS__>); \
VEG_TEMPLATE( \
Tpl, \
requires(__VA_ARGS__), \
constexpr auto check_##Name, \
(_ = 0, int)) noexcept -> ::proxsuite::linalg::veg::meta::true_type
VEG_TEMPLATE(Tpl, \
requires(__VA_ARGS__), \
constexpr auto check_##Name, \
(_ = 0, int)) noexcept \
-> ::proxsuite::linalg::veg::meta::true_type

#define __VEG_IMPL_SFINAE(_, Param) \
, ::proxsuite::linalg::veg::meta:: \
Expand Down Expand Up @@ -1195,20 +1195,18 @@ struct ExtractCharsImplExpr<LiteralType, _meta::integer_sequence<usize, Is...>>

template<typename LiteralType>
auto
extract_chars(LiteralType /*unused*/) ->
typename ExtractCharsImpl<
LiteralType,
_meta::make_index_sequence<LiteralType::Size::value>>::Type
extract_chars(LiteralType /*unused*/) -> typename ExtractCharsImpl<
LiteralType,
_meta::make_index_sequence<LiteralType::Size::value>>::Type
{
return {};
}

template<typename LiteralType>
auto
extract_chars_expr(LiteralType /*unused*/) ->
typename ExtractCharsImplExpr<
LiteralType,
_meta::make_index_sequence<LiteralType::Size::value>>::Type
extract_chars_expr(LiteralType /*unused*/) -> typename ExtractCharsImplExpr<
LiteralType,
_meta::make_index_sequence<LiteralType::Size::value>>::Type
{
return {};
}
Expand Down
4 changes: 2 additions & 2 deletions include/proxsuite/linalg/veg/memory/dynamic_stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ struct DynStackMut
template<typename T>
VEG_NODISCARD auto make_alloc(Tag<T> /*unused*/,
isize len,
isize align = alignof(T))
VEG_NOEXCEPT -> DynStackAlloc<T>
isize align = alignof(T)) VEG_NOEXCEPT
-> DynStackAlloc<T>
{
assert_valid_len(len);
DynStackAlloc<T> get{
Expand Down
Loading

0 comments on commit dbc28e3

Please sign in to comment.