26template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
27 requires IsVectorOrRow<R,C>
30 Base::template _init2<int,int>(R == 1 ? 1 : n, C == 1 ? 1 : n);
31 if constexpr(!IsIntervalDomain<Scalar>)
42template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
43 requires IsVectorOrRow<R,C>
44explicit Matrix(
const std::vector<double>& v)
45 :
Matrix<Scalar,R,C>(R == 1 ? 1 : v.size(), C == 1 ? 1 : v.size())
47 for(
size_t i = 0 ; i < v.size() ; i++)
59template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
60 requires IsVectorOrRow<R,C>
63 return const_cast<Scalar&
>(
const_cast<const Matrix<Scalar,R,C>*
>(
this)->operator()(i));
74template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
75 requires IsVectorOrRow<R,C>
78 assert_release(i >= 0 && i < this->size());
79 return this->PlainObjectBase<Matrix<Scalar,R,C>>::operator()(i);
90template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
91 requires IsVectorOrRow<R,C>
94 return const_cast<Scalar&
>(
const_cast<const Matrix<Scalar,R,C>*
>(
this)->operator[](i));
105template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
106 requires IsVectorOrRow<R,C>
109 assert_release(i >= 0 && i < this->size());
110 return this->PlainObjectBase<Matrix<Scalar,R,C>>::operator[](i);
121template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
122 requires IsVectorOrRow<R,C>
125 assert_release(n >= 0);
126 return DenseBase<Matrix<Scalar,R,C>>::Zero(n);
137template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
138 requires IsVectorOrRow<R,C>
141 assert_release(n >= 0);
142 return DenseBase<Matrix<Scalar,R,C>>::Ones(n);
154template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
155 requires IsVectorOrRow<R,C>
158 assert_release(n >= 0);
159 return DenseBase<Matrix<Scalar,R,C>>::Constant(n,x);
172template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
173 requires IsVectorOrRow<R,C>
176 assert_release(n >= 0);
177 return DenseBase<Matrix<Scalar,R,C>>::Random(n);
188template<
typename OtherDerived,
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
189 requires IsVectorOrRow<R,C> && IsVectorOrRow<MatrixBase<OtherDerived>::RowsAtCompileTime,MatrixBase<OtherDerived>::ColsAtCompileTime>
190inline void put(Index start_id,
const MatrixBase<OtherDerived>& x)
192 assert_release(start_id >= 0 && start_id < this->size());
193 assert_release(start_id+x.size() <= this->size());
195 this->segment(start_id,x.size()) << x;
209template<
int R=RowsAtCompileTime,
int C=ColsAtCompileTime>
210 requires IsVectorOrRow<R,C>
216 for(Index i = 0 ; i < std::min((Index)copy.size(),n) ; i++)
217 (*
this)[i] = copy[i];
Matrix(const Matrix< double, R, C > &lb, const Matrix< double, R, C > &ub)
Constructs an interval matrix from lower and upper bound matrices.
Definition codac2_Matrix_addons_IntervalMatrixBase.h:50
auto & init()
Initializes all elements of the matrix with default intervals.
Definition codac2_Matrix_addons_IntervalMatrixBase.h:113
Matrix()=delete
Deleted default constructor to prevent default instantiation when either the number of rows or column...
Scalar & operator()(Index i)
Access element at index i (mutable).
Definition codac2_Matrix_addons_VectorBase.h:61
Scalar & operator[](Index i)
Access element at index i (mutable) via operator[].
Definition codac2_Matrix_addons_VectorBase.h:92
void put(Index start_id, const MatrixBase< OtherDerived > &x)
Inserts values from matrix x starting at index start_id.
Definition codac2_Matrix_addons_VectorBase.h:190
void resize_save_values(Index n)
Resizes the vector or row matrix to size n, preserving existing values.
Definition codac2_Matrix_addons_VectorBase.h:211