Implements map and ref for both static & dynamic mode
See merge request oss/rotgen!12
This commit is contained in:
parent
aacae1cbb1
commit
6c2b260229
58 changed files with 4121 additions and 1205 deletions
106
include/rotgen/impl/map_model.hpp
Normal file
106
include/rotgen/impl/map_model.hpp
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
|
||||
//==================================================================================================
|
||||
/*
|
||||
This file is a X-File to generate various map_impl_* declarations variant
|
||||
*/
|
||||
//==================================================================================================
|
||||
class CLASSNAME
|
||||
{
|
||||
public:
|
||||
CLASSNAME(TYPE CONST* ptr, Index r, Index c);
|
||||
CLASSNAME(TYPE CONST* ptr, Index r, Index c, stride s);
|
||||
|
||||
CLASSNAME(CLASSNAME const& other);
|
||||
|
||||
#if !defined(USE_CONST)
|
||||
CLASSNAME& operator=(CLASSNAME const& other);
|
||||
#endif
|
||||
|
||||
CLASSNAME(CLASSNAME&&) noexcept;
|
||||
|
||||
CLASSNAME& operator=(CLASSNAME&&) noexcept;
|
||||
|
||||
~CLASSNAME();
|
||||
|
||||
Index rows() const;
|
||||
Index cols() const;
|
||||
Index size() const;
|
||||
|
||||
Index innerStride() const;
|
||||
Index outerStride() const;
|
||||
|
||||
SOURCENAME transpose() const;
|
||||
SOURCENAME conjugate() const;
|
||||
SOURCENAME adjoint() const;
|
||||
|
||||
#if !defined(USE_CONST)
|
||||
void transposeInPlace();
|
||||
void adjointInPlace();
|
||||
#endif
|
||||
|
||||
TYPE sum() const;
|
||||
TYPE prod() const;
|
||||
TYPE mean() const;
|
||||
TYPE trace() const;
|
||||
TYPE maxCoeff() const;
|
||||
TYPE minCoeff() const;
|
||||
TYPE maxCoeff(Index* row, Index* col) const;
|
||||
TYPE minCoeff(Index* row, Index* col) const;
|
||||
|
||||
TYPE squaredNorm() const;
|
||||
TYPE norm() const;
|
||||
TYPE lpNorm(int p) const;
|
||||
|
||||
#if !defined(USE_CONST)
|
||||
TYPE& operator()(Index i, Index j);
|
||||
TYPE& operator()(Index i);
|
||||
#endif
|
||||
|
||||
TYPE operator()(Index i, Index j) const;
|
||||
TYPE operator()(Index i) const;
|
||||
|
||||
|
||||
#if !defined(USE_CONST)
|
||||
CLASSNAME& operator+=(CLASSNAME const& rhs);
|
||||
CLASSNAME& operator-=(CLASSNAME const& rhs);
|
||||
CLASSNAME& operator*=(CLASSNAME const& rhs);
|
||||
CLASSNAME& operator*=(TYPE d);
|
||||
CLASSNAME& operator/=(TYPE d);
|
||||
#endif
|
||||
|
||||
SOURCENAME operator-() const;
|
||||
SOURCENAME add(CLASSNAME const& rhs) const;
|
||||
SOURCENAME sub(CLASSNAME const& rhs) const;
|
||||
SOURCENAME mul(CLASSNAME const& rhs) const;
|
||||
SOURCENAME mul(TYPE s) const;
|
||||
SOURCENAME div(TYPE s) const;
|
||||
|
||||
friend std::ostream& operator<<(std::ostream&,CLASSNAME const&);
|
||||
const TYPE* data() const;
|
||||
|
||||
#if !defined(USE_CONST)
|
||||
void setZero();
|
||||
void setOnes();
|
||||
void setRandom();
|
||||
void setIdentity();
|
||||
void setConstant(TYPE);
|
||||
#endif
|
||||
|
||||
friend bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
|
||||
friend bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
|
||||
|
||||
private:
|
||||
struct payload;
|
||||
std::unique_ptr<payload> storage_;
|
||||
|
||||
public:
|
||||
std::unique_ptr<payload>& storage() { return storage_; }
|
||||
std::unique_ptr<payload> const& storage() const { return storage_; }
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue