7#include <initializer_list>
14#include <gch/small_vector.hpp>
16#include "sleipnir/autodiff/slice.hpp"
17#include "sleipnir/autodiff/variable.hpp"
18#include "sleipnir/autodiff/variable_block.hpp"
19#include "sleipnir/util/assert.hpp"
20#include "sleipnir/util/concepts.hpp"
21#include "sleipnir/util/function_ref.hpp"
22#include "sleipnir/util/symbol_exports.hpp"
61 m_storage.reserve(rows * cols);
62 for (
int index = 0; index < rows * cols; ++index) {
63 m_storage.emplace_back();
74 m_storage.reserve(rows * cols);
75 for (
int index = 0; index < rows * cols; ++index) {
76 m_storage.emplace_back(
nullptr);
86 std::initializer_list<std::initializer_list<Variable>> list) {
90 if (list.size() > 0) {
91 m_cols = list.begin()->size();
96 const auto& row : list) {
97 slp_assert(
static_cast<int>(row.size()) == m_cols);
100 m_storage.reserve(rows() * cols());
101 for (
const auto& row : list) {
102 std::ranges::copy(row, std::back_inserter(m_storage));
115 m_rows = list.size();
117 if (list.size() > 0) {
118 m_cols = list.begin()->size();
122 for ([[maybe_unused]]
123 const auto& row : list) {
124 slp_assert(
static_cast<int>(row.size()) == m_cols);
127 m_storage.reserve(rows() * cols());
128 for (
const auto& row : list) {
129 std::ranges::copy(row, std::back_inserter(m_storage));
142 m_rows = list.size();
144 if (list.size() > 0) {
145 m_cols = list.begin()->size();
149 for ([[maybe_unused]]
150 const auto& row : list) {
151 slp_assert(
static_cast<int>(row.size()) == m_cols);
154 m_storage.reserve(rows() * cols());
155 for (
const auto& row : list) {
156 std::ranges::copy(row, std::back_inserter(m_storage));
165 template <
typename Derived>
167 : m_rows{static_cast<int>(values.rows())},
168 m_cols{static_cast<int>(values.cols())} {
169 m_storage.reserve(values.rows() * values.cols());
170 for (
int row = 0; row < values.rows(); ++row) {
171 for (
int col = 0; col < values.cols(); ++col) {
172 m_storage.emplace_back(values(row, col));
182 template <
typename Derived>
184 : m_rows{static_cast<int>(values.rows())},
185 m_cols{static_cast<int>(values.cols())} {
186 m_storage.reserve(values.rows() * values.cols());
187 for (
int row = 0; row < values.rows(); ++row) {
188 for (
int col = 0; col < values.cols(); ++col) {
190 m_storage.emplace_back(values.diagonal()[row]);
192 m_storage.emplace_back(0.0);
204 : m_rows{1}, m_cols{1} {
205 m_storage.emplace_back(variable);
214 m_storage.emplace_back(std::move(variable));
223 : m_rows{values.rows()}, m_cols{values.cols()} {
224 m_storage.reserve(rows() * cols());
225 for (
int row = 0; row < rows(); ++row) {
226 for (
int col = 0; col < cols(); ++col) {
227 m_storage.emplace_back(values[row, col]);
238 : m_rows{values.rows()}, m_cols{values.cols()} {
239 m_storage.reserve(rows() * cols());
240 for (
int row = 0; row < rows(); ++row) {
241 for (
int col = 0; col < cols(); ++col) {
242 m_storage.emplace_back(values[row, col]);
253 : m_rows{static_cast<int>(values.size())}, m_cols{1} {
254 m_storage.reserve(rows() * cols());
255 for (
int row = 0; row < rows(); ++row) {
256 for (
int col = 0; col < cols(); ++col) {
257 m_storage.emplace_back(values[row * cols() + col]);
270 : m_rows{rows}, m_cols{cols} {
271 slp_assert(
static_cast<int>(values.size()) == rows * cols);
272 m_storage.reserve(rows * cols);
273 for (
int row = 0; row < rows; ++row) {
274 for (
int col = 0; col < cols; ++col) {
275 m_storage.emplace_back(values[row * cols + col]);
286 template <
typename Derived>
288 slp_assert(rows() == values.rows() && cols() == values.cols());
290 for (
int row = 0; row < values.rows(); ++row) {
291 for (
int col = 0; col < values.cols(); ++col) {
292 (*this)[row, col] = values(row, col);
308 slp_assert(rows() == 1 && cols() == 1);
310 (*this)[0, 0] = value;
320 template <
typename Derived>
321 requires std::same_as<typename Derived::Scalar, double>
322 void set_value(
const Eigen::MatrixBase<Derived>& values) {
323 slp_assert(rows() == values.rows() && cols() == values.cols());
325 for (
int row = 0; row < values.rows(); ++row) {
326 for (
int col = 0; col < values.cols(); ++col) {
327 (*this)[row, col].set_value(values(row, col));
340 slp_assert(row >= 0 && row < rows());
341 slp_assert(col >= 0 && col < cols());
342 return m_storage[row * cols() + col];
353 slp_assert(row >= 0 && row < rows());
354 slp_assert(col >= 0 && col < cols());
355 return m_storage[row * cols() + col];
365 slp_assert(index >= 0 && index < rows() * cols());
366 return m_storage[index];
376 slp_assert(index >= 0 && index < rows() * cols());
377 return m_storage[index];
390 int block_rows,
int block_cols) {
391 slp_assert(row_offset >= 0 && row_offset <= rows());
392 slp_assert(col_offset >= 0 && col_offset <= cols());
393 slp_assert(block_rows >= 0 && block_rows <= rows() - row_offset);
394 slp_assert(block_cols >= 0 && block_cols <= cols() - col_offset);
395 return VariableBlock{*
this, row_offset, col_offset, block_rows, block_cols};
410 int block_cols)
const {
411 slp_assert(row_offset >= 0 && row_offset <= rows());
412 slp_assert(col_offset >= 0 && col_offset <= cols());
413 slp_assert(block_rows >= 0 && block_rows <= rows() - row_offset);
414 slp_assert(block_cols >= 0 && block_cols <= cols() - col_offset);
415 return VariableBlock{*
this, row_offset, col_offset, block_rows, block_cols};
426 int row_slice_length = row_slice.
adjust(rows());
427 int col_slice_length = col_slice.
adjust(cols());
428 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
429 std::move(col_slice), col_slice_length};
440 Slice col_slice)
const {
441 int row_slice_length = row_slice.
adjust(rows());
442 int col_slice_length = col_slice.
adjust(cols());
443 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
444 std::move(col_slice), col_slice_length};
461 int row_slice_length,
463 int col_slice_length) {
464 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
465 std::move(col_slice), col_slice_length};
481 Slice row_slice,
int row_slice_length,
Slice col_slice,
482 int col_slice_length)
const {
483 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
484 std::move(col_slice), col_slice_length};
495 slp_assert(cols() == 1);
496 slp_assert(offset >= 0 && offset < rows());
497 slp_assert(length >= 0 && length <= rows() - offset);
498 return block(offset, 0, length, 1);
510 slp_assert(cols() == 1);
511 slp_assert(offset >= 0 && offset < rows());
512 slp_assert(length >= 0 && length <= rows() - offset);
513 return block(offset, 0, length, 1);
523 slp_assert(row >= 0 && row < rows());
524 return block(row, 0, 1, cols());
534 slp_assert(row >= 0 && row < rows());
535 return block(row, 0, 1, cols());
545 slp_assert(col >= 0 && col < cols());
546 return block(0, col, rows(), 1);
556 slp_assert(col >= 0 && col < cols());
557 return block(0, col, rows(), 1);
566 template <MatrixLike LHS, MatrixLike RHS>
570 slp_assert(lhs.cols() == rhs.rows());
572 VariableMatrix result(VariableMatrix::empty, lhs.rows(), rhs.cols());
574 for (
int i = 0; i < lhs.rows(); ++i) {
575 for (
int j = 0; j < rhs.cols(); ++j) {
577 for (
int k = 0; k < lhs.cols(); ++k) {
579 sum += lhs[i, k] * rhs[k, j];
582 sum += lhs[i, k] * rhs(k, j);
585 sum += lhs(i, k) * rhs[k, j];
605 for (
int row = 0; row < result.rows(); ++row) {
606 for (
int col = 0; col < result.cols(); ++col) {
607 result[row, col] = lhs[row, col] * rhs;
622 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
624 for (
int row = 0; row < result.
rows(); ++row) {
625 for (
int col = 0; col < result.
cols(); ++col) {
627 result[row, col] = lhs[row, col] * rhs;
629 result[row, col] = lhs(row, col) * rhs;
647 for (
int row = 0; row < result.rows(); ++row) {
648 for (
int col = 0; col < result.cols(); ++col) {
649 result[row, col] = rhs[row, col] * lhs;
664 VariableMatrix result(VariableMatrix::empty, rhs.rows(), rhs.cols());
666 for (
int row = 0; row < result.
rows(); ++row) {
667 for (
int col = 0; col < result.
cols(); ++col) {
669 result[row, col] = rhs[row, col] * lhs;
671 result[row, col] = rhs(row, col) * lhs;
686 slp_assert(cols() == rhs.rows() && cols() == rhs.cols());
688 for (
int i = 0; i < rows(); ++i) {
689 for (
int j = 0; j < rhs.cols(); ++j) {
691 for (
int k = 0; k < cols(); ++k) {
693 sum += (*this)[i, k] * rhs[k, j];
695 sum += (*this)[i, k] * rhs(k, j);
712 for (
int row = 0; row < rows(); ++row) {
713 for (
int col = 0; col < rhs.cols(); ++col) {
714 (*this)[row, col] *= rhs;
730 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
732 for (
int row = 0; row < result.
rows(); ++row) {
733 for (
int col = 0; col < result.
cols(); ++col) {
735 result[row, col] = lhs[row, col] / rhs;
737 result[row, col] = lhs(row, col) / rhs;
752 for (
int row = 0; row < rows(); ++row) {
753 for (
int col = 0; col < cols(); ++col) {
754 (*this)[row, col] /= rhs;
768 template <MatrixLike LHS, MatrixLike RHS>
772 slp_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
774 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
776 for (
int row = 0; row < result.
rows(); ++row) {
777 for (
int col = 0; col < result.
cols(); ++col) {
779 result[row, col] = lhs[row, col] + rhs[row, col];
781 result[row, col] = lhs[row, col] + rhs(row, col);
783 result[row, col] = lhs(row, col) + rhs[row, col];
798 slp_assert(rows() == rhs.rows() && cols() == rhs.cols());
800 for (
int row = 0; row < rows(); ++row) {
801 for (
int col = 0; col < cols(); ++col) {
803 (*this)[row, col] += rhs[row, col];
805 (*this)[row, col] += rhs(row, col);
820 slp_assert(rows() == 1 && cols() == 1);
822 for (
int row = 0; row < rows(); ++row) {
823 for (
int col = 0; col < cols(); ++col) {
824 (*this)[row, col] += rhs;
838 template <MatrixLike LHS, MatrixLike RHS>
842 slp_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
844 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
846 for (
int row = 0; row < result.
rows(); ++row) {
847 for (
int col = 0; col < result.
cols(); ++col) {
849 result[row, col] = lhs[row, col] - rhs[row, col];
851 result[row, col] = lhs[row, col] - rhs(row, col);
853 result[row, col] = lhs(row, col) - rhs[row, col];
868 slp_assert(rows() == rhs.rows() && cols() == rhs.cols());
870 for (
int row = 0; row < rows(); ++row) {
871 for (
int col = 0; col < cols(); ++col) {
873 (*this)[row, col] -= rhs[row, col];
875 (*this)[row, col] -= rhs(row, col);
890 slp_assert(rows() == 1 && cols() == 1);
892 for (
int row = 0; row < rows(); ++row) {
893 for (
int col = 0; col < cols(); ++col) {
894 (*this)[row, col] -= rhs;
910 for (
int row = 0; row < result.rows(); ++row) {
911 for (
int col = 0; col < result.cols(); ++col) {
912 result[row, col] = -lhs[row, col];
923 slp_assert(rows() == 1 && cols() == 1);
924 return (*
this)[0, 0];
935 for (
int row = 0; row < rows(); ++row) {
936 for (
int col = 0; col < cols(); ++col) {
937 result[col, row] = (*this)[row, col];
949 int rows()
const {
return m_rows; }
956 int cols()
const {
return m_cols; }
965 double value(
int row,
int col) {
return (*
this)[row, col].value(); }
973 double value(
int index) {
return (*
this)[index].value(); }
981 Eigen::MatrixXd result{rows(), cols()};
983 for (
int row = 0; row < rows(); ++row) {
984 for (
int col = 0; col < cols(); ++col) {
985 result(row, col) = value(row, col);
1002 for (
int row = 0; row < rows(); ++row) {
1003 for (
int col = 0; col < cols(); ++col) {
1004 result[row, col] = unary_op((*
this)[row, col]);
1011#ifndef DOXYGEN_SHOULD_SKIP_THIS
1015 using iterator_category = std::bidirectional_iterator_tag;
1017 using difference_type = std::ptrdiff_t;
1021 constexpr iterator() noexcept = default;
1023 explicit constexpr iterator(
1024 gch::small_vector<
Variable>::iterator it) noexcept
1027 constexpr iterator& operator++() noexcept {
1032 constexpr iterator operator++(
int)
noexcept {
1033 iterator retval = *
this;
1038 constexpr iterator& operator--() noexcept {
1043 constexpr iterator operator--(
int)
noexcept {
1044 iterator retval = *
this;
1049 constexpr bool operator==(
const iterator&)
const noexcept =
default;
1051 constexpr reference operator*() const noexcept {
return *m_it; }
1054 gch::small_vector<Variable>::iterator m_it;
1057 class const_iterator {
1059 using iterator_category = std::bidirectional_iterator_tag;
1060 using value_type = Variable;
1061 using difference_type = std::ptrdiff_t;
1062 using pointer = Variable*;
1063 using const_reference =
const Variable&;
1065 constexpr const_iterator() noexcept = default;
1067 explicit constexpr const_iterator(
1068 gch::small_vector<Variable>::const_iterator it) noexcept
1071 constexpr const_iterator& operator++() noexcept {
1076 constexpr const_iterator operator++(
int)
noexcept {
1077 const_iterator retval = *
this;
1082 constexpr const_iterator& operator--() noexcept {
1087 constexpr const_iterator operator--(
int)
noexcept {
1088 const_iterator retval = *
this;
1093 constexpr bool operator==(
const const_iterator&)
const noexcept =
default;
1095 constexpr const_reference operator*() const noexcept {
return *m_it; }
1098 gch::small_vector<Variable>::const_iterator m_it;
1101 using reverse_iterator = std::reverse_iterator<iterator>;
1102 using const_reverse_iterator = std::reverse_iterator<const_iterator>;
1111 iterator
begin() {
return iterator{m_storage.begin()}; }
1118 iterator
end() {
return iterator{m_storage.end()}; }
1125 const_iterator
begin()
const {
return const_iterator{m_storage.begin()}; }
1132 const_iterator
end()
const {
return const_iterator{m_storage.end()}; }
1139 const_iterator
cbegin()
const {
return const_iterator{m_storage.cbegin()}; }
1146 const_iterator
cend()
const {
return const_iterator{m_storage.cend()}; }
1153 reverse_iterator
rbegin() {
return reverse_iterator{end()}; }
1160 reverse_iterator
rend() {
return reverse_iterator{begin()}; }
1168 return const_reverse_iterator{end()};
1176 const_reverse_iterator
rend()
const {
1177 return const_reverse_iterator{begin()};
1186 return const_reverse_iterator{cend()};
1195 return const_reverse_iterator{cbegin()};
1203 size_t size()
const {
return m_storage.size(); }
1215 for (
auto& elem : result) {
1232 for (
auto& elem : result) {
1240 gch::small_vector<Variable> m_storage;
1252SLEIPNIR_DLLEXPORT
inline VariableMatrix cwise_reduce(
1253 const VariableMatrix& lhs,
const VariableMatrix& rhs,
1254 function_ref<Variable(
const Variable& x,
const Variable& y)> binary_op) {
1255 slp_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
1259 for (
int row = 0; row < lhs.rows(); ++row) {
1260 for (
int col = 0; col < lhs.cols(); ++col) {
1261 result[row, col] = binary_op(lhs[row, col], rhs[row, col]);
1278SLEIPNIR_DLLEXPORT
inline VariableMatrix block(
1279 std::initializer_list<std::initializer_list<VariableMatrix>> list) {
1283 for (
const auto& row : list) {
1284 if (row.size() > 0) {
1285 rows += row.
begin()->rows();
1289 int latest_cols = 0;
1290 for (
const auto& elem : row) {
1292 slp_assert(row.begin()->rows() == elem.rows());
1294 latest_cols += elem.cols();
1302 slp_assert(cols == latest_cols);
1309 for (
const auto& row : list) {
1311 for (
const auto& elem : row) {
1312 result.block(row_offset, col_offset, elem.rows(), elem.cols()) = elem;
1313 col_offset += elem.cols();
1315 if (row.size() > 0) {
1316 row_offset += row.begin()->rows();
1335SLEIPNIR_DLLEXPORT
inline VariableMatrix block(
1336 const std::vector<std::vector<VariableMatrix>>& list) {
1340 for (
const auto& row : list) {
1341 if (row.size() > 0) {
1342 rows += row.
begin()->rows();
1346 int latest_cols = 0;
1347 for (
const auto& elem : row) {
1349 slp_assert(row.begin()->rows() == elem.rows());
1351 latest_cols += elem.cols();
1359 slp_assert(cols == latest_cols);
1366 for (
const auto& row : list) {
1368 for (
const auto& elem : row) {
1369 result.block(row_offset, col_offset, elem.rows(), elem.cols()) = elem;
1370 col_offset += elem.cols();
1372 if (row.size() > 0) {
1373 row_offset += row.begin()->rows();
1387SLEIPNIR_DLLEXPORT VariableMatrix solve(
const VariableMatrix& A,
1388 const VariableMatrix& B);
constexpr int adjust(int length)
Definition slice.hpp:134
Definition variable_block.hpp:24
Definition variable_matrix.hpp:29
VariableMatrix & operator=(ScalarLike auto value)
Definition variable_matrix.hpp:307
Eigen::MatrixXd value()
Definition variable_matrix.hpp:980
const VariableBlock< const VariableMatrix > operator[](Slice row_slice, int row_slice_length, Slice col_slice, int col_slice_length) const
Definition variable_matrix.hpp:480
const VariableBlock< const VariableMatrix > row(int row) const
Definition variable_matrix.hpp:533
VariableBlock< VariableMatrix > segment(int offset, int length)
Definition variable_matrix.hpp:494
VariableMatrix(const Eigen::DiagonalBase< Derived > &values)
Definition variable_matrix.hpp:183
const_iterator end() const
Definition variable_matrix.hpp:1132
VariableBlock< VariableMatrix > operator[](Slice row_slice, int row_slice_length, Slice col_slice, int col_slice_length)
Definition variable_matrix.hpp:460
const_reverse_iterator rbegin() const
Definition variable_matrix.hpp:1167
const_iterator cend() const
Definition variable_matrix.hpp:1146
VariableMatrix(const Variable &variable)
Definition variable_matrix.hpp:203
VariableBlock< VariableMatrix > block(int row_offset, int col_offset, int block_rows, int block_cols)
Definition variable_matrix.hpp:389
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const ScalarLike auto &lhs, const SleipnirMatrixLike auto &rhs)
Definition variable_matrix.hpp:644
VariableMatrix & operator*=(const MatrixLike auto &rhs)
Definition variable_matrix.hpp:685
size_t size() const
Definition variable_matrix.hpp:1203
VariableMatrix & operator+=(const ScalarLike auto &rhs)
Definition variable_matrix.hpp:819
friend SLEIPNIR_DLLEXPORT VariableMatrix operator-(const LHS &lhs, const RHS &rhs)
Definition variable_matrix.hpp:840
const Variable & operator[](int index) const
Definition variable_matrix.hpp:375
VariableMatrix & operator/=(const ScalarLike auto &rhs)
Definition variable_matrix.hpp:751
const VariableBlock< const VariableMatrix > block(int row_offset, int col_offset, int block_rows, int block_cols) const
Definition variable_matrix.hpp:407
VariableMatrix(const Eigen::MatrixBase< Derived > &values)
Definition variable_matrix.hpp:166
reverse_iterator rbegin()
Definition variable_matrix.hpp:1153
const VariableBlock< const VariableMatrix > operator[](Slice row_slice, Slice col_slice) const
Definition variable_matrix.hpp:439
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const Variable &lhs, const MatrixLike auto &rhs)
Definition variable_matrix.hpp:663
VariableMatrix & operator+=(const MatrixLike auto &rhs)
Definition variable_matrix.hpp:797
VariableMatrix T() const
Definition variable_matrix.hpp:932
VariableMatrix & operator*=(const ScalarLike auto &rhs)
Definition variable_matrix.hpp:711
VariableMatrix cwise_transform(function_ref< Variable(const Variable &x)> unary_op) const
Definition variable_matrix.hpp:998
reverse_iterator rend()
Definition variable_matrix.hpp:1160
const Variable & operator[](int row, int col) const
Definition variable_matrix.hpp:352
static VariableMatrix ones(int rows, int cols)
Definition variable_matrix.hpp:1229
const_reverse_iterator rend() const
Definition variable_matrix.hpp:1176
double value(int index)
Definition variable_matrix.hpp:973
VariableMatrix & operator-=(const MatrixLike auto &rhs)
Definition variable_matrix.hpp:867
VariableMatrix(int rows, int cols)
Definition variable_matrix.hpp:60
VariableBlock< VariableMatrix > operator[](Slice row_slice, Slice col_slice)
Definition variable_matrix.hpp:425
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const MatrixLike auto &lhs, const Variable &rhs)
Definition variable_matrix.hpp:620
const_reverse_iterator crend() const
Definition variable_matrix.hpp:1194
VariableMatrix(int rows)
Definition variable_matrix.hpp:52
VariableMatrix(const VariableBlock< const VariableMatrix > &values)
Definition variable_matrix.hpp:237
friend SLEIPNIR_DLLEXPORT VariableMatrix operator/(const MatrixLike auto &lhs, const ScalarLike auto &rhs)
Definition variable_matrix.hpp:729
iterator end()
Definition variable_matrix.hpp:1118
const_reverse_iterator crbegin() const
Definition variable_matrix.hpp:1185
VariableBlock< VariableMatrix > row(int row)
Definition variable_matrix.hpp:522
VariableMatrix & operator-=(const ScalarLike auto &rhs)
Definition variable_matrix.hpp:889
const_iterator cbegin() const
Definition variable_matrix.hpp:1139
VariableMatrix(empty_t, int rows, int cols)
Definition variable_matrix.hpp:73
VariableMatrix(std::span< const Variable > values)
Definition variable_matrix.hpp:252
VariableMatrix(std::span< const Variable > values, int rows, int cols)
Definition variable_matrix.hpp:269
const_iterator begin() const
Definition variable_matrix.hpp:1125
Variable & operator[](int row, int col)
Definition variable_matrix.hpp:339
double value(int row, int col)
Definition variable_matrix.hpp:965
iterator begin()
Definition variable_matrix.hpp:1111
static VariableMatrix zero(int rows, int cols)
Definition variable_matrix.hpp:1212
VariableMatrix & operator=(const Eigen::MatrixBase< Derived > &values)
Definition variable_matrix.hpp:287
friend SLEIPNIR_DLLEXPORT VariableMatrix operator-(const SleipnirMatrixLike auto &lhs)
Definition variable_matrix.hpp:907
const VariableBlock< const VariableMatrix > col(int col) const
Definition variable_matrix.hpp:555
int rows() const
Definition variable_matrix.hpp:949
int cols() const
Definition variable_matrix.hpp:956
VariableMatrix(Variable &&variable)
Definition variable_matrix.hpp:213
const VariableBlock< const VariableMatrix > segment(int offset, int length) const
Definition variable_matrix.hpp:508
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const SleipnirMatrixLike auto &lhs, const ScalarLike auto &rhs)
Definition variable_matrix.hpp:602
VariableMatrix(std::initializer_list< std::initializer_list< Variable > > list)
Definition variable_matrix.hpp:85
void set_value(const Eigen::MatrixBase< Derived > &values)
Definition variable_matrix.hpp:322
VariableMatrix(const std::vector< std::vector< double > > &list)
Definition variable_matrix.hpp:113
Variable & operator[](int index)
Definition variable_matrix.hpp:364
VariableMatrix(const std::vector< std::vector< Variable > > &list)
Definition variable_matrix.hpp:140
VariableBlock< VariableMatrix > col(int col)
Definition variable_matrix.hpp:544
static constexpr empty_t empty
Definition variable_matrix.hpp:39
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const LHS &lhs, const RHS &rhs)
Definition variable_matrix.hpp:568
friend SLEIPNIR_DLLEXPORT VariableMatrix operator+(const LHS &lhs, const RHS &rhs)
Definition variable_matrix.hpp:770
VariableMatrix(const VariableBlock< VariableMatrix > &values)
Definition variable_matrix.hpp:222
Definition variable.hpp:40
Definition function_ref.hpp:13
Definition concepts.hpp:26
Definition concepts.hpp:40
Definition concepts.hpp:13
Definition concepts.hpp:30
Definition variable_matrix.hpp:34