5#ifndef PROXSUITE_LINALG_SPARSE_LDLT_CORE_HPP
6#define PROXSUITE_LINALG_SPARSE_LDLT_CORE_HPP
11#include <Eigen/SparseCore>
13#define SPARSE_LDLT_CONCEPT(...) \
14 VEG_CONCEPT_MACRO(::proxsuite::linalg::sparse::concepts, __VA_ARGS__)
15#define SPARSE_LDLT_CHECK_CONCEPT(...) \
16 VEG_CONCEPT_MACRO(::proxsuite::linalg::sparse::concepts, __VA_ARGS__)
30using proxsuite::linalg::veg::mut;
32using proxsuite::linalg::veg::ref;
35inline namespace tags {
36using proxsuite::linalg::veg::Unsafe;
37using proxsuite::linalg::veg::unsafe;
39using proxsuite::linalg::veg::from_raw_parts;
40using proxsuite::linalg::veg::FromRawParts;
48template<
typename I,
bool = sizeof(I) < sizeof(
int)>
49struct WrappingPlusType;
59 using Promoted =
typename std::make_unsigned<I>::type;
69 using U =
typename _detail::WrappingPlusType<I>::Promoted;
70 return I(
U(a) +
U(b));
104 return usize(isize(
typename std::make_signed<I>::type(a)));
112 return usize(
typename std::make_unsigned<I>::type(a));
136 : _{
v.data(),
v.rows() }
138 static_assert(V::InnerStrideAtCompileTime == 1,
".");
139 static_assert(V::ColsAtCompileTime == 1,
".");
156 return { _.ptr, _.size };
177 : _{
v.data(),
v.rows() }
180 proxsuite::linalg::veg::uncvref_t<V>::InnerStrideAtCompileTime == 1,
".");
181 static_assert(proxsuite::linalg::veg::uncvref_t<V>::ColsAtCompileTime == 1,
206 return { from_raw_parts, _.
ptr, _.size };
213 return { _.ptr, _.size };
224template<
typename T,
typename I = isize>
231 I
const* row_indices,
233 : _{ nrows, nnz, row_indices, values }
255template<
typename D,
typename I>
259 template<
typename U = D>
260 auto _()
const noexcept ->
decltype((
VEG_DECLVAL(
U const&)._))
262 return static_cast<D const*
>(
this)->_;
274 return nnz_per_col() ==
nullptr;
281 return VEG_ASSERT(
j < usize(ncols())), util::zero_extend(_().col[
j]);
289 return VEG_ASSERT(
j < usize(ncols())), col_end_unchecked(unsafe,
j);
294 util::zero_extend(is_compressed()
296 : I(_().col[
j] + _().nnz_per_col[
j]));
299template<
typename D,
typename I>
303 template<
typename U = D>
306 return static_cast<D*
>(
this)->_;
312 auto row_indices_mut()
noexcept -> I* {
return _().row; }
316template<
typename I = isize>
325 I
const* nnz_per_col,
326 I
const* row_indices)
328 nrows, ncols, nnz, col_ptrs, nnz_per_col, row_indices,
344template<
typename I = isize>
382template<
typename T,
typename I = isize>
412 static_assert(!
bool(M::IsRowMajor),
".");
427 return { _.nrows, _.ncols, _.nnz, _.col, _.row, _.val, _.nnz_per_col };
443template<
typename T,
typename I = isize>
474 static_assert(!
bool(proxsuite::linalg::veg::uncvref_t<M>::IsRowMajor),
".");
481 return _.nnz_per_col ==
nullptr;
502 from_raw_parts, this->
nrows(),
511 return { _.nrows, _.ncols, _.nnz, _.col, _.row, _.val, _.nnz_per_col };
#define VEG_DEBUG_ASSERT(...)
#define VEG_TAG(Name, Type)
#define VEG_NIEBLOID(Name)
_detail::_meta::make_signed< usize >::Type isize
decltype(sizeof(0)) usize
auto nrows() const noexcept -> isize
auto as_const() const noexcept -> DenseVecRef< T >
auto as_slice() const noexcept -> Slice< T >
DenseVecMut(FromEigen, V &&v) noexcept
auto ncols() const noexcept -> isize
DenseVecMut(FromRawParts, T *data, isize len) noexcept
auto to_eigen() const noexcept -> Eigen::Map< Eigen::Matrix< T, -1, 1 > >
auto as_slice_mut() noexcept -> SliceMut< T >
auto ncols() const noexcept -> isize
DenseVecRef(FromEigen, V const &v) noexcept
auto nrows() const noexcept -> isize
DenseVecRef(FromRawParts, T const *data, isize len) noexcept
auto to_eigen() const noexcept -> Eigen::Map< Eigen::Matrix< T, -1, 1 > const >
auto as_slice() const noexcept -> Slice< T >
void _set_nnz(isize new_nnz) noexcept
auto is_compressed() const noexcept -> bool
MatMut(FromRawParts, isize nrows, isize ncols, isize nnz, I *col_ptrs, I *nnz_per_col, I *row_indices, T *values)
auto values() const noexcept -> T const *
auto as_const() const noexcept -> MatRef< T, I >
auto symbolic() const noexcept -> SymbolicMatRef< I >
auto values_mut() const noexcept -> T *
auto to_eigen() const noexcept -> Eigen::Map< Eigen::SparseMatrix< T, Eigen::ColMajor, I > >
auto symbolic_mut() const noexcept -> SymbolicMatRef< I >
auto symbolic() const noexcept -> SymbolicMatRef< I >
MatRef(FromRawParts, isize nrows, isize ncols, isize nnz, I const *col_ptrs, I const *nnz_per_col, I const *row_indices, T const *values)
auto to_eigen() const noexcept -> Eigen::Map< Eigen::SparseMatrix< T, Eigen::ColMajor, I > const >
auto values() const noexcept -> T const *
MatRef(FromEigen, M const &m)
auto as_const() const noexcept -> SymbolicMatRef< I >
SymbolicMatMut(FromRawParts, isize nrows, isize ncols, isize nnz, I *col_ptrs, I *nnz_per_col, I *row_indices)
SymbolicMatRef(FromRawParts, isize nrows, isize ncols, isize nnz, I const *col_ptrs, I const *nnz_per_col, I const *row_indices)
auto row_indices() const noexcept -> I const *
VecRef(FromRawParts, isize nrows, isize nnz, I const *row_indices, T const *values)
auto nnz() const noexcept -> isize
auto values() const noexcept -> T const *
auto nrows() const noexcept -> isize
auto ncols() const noexcept -> isize
auto nnz_per_col_mut() noexcept -> I *
auto row_indices_mut() noexcept -> I *
auto col_ptrs_mut() noexcept -> I *
auto col_start(usize j) const noexcept -> usize
auto col_end(usize j) const noexcept -> usize
auto col_ptrs() const noexcept -> I const *
auto nrows() const noexcept -> isize
auto row_indices() const noexcept -> I const *
auto nnz() const noexcept -> isize
auto col_end_unchecked(Unsafe, usize j) const noexcept -> usize
auto ncols() const noexcept -> isize
auto nnz_per_col() const noexcept -> I const *
auto is_compressed() const noexcept -> bool
auto col_start_unchecked(Unsafe, usize j) const noexcept -> usize
auto operator()(I a, I b) const noexcept -> I
auto operator()(I a) const noexcept -> usize
auto operator()(RefMut< I > a) const noexcept -> I
auto operator()(RefMut< I > a) const noexcept -> I
auto operator()(I a, I b) const noexcept -> I
auto operator()(I a) const noexcept -> usize
VEG_NODISCARD VEG_INLINE constexpr auto get() const noexcept -> T const &
VEG_NODISCARD VEG_INLINE constexpr auto ptr() const VEG_NOEXCEPT -> T const *