Pigon is an open source C++ library for scientific purposes
Pigon is an open source C++ library for scientific purposes
Pigon is contains some tools for mathematics and physics. Programming principle that behind of Pigon is quite simple. This is more like an API rather than a library. Readability
Matrix<float> m = { {2,5},
{3,7} };
There are 2 steps for installation:
Include header files that you need like that:
#include "pigon/pigon.h"
#include "pigon/matrix.h"
// create a 4x4 unit matrix in float type
Matrixf m4x4(4, 4, MatrixType::Unit);
Some basic concepts are explained in this document about mathematics and physics in Pigon.
Matrix tool has a lot of mathematical functions like that
It is possible to carry out an initialization in two ways:
// initialize a 3x3 matrix with initializer list
Matrix<float> m = { {1, 3, 5},
{2, 5, 6},
{4, 8, 7} };
// initialize a 3x3 random matrix with constructor function
Matrix<float> m(3, 3, MatrixType::Random);
In pigon, there are too many selection types for matrices.
Note: Row and col numbers starts from 0 in pigon.
// initialize a 3x3 matrix
Matrix<float> m = { {1, 3, 5},
{2, 5, 6},
{4, 8, 7} };
Selection of single element:
// row=1, col=2
std::cout << m[1][2] << std::endl; // 6 [row][col]
std::cout << m(1, 2) << std::endl; // 6 (row, col) these are same things
Selection an array of rows and single column
// row={0, 1}, col=2
Matrix<float> m_sub = m({0, 1}, 2);
Selection an array of rows and columns
// row={0, 1}, col={0, 1}
Matrix<float> m_sub = m({0, 1}, {1, 2});
By Select::type
// row=All, col={0, 2}
Matrix<float> m_sub = m(Select::All, {0, 2});
For select only even columns
// row=All, col={0, 2}
Matrix<float> m_sub = m({1, 2}, Select::Even);