7#include <initializer_list>
52 m_storage.reserve(rows);
53 for (
int row = 0; row < rows; ++row) {
54 m_storage.emplace_back();
65 m_storage.reserve(rows * cols);
67 m_storage.emplace_back();
78 m_storage.reserve(rows * cols);
80 m_storage.emplace_back(
nullptr);
90 std::initializer_list<std::initializer_list<Variable>> list) {
94 if (list.size() > 0) {
95 m_cols = list.begin()->size();
100 const auto& row : list) {
101 slp_assert(list.begin()->size() == row.size());
104 m_storage.reserve(rows() * cols());
105 for (
const auto& row : list) {
106 std::ranges::copy(row, std::back_inserter(m_storage));
119 m_rows = list.size();
121 if (list.size() > 0) {
122 m_cols = list.begin()->size();
126 for ([[maybe_unused]]
127 const auto& row : list) {
128 slp_assert(list.begin()->size() == row.size());
131 m_storage.reserve(rows() * cols());
132 for (
const auto& row : list) {
133 std::ranges::copy(row, std::back_inserter(m_storage));
146 m_rows = list.size();
148 if (list.size() > 0) {
149 m_cols = list.begin()->size();
153 for ([[maybe_unused]]
154 const auto& row : list) {
155 slp_assert(list.begin()->size() == row.size());
158 m_storage.reserve(rows() * cols());
159 for (
const auto& row : list) {
160 std::ranges::copy(row, std::back_inserter(m_storage));
169 template <
typename Derived>
171 : m_rows{static_cast<int>(values.rows())},
172 m_cols{static_cast<int>(values.cols())} {
173 m_storage.reserve(values.rows() * values.cols());
174 for (
int row = 0; row < values.rows(); ++row) {
175 for (
int col = 0; col < values.cols(); ++col) {
176 m_storage.emplace_back(values(row, col));
186 template <
typename Derived>
188 : m_rows{static_cast<int>(values.rows())},
189 m_cols{static_cast<int>(values.cols())} {
190 m_storage.reserve(values.rows() * values.cols());
191 for (
int row = 0; row < values.rows(); ++row) {
192 for (
int col = 0; col < values.cols(); ++col) {
194 m_storage.emplace_back(values.diagonal()[row]);
196 m_storage.emplace_back(0.0);
208 template <
typename Derived>
210 slp_assert(rows() == values.rows() && cols() == values.cols());
212 for (
int row = 0; row < values.rows(); ++row) {
213 for (
int col = 0; col < values.cols(); ++col) {
214 (*this)(row, col) = values(row, col);
232 (*this)(0, 0) = value;
242 template <
typename Derived>
243 requires std::same_as<typename Derived::Scalar, double>
244 void set_value(
const Eigen::MatrixBase<Derived>& values) {
245 slp_assert(rows() == values.rows() && cols() == values.cols());
247 for (
int row = 0; row < values.rows(); ++row) {
248 for (
int col = 0; col < values.cols(); ++col) {
249 (*this)(row, col).set_value(values(row, col));
260 : m_rows{1}, m_cols{1} {
261 m_storage.emplace_back(variable);
270 m_storage.emplace_back(std::move(variable));
279 : m_rows{values.rows()}, m_cols{values.cols()} {
280 m_storage.reserve(rows() * cols());
281 for (
int row = 0; row < rows(); ++row) {
282 for (
int col = 0; col < cols(); ++col) {
283 m_storage.emplace_back(values(row, col));
294 : m_rows{values.rows()}, m_cols{values.cols()} {
295 m_storage.reserve(rows() * cols());
296 for (
int row = 0; row < rows(); ++row) {
297 for (
int col = 0; col < cols(); ++col) {
298 m_storage.emplace_back(values(row, col));
309 : m_rows{static_cast<int>(values.size())}, m_cols{1} {
310 m_storage.reserve(rows() * cols());
311 for (
int row = 0; row < rows(); ++row) {
312 for (
int col = 0; col < cols(); ++col) {
313 m_storage.emplace_back(values[row * cols() + col]);
326 : m_rows{rows}, m_cols{cols} {
327 slp_assert(
static_cast<int>(values.size()) == rows * cols);
328 m_storage.reserve(rows * cols);
329 for (
int row = 0; row < rows; ++row) {
330 for (
int col = 0; col < cols; ++col) {
331 m_storage.emplace_back(values[row * cols + col]);
346 return m_storage[row * cols() + col];
359 return m_storage[row * cols() + col];
369 slp_assert(row >= 0 && row < rows() * cols());
370 return m_storage[row];
380 slp_assert(row >= 0 && row < rows() * cols());
381 return m_storage[row];
394 int block_rows,
int block_cols) {
395 slp_assert(row_offset >= 0 && row_offset <= rows());
396 slp_assert(col_offset >= 0 && col_offset <= cols());
397 slp_assert(block_rows >= 0 && block_rows <= rows() - row_offset);
398 slp_assert(block_cols >= 0 && block_cols <= cols() - col_offset);
399 return VariableBlock{*
this, row_offset, col_offset, block_rows, block_cols};
414 int block_cols)
const {
415 slp_assert(row_offset >= 0 && row_offset <= rows());
416 slp_assert(col_offset >= 0 && col_offset <= cols());
417 slp_assert(block_rows >= 0 && block_rows <= rows() - row_offset);
418 slp_assert(block_cols >= 0 && block_cols <= cols() - col_offset);
419 return VariableBlock{*
this, row_offset, col_offset, block_rows, block_cols};
430 int row_slice_length = row_slice.
adjust(rows());
431 int col_slice_length = col_slice.
adjust(cols());
432 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
433 std::move(col_slice), col_slice_length};
444 Slice col_slice)
const {
445 int row_slice_length = row_slice.
adjust(rows());
446 int col_slice_length = col_slice.
adjust(cols());
447 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
448 std::move(col_slice), col_slice_length};
465 int row_slice_length,
467 int col_slice_length) {
468 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
469 std::move(col_slice), col_slice_length};
485 Slice row_slice,
int row_slice_length,
Slice col_slice,
486 int col_slice_length)
const {
487 return VariableBlock{*
this, std::move(row_slice), row_slice_length,
488 std::move(col_slice), col_slice_length};
499 slp_assert(offset >= 0 && offset < rows() * cols());
500 slp_assert(length >= 0 && length <= rows() * cols() - offset);
501 return block(offset, 0, length, 1);
513 slp_assert(offset >= 0 && offset < rows() * cols());
514 slp_assert(length >= 0 && length <= rows() * cols() - offset);
515 return block(offset, 0, length, 1);
526 return block(row, 0, 1, cols());
537 return block(row, 0, 1, cols());
548 return block(0, col, rows(), 1);
559 return block(0, col, rows(), 1);
568 template <MatrixLike LHS, MatrixLike RHS>
574 VariableMatrix result(VariableMatrix::empty, lhs.rows(), rhs.cols());
577#pragma GCC diagnostic push
578#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
580 for (
int i = 0; i < lhs.rows(); ++i) {
581 for (
int j = 0; j < rhs.cols(); ++j) {
583 for (
int k = 0; k < lhs.cols(); ++k) {
584 sum += lhs(i, k) * rhs(k, j);
590#pragma GCC diagnostic pop
604 VariableMatrix result{VariableMatrix::empty, lhs.rows(), lhs.cols()};
606 for (
int row = 0; row < result.rows(); ++row) {
607 for (
int col = 0; col < result.cols(); ++col) {
608 result(row, col) = lhs(row, col) * rhs;
623 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
625 for (
int row = 0; row < result.rows(); ++row) {
626 for (
int col = 0; col < result.cols(); ++col) {
627 result(row, col) = lhs(row, col) * rhs;
642 VariableMatrix result{VariableMatrix::empty, rhs.rows(), rhs.cols()};
644 for (
int row = 0; row < result.rows(); ++row) {
645 for (
int col = 0; col < result.cols(); ++col) {
646 result(row, col) = rhs(row, col) * lhs;
661 VariableMatrix result(VariableMatrix::empty, rhs.rows(), rhs.cols());
663 for (
int row = 0; row < result.rows(); ++row) {
664 for (
int col = 0; col < result.cols(); ++col) {
665 result(row, col) = rhs(row, col) * lhs;
679 slp_assert(cols() == rhs.rows() && cols() == rhs.cols());
681 for (
int i = 0; i < rows(); ++i) {
682 for (
int j = 0; j < rhs.cols(); ++j) {
684 for (
int k = 0; k < cols(); ++k) {
685 sum += (*this)(i, k) * rhs(k, j);
701 for (
int row = 0; row < rows(); ++row) {
702 for (
int col = 0; col < rhs.cols(); ++col) {
703 (*this)(row, col) *= rhs;
719 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
721 for (
int row = 0; row < result.rows(); ++row) {
722 for (
int col = 0; col < result.cols(); ++col) {
723 result(row, col) = lhs(row, col) / rhs;
737 for (
int row = 0; row < rows(); ++row) {
738 for (
int col = 0; col < cols(); ++col) {
739 (*this)(row, col) /= rhs;
753 template <MatrixLike LHS, MatrixLike RHS>
757 slp_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
759 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
761 for (
int row = 0; row < result.rows(); ++row) {
762 for (
int col = 0; col < result.cols(); ++col) {
763 result(row, col) = lhs(row, col) + rhs(row, col);
777 slp_assert(rows() == rhs.rows() && cols() == rhs.cols());
779 for (
int row = 0; row < rows(); ++row) {
780 for (
int col = 0; col < cols(); ++col) {
781 (*this)(row, col) += rhs(row, col);
797 for (
int row = 0; row < rows(); ++row) {
798 for (
int col = 0; col < cols(); ++col) {
799 (*this)(row, col) += rhs;
813 template <MatrixLike LHS, MatrixLike RHS>
817 slp_assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols());
819 VariableMatrix result(VariableMatrix::empty, lhs.rows(), lhs.cols());
821 for (
int row = 0; row < result.rows(); ++row) {
822 for (
int col = 0; col < result.cols(); ++col) {
823 result(row, col) = lhs(row, col) - rhs(row, col);
837 slp_assert(rows() == rhs.rows() && cols() == rhs.cols());
839 for (
int row = 0; row < rows(); ++row) {
840 for (
int col = 0; col < cols(); ++col) {
841 (*this)(row, col) -= rhs(row, col);
857 for (
int row = 0; row < rows(); ++row) {
858 for (
int col = 0; col < cols(); ++col) {
859 (*this)(row, col) -= rhs;
873 VariableMatrix result{VariableMatrix::empty, lhs.rows(), lhs.cols()};
875 for (
int row = 0; row < result.rows(); ++row) {
876 for (
int col = 0; col < result.cols(); ++col) {
877 result(row, col) = -lhs(row, col);
889 return (*
this)(0, 0);
900 for (
int row = 0; row < rows(); ++row) {
901 for (
int col = 0; col < cols(); ++col) {
902 result(col, row) = (*this)(row, col);
914 int rows()
const {
return m_rows; }
921 int cols()
const {
return m_cols; }
933 return m_storage[row * cols() + col].value();
944 return m_storage[
index].value();
953 Eigen::MatrixXd result{rows(), cols()};
955 for (
int row = 0; row < rows(); ++row) {
956 for (
int col = 0; col < cols(); ++col) {
957 result(row, col) = value(row, col);
974 for (
int row = 0; row < rows(); ++row) {
975 for (
int col = 0; col < cols(); ++col) {
976 result(row, col) = unary_op((*
this)(row, col));
983#ifndef DOXYGEN_SHOULD_SKIP_THIS
1100 size_t size()
const {
return m_storage.size(); }
1112 for (
auto& elem : result) {
1129 for (
auto& elem : result) {
1156 for (
int row = 0; row < lhs.
rows(); ++row) {
1157 for (
int col = 0; col < lhs.
cols(); ++col) {
1158 result(row, col) = binary_op(lhs(row, col), rhs(row, col));
1176 std::initializer_list<std::initializer_list<VariableMatrix>> list) {
1180 for (
const auto& row : list) {
1181 if (row.size() > 0) {
1182 rows += row.begin()->rows();
1186 int latest_cols = 0;
1187 for (
const auto& elem : row) {
1189 slp_assert(row.begin()->rows() == elem.rows());
1191 latest_cols += elem.cols();
1206 for (
const auto& row : list) {
1208 for (
const auto& elem : row) {
1209 result.block(row_offset, col_offset, elem.rows(), elem.cols()) = elem;
1210 col_offset += elem.cols();
1212 row_offset += row.begin()->rows();
1231 const std::vector<std::vector<VariableMatrix>>& list) {
1235 for (
const auto& row : list) {
1236 if (row.size() > 0) {
1237 rows += row.begin()->rows();
1241 int latest_cols = 0;
1242 for (
const auto& elem : row) {
1244 slp_assert(row.begin()->rows() == elem.rows());
1246 latest_cols += elem.cols();
1261 for (
const auto& row : list) {
1263 for (
const auto& elem : row) {
1264 result.block(row_offset, col_offset, elem.rows(), elem.cols()) = elem;
1265 col_offset += elem.cols();
1267 row_offset += row.begin()->rows();
#define slp_assert(condition)
Abort in C++.
Definition assert.hpp:26
Represents a sequence of elements in an iterable object.
Definition slice.hpp:31
constexpr int adjust(int length)
Adjusts start and end slice indices assuming a sequence of the specified length.
Definition slice.hpp:134
A submatrix of autodiff variables with reference semantics.
Definition variable_block.hpp:24
An autodiff variable pointing to an expression node.
Definition variable.hpp:40
Definition variable_matrix.hpp:1018
constexpr const_iterator & operator++() noexcept
Definition variable_matrix.hpp:1032
std::ptrdiff_t difference_type
Definition variable_matrix.hpp:1022
constexpr const_iterator() noexcept=default
constexpr const_iterator operator++(int) noexcept
Definition variable_matrix.hpp:1037
constexpr bool operator==(const const_iterator &) const noexcept=default
constexpr const_reference operator*() const noexcept
Definition variable_matrix.hpp:1045
std::forward_iterator_tag iterator_category
Definition variable_matrix.hpp:1020
Definition variable_matrix.hpp:985
constexpr iterator & operator++() noexcept
Definition variable_matrix.hpp:999
constexpr iterator() noexcept=default
constexpr iterator operator++(int) noexcept
Definition variable_matrix.hpp:1004
std::ptrdiff_t difference_type
Definition variable_matrix.hpp:989
constexpr reference operator*() const noexcept
Definition variable_matrix.hpp:1012
constexpr bool operator==(const iterator &) const noexcept=default
std::forward_iterator_tag iterator_category
Definition variable_matrix.hpp:987
A matrix of autodiff variables.
Definition variable_matrix.hpp:29
VariableMatrix & operator=(ScalarLike auto value)
Assigns a double to the matrix.
Definition variable_matrix.hpp:229
Eigen::MatrixXd value()
Returns the contents of the variable matrix.
Definition variable_matrix.hpp:952
const VariableBlock< const VariableMatrix > row(int row) const
Returns a row slice of the variable matrix.
Definition variable_matrix.hpp:535
VariableBlock< VariableMatrix > segment(int offset, int length)
Returns a segment of the variable vector.
Definition variable_matrix.hpp:498
VariableMatrix(const Eigen::DiagonalBase< Derived > &values)
Constructs a VariableMatrix from an Eigen diagonal matrix.
Definition variable_matrix.hpp:187
const_iterator end() const
Returns end iterator.
Definition variable_matrix.hpp:1079
const_iterator cend() const
Returns end iterator.
Definition variable_matrix.hpp:1093
VariableMatrix(const Variable &variable)
Constructs a scalar VariableMatrix from a Variable.
Definition variable_matrix.hpp:259
VariableBlock< VariableMatrix > block(int row_offset, int col_offset, int block_rows, int block_cols)
Returns a block of the variable matrix.
Definition variable_matrix.hpp:393
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const ScalarLike auto &lhs, const SleipnirMatrixLike auto &rhs)
Scalar-matrix multiplication operator.
Definition variable_matrix.hpp:641
VariableMatrix & operator*=(const MatrixLike auto &rhs)
Compound matrix multiplication-assignment operator.
Definition variable_matrix.hpp:678
size_t size() const
Returns number of elements in matrix.
Definition variable_matrix.hpp:1100
VariableMatrix & operator+=(const ScalarLike auto &rhs)
Compound addition-assignment operator.
Definition variable_matrix.hpp:794
friend SLEIPNIR_DLLEXPORT VariableMatrix operator-(const LHS &lhs, const RHS &rhs)
Binary subtraction operator.
Definition variable_matrix.hpp:815
const Variable & operator()(int row, int col) const
Returns a block pointing to the given row and column.
Definition variable_matrix.hpp:356
VariableMatrix & operator/=(const ScalarLike auto &rhs)
Compound matrix division-assignment operator.
Definition variable_matrix.hpp:736
VariableMatrix()=default
Constructs an empty VariableMatrix.
const VariableBlock< const VariableMatrix > block(int row_offset, int col_offset, int block_rows, int block_cols) const
Returns a block of the variable matrix.
Definition variable_matrix.hpp:411
Variable & operator()(int row, int col)
Returns a block pointing to the given row and column.
Definition variable_matrix.hpp:343
const Variable & operator[](int row) const
Returns a block pointing to the given row.
Definition variable_matrix.hpp:379
VariableMatrix(const Eigen::MatrixBase< Derived > &values)
Constructs a VariableMatrix from an Eigen matrix.
Definition variable_matrix.hpp:170
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const Variable &lhs, const MatrixLike auto &rhs)
Scalar-matrix multiplication operator.
Definition variable_matrix.hpp:660
VariableMatrix & operator+=(const MatrixLike auto &rhs)
Compound addition-assignment operator.
Definition variable_matrix.hpp:776
VariableMatrix T() const
Returns the transpose of the variable matrix.
Definition variable_matrix.hpp:897
VariableMatrix & operator*=(const ScalarLike auto &rhs)
Compound matrix-scalar multiplication-assignment operator.
Definition variable_matrix.hpp:700
VariableMatrix cwise_transform(function_ref< Variable(const Variable &x)> unary_op) const
Transforms the matrix coefficient-wise with an unary operator.
Definition variable_matrix.hpp:970
const VariableBlock< const VariableMatrix > operator()(Slice row_slice, Slice col_slice) const
Returns a slice of the variable matrix.
Definition variable_matrix.hpp:443
static VariableMatrix ones(int rows, int cols)
Returns a variable matrix filled with ones.
Definition variable_matrix.hpp:1126
double value(int index)
Returns a row of the variable column vector.
Definition variable_matrix.hpp:942
VariableMatrix & operator-=(const MatrixLike auto &rhs)
Compound subtraction-assignment operator.
Definition variable_matrix.hpp:836
VariableMatrix(int rows, int cols)
Constructs a zero-initialized VariableMatrix with the given dimensions.
Definition variable_matrix.hpp:64
VariableBlock< VariableMatrix > operator()(Slice row_slice, Slice col_slice)
Returns a slice of the variable matrix.
Definition variable_matrix.hpp:429
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const MatrixLike auto &lhs, const Variable &rhs)
Matrix-scalar multiplication operator.
Definition variable_matrix.hpp:621
VariableMatrix(int rows)
Constructs a VariableMatrix column vector with the given rows.
Definition variable_matrix.hpp:51
const VariableBlock< const VariableMatrix > operator()(Slice row_slice, int row_slice_length, Slice col_slice, int col_slice_length) const
Returns a slice of the variable matrix.
Definition variable_matrix.hpp:484
VariableMatrix(const VariableBlock< const VariableMatrix > &values)
Constructs a VariableMatrix from a VariableBlock.
Definition variable_matrix.hpp:293
friend SLEIPNIR_DLLEXPORT VariableMatrix operator/(const MatrixLike auto &lhs, const ScalarLike auto &rhs)
Binary division operator.
Definition variable_matrix.hpp:718
iterator end()
Returns end iterator.
Definition variable_matrix.hpp:1065
VariableBlock< VariableMatrix > row(int row)
Returns a row slice of the variable matrix.
Definition variable_matrix.hpp:524
VariableMatrix & operator-=(const ScalarLike auto &rhs)
Compound subtraction-assignment operator.
Definition variable_matrix.hpp:854
const_iterator cbegin() const
Returns begin iterator.
Definition variable_matrix.hpp:1086
VariableMatrix(empty_t, int rows, int cols)
Constructs an empty VariableMatrix with the given dimensions.
Definition variable_matrix.hpp:77
Variable & operator[](int row)
Returns a block pointing to the given row.
Definition variable_matrix.hpp:368
VariableMatrix(std::span< const Variable > values)
Constructs a column vector wrapper around a Variable array.
Definition variable_matrix.hpp:308
VariableMatrix(std::span< const Variable > values, int rows, int cols)
Constructs a matrix wrapper around a Variable array.
Definition variable_matrix.hpp:325
const_iterator begin() const
Returns begin iterator.
Definition variable_matrix.hpp:1072
double value(int row, int col)
Returns an element of the variable matrix.
Definition variable_matrix.hpp:930
iterator begin()
Returns begin iterator.
Definition variable_matrix.hpp:1058
static VariableMatrix zero(int rows, int cols)
Returns a variable matrix filled with zeroes.
Definition variable_matrix.hpp:1109
VariableMatrix & operator=(const Eigen::MatrixBase< Derived > &values)
Assigns an Eigen matrix to a VariableMatrix.
Definition variable_matrix.hpp:209
friend SLEIPNIR_DLLEXPORT VariableMatrix operator-(const SleipnirMatrixLike auto &lhs)
Unary minus operator.
Definition variable_matrix.hpp:872
const VariableBlock< const VariableMatrix > col(int col) const
Returns a column slice of the variable matrix.
Definition variable_matrix.hpp:557
int rows() const
Returns the number of rows in the matrix.
Definition variable_matrix.hpp:914
int cols() const
Returns the number of columns in the matrix.
Definition variable_matrix.hpp:921
VariableMatrix(Variable &&variable)
Constructs a scalar VariableMatrix from a Variable.
Definition variable_matrix.hpp:269
const VariableBlock< const VariableMatrix > segment(int offset, int length) const
Returns a segment of the variable vector.
Definition variable_matrix.hpp:511
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const SleipnirMatrixLike auto &lhs, const ScalarLike auto &rhs)
Matrix-scalar multiplication operator.
Definition variable_matrix.hpp:603
VariableMatrix(std::initializer_list< std::initializer_list< Variable > > list)
Constructs a scalar VariableMatrix from a nested list of Variables.
Definition variable_matrix.hpp:89
void set_value(const Eigen::MatrixBase< Derived > &values)
Sets the VariableMatrix's internal values.
Definition variable_matrix.hpp:244
VariableMatrix(const std::vector< std::vector< double > > &list)
Constructs a scalar VariableMatrix from a nested list of doubles.
Definition variable_matrix.hpp:117
VariableMatrix(const std::vector< std::vector< Variable > > &list)
Constructs a scalar VariableMatrix from a nested list of Variables.
Definition variable_matrix.hpp:144
VariableBlock< VariableMatrix > col(int col)
Returns a column slice of the variable matrix.
Definition variable_matrix.hpp:546
static constexpr empty_t empty
Designates an uninitialized VariableMatrix.
Definition variable_matrix.hpp:39
friend SLEIPNIR_DLLEXPORT VariableMatrix operator*(const LHS &lhs, const RHS &rhs)
Matrix multiplication operator.
Definition variable_matrix.hpp:570
VariableBlock< VariableMatrix > operator()(Slice row_slice, int row_slice_length, Slice col_slice, int col_slice_length)
Returns a slice of the variable matrix.
Definition variable_matrix.hpp:464
friend SLEIPNIR_DLLEXPORT VariableMatrix operator+(const LHS &lhs, const RHS &rhs)
Binary addition operator.
Definition variable_matrix.hpp:755
VariableMatrix(const VariableBlock< VariableMatrix > &values)
Constructs a VariableMatrix from a VariableBlock.
Definition variable_matrix.hpp:278
Definition function_ref.hpp:13
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition SmallVector.h:1198
T * iterator
Definition SmallVector.h:253
const T * const_iterator
Definition SmallVector.h:254
Definition concepts.hpp:40
Definition concepts.hpp:13
Definition concepts.hpp:30
Definition small_vector.hpp:7
Definition expression_graph.hpp:11
SLEIPNIR_DLLEXPORT VariableMatrix cwise_reduce(const VariableMatrix &lhs, const VariableMatrix &rhs, function_ref< Variable(const Variable &x, const Variable &y)> binary_op)
Applies a coefficient-wise reduce operation to two matrices.
Definition variable_matrix.hpp:1149
SLEIPNIR_DLLEXPORT VariableMatrix block(std::initializer_list< std::initializer_list< VariableMatrix > > list)
Assemble a VariableMatrix from a nested list of blocks.
Definition variable_matrix.hpp:1175
SLEIPNIR_DLLEXPORT VariableMatrix solve(const VariableMatrix &A, const VariableMatrix &B)
Solves the VariableMatrix equation AX = B for X.
Type tag used to designate an uninitialized VariableMatrix.
Definition variable_matrix.hpp:34
#define SLEIPNIR_DLLEXPORT
Definition symbol_exports.hpp:34