GithubHelp home page GithubHelp logo

3d_lib_for_ege's Introduction

Welcome to the 3D_Lib_for_ege wiki!

基本运算元

矩阵

矩阵宏

IDENTITY_MATRIX 1 用于初始化单位矩阵,当且仅当矩阵为方阵

D_TYPE double 矩阵默认使用的基元类型

矩阵声明

template < int l, int m, typename T = D_TYPE >
class matrix;

矩阵构造函数

默认构造函数会构造零矩阵,允许使用宏IDENTITY_MATRIX构造单位矩阵

matrix< l, m, T> ( const int opt = 0 );
  • opt: 构造参数

初始化构造函数

matrix< l, m, T > ( const T src[l][m] );
  • src: 包含矩阵所有元素的二位数组变量

拷贝构造函数

matrix< l, m, T > ( const matrix < l, m, T >& src );
  • src: 同阶矩阵

初始化构造函数

matrix < l, m, T > ( const std::initializer_list< std::initializer_list< T > >& src )
  • src: 二维初始化列表,利用C++11语法允许使用更简单的方式初始化矩阵。例如:
matrix< 3, 3 > item {
    { 1, 2, 4 },
    { 2, 4, 8 },
    { 4, 8, 16 },
};

矩阵操作符重载

重载下标运算符

T* operator [] ( const int opt ) const 
  • opt: 下标

重载赋值运算符

matrix < l, m, T >& operator = ( const matrix < l, m, T >& opt ) 
  • opt: 同阶矩阵

重载相等比较运算符(矩阵不存在顺序序列,故而未重载<、>、<=、>=)

bool operator == ( const matrix < l, m, T >& opt ) const
  • opt: 同阶矩阵

重载加法运算符

matrix < l, m, T > operator + ( const matrix < l, m, T >& opt ) const
  • opt: 同阶矩阵

重载减法运算符

matrix < l, m, T > operator - ( const matrix < l, m, T >& opt ) const 
  • opt: 同阶矩阵

重载数乘运算运算符

matrix < l, m, T > operator * ( T opt ) const 
  • opt: 矩阵单元

重载乘法运算符

template < int n >
matrix < l, n, T > operator * ( const matrix < m, n, T >& opt ) const 
  • opt: 行数与源矩阵列数相等的矩阵

重载数除除法运算符

matrix < l, m, T > operator / ( T opt ) const 
  • opt: 矩阵单元

重载幂运算符(opt == -1 时进行矩阵求逆运算

matrix < l, m, T > operator ^ ( int opt ) const 
  • opt: 幂次

矩阵函数

矩阵对应行列式求值(当且仅当矩阵为方阵)

T det() const 

矩阵转置

matrix< m, l > trans() const 

静态方法 矩阵对应行列式求值(当且仅当矩阵为方阵)

template < int o >
static T det ( const matrix < o, o, T >& opt);

opt: 求值矩阵


静态方法 矩阵余子式(当且仅当矩阵为方阵)

template < int o >
static matrix < o - 1, o - 1, T > cofactor ( const matrix < o, o, T >& opt, int r, int c )
  • opt: 求值矩阵
  • r: 余子式去行行号(从0开始)
  • c: 余子式去列列号(从0开始)

静态方法 矩阵转置

template < int o, int p >
static matrix < p, o, T > trans ( const matrix < o, p, T >& opt ) 
  • opt: 求值矩阵

静态方法 矩阵求逆

template < int o >
static matrix < o, o, T > inv ( const matrix < o, o, T >& opt ) 
  • opt: 求值矩阵

3d_lib_for_ege's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.