parent
6521f68c95
commit
ffa9309332
55 changed files with 585 additions and 495 deletions
|
|
@ -40,12 +40,11 @@ handle_option(ROTGEN_COMPILE_DEFS)
|
|||
##======================================================================================================================
|
||||
if(ROTGEN_FORCE_DYNAMIC)
|
||||
set ( SOURCES
|
||||
src/map.cpp
|
||||
src/matrix.cpp
|
||||
src/block.cpp
|
||||
src/map/impl.cpp
|
||||
src/matrix/impl.cpp
|
||||
src/block/impl.cpp
|
||||
src/svd/impl.cpp
|
||||
src/info.cpp
|
||||
src/svd.cpp
|
||||
src/operators.cpp
|
||||
src/format.cpp
|
||||
)
|
||||
else()
|
||||
|
|
|
|||
16
include/rotgen/algebra.hpp
Normal file
16
include/rotgen/algebra.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/algebra/qr.hpp>
|
||||
|
||||
#if defined(ROTGEN_FORCE_DYNAMIC)
|
||||
#include <rotgen/algebra/svd/dynamic.hpp>
|
||||
#else
|
||||
#include <rotgen/algebra/svd/fixed.hpp>
|
||||
#endif
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/impl/svd.hpp>
|
||||
#include <rotgen/algebra/svd/dynamic/impl.hpp>
|
||||
|
||||
namespace rotgen
|
||||
{
|
||||
|
|
@ -24,13 +24,13 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include <rotgen/impl/svd_model.hpp>
|
||||
#include <rotgen/algebra/svd/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include <rotgen/impl/svd_model.hpp>
|
||||
#include <rotgen/algebra/svd/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
|
||||
|
|
@ -42,13 +42,13 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include <rotgen/impl/svd_model.hpp>
|
||||
#include <rotgen/algebra/svd/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include <rotgen/impl/svd_model.hpp>
|
||||
#include <rotgen/algebra/svd/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
|
||||
|
|
@ -26,19 +26,19 @@ namespace rotgen
|
|||
|
||||
auto singular_values() const
|
||||
{
|
||||
if constexpr(!use_expression_templates) return as_concrete_t<d_type, matrix>{svd_.singularValues()};
|
||||
if constexpr(!use_expression_templates) return detail::as_concrete_t<d_type, matrix>{svd_.singularValues()};
|
||||
else return svd_.singularValues();
|
||||
}
|
||||
|
||||
auto U() const
|
||||
{
|
||||
if constexpr(!use_expression_templates) return as_concrete_t<u_type, matrix>{svd_.matrixU()};
|
||||
if constexpr(!use_expression_templates) return detail::as_concrete_t<u_type, matrix>{svd_.matrixU()};
|
||||
else return svd_.matrixU();
|
||||
}
|
||||
|
||||
auto V() const
|
||||
{
|
||||
if constexpr(!use_expression_templates) return as_concrete_t<v_type, matrix>{svd_.matrixV()};
|
||||
if constexpr(!use_expression_templates) return detail::as_concrete_t<v_type, matrix>{svd_.matrixV()};
|
||||
else return svd_.matrixV();
|
||||
}
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ namespace rotgen
|
|||
{
|
||||
auto d = svd_.singularValues().asDiagonal();
|
||||
if constexpr(!use_expression_templates)
|
||||
return as_concrete_t<decltype(d.toDenseMatrix()), matrix>{d.toDenseMatrix ()};
|
||||
return detail::as_concrete_t<decltype(d.toDenseMatrix()), matrix>{d.toDenseMatrix ()};
|
||||
else
|
||||
return d;
|
||||
}
|
||||
|
|
@ -55,21 +55,21 @@ namespace rotgen
|
|||
auto singular_values(int r) const
|
||||
{
|
||||
auto that = svd_.singularValues().head(r);
|
||||
if constexpr(!use_expression_templates) return as_concrete_t<decltype(that), matrix>{that};
|
||||
if constexpr(!use_expression_templates) return detail::as_concrete_t<decltype(that), matrix>{that};
|
||||
else return svd_.singularValues();
|
||||
}
|
||||
|
||||
auto U(int r) const
|
||||
{
|
||||
auto that = svd_.matrixU().leftCols(r);
|
||||
if constexpr(!use_expression_templates) return as_concrete_t<decltype(that), matrix>{that};
|
||||
if constexpr(!use_expression_templates) return detail::as_concrete_t<decltype(that), matrix>{that};
|
||||
else return that;
|
||||
}
|
||||
|
||||
auto V(int r) const
|
||||
{
|
||||
auto that = svd_.matrixV().leftCols(r);
|
||||
if constexpr(!use_expression_templates) return as_concrete_t<decltype(that), matrix>{that};
|
||||
if constexpr(!use_expression_templates) return detail::as_concrete_t<decltype(that), matrix>{that};
|
||||
else return that;
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ namespace rotgen
|
|||
{
|
||||
auto d = svd_.singularValues().head(r).asDiagonal();
|
||||
if constexpr(!use_expression_templates)
|
||||
return as_concrete_t<decltype(d.toDenseMatrix()), matrix>{d.toDenseMatrix ()};
|
||||
return detail::as_concrete_t<decltype(d.toDenseMatrix()), matrix>{d.toDenseMatrix ()};
|
||||
else
|
||||
return d;
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
namespace rotgen
|
||||
{
|
||||
template< typename EigenType
|
||||
, template<typename,int,int,int,int,int> typename Wrapper
|
||||
>
|
||||
struct as_concrete
|
||||
{
|
||||
using type = Wrapper< typename EigenType::value_type
|
||||
, EigenType::RowsAtCompileTime, EigenType::ColsAtCompileTime
|
||||
, EigenType::Flags & 1
|
||||
, EigenType::MaxRowsAtCompileTime, EigenType::MaxColsAtCompileTime
|
||||
>;
|
||||
};
|
||||
|
||||
template<typename EigenType
|
||||
, template<typename,int,int,int,int,int> typename Wrapper
|
||||
>
|
||||
using as_concrete_t = typename as_concrete<std::remove_cvref_t<EigenType>,Wrapper>::type;
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <iostream>
|
||||
#include <rotgen/common/export.hpp>
|
||||
#include <rotgen/detail/export.hpp>
|
||||
#include <rotgen/detail/spy.hpp>
|
||||
|
||||
namespace rotgen
|
||||
|
|
|
|||
13
include/rotgen/container.hpp
Normal file
13
include/rotgen/container.hpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/container/matrix.hpp>
|
||||
#include <rotgen/container/block.hpp>
|
||||
#include <rotgen/container/map.hpp>
|
||||
#include <rotgen/container/ref.hpp>
|
||||
16
include/rotgen/container/block.hpp
Normal file
16
include/rotgen/container/block.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/config.hpp>
|
||||
|
||||
#if defined(ROTGEN_FORCE_DYNAMIC)
|
||||
#include <rotgen/container/block/dynamic.hpp>
|
||||
#else
|
||||
#include <rotgen/container/block/fixed.hpp>
|
||||
#endif
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <rotgen/concepts.hpp>
|
||||
#include <rotgen/impl/block.hpp>
|
||||
#include <rotgen/dynamic/matrix.hpp>
|
||||
#include <rotgen/container/block/dynamic/impl.hpp>
|
||||
#include <rotgen/container/matrix/dynamic.hpp>
|
||||
#include <initializer_list>
|
||||
#include <cassert>
|
||||
|
||||
|
|
@ -39,6 +39,8 @@ namespace rotgen
|
|||
|
||||
static constexpr int RowsAtCompileTime = Rows;
|
||||
static constexpr int ColsAtCompileTime = Cols;
|
||||
static constexpr int MaxRowsAtCompileTime = Rows;
|
||||
static constexpr int MaxColsAtCompileTime = Cols;
|
||||
static constexpr bool IsVectorAtCompileTime = Ref::IsVectorAtCompileTime;
|
||||
static constexpr int Options = Ref::Options;
|
||||
static constexpr bool IsRowMajor = (storage_order & RowMajor) == RowMajor;
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <rotgen/detail/generators.hpp>
|
||||
#include <rotgen/impl/matrix.hpp>
|
||||
#include <rotgen/impl/map.hpp>
|
||||
#include <rotgen/container/matrix/dynamic.hpp>
|
||||
#include <rotgen/container/map/dynamic.hpp>
|
||||
#include <initializer_list>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
|
@ -26,7 +26,7 @@ namespace rotgen
|
|||
#define CONST const
|
||||
#define BASENAME block_const_impl
|
||||
#define BASEMAP map_const_impl
|
||||
#include <rotgen/impl/block_indirect.hpp>
|
||||
#include <rotgen/container/block/dynamic/indirect.hpp>
|
||||
#undef BASENAME
|
||||
#undef BASEMAP
|
||||
#undef CONST
|
||||
|
|
@ -35,7 +35,7 @@ namespace rotgen
|
|||
#define CONST
|
||||
#define BASENAME block_impl
|
||||
#define BASEMAP map_impl
|
||||
#include <rotgen/impl/block_indirect.hpp>
|
||||
#include <rotgen/container/block/dynamic/indirect.hpp>
|
||||
#undef BASENAME
|
||||
#undef BASEMAP
|
||||
#undef CONST
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_col)
|
||||
#include <rotgen/impl/block_model.hpp>
|
||||
#include <rotgen/container/block/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_row)
|
||||
#include <rotgen/impl/block_model.hpp>
|
||||
#include <rotgen/container/block/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_col)
|
||||
#include <rotgen/impl/block_model.hpp>
|
||||
#include <rotgen/container/block/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_row)
|
||||
#include <rotgen/impl/block_model.hpp>
|
||||
#include <rotgen/container/block/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/container/strides.hpp>
|
||||
#include <Eigen/Dense>
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -64,11 +65,13 @@ namespace rotgen
|
|||
using concrete_dynamic_type = matrix<value_type,Dynamic,Dynamic,storage_order>;
|
||||
|
||||
template<typename ET>
|
||||
using as_concrete_type = as_concrete_t<ET, matrix>;
|
||||
using as_concrete_type = detail::as_concrete_t<ET, matrix>;
|
||||
|
||||
static constexpr int Options = Ref::Options;
|
||||
static constexpr int RowsAtCompileTime = Rows;
|
||||
static constexpr int ColsAtCompileTime = Cols;
|
||||
static constexpr int MaxRowsAtCompileTime = Ref::MaxRowsAtCompileTime;
|
||||
static constexpr int MaxColsAtCompileTime = Ref::MaxColsAtCompileTime;
|
||||
static constexpr bool IsVectorAtCompileTime = Ref::IsVectorAtCompileTime;
|
||||
static constexpr bool is_defined_static = Rows!=-1 && Cols!=-1;
|
||||
static constexpr bool has_static_storage = storage_status<Rows,Cols,Rows,Cols>;
|
||||
16
include/rotgen/container/map.hpp
Normal file
16
include/rotgen/container/map.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/config.hpp>
|
||||
|
||||
#if defined(ROTGEN_FORCE_DYNAMIC)
|
||||
#include <rotgen/container/map/dynamic.hpp>
|
||||
#else
|
||||
#include <rotgen/container/map/fixed.hpp>
|
||||
#endif
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <rotgen/concepts.hpp>
|
||||
#include <rotgen/impl/map.hpp>
|
||||
#include <rotgen/container/map/dynamic/impl.hpp>
|
||||
#include <rotgen/detail/helpers.hpp>
|
||||
#include <cassert>
|
||||
|
||||
|
|
@ -40,6 +40,8 @@ namespace rotgen
|
|||
|
||||
static constexpr int RowsAtCompileTime = Ref::RowsAtCompileTime;
|
||||
static constexpr int ColsAtCompileTime = Ref::ColsAtCompileTime;
|
||||
static constexpr int MaxRowsAtCompileTime = Ref::MaxRowsAtCompileTime;
|
||||
static constexpr int MaxColsAtCompileTime = Ref::MaxColsAtCompileTime;
|
||||
static constexpr bool IsVectorAtCompileTime = Ref::IsVectorAtCompileTime;
|
||||
static constexpr bool IsCompileTimeSized = RowsAtCompileTime != -1 && ColsAtCompileTime != -1;
|
||||
|
||||
|
|
@ -336,20 +338,20 @@ namespace rotgen
|
|||
};
|
||||
|
||||
template<typename R1, typename R2, int O1, typename S1, int O2, typename S2>
|
||||
detail::composite_matrix_type<R1,R2> operator+(map<R1,O1,S1> const& lhs, map<R2,O2,S2> const& rhs)
|
||||
detail::composite_type<R1,R2,matrix> operator+(map<R1,O1,S1> const& lhs, map<R2,O2,S2> const& rhs)
|
||||
{
|
||||
using map1_type = map<R1 const,O1,S1>;
|
||||
using map2_type = map<R2 const,O2,S2>;
|
||||
using concrete_type = detail::composite_matrix_type<R1,R2>;
|
||||
using concrete_type = detail::composite_type<R1,R2,matrix>;
|
||||
return concrete_type(map1_type(lhs).base().add(map2_type(rhs)));
|
||||
}
|
||||
|
||||
template<typename R1, typename R2, int O1, typename S1, int O2, typename S2>
|
||||
detail::composite_matrix_type<R1,R2> operator-(map<R1,O1,S1> const& lhs, map<R2,O2,S2> const& rhs)
|
||||
detail::composite_type<R1,R2,matrix> operator-(map<R1,O1,S1> const& lhs, map<R2,O2,S2> const& rhs)
|
||||
{
|
||||
using map1_type = map<R1 const,O1,S1>;
|
||||
using map2_type = map<R2 const,O2,S2>;
|
||||
using concrete_type = detail::composite_matrix_type<R1,R2>;
|
||||
using concrete_type = detail::composite_type<R1,R2,matrix>;
|
||||
return concrete_type(map1_type(lhs).base().sub(map2_type(rhs)));
|
||||
}
|
||||
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <rotgen/detail/generators.hpp>
|
||||
#include <rotgen/impl/matrix.hpp>
|
||||
#include <rotgen/common/strides.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/impl.hpp>
|
||||
#include <rotgen/container/strides.hpp>
|
||||
#include <initializer_list>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
|
|
@ -28,14 +28,14 @@ namespace rotgen
|
|||
#define USE_CONST
|
||||
#define CONST const
|
||||
#define BASENAME map_const_impl
|
||||
#include <rotgen/impl/map_indirect.hpp>
|
||||
#include <rotgen/container/map/dynamic/indirect.hpp>
|
||||
#undef BASENAME
|
||||
#undef CONST
|
||||
#undef USE_CONST
|
||||
|
||||
#define CONST
|
||||
#define BASENAME map_impl
|
||||
#include <rotgen/impl/map_indirect.hpp>
|
||||
#include <rotgen/container/map/dynamic/indirect.hpp>
|
||||
#undef BASENAME
|
||||
#undef CONST
|
||||
|
||||
|
|
@ -57,4 +57,4 @@ namespace rotgen
|
|||
>::type;
|
||||
}
|
||||
|
||||
#include <rotgen/impl/map_operators.hpp>
|
||||
#include <rotgen/container/map/dynamic/operators.hpp>
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_col)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include <rotgen/impl/map_model.hpp>
|
||||
#include <rotgen/container/map/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_row)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include <rotgen/impl/map_model.hpp>
|
||||
#include <rotgen/container/map/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_col)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include <rotgen/impl/map_model.hpp>
|
||||
#include <rotgen/container/map/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_row)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include <rotgen/impl/map_model.hpp>
|
||||
#include <rotgen/container/map/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -39,16 +39,18 @@ namespace rotgen
|
|||
using value_type = typename std::remove_const_t<Ref>::value_type;
|
||||
using concrete_type = typename std::remove_const_t<Ref>::concrete_type;
|
||||
|
||||
static constexpr Index RowsAtCompileTime = Ref::RowsAtCompileTime;
|
||||
static constexpr Index ColsAtCompileTime = Ref::ColsAtCompileTime;
|
||||
static constexpr bool IsVectorAtCompileTime = Ref::IsVectorAtCompileTime;
|
||||
static constexpr bool has_static_storage = Ref::has_static_storage;
|
||||
static constexpr int storage_order = Ref::storage_order;
|
||||
static constexpr bool is_immutable = std::is_const_v<Ref>;
|
||||
static constexpr bool is_defined_static = Ref::is_defined_static;
|
||||
static constexpr int RowsAtCompileTime = Ref::RowsAtCompileTime;
|
||||
static constexpr int ColsAtCompileTime = Ref::ColsAtCompileTime;
|
||||
static constexpr int MaxRowsAtCompileTime = Ref::MaxRowsAtCompileTime;
|
||||
static constexpr int MaxColsAtCompileTime = Ref::MaxColsAtCompileTime;
|
||||
static constexpr bool IsVectorAtCompileTime = Ref::IsVectorAtCompileTime;
|
||||
static constexpr bool has_static_storage = Ref::has_static_storage;
|
||||
static constexpr int storage_order = Ref::storage_order;
|
||||
static constexpr bool is_immutable = std::is_const_v<Ref>;
|
||||
static constexpr bool is_defined_static = Ref::is_defined_static;
|
||||
|
||||
template<typename ET>
|
||||
using as_concrete_type = as_concrete_t<ET, matrix>;
|
||||
using as_concrete_type = detail::as_concrete_t<ET, matrix>;
|
||||
|
||||
using ptr_type = std::conditional_t<is_immutable, value_type const*, value_type*>;
|
||||
using stride_type = Stride;
|
||||
16
include/rotgen/container/matrix.hpp
Normal file
16
include/rotgen/container/matrix.hpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/config.hpp>
|
||||
|
||||
#if defined(ROTGEN_FORCE_DYNAMIC)
|
||||
#include <rotgen/container/matrix/dynamic.hpp>
|
||||
#else
|
||||
#include <rotgen/container/matrix/fixed.hpp>
|
||||
#endif
|
||||
|
|
@ -7,7 +7,8 @@
|
|||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/impl/matrix.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/impl.hpp>
|
||||
#include <rotgen/concepts.hpp>
|
||||
#include <initializer_list>
|
||||
#include <cassert>
|
||||
|
||||
|
|
@ -26,16 +27,18 @@ namespace rotgen
|
|||
using concrete_type = matrix;
|
||||
using value_type = Scalar;
|
||||
|
||||
static constexpr auto storage_order = Opts & 1;
|
||||
static constexpr Index RowsAtCompileTime = Rows;
|
||||
static constexpr Index ColsAtCompileTime = Cols;
|
||||
static constexpr bool IsCompileTimeSized = Rows != -1 && Cols != -1;
|
||||
static constexpr bool IsVectorAtCompileTime = (RowsAtCompileTime == 1) || (ColsAtCompileTime == 1);
|
||||
static constexpr int Options = Opts;
|
||||
static constexpr bool IsRowMajor = (Opts & RowMajor) == RowMajor;
|
||||
static constexpr bool is_defined_static = false;
|
||||
static constexpr bool has_static_storage = false;
|
||||
static constexpr bool is_immutable = false;
|
||||
static constexpr auto storage_order = Opts & 1;
|
||||
static constexpr int RowsAtCompileTime = Rows;
|
||||
static constexpr int ColsAtCompileTime = Cols;
|
||||
static constexpr int MaxRowsAtCompileTime = MaxRows;
|
||||
static constexpr int MaxColsAtCompileTime = MaxCols;
|
||||
static constexpr bool IsCompileTimeSized = Rows != -1 && Cols != -1;
|
||||
static constexpr bool IsVectorAtCompileTime = (RowsAtCompileTime == 1) || (ColsAtCompileTime == 1);
|
||||
static constexpr int Options = Opts;
|
||||
static constexpr bool IsRowMajor = (Opts & RowMajor) == RowMajor;
|
||||
static constexpr bool is_defined_static = false;
|
||||
static constexpr bool has_static_storage = false;
|
||||
static constexpr bool is_immutable = false;
|
||||
|
||||
using transposed_type = matrix<value_type,Cols,Rows, storage_order ^ RowMajor>;
|
||||
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <rotgen/detail/generators.hpp>
|
||||
#include <rotgen/dynamic/format.hpp>
|
||||
#include <rotgen/format/dynamic.hpp>
|
||||
#include <rotgen/config.hpp>
|
||||
#include <initializer_list>
|
||||
#include <cstddef>
|
||||
|
|
@ -26,13 +26,13 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include <rotgen/impl/matrix_model.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include <rotgen/impl/matrix_model.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
|
||||
|
|
@ -44,13 +44,13 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include <rotgen/impl/matrix_model.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include <rotgen/impl/matrix_model.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/model.hpp>
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/detail/helpers.hpp>
|
||||
#include <Eigen/Dense>
|
||||
#include <iostream>
|
||||
|
||||
|
|
@ -38,15 +39,17 @@ namespace rotgen
|
|||
using concrete_type = matrix;
|
||||
using concrete_dynamic_type = matrix<value_type>;
|
||||
|
||||
static constexpr int RowsAtCompileTime = Rows;
|
||||
static constexpr int ColsAtCompileTime = Cols;
|
||||
static constexpr bool IsCompileTimeSized = Rows != -1 && Cols != -1;
|
||||
static constexpr bool IsVectorAtCompileTime = (RowsAtCompileTime == 1) || (ColsAtCompileTime == 1);
|
||||
static constexpr int Options = parent::Options;
|
||||
static constexpr bool IsRowMajor = parent::IsRowMajor;
|
||||
static constexpr int RowsAtCompileTime = Rows;
|
||||
static constexpr int ColsAtCompileTime = Cols;
|
||||
static constexpr int MaxRowsAtCompileTime = MaxRows;
|
||||
static constexpr int MaxColsAtCompileTime = MaxCols;
|
||||
static constexpr bool IsCompileTimeSized = Rows != -1 && Cols != -1;
|
||||
static constexpr bool IsVectorAtCompileTime = (RowsAtCompileTime == 1) || (ColsAtCompileTime == 1);
|
||||
static constexpr int Options = parent::Options;
|
||||
static constexpr bool IsRowMajor = parent::IsRowMajor;
|
||||
|
||||
template<typename ET>
|
||||
using as_concrete_type = as_concrete_t<ET, matrix>;
|
||||
using as_concrete_type = detail::as_concrete_t<ET, matrix>;
|
||||
|
||||
static constexpr bool is_immutable = false;
|
||||
static constexpr bool is_defined_static = Rows!=-1 && Cols!=-1;
|
||||
|
|
@ -9,6 +9,23 @@
|
|||
|
||||
namespace rotgen::detail
|
||||
{
|
||||
template< typename EigenType
|
||||
, template<typename,int,int,int,int,int> typename Wrapper
|
||||
>
|
||||
struct as_concrete
|
||||
{
|
||||
using type = Wrapper< typename EigenType::value_type
|
||||
, EigenType::RowsAtCompileTime, EigenType::ColsAtCompileTime
|
||||
, EigenType::Flags & 1
|
||||
, EigenType::MaxRowsAtCompileTime, EigenType::MaxColsAtCompileTime
|
||||
>;
|
||||
};
|
||||
|
||||
template<typename EigenType
|
||||
, template<typename,int,int,int,int,int> typename Wrapper
|
||||
>
|
||||
using as_concrete_t = typename as_concrete<std::remove_cvref_t<EigenType>,Wrapper>::type;
|
||||
|
||||
template<typename M, typename N>
|
||||
inline constexpr bool has_same_vector_size = []()
|
||||
{
|
||||
|
|
@ -28,10 +45,14 @@ namespace rotgen::detail
|
|||
template<auto M, auto N>
|
||||
inline constexpr auto select_static = (M==rotgen::Dynamic || N==rotgen::Dynamic) ? rotgen::Dynamic : M;
|
||||
|
||||
template<typename M1, typename M2>
|
||||
using composite_matrix_type = matrix< typename M1::value_type
|
||||
, select_static<M1::RowsAtCompileTime,M2::RowsAtCompileTime>
|
||||
, select_static<M1::ColsAtCompileTime,M2::ColsAtCompileTime>
|
||||
, M1::storage_order
|
||||
>;
|
||||
template< typename M1, typename M2
|
||||
, template<typename,int,int,int,int,int> typename Wrapper
|
||||
>
|
||||
using composite_type = Wrapper< typename M1::value_type
|
||||
, select_static<M1::RowsAtCompileTime,M2::RowsAtCompileTime>
|
||||
, select_static<M1::ColsAtCompileTime,M2::ColsAtCompileTime>
|
||||
, M1::storage_order
|
||||
, select_static<M1::MaxRowsAtCompileTime,M2::MaxRowsAtCompileTime>
|
||||
, select_static<M1::MaxColsAtCompileTime,M2::MaxColsAtCompileTime>
|
||||
>;
|
||||
}
|
||||
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <rotgen/impl/matrix.hpp>
|
||||
#include <rotgen/impl/map.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/impl.hpp>
|
||||
#include <rotgen/container/map/dynamic/impl.hpp>
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/Core>
|
||||
|
||||
14
include/rotgen/format.hpp
Normal file
14
include/rotgen/format.hpp
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#if defined(ROTGEN_FORCE_DYNAMIC)
|
||||
#include <rotgen/format/dynamic.hpp>
|
||||
#else
|
||||
#include <rotgen/format/fixed.hpp>
|
||||
#endif
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <rotgen/config.hpp>
|
||||
#include <rotgen/concepts.hpp>
|
||||
#include <Eigen/Core>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
|
@ -7,325 +7,7 @@
|
|||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/detail/helpers.hpp>
|
||||
|
||||
namespace rotgen
|
||||
{
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Infos & Shape
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
std::size_t rows(auto const& m) requires(requires{ m.rows(); }){ return m.rows(); }
|
||||
std::size_t cols(auto const& m) requires(requires{ m.cols(); }){ return m.cols(); }
|
||||
std::size_t size(auto const& m) requires(requires{ m.size(); }){ return m.size(); }
|
||||
|
||||
void resize(auto& a, int s) requires requires{a.resize(s);} { a.resize(s); }
|
||||
void resize(auto& a, int r, int c) requires requires{a.resize(r,c);} { a.resize(r,c); }
|
||||
|
||||
void conservativeResize(auto& a, int s) requires requires{a.conservativeResize(s);}
|
||||
{
|
||||
a.conservativeResize(s);
|
||||
}
|
||||
|
||||
void conservativeResize(auto& a, int r, int c) requires requires{a.conservativeResize(r,c);}
|
||||
{
|
||||
a.conservativeResize(r, c);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Global operations
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
decltype(auto) normalized (auto const& m) requires(requires{ m.normalized(); }) { return m.normalized(); }
|
||||
decltype(auto) transpose (auto const& m) requires(requires{ m.transpose(); }) { return m.transpose(); }
|
||||
decltype(auto) conjugate (auto const& m) requires(requires{ m.conjugate(); }) { return m.conjugate(); }
|
||||
decltype(auto) adjoint (auto const& m) requires(requires{ m.adjoint(); }) { return m.adjoint(); }
|
||||
|
||||
void normalize(auto& a) requires(requires{ a.normalize(); }) { a.normalize(); }
|
||||
void transposeInPlace(auto& a) requires(requires{ a.transposeInPlace(); }) { a.transposeInPlace(); }
|
||||
void adjointInPlace(auto& a) requires(requires{ a.adjointInPlace(); }) { a.adjointInPlace(); }
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Component-wise functions
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
auto abs (auto const& arg) requires(requires{arg.cwiseAbs();} ) { return arg.cwiseAbs(); }
|
||||
auto abs2(auto const& arg) requires(requires{arg.cwiseAbs2();} ) { return arg.cwiseAbs2(); }
|
||||
auto rec (auto const& arg) requires(requires{arg.cwiseInverse();}) { return arg.cwiseInverse(); }
|
||||
auto sqrt(auto const& arg) requires(requires{arg.cwiseSqrt();} ) { return arg.cwiseSqrt(); }
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto min(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return min(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).cwiseMin(base_of(b));
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto min(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return min(generalize_t<A const>(a), b);
|
||||
else return base_of(a).cwiseMin(b);
|
||||
}
|
||||
|
||||
template<concepts::entity B>
|
||||
auto min(std::convertible_to<typename B::value_type> auto a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return min(a,generalize_t<B const>(b));
|
||||
else return base_of(b).cwiseMin(a);
|
||||
}
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto max(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return max(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).cwiseMax(base_of(b));
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto max(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return max(generalize_t<A const>(a), b);
|
||||
else return base_of(a).cwiseMax(b);
|
||||
}
|
||||
|
||||
template<concepts::entity B>
|
||||
auto max(std::convertible_to<typename B::value_type> auto a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return max(a, generalize_t<B const>(b));
|
||||
else return base_of(b).cwiseMax(a);
|
||||
}
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto mul(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return mul(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).cwiseProduct(base_of(b));
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto mul(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
template<concepts::entity B>
|
||||
auto mul(std::convertible_to<typename B::value_type> auto a, B const& b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto div(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return div(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).array() / base_of(b).array();
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto div(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Reductions
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
auto trace(concepts::entity auto const& arg) { return arg.trace(); }
|
||||
auto squaredNorm(concepts::entity auto const& arg) { return arg.squaredNorm(); }
|
||||
auto norm(concepts::entity auto const& arg) { return arg.norm(); }
|
||||
auto sum(auto const& arg) requires requires{ arg.sum(); } { return arg.sum(); }
|
||||
auto prod(concepts::entity auto const& arg) { return arg.prod(); }
|
||||
auto mean(concepts::entity auto const& arg) { return arg.mean(); }
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto dot(A const& a, B const& b)
|
||||
requires(detail::has_same_vector_size<A,B> && std::same_as<typename A::value_type, typename B::value_type>)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return dot(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).dot(base_of(b));
|
||||
}
|
||||
|
||||
auto maxCoeff(auto const& arg) requires( requires{ arg.maxCoeff(); } ) { return arg.maxCoeff(); }
|
||||
auto minCoeff(auto const& arg) requires( requires{ arg.minCoeff(); } ) { return arg.minCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(concepts::entity auto const& arg, IndexType* row, IndexType* col)
|
||||
{
|
||||
return arg.maxCoeff(row, col);
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(concepts::entity auto const& arg, IndexType* row, IndexType* col)
|
||||
{
|
||||
return arg.minCoeff(row, col);
|
||||
}
|
||||
|
||||
template<int P, typename T>
|
||||
auto lpNorm(T const& arg) requires( requires{arg.template lpNorm<P>();} )
|
||||
{
|
||||
static_assert(P == 1 || P == 2 || P == Infinity);
|
||||
return arg.template lpNorm<P>();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Expression handling
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
decltype(auto) noalias(T&& t) requires( requires{std::forward<T>(t).noalias();} )
|
||||
{
|
||||
return std::forward<T>(t).noalias();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto evaluate(T&& t) requires( requires{std::forward<T>(t).evaluate();} )
|
||||
{
|
||||
return std::forward<T>(t).evaluate();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto evaluate(T&& t) requires( requires{std::forward<T>(t).eval();} )
|
||||
{
|
||||
return std::forward<T>(t).eval();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Generators
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
auto setZero(T&& t) requires( requires{std::forward<T>(t).setZero();} )
|
||||
{
|
||||
return std::forward<T>(t).setZero();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setZero() requires( requires{T::Zero();} )
|
||||
{
|
||||
return T::Zero();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setZero(std::integral auto n) requires( requires{T::Zero(n);} )
|
||||
{
|
||||
return T::Zero(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setZero(std::integral auto r,std::integral auto c) requires( requires{T::Zero(r,c);} )
|
||||
{
|
||||
return T::Zero(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes(T&& t) requires( requires{std::forward<T>(t).setOnes();} )
|
||||
{
|
||||
return std::forward<T>(t).setOnes();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes() requires( requires{T::Ones();} )
|
||||
{
|
||||
return T::Ones();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes(std::integral auto n) requires( requires{T::Ones(n);} )
|
||||
{
|
||||
return T::Ones(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes(std::integral auto r,std::integral auto c) requires( requires{T::Ones(r,c);} )
|
||||
{
|
||||
return T::Ones(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity(T&& t) requires( requires{std::forward<T>(t).setIdentity();} )
|
||||
{
|
||||
return std::forward<T>(t).setIdentity();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity() requires( requires{T::Identity();} )
|
||||
{
|
||||
return T::Identity();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity(std::integral auto n) requires( requires{T::Identity(n);} )
|
||||
{
|
||||
return T::Identity(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity(std::integral auto r,std::integral auto c) requires( requires{T::Identity(r,c);} )
|
||||
{
|
||||
return T::Identity(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom(T&& t) requires( requires{std::forward<T>(t).setRandom();} )
|
||||
{
|
||||
return std::forward<T>(t).setRandom();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom() requires( requires{T::Random();} )
|
||||
{
|
||||
return T::Random();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom(std::integral auto n) requires( requires{T::Random(n);} )
|
||||
{
|
||||
return T::Random(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom(std::integral auto r,std::integral auto c) requires( requires{T::Random(r,c);} )
|
||||
{
|
||||
return T::Random(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(T&& t, auto v) requires( requires{std::forward<T>(t).setConstant(v);} )
|
||||
{
|
||||
return std::forward<T>(t).setConstant(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(auto v) requires( requires{T::Constant(v);} )
|
||||
{
|
||||
return T::Constant(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(std::integral auto n, auto v) requires( requires{T::Constant(n,v);} )
|
||||
{
|
||||
return T::Constant(n,v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(std::integral auto r,std::integral auto c, auto v) requires( requires{T::Constant(r,c,v);} )
|
||||
{
|
||||
return T::Constant(r,c,v);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Others
|
||||
// TODO: Adapt other functions ot behave as inverse and limit code in non-ref/non-map containers
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
template<typename A> auto inverse(A const& a)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return inverse(generalize_t<A const>(a));
|
||||
else if constexpr(requires{typename A::rotgen_tag;}) return base_of(a).inverse();
|
||||
else return a.inverse();
|
||||
}
|
||||
|
||||
template<concepts::vectorND<3> L, concepts::vectorND<3> R> auto cross(L const& l, R const& r)
|
||||
{
|
||||
if constexpr(!use_expression_templates)
|
||||
return cross(generalize_t<R const>(l),generalize_t<R const>(r));
|
||||
else if constexpr(requires{typename L::rotgen_tag;} || requires{typename R::rotgen_tag;} )
|
||||
return base_of(l).cross(base_of(r));
|
||||
else return l.cross(r);
|
||||
}
|
||||
}
|
||||
#include <rotgen/functions/extract.hpp>
|
||||
#include <rotgen/functions/functions.hpp>
|
||||
#include <rotgen/functions/operators.hpp>
|
||||
#include <rotgen/functions/reshaper.hpp>
|
||||
331
include/rotgen/functions/functions.hpp
Normal file
331
include/rotgen/functions/functions.hpp
Normal file
|
|
@ -0,0 +1,331 @@
|
|||
//==================================================================================================
|
||||
/*
|
||||
ROTGEN - Runtime Overlay for Eigen
|
||||
Copyright : CODE RECKONS
|
||||
SPDX-License-Identifier: BSL-1.0
|
||||
*/
|
||||
//==================================================================================================
|
||||
#pragma once
|
||||
|
||||
#include <rotgen/detail/helpers.hpp>
|
||||
|
||||
namespace rotgen
|
||||
{
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Infos & Shape
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
std::size_t rows(auto const& m) requires(requires{ m.rows(); }){ return m.rows(); }
|
||||
std::size_t cols(auto const& m) requires(requires{ m.cols(); }){ return m.cols(); }
|
||||
std::size_t size(auto const& m) requires(requires{ m.size(); }){ return m.size(); }
|
||||
|
||||
void resize(auto& a, int s) requires requires{a.resize(s);} { a.resize(s); }
|
||||
void resize(auto& a, int r, int c) requires requires{a.resize(r,c);} { a.resize(r,c); }
|
||||
|
||||
void conservativeResize(auto& a, int s) requires requires{a.conservativeResize(s);}
|
||||
{
|
||||
a.conservativeResize(s);
|
||||
}
|
||||
|
||||
void conservativeResize(auto& a, int r, int c) requires requires{a.conservativeResize(r,c);}
|
||||
{
|
||||
a.conservativeResize(r, c);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Global operations
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
decltype(auto) normalized (auto const& m) requires(requires{ m.normalized(); }) { return m.normalized(); }
|
||||
decltype(auto) transpose (auto const& m) requires(requires{ m.transpose(); }) { return m.transpose(); }
|
||||
decltype(auto) conjugate (auto const& m) requires(requires{ m.conjugate(); }) { return m.conjugate(); }
|
||||
decltype(auto) adjoint (auto const& m) requires(requires{ m.adjoint(); }) { return m.adjoint(); }
|
||||
|
||||
void normalize(auto& a) requires(requires{ a.normalize(); }) { a.normalize(); }
|
||||
void transposeInPlace(auto& a) requires(requires{ a.transposeInPlace(); }) { a.transposeInPlace(); }
|
||||
void adjointInPlace(auto& a) requires(requires{ a.adjointInPlace(); }) { a.adjointInPlace(); }
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Component-wise functions
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
auto abs (auto const& arg) requires(requires{arg.cwiseAbs();} ) { return arg.cwiseAbs(); }
|
||||
auto abs2(auto const& arg) requires(requires{arg.cwiseAbs2();} ) { return arg.cwiseAbs2(); }
|
||||
auto rec (auto const& arg) requires(requires{arg.cwiseInverse();}) { return arg.cwiseInverse(); }
|
||||
auto sqrt(auto const& arg) requires(requires{arg.cwiseSqrt();} ) { return arg.cwiseSqrt(); }
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto min(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return min(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).cwiseMin(base_of(b));
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto min(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return min(generalize_t<A const>(a), b);
|
||||
else return base_of(a).cwiseMin(b);
|
||||
}
|
||||
|
||||
template<concepts::entity B>
|
||||
auto min(std::convertible_to<typename B::value_type> auto a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return min(a,generalize_t<B const>(b));
|
||||
else return base_of(b).cwiseMin(a);
|
||||
}
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto max(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return max(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).cwiseMax(base_of(b));
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto max(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return max(generalize_t<A const>(a), b);
|
||||
else return base_of(a).cwiseMax(b);
|
||||
}
|
||||
|
||||
template<concepts::entity B>
|
||||
auto max(std::convertible_to<typename B::value_type> auto a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return max(a, generalize_t<B const>(b));
|
||||
else return base_of(b).cwiseMax(a);
|
||||
}
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto mul(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return mul(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).cwiseProduct(base_of(b));
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto mul(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
template<concepts::entity B>
|
||||
auto mul(std::convertible_to<typename B::value_type> auto a, B const& b)
|
||||
{
|
||||
return a * b;
|
||||
}
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto div(A const& a, B const& b)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return div(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).array() / base_of(b).array();
|
||||
}
|
||||
|
||||
template<concepts::entity A>
|
||||
auto div(A const& a, std::convertible_to<typename A::value_type> auto b)
|
||||
{
|
||||
return a / b;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Reductions
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
auto trace(concepts::entity auto const& arg) { return arg.trace(); }
|
||||
auto squaredNorm(concepts::entity auto const& arg) { return arg.squaredNorm(); }
|
||||
auto norm(concepts::entity auto const& arg) { return arg.norm(); }
|
||||
auto sum(auto const& arg) requires requires{ arg.sum(); } { return arg.sum(); }
|
||||
auto prod(concepts::entity auto const& arg) { return arg.prod(); }
|
||||
auto mean(concepts::entity auto const& arg) { return arg.mean(); }
|
||||
|
||||
template<concepts::entity A, concepts::entity B>
|
||||
auto dot(A const& a, B const& b)
|
||||
requires(detail::has_same_vector_size<A,B> && std::same_as<typename A::value_type, typename B::value_type>)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return dot(generalize_t<A const>(a), generalize_t<B const>(b));
|
||||
else return base_of(a).dot(base_of(b));
|
||||
}
|
||||
|
||||
auto maxCoeff(auto const& arg) requires( requires{ arg.maxCoeff(); } ) { return arg.maxCoeff(); }
|
||||
auto minCoeff(auto const& arg) requires( requires{ arg.minCoeff(); } ) { return arg.minCoeff(); }
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto maxCoeff(concepts::entity auto const& arg, IndexType* row, IndexType* col)
|
||||
{
|
||||
return arg.maxCoeff(row, col);
|
||||
}
|
||||
|
||||
template<std::integral IndexType>
|
||||
auto minCoeff(concepts::entity auto const& arg, IndexType* row, IndexType* col)
|
||||
{
|
||||
return arg.minCoeff(row, col);
|
||||
}
|
||||
|
||||
template<int P, typename T>
|
||||
auto lpNorm(T const& arg) requires( requires{arg.template lpNorm<P>();} )
|
||||
{
|
||||
static_assert(P == 1 || P == 2 || P == Infinity);
|
||||
return arg.template lpNorm<P>();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Expression handling
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
decltype(auto) noalias(T&& t) requires( requires{std::forward<T>(t).noalias();} )
|
||||
{
|
||||
return std::forward<T>(t).noalias();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto evaluate(T&& t) requires( requires{std::forward<T>(t).evaluate();} )
|
||||
{
|
||||
return std::forward<T>(t).evaluate();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto evaluate(T&& t) requires( requires{std::forward<T>(t).eval();} )
|
||||
{
|
||||
return std::forward<T>(t).eval();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Generators
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
template<typename T>
|
||||
auto setZero(T&& t) requires( requires{std::forward<T>(t).setZero();} )
|
||||
{
|
||||
return std::forward<T>(t).setZero();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setZero() requires( requires{T::Zero();} )
|
||||
{
|
||||
return T::Zero();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setZero(std::integral auto n) requires( requires{T::Zero(n);} )
|
||||
{
|
||||
return T::Zero(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setZero(std::integral auto r,std::integral auto c) requires( requires{T::Zero(r,c);} )
|
||||
{
|
||||
return T::Zero(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes(T&& t) requires( requires{std::forward<T>(t).setOnes();} )
|
||||
{
|
||||
return std::forward<T>(t).setOnes();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes() requires( requires{T::Ones();} )
|
||||
{
|
||||
return T::Ones();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes(std::integral auto n) requires( requires{T::Ones(n);} )
|
||||
{
|
||||
return T::Ones(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setOnes(std::integral auto r,std::integral auto c) requires( requires{T::Ones(r,c);} )
|
||||
{
|
||||
return T::Ones(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity(T&& t) requires( requires{std::forward<T>(t).setIdentity();} )
|
||||
{
|
||||
return std::forward<T>(t).setIdentity();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity() requires( requires{T::Identity();} )
|
||||
{
|
||||
return T::Identity();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity(std::integral auto n) requires( requires{T::Identity(n);} )
|
||||
{
|
||||
return T::Identity(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setIdentity(std::integral auto r,std::integral auto c) requires( requires{T::Identity(r,c);} )
|
||||
{
|
||||
return T::Identity(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom(T&& t) requires( requires{std::forward<T>(t).setRandom();} )
|
||||
{
|
||||
return std::forward<T>(t).setRandom();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom() requires( requires{T::Random();} )
|
||||
{
|
||||
return T::Random();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom(std::integral auto n) requires( requires{T::Random(n);} )
|
||||
{
|
||||
return T::Random(n);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setRandom(std::integral auto r,std::integral auto c) requires( requires{T::Random(r,c);} )
|
||||
{
|
||||
return T::Random(r,c);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(T&& t, auto v) requires( requires{std::forward<T>(t).setConstant(v);} )
|
||||
{
|
||||
return std::forward<T>(t).setConstant(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(auto v) requires( requires{T::Constant(v);} )
|
||||
{
|
||||
return T::Constant(v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(std::integral auto n, auto v) requires( requires{T::Constant(n,v);} )
|
||||
{
|
||||
return T::Constant(n,v);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
auto setConstant(std::integral auto r,std::integral auto c, auto v) requires( requires{T::Constant(r,c,v);} )
|
||||
{
|
||||
return T::Constant(r,c,v);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
// Others
|
||||
// TODO: Adapt other functions ot behave as inverse and limit code in non-ref/non-map containers
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
template<typename A> auto inverse(A const& a)
|
||||
{
|
||||
if constexpr(!use_expression_templates) return inverse(generalize_t<A const>(a));
|
||||
else if constexpr(requires{typename A::rotgen_tag;}) return base_of(a).inverse();
|
||||
else return a.inverse();
|
||||
}
|
||||
|
||||
template<concepts::vectorND<3> L, concepts::vectorND<3> R> auto cross(L const& l, R const& r)
|
||||
{
|
||||
if constexpr(!use_expression_templates)
|
||||
return cross(generalize_t<R const>(l),generalize_t<R const>(r));
|
||||
else if constexpr(requires{typename L::rotgen_tag;} || requires{typename R::rotgen_tag;} )
|
||||
return base_of(l).cross(base_of(r));
|
||||
else return l.cross(r);
|
||||
}
|
||||
}
|
||||
|
|
@ -8,28 +8,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <rotgen/config.hpp>
|
||||
#include <rotgen/concepts.hpp>
|
||||
#include <rotgen/common/traits.hpp>
|
||||
#include <rotgen/common/strides.hpp>
|
||||
|
||||
#if defined(ROTGEN_FORCE_DYNAMIC)
|
||||
#include <rotgen/dynamic/matrix.hpp>
|
||||
#include <rotgen/dynamic/block.hpp>
|
||||
#include <rotgen/dynamic/map.hpp>
|
||||
#include <rotgen/dynamic/svd.hpp>
|
||||
#include <rotgen/dynamic/format.hpp>
|
||||
#else
|
||||
#include <rotgen/fixed/matrix.hpp>
|
||||
#include <rotgen/fixed/block.hpp>
|
||||
#include <rotgen/fixed/map.hpp>
|
||||
#include <rotgen/fixed/svd.hpp>
|
||||
#include <rotgen/fixed/format.hpp>
|
||||
#endif
|
||||
|
||||
#include <rotgen/common/ref.hpp>
|
||||
#include <rotgen/extract.hpp>
|
||||
#include <rotgen/functions.hpp>
|
||||
#include <rotgen/operators.hpp>
|
||||
#include <rotgen/common/reshaper.hpp>
|
||||
#include <rotgen/solver.hpp>
|
||||
#include <rotgen/format.hpp>
|
||||
#include <rotgen/container.hpp>
|
||||
#include <rotgen/alias.hpp>
|
||||
#include <rotgen/algebra.hpp>
|
||||
#include <rotgen/functions.hpp>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_col)
|
||||
#include "block_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_row)
|
||||
#include "block_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_col)
|
||||
#include "block_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define MAPNAME ROTGEN_MATRIX_NAME(BASEMAP,SIZE,_row)
|
||||
#include "block_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
#undef SOURCENAME
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
//==================================================================================================
|
||||
#include <rotgen/detail/generators.hpp>
|
||||
#include <rotgen/impl/block.hpp>
|
||||
#include <rotgen/impl/payload.hpp>
|
||||
#include <rotgen/container/block/dynamic/impl.hpp>
|
||||
#include <rotgen/detail/payload.hpp>
|
||||
#include <Eigen/Dense>
|
||||
#include <variant>
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ namespace rotgen
|
|||
#define CONST const
|
||||
#define BASENAME block_const_impl
|
||||
#define BASEMAP map_const_impl
|
||||
#include "block_indirect.cpp"
|
||||
#include "generate.cpp"
|
||||
#undef BASENAME
|
||||
#undef BASEMAP
|
||||
#undef USE_CONST
|
||||
|
|
@ -26,7 +26,7 @@ namespace rotgen
|
|||
#define CONST
|
||||
#define BASENAME block_impl
|
||||
#define BASEMAP map_impl
|
||||
#include "block_indirect.cpp"
|
||||
#include "generate.cpp"
|
||||
#undef BASENAME
|
||||
#undef BASEMAP
|
||||
#undef CONST
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
//==================================================================================================
|
||||
|
||||
#include <rotgen/config.hpp>
|
||||
#include <rotgen/dynamic/format.hpp>
|
||||
#include <rotgen/impl/payload.hpp>
|
||||
#include <rotgen/format/dynamic.hpp>
|
||||
#include <rotgen/detail/payload.hpp>
|
||||
#include <Eigen/Core>
|
||||
#include <string>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
*/
|
||||
//==================================================================================================
|
||||
#include <rotgen/config.hpp>
|
||||
#include <rotgen/common/export.hpp>
|
||||
|
||||
namespace rotgen::detail
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include "map_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include "map_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -48,7 +48,7 @@
|
|||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include "map_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
#define TRANSSOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define CLASSCONSTNAME ROTGEN_MATRIX_NAME(map_const_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include "map_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef TRANSSOURCENAME
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
//==================================================================================================
|
||||
#include <rotgen/detail/generators.hpp>
|
||||
#include <rotgen/impl/map.hpp>
|
||||
#include <rotgen/impl/payload.hpp>
|
||||
#include <rotgen/container/map/dynamic/impl.hpp>
|
||||
#include <rotgen/detail/payload.hpp>
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/LU>
|
||||
|
||||
|
|
@ -16,14 +16,16 @@ namespace rotgen
|
|||
#define USE_CONST
|
||||
#define CONST const
|
||||
#define BASENAME map_const_impl
|
||||
#include "map_indirect.cpp"
|
||||
#include "generate.cpp"
|
||||
#undef BASENAME
|
||||
#undef USE_CONST
|
||||
#undef CONST
|
||||
|
||||
#define CONST
|
||||
#define BASENAME map_impl
|
||||
#include "map_indirect.cpp"
|
||||
#include "generate.cpp"
|
||||
#undef BASENAME
|
||||
#undef CONST
|
||||
}
|
||||
|
||||
#include "operators.cpp"
|
||||
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
//==================================================================================================
|
||||
|
||||
#include <rotgen/impl/map.hpp>
|
||||
#include <rotgen/impl/payload.hpp>
|
||||
#include <rotgen/container/map/dynamic/impl.hpp>
|
||||
#include <rotgen/detail/payload.hpp>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#define ROTGEN_IMPL_OP(OP,FN,RET) \
|
||||
#define ROTGEN_IMPL_OP(OP,FN,RET) \
|
||||
RET operator OP(map_const_impl32_col const& a, map_impl32_col const& b ) { return FN(a, b); } \
|
||||
RET operator OP(map_const_impl32_col const& a, map_impl32_row const& b ) { return FN(a, b); } \
|
||||
RET operator OP(map_const_impl32_col const& a, map_const_impl32_row const& b ) { return FN(a, b); } \
|
||||
|
|
@ -29,12 +29,9 @@ namespace rotgen
|
|||
{
|
||||
namespace
|
||||
{
|
||||
auto add(auto const& a, auto const& b) { return a.storage()->data + b.storage()->data; }
|
||||
auto sub(auto const& a, auto const& b) { return a.storage()->data - b.storage()->data; }
|
||||
bool equal(auto const& a, auto const& b) { return a.storage()->data == b.storage()->data; }
|
||||
bool not_equal(auto const& a, auto const& b) { return a.storage()->data != b.storage()->data; }
|
||||
}
|
||||
|
||||
ROTGEN_IMPL_OP(==, equal , bool);
|
||||
ROTGEN_IMPL_OP(!=, not_equal, bool);
|
||||
}
|
||||
|
|
@ -6,8 +6,8 @@
|
|||
*/
|
||||
//==================================================================================================
|
||||
#include <rotgen/detail/generators.hpp>
|
||||
#include <rotgen/impl/matrix.hpp>
|
||||
#include <rotgen/impl/payload.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/impl.hpp>
|
||||
#include <rotgen/detail/payload.hpp>
|
||||
#include <rotgen/config.hpp>
|
||||
#include <Eigen/Dense>
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include "matrix_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef STORAGE_ORDER
|
||||
|
|
@ -27,7 +27,7 @@ namespace rotgen
|
|||
#define STORAGE_ORDER Eigen::RowMajor
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include "matrix_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef STORAGE_ORDER
|
||||
|
|
@ -41,7 +41,7 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include "matrix_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef STORAGE_ORDER
|
||||
|
|
@ -49,7 +49,7 @@ namespace rotgen
|
|||
#define STORAGE_ORDER Eigen::RowMajor
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#define TRANSCLASSNAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include "matrix_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef TRANSCLASSNAME
|
||||
#undef STORAGE_ORDER
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
//==================================================================================================
|
||||
#include <rotgen/detail/generators.hpp>
|
||||
#include <rotgen/impl/matrix.hpp>
|
||||
#include <rotgen/impl/payload.hpp>
|
||||
#include <rotgen/impl/svd.hpp>
|
||||
#include <rotgen/container/matrix/dynamic/impl.hpp>
|
||||
#include <rotgen/algebra/svd/dynamic/impl.hpp>
|
||||
#include <rotgen/detail/payload.hpp>
|
||||
#include <rotgen/config.hpp>
|
||||
#include <Eigen/Dense>
|
||||
#include <Eigen/SVD>
|
||||
|
|
@ -21,7 +21,7 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include "svd_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
#undef STORAGE_ORDER
|
||||
|
|
@ -29,7 +29,7 @@ namespace rotgen
|
|||
#define STORAGE_ORDER Eigen::RowMajor
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include "svd_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
#undef STORAGE_ORDER
|
||||
|
|
@ -43,7 +43,7 @@ namespace rotgen
|
|||
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_col)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_col)
|
||||
#include "svd_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
#undef STORAGE_ORDER
|
||||
|
|
@ -51,7 +51,7 @@ namespace rotgen
|
|||
#define STORAGE_ORDER Eigen::RowMajor
|
||||
#define CLASSNAME ROTGEN_MATRIX_NAME(svd_impl,SIZE,_row)
|
||||
#define SOURCENAME ROTGEN_MATRIX_NAME(matrix_impl,SIZE,_row)
|
||||
#include "svd_model.cpp"
|
||||
#include "model.cpp"
|
||||
#undef CLASSNAME
|
||||
#undef SOURCENAME
|
||||
#undef STORAGE_ORDER
|
||||
Loading…
Add table
Add a link
Reference in a new issue