Cumulia Illustrator Rendering Engine v1.1.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
cil::Matrix< S > Class Template Reference

The templated class Matrix inherits from the templated class Tuple which is being instantiated with a specified data type of float. More...

#include <matrix.h>

Inheritance diagram for cil::Matrix< S >:
cil::Tuple< float > cil::Variant

Public Member Functions

 Matrix (int dim)
 Constructs a dim X dim Matrix object, initializing elements on the diagonal to 1 and all others to 0.
 
const float * operator[] (int index) const
 Returns a constant pointer to the first element in the column of index of this matrix, providing a read-only access.
 
float * operator[] (int index)
 Returns a pointer to the first element in the column of index of this matrix, providing a read-write access.
 
Matrixoperator+= (const Matrix &other)
 Performs element-wise addition between the current Matrix and another matrix.
 
Matrix< S > & operator-= (const Matrix &other)
 Performs element-wise subtraction between the current Matrix and another matrix.
 
Matrix< S > & operator*= (const Matrix &other)
 Performs right matrix multiplication of the current matrix with another matrix.
 
operator+ (const S &other) const
 Returns a new Matrix object that is formed by element-wise addition between the current matrix and another matrix.
 
operator- (const S &other) const
 Returns a new Matrix object that is formed by element-wise subtraction between the current matrix and another matrix.
 
operator* (const S &other) const
 Returns a new Matrix object that is formed by matrix multiplication between the current Matrix and another matrix.
 
void setIdentity ()
 Sets elements on the diagonal of this matrix to 1 and all others to 0.
 
void transpose ()
 Transpose this matrix.
 
- Public Member Functions inherited from cil::Tuple< float >
 Tuple (int size)
 Constructs a Tuple object with a specified number of elements, and initialize all elements to 0.
 
virtual ~Tuple ()
 
int size () const
 Gets the number of elements of the Tuple.
 
float * data ()
 Gets the data array of the Tuple.
 
const float * data () const
 Gets the data array of the Tuple, and the data could not be modified upon which this function is called.
 
void setData (const float *data)
 Sets the data array of the Variant.
 
Tuple< float > & operator= (const Tuple &other)
 Copys the data of another Tuple to the one on which the operator is invoked.
 
bool operator== (const Tuple &other) const
 Compares the Tuple with another one, and returns true if they are equal, otherwise returns false.
 
bool operator!= (const Tuple &other) const
 Compares the Tuple with another one, and returns false if they are equal, otherwise returns true.
 
- Public Member Functions inherited from cil::Variant
 Variant ()
 
virtual ~Variant ()
 
const std::string & type () const
 

Protected Attributes

int m_dim
 The dimension of the Matrix.
 
- Protected Attributes inherited from cil::Tuple< float >
float * m_data
 The data array of the Tuple.
 
int m_size
 The number of elements that the data array of the Tuple holds.
 
- Protected Attributes inherited from cil::Variant
std::string m_type
 

Detailed Description

template<typename S>
class cil::Matrix< S >

The templated class Matrix inherits from the templated class Tuple which is being instantiated with a specified data type of float.

The elements of the matrix are stored in the shape of the tuple using column-major ordering.

Constructor & Destructor Documentation

◆ Matrix()

template<typename S >
cil::Matrix< S >::Matrix ( int dim)
inline

Constructs a dim X dim Matrix object, initializing elements on the diagonal to 1 and all others to 0.

Member Function Documentation

◆ operator*()

template<typename S >
S cil::Matrix< S >::operator* ( const S & other) const
inline

Returns a new Matrix object that is formed by matrix multiplication between the current Matrix and another matrix.

◆ operator*=()

template<typename S >
Matrix< S > & cil::Matrix< S >::operator*= ( const Matrix< S > & other)
inline

Performs right matrix multiplication of the current matrix with another matrix.

a = a * b

◆ operator+()

template<typename S >
S cil::Matrix< S >::operator+ ( const S & other) const
inline

Returns a new Matrix object that is formed by element-wise addition between the current matrix and another matrix.

◆ operator+=()

template<typename S >
Matrix & cil::Matrix< S >::operator+= ( const Matrix< S > & other)
inline

Performs element-wise addition between the current Matrix and another matrix.

This operator modifies the current matrix by adding the corresponding elements from both matrices.

◆ operator-()

template<typename S >
S cil::Matrix< S >::operator- ( const S & other) const
inline

Returns a new Matrix object that is formed by element-wise subtraction between the current matrix and another matrix.

◆ operator-=()

template<typename S >
Matrix< S > & cil::Matrix< S >::operator-= ( const Matrix< S > & other)
inline

Performs element-wise subtraction between the current Matrix and another matrix.

This operator modifies the current matrix by subtracting the corresponding elements from both matrices.

◆ operator[]() [1/2]

template<typename S >
float * cil::Matrix< S >::operator[] ( int index)
inline

Returns a pointer to the first element in the column of index of this matrix, providing a read-write access.

◆ operator[]() [2/2]

template<typename S >
const float * cil::Matrix< S >::operator[] ( int index) const
inline

Returns a constant pointer to the first element in the column of index of this matrix, providing a read-only access.

◆ setIdentity()

template<typename S >
void cil::Matrix< S >::setIdentity ( )
inline

Sets elements on the diagonal of this matrix to 1 and all others to 0.

◆ transpose()

template<typename S >
void cil::Matrix< S >::transpose ( )
inline

Transpose this matrix.

Member Data Documentation

◆ m_dim

template<typename S >
int cil::Matrix< S >::m_dim
protected

The dimension of the Matrix.