matrixtrait.hpp
来自「简单的C++计算库.其中实现了矩阵运算,大数运算.矩阵处理中使用lazy cal」· HPP 代码 · 共 173 行
HPP
173 行
#ifndef _SDL_MATHS_MATRIX_MATRIX_TRAIT_HPP_
#define _SDL_MATHS_MATRIX_MATRIX_TRAIT_HPP_
#ifndef _SDL_MATHS_MATRIX_MATRIX_HPP_
#error "must be included by Matrix.hpp"
#endif
SDL_MATHS_MATRIX_BEGIN
/*
*
* Is Matrix Concept
*
*/
struct MatrixTypeTrait
: public TypeTrait
{
};
/*
*
* Forward declarations
*
*/
template<
typename _NumberType,
typename _MatrixPolicy
>
class BasicMatrix;
template<typename _Type>
struct IsMatConcept
: public MatrixTypeTrait
{
enum {Result = false};
};
template<typename _Type>
struct IsMatConcept<SubMatrixRef<_Type> >
: public MatrixTypeTrait
{
enum {Result = true};
};
template<typename _Type>
struct IsMatConcept<ConstSubMatrixRef<_Type> >
: public MatrixTypeTrait
{
enum {Result = true};
};
template<typename _Type>
struct IsMatConcept<BasicMatrixExpr<_Type> >
: public MatrixTypeTrait
{
enum {Result = true};
};
/*
template<template <typename> class _MatrixPolicy, typename _NumberType
>
struct IsMatConcept<BasicMatrix<_MatrixPolicy, _NumberType> >
{
enum{Result = true};
};
*/
template<
typename _NumberType,
typename _MatrixPolicy
>
struct IsMatConcept<BasicMatrix<_NumberType, _MatrixPolicy> >
: public MatrixTypeTrait
{
enum {Result = true};
};
/*
*
* Matrix Type
*
*/
template<typename _MatType>
struct IsFullMatrix
: public MatrixTypeTrait
{
enum {Result = false};
};
template<typename _NumberType>
struct IsFullMatrix<BasicMatrix<_NumberType, FullMatrixPolicy<_NumberType> > >
: public MatrixTypeTrait
{
enum {Result = true};
};
template<typename _MatType>
struct IsDiagMatrix
: public MatrixTypeTrait
{
enum {Result = false};
};
template<typename _NumberType>
struct IsDiagMatrix<BasicMatrix<_NumberType, DiagMatrixPolicy<_NumberType> > >
: public MatrixTypeTrait
{
enum {Result = true};
};
template<typename _MatType>
struct IsKDiagMatrix
: public MatrixTypeTrait
{
enum {Result = false};
};
template<typename _NumberType>
struct IsKDiagMatrix<BasicMatrix<_NumberType, KDiagMatrixPolicy<_NumberType> > >
: public MatrixTypeTrait
{
enum {Result = true};
};
template<typename _MatType>
struct IsUpperMatrix
: public MatrixTypeTrait
{
enum {Result = false};
};
template<typename _NumberType>
struct IsUpperMatrix<BasicMatrix<_NumberType, UpperMatrixPolicy<_NumberType> > >
: public MatrixTypeTrait
{
enum {Result = true};
};
template<typename _MatType>
struct IsLowerMatrix
: public MatrixTypeTrait
{
enum {Result = false};
};
template<typename _NumberType>
struct IsLowerMatrix<BasicMatrix<_NumberType, LowerMatrixPolicy<_NumberType> > >
: public MatrixTypeTrait
{
enum {Result = true};
};
template<typename _MatType>
struct IsSparseMatrix
: public MatrixTypeTrait
{
enum {Result = false};
};
template<typename _NumberType>
struct IsSparseMatrix<BasicMatrix<_NumberType, SparseMatrixPolicy<_NumberType> > >
: public MatrixTypeTrait
{
enum {Result = true};
};
SDL_MATHS_MATRIX_END
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?