42 using scalar_type =
typename Matrix::value_type;
43 using storage_index_type =
typename Matrix::StorageIndex;
46 (outer_size - 1) * inner_size + outer_size * (inner_size - 1);
50 std::vector<Eigen::Triplet<scalar_type, storage_index_type>> triplets;
54 triplets.emplace_back(
55 row, o * inner_size + i,
static_cast<scalar_type
>(1));
56 triplets.emplace_back(
57 row, (o + 1) * inner_size + i,
static_cast<scalar_type
>(-1));
65 (outer_size - 1) * inner_size + o * (inner_size - 1) + i;
66 triplets.emplace_back(
67 row, o * inner_size + i,
static_cast<scalar_type
>(1));
68 triplets.emplace_back(
69 row, o * inner_size + i + 1,
static_cast<scalar_type
>(-1));
73 Matrix matrix(rows, cols);
74 matrix.setFromTriplets(triplets.begin(), triplets.end());