Skip to content

Commit

Permalink
identify alloctions in dense backend
Browse files Browse the repository at this point in the history
  • Loading branch information
fabinsch committed Nov 10, 2022
1 parent e3427cf commit 4c16380
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions include/proxsuite/linalg/dense/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,9 @@ noalias_mul_add_impl(Dst dst, Lhs lhs, Rhs rhs, T factor)
} else
#endif
{
PROXSUITE_EIGEN_MALLOC_ALLOWED();
dst.noalias().operator+=(factor * LAZY_PRODUCT(lhs, rhs));
PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED();
}

#undef LAZY_PRODUCT
Expand Down
7 changes: 4 additions & 3 deletions include/proxsuite/linalg/dense/factorize.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ factorize_recursive_impl(Mat mat,
auto d0 = util::diagonal(l00);

isize work_stride = _detail::adjusted_stride<T>(rem);

PROXSUITE_EIGEN_MALLOC_ALLOWED();
util::trans(l00)
.template triangularView<Eigen::UnitUpper>()
.template solveInPlace<Eigen::OnTheRight>(l10);

PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED();
{
auto _work = stack.make_new_for_overwrite( //
proxsuite::linalg::veg::Tag<T>{},
Expand All @@ -271,8 +271,9 @@ factorize_recursive_impl(Mat mat,
};
work = l10;
l10 = l10 * d0.asDiagonal().inverse();

PROXSUITE_EIGEN_MALLOC_ALLOWED();
l11.template triangularView<Eigen::Lower>() -= l10 * util::trans(work);
PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED();
}

_detail::factorize_recursive_impl(l11, stack);
Expand Down
8 changes: 6 additions & 2 deletions include/proxsuite/linalg/dense/modify.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,11 @@ ldlt_insert_rows_and_cols_impl(

if (l10.cols() > 0) {
l10 = util::trans(a01);
PROXSUITE_EIGEN_MALLOC_ALLOWED();
util::trans(ld00) //
.template triangularView<Eigen::UnitUpper>()
.template solveInPlace<Eigen::OnTheRight>(l10);

PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED();
l10 = l10 * d0.inverse();
}

Expand All @@ -224,20 +225,23 @@ ldlt_insert_rows_and_cols_impl(

ld11.template triangularView<Eigen::Lower>() =
a11.template triangularView<Eigen::Lower>();

// PROXSUITE_EIGEN_MALLOC_ALLOWED();
if (l10.cols() > 0) {
d0xl10T = d0 * util::trans(l10);
ld11.template triangularView<Eigen::Lower>() -= l10 * d0xl10T;
}
// PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED();

l21 = a21;
util::noalias_mul_add(l21, l20, d0xl10T, T(-1));
}

proxsuite::linalg::dense::factorize(ld11, stack);
PROXSUITE_EIGEN_MALLOC_ALLOWED();
util::trans(ld11) //
.template triangularView<Eigen::UnitUpper>()
.template solveInPlace<Eigen::OnTheRight>(l21);
PROXSUITE_EIGEN_MALLOC_NOT_ALLOWED();

auto d1 = util::diagonal(ld11).asDiagonal();
l21 = l21 * d1.inverse();
Expand Down

0 comments on commit 4c16380

Please sign in to comment.