[ADVANCED INITIALISATION] implemented and tested the static methods
Co-authored-by: kallore <kkaspar@codereckons.com> See merge request oss/rotgen!4
This commit is contained in:
parent
03591ac323
commit
ab8336bd5b
4 changed files with 191 additions and 3 deletions
|
|
@ -15,12 +15,14 @@ namespace rotgen
|
|||
//================================================================================================
|
||||
struct matrix_impl64::payload
|
||||
{
|
||||
Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic> data;
|
||||
using data_type = Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic>;
|
||||
|
||||
data_type 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) {}
|
||||
payload(data_type&& matrix) : data(std::move(matrix)) {}
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// Constructors & Special Members
|
||||
//==================================================================================================
|
||||
|
|
@ -169,4 +171,37 @@ namespace rotgen
|
|||
storage_->data /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//==================================================================================================
|
||||
// Static functions
|
||||
//==================================================================================================
|
||||
|
||||
matrix_impl64 matrix_impl64::Zero(std::size_t rows, std::size_t cols) {
|
||||
matrix_impl64 m;
|
||||
m.storage_ = std::make_unique<payload>(payload::data_type::Zero(rows, cols));
|
||||
return m;
|
||||
}
|
||||
|
||||
matrix_impl64 matrix_impl64::Constant(std::size_t rows, std::size_t cols, double value)
|
||||
{
|
||||
matrix_impl64 m;
|
||||
m.storage_ = std::make_unique<payload>(payload::data_type::Constant(rows, cols, value));
|
||||
return m;
|
||||
}
|
||||
|
||||
matrix_impl64 matrix_impl64::Random(std::size_t rows, std::size_t cols)
|
||||
{
|
||||
matrix_impl64 m;
|
||||
m.storage_ = std::make_unique<payload>(payload::data_type::Random(rows, cols));
|
||||
return m;
|
||||
}
|
||||
|
||||
matrix_impl64 matrix_impl64::Identity(std::size_t rows, std::size_t cols)
|
||||
{
|
||||
matrix_impl64 m;
|
||||
m.storage_ = std::make_unique<payload>(payload::data_type::Identity(rows, cols));
|
||||
return m;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue