rotgen/include/rotgen/container/block/dynamic/model.hpp
Joel Falcou ffa9309332 Reorganize internals
See merge request oss/rotgen!36
2025-10-12 19:01:13 +02:00

120 lines
No EOL
3.8 KiB
C++

//==================================================================================================
/*
ROTGEN - Runtime Overlay for Eigen
Copyright : CODE RECKONS
SPDX-License-Identifier: BSL-1.0
*/
//==================================================================================================
//==================================================================================================
/*
This file is a X-File to generate various block_impl_* declarations variant
*/
//==================================================================================================
class ROTGEN_EXPORT CLASSNAME
{
private:
struct payload;
std::unique_ptr<payload> storage_;
public:
CLASSNAME(SOURCENAME CONST& r , Index i0, Index j0, Index ni, Index nj);
CLASSNAME(MAPNAME CONST& r, Index i0, Index j0, Index ni, Index nj);
CLASSNAME(payload const& r, Index i0, Index j0, Index ni, Index nj);
CLASSNAME(CLASSNAME const& other);
CLASSNAME(CLASSNAME&&) noexcept;
#if !defined(USE_CONST)
CLASSNAME& operator=(CLASSNAME const& other);
CLASSNAME& operator=(CLASSNAME&&) noexcept;
#endif
~CLASSNAME();
#if !defined(USE_CONST)
void assign(SOURCENAME const&);
#endif
Index rows() const;
Index cols() const;
Index size() const;
Index innerStride() const;
Index outerStride() const;
Index startRow() const;
Index startCol() const;
SOURCENAME normalized() const;
TRANSSOURCENAME transpose() const;
SOURCENAME conjugate() const;
TRANSSOURCENAME adjoint() const;
SOURCENAME cwiseAbs() const;
SOURCENAME cwiseAbs2() const;
SOURCENAME cwiseInverse() const;
SOURCENAME cwiseSqrt() const;
#if !defined(USE_CONST)
void normalize();
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 index);
CLASSNAME& operator+=(CLASSNAME const& rhs);
CLASSNAME& operator-=(CLASSNAME const& rhs);
CLASSNAME& operator*=(CLASSNAME const& rhs);
CLASSNAME& operator*=(TYPE d);
CLASSNAME& operator/=(TYPE d);
#endif
TYPE operator()(Index i, Index j) const;
TYPE operator()(Index index) const;
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 ROTGEN_EXPORT std::ostream& operator<<(std::ostream&,CLASSNAME const&);
friend ROTGEN_EXPORT std::ostream& operator<<(std::ostream&, format<CLASSNAME> const&);
friend ROTGEN_EXPORT bool operator==(CLASSNAME const& lhs, CLASSNAME const& rhs);
friend ROTGEN_EXPORT bool operator!=(CLASSNAME const& lhs, CLASSNAME const& rhs);
#if !defined(USE_CONST)
TYPE* data();
#endif
const TYPE* data() const;
static SOURCENAME Zero(Index r, Index c) { return SOURCENAME::Zero(r,c); }
static SOURCENAME Ones(Index r, Index c) { return SOURCENAME::Ones(r,c); }
static SOURCENAME Constant(Index r, Index c, TYPE v) { return SOURCENAME::Constant(r,c,v); }
static SOURCENAME Random(Index r, Index c) { return SOURCENAME::Random(r,c); }
static SOURCENAME Identity(Index r, Index c) { return SOURCENAME::Identity(r,c); }
public:
#if !defined(USE_CONST)
std::unique_ptr<payload>& storage() { return storage_; }
#endif
std::unique_ptr<payload> const& storage() const { return storage_; }
};