⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matrixtrait.hpp

📁 简单的C++计算库.其中实现了矩阵运算,大数运算.矩阵处理中使用lazy calculate,并且封装常见算法,可以将普通matlab程序用SDL改写.
💻 HPP
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -