17#include <lagrange/internal/sortrows.h>
21template <
typename DerivedA,
typename DerivedC,
typename DerivedIA,
typename DerivedIC>
23 const Eigen::DenseBase<DerivedA>& A,
24 Eigen::PlainObjectBase<DerivedC>& C,
25 Eigen::PlainObjectBase<DerivedIA>& IA,
26 Eigen::PlainObjectBase<DerivedIC>& IC)
30 lagrange::internal::sortrows(A,
true, sortA, IM);
32 const int num_rows =
static_cast<int>(sortA.rows());
33 const int num_cols =
static_cast<int>(sortA.cols());
34 std::vector<int> vIA(num_rows);
35 for (
int i = 0; i < num_rows; i++) {
39 auto index_equal = [&](
const size_t i,
const size_t j) {
40 for (
size_t c = 0; c < num_cols; c++) {
41 if (sortA(i, c) != sortA(j, c))
return false;
45 vIA.erase(std::unique(vIA.begin(), vIA.end(), index_equal), vIA.end());
47 IC.resize(A.rows(), 1);
50 for (
int i = 0; i < num_rows; i++) {
51 if (sortA.row(vIA[j]) != sortA.row(i)) {
57 const int unique_rows =
static_cast<int>(vIA.size());
58 C.resize(unique_rows, A.cols());
59 IA.resize(unique_rows, 1);
61 for (
int i = 0; i < unique_rows; i++) {
62 IA(i, 0) = IM(vIA[i], 0);
63 C.row(i) << A.row(IA(i, 0));
nullptr_t, size_t, ptrdiff_t basic_ostream bad_weak_ptr extent, remove_extent, is_array,...
Definition: attribute_string_utils.h:21