Go to the documentation of this file.
17 template<
typename Scalar =
double>
39 if(
size > buffer_.size() || (
size < buffer_.size() && fit))
48 return static_cast<int>(buffer_.size());
52 void resize(
int rows,
int cols,
bool fit =
false)
62 void changeLd(
int rows,
int cols,
int oldLd,
int newLd)
66 assert(cols * newLd < buffer_.size());
67 for(
int i = cols - 1; i > 0; --i)
69 void * src =
reinterpret_cast<void *
>(&buffer_[i * oldLd]);
70 void * dst =
reinterpret_cast<void *
>(&buffer_[i * newLd]);
71 memmove(dst, src, rows *
sizeof(
double));
74 else if(oldLd > newLd)
76 for(
int i = 1; i < cols; ++i)
78 void * src =
reinterpret_cast<void *
>(&buffer_[i * oldLd]);
79 void * dst =
reinterpret_cast<void *
>(&buffer_[i * newLd]);
80 memmove(dst, src, rows *
sizeof(
double));
90 assert(
size <= buffer_.size());
91 return buffer_.head(
size);
99 assert(
size <= buffer_.size());
100 return buffer_.head(
size);
116 assert(ld * cols <= buffer_.size());
118 return Eigen::Map<Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>, 0, Eigen::Stride<Eigen::Dynamic, 1>>(
119 buffer_.data(), rows, cols, Eigen::Stride<Eigen::Dynamic, 1>(ld, 1));
128 assert(ld * cols <= buffer_.size());
130 return Eigen::Map<const Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic>, 0, Eigen::Stride<Eigen::Dynamic, 1>>(
131 buffer_.data(), rows, cols, Eigen::Stride<Eigen::Dynamic, 1>(ld, 1));
141 Eigen::Matrix<Scalar, Eigen::Dynamic, 1> buffer_;
Definition: Workspace.h:18
auto asVector(int size, NotConst={})
Definition: Workspace.h:88
auto asMatrix(int rows, int cols, int ld) const
Definition: Workspace.h:126
void changeLd(int rows, int cols, int oldLd, int newLd)
Definition: Workspace.h:62
Workspace()
Definition: Workspace.h:22
auto asVector(int size) const
Definition: Workspace.h:97
Workspace(int rows, int cols)
Definition: Workspace.h:29
Definition: ActiveSet.h:11
Definition: Workspace.h:12
Definition: blockArrowLLT.h:12
decltype(std::add_const_t< internal::Workspace< double > >().asVector(0)) WConstVector
Definition: Workspace.h:150
decltype(internal::Workspace< double >().asVector(0)) WVector
Definition: Workspace.h:148
void resize(int rows, int cols, bool fit=false)
Definition: Workspace.h:52
auto asMatrix(int rows, int cols, int ld, NotConst={})
Definition: Workspace.h:114
void resize(int size, bool fit=false)
Definition: Workspace.h:37
Workspace(int size)
Definition: Workspace.h:27
int size() const
Definition: Workspace.h:46
void setZero()
Definition: Workspace.h:135