First batch of rotgen implementation: constructors, basic infrastructure
This commit is contained in:
parent
2554a83890
commit
afd504d679
9 changed files with 428 additions and 10 deletions
|
|
@ -17,6 +17,7 @@ namespace rotgen
|
|||
{
|
||||
Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> data;
|
||||
payload(std::size_t r=0, std::size_t c=0) : data(r, c) {}
|
||||
payload(std::initializer_list<std::initializer_list<double>> init) : data(init) {}
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -25,19 +26,34 @@ namespace rotgen
|
|||
//==================================================================================================
|
||||
matrix_impl64::matrix_impl64(std::size_t r, std::size_t c) : storage_(std::make_unique<payload>(r,c)) {}
|
||||
|
||||
matrix_impl64::matrix_impl64(std::initializer_list<std::initializer_list<double>> init)
|
||||
: storage_(std::make_unique<payload>(init))
|
||||
{}
|
||||
|
||||
matrix_impl64::matrix_impl64(std::size_t r, std::size_t c,std::initializer_list<double> init)
|
||||
: matrix_impl64(r,c)
|
||||
{
|
||||
auto first = init.begin();
|
||||
for(std::size_t i=0; i < init.size(); i++)
|
||||
(*this)(i) = first[i];
|
||||
}
|
||||
|
||||
matrix_impl64::matrix_impl64(matrix_impl64 const& o)
|
||||
: matrix_impl64(o.storage_->data.rows(),o.storage_->data.cols())
|
||||
: matrix_impl64(o.rows(),o.cols())
|
||||
{
|
||||
storage_->data = o.storage_->data;
|
||||
}
|
||||
|
||||
matrix_impl64::matrix_impl64(matrix_impl64&&) noexcept = default;
|
||||
|
||||
|
||||
matrix_impl64& matrix_impl64::operator=(matrix_impl64 const& o)
|
||||
{
|
||||
if (this != &o) storage_->data = o.storage_->data;
|
||||
return *this;
|
||||
}
|
||||
|
||||
matrix_impl64::matrix_impl64(matrix_impl64&&) noexcept = default;
|
||||
|
||||
matrix_impl64& matrix_impl64::operator=(matrix_impl64&&) noexcept = default;
|
||||
|
||||
matrix_impl64::~matrix_impl64() = default;
|
||||
|
|
@ -48,9 +64,18 @@ namespace rotgen
|
|||
std::size_t matrix_impl64::rows() const { return static_cast<std::size_t>(storage_->data.rows()); }
|
||||
std::size_t matrix_impl64::cols() const { return static_cast<std::size_t>(storage_->data.cols()); }
|
||||
|
||||
std::size_t matrix_impl64::size() const { return static_cast<std::size_t>(storage_->data.size()); }
|
||||
void matrix_impl64::resize(std::size_t new_rows, std::size_t new_cols) { storage_->data.resize(new_rows, new_cols); }
|
||||
void matrix_impl64::conservativeResize(std::size_t new_rows, std::size_t new_cols) { storage_->data.conservativeResize(new_rows, new_cols); }
|
||||
|
||||
double& matrix_impl64::operator()(std::size_t i, std::size_t j) { return storage_->data(i,j); }
|
||||
double const& matrix_impl64::operator()(std::size_t i, std::size_t j) const { return storage_->data(i,j); }
|
||||
|
||||
double& matrix_impl64::operator()(std::size_t index) { return storage_->data(index); }
|
||||
double const& matrix_impl64::operator()(std::size_t index) const { return storage_->data(index); }
|
||||
|
||||
const double* matrix_impl64::data() const { return storage_->data.data(); }
|
||||
|
||||
//==================================================================================================
|
||||
// Operators
|
||||
//==================================================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue