Adding a merge checker script
This commit is contained in:
26
.gitea/workflows/Merge-Checker.yaml
Normal file
26
.gitea/workflows/Merge-Checker.yaml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
name: Merge-Checker
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: ["**"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install dependencies (CMake + Ninja + Compiler)
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y cmake ninja-build build-essential
|
||||||
|
|
||||||
|
- name: Configure project with CMake
|
||||||
|
run: |
|
||||||
|
cmake -G Ninja -S . -B build/
|
||||||
|
|
||||||
|
- name: Build with Ninja
|
||||||
|
run: |
|
||||||
|
ninja -C build/
|
||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
build/
|
build/
|
||||||
|
.cache/
|
||||||
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
"C_Cpp.intelliSenseEngine": "default",
|
"C_Cpp.intelliSenseEngine": "default",
|
||||||
"clangd.arguments": [
|
|
||||||
"--include-directory=build/unit-tests"
|
|
||||||
],
|
|
||||||
"C_Cpp.default.intelliSenseMode": "linux-gcc-x64",
|
"C_Cpp.default.intelliSenseMode": "linux-gcc-x64",
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.h": "cpp",
|
"*.h": "cpp",
|
||||||
@@ -76,6 +73,7 @@
|
|||||||
"csignal": "cpp",
|
"csignal": "cpp",
|
||||||
"span": "cpp"
|
"span": "cpp"
|
||||||
},
|
},
|
||||||
"clangd.enable": false,
|
"clangd.enable": true,
|
||||||
"C_Cpp.dimInactiveRegions": false
|
"C_Cpp.dimInactiveRegions": false,
|
||||||
|
"editor.defaultFormatter": "xaver.clang-format"
|
||||||
}
|
}
|
||||||
@@ -212,8 +212,8 @@ Matrix<rows, columns>::Transpose() const
|
|||||||
|
|
||||||
// explicitly define the determinant for a 2x2 matrix because it is definitely
|
// explicitly define the determinant for a 2x2 matrix because it is definitely
|
||||||
// the fastest way to calculate a 2x2 matrix determinant
|
// the fastest way to calculate a 2x2 matrix determinant
|
||||||
template <>
|
// template <>
|
||||||
inline float Matrix<0, 0>::Det() const { return 1e+6; }
|
// inline float Matrix<0, 0>::Det() const { return 1e+6; }
|
||||||
template <>
|
template <>
|
||||||
inline float Matrix<1, 1>::Det() const { return this->matrix[0]; }
|
inline float Matrix<1, 1>::Det() const { return this->matrix[0]; }
|
||||||
template <>
|
template <>
|
||||||
|
|||||||
@@ -10,10 +10,10 @@
|
|||||||
// TODO: Add a function for SVD decomposition
|
// TODO: Add a function for SVD decomposition
|
||||||
// TODO: Add a function for LQ decomposition
|
// TODO: Add a function for LQ decomposition
|
||||||
|
|
||||||
template <uint8_t rows, uint8_t columns>
|
template <uint8_t rows, uint8_t columns> class Matrix {
|
||||||
class Matrix
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
|
static_assert(rows > 0, "Template error: rows must be greater than 0.");
|
||||||
|
static_assert(columns > 0, "Template error: columns must be greater than 0.");
|
||||||
/**
|
/**
|
||||||
* @brief create a matrix but leave all of its values unitialized
|
* @brief create a matrix but leave all of its values unitialized
|
||||||
*/
|
*/
|
||||||
@@ -37,8 +37,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* @brief Initialize a matrix directly with any number of arguments
|
* @brief Initialize a matrix directly with any number of arguments
|
||||||
*/
|
*/
|
||||||
template <typename... Args>
|
template <typename... Args> Matrix(Args... args);
|
||||||
Matrix(Args... args);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief set the matrix diagonals to 1 and all other values to 0
|
* @brief set the matrix diagonals to 1 and all other values to 0
|
||||||
@@ -189,14 +188,17 @@ public:
|
|||||||
Matrix<rows, columns> operator-(const Matrix<rows, columns> &other) const;
|
Matrix<rows, columns> operator-(const Matrix<rows, columns> &other) const;
|
||||||
|
|
||||||
template <uint8_t other_columns>
|
template <uint8_t other_columns>
|
||||||
Matrix<rows, other_columns> operator*(const Matrix<columns, other_columns> &other) const;
|
Matrix<rows, other_columns>
|
||||||
|
operator*(const Matrix<columns, other_columns> &other) const;
|
||||||
|
|
||||||
Matrix<rows, columns> operator*(float scalar) const;
|
Matrix<rows, columns> operator*(float scalar) const;
|
||||||
|
|
||||||
template <uint8_t sub_rows, uint8_t sub_columns, uint8_t row_offset, uint8_t column_offset>
|
template <uint8_t sub_rows, uint8_t sub_columns, uint8_t row_offset,
|
||||||
|
uint8_t column_offset>
|
||||||
Matrix<sub_rows, sub_columns> SubMatrix() const;
|
Matrix<sub_rows, sub_columns> SubMatrix() const;
|
||||||
|
|
||||||
template <uint8_t sub_rows, uint8_t sub_columns, uint8_t row_offset, uint8_t column_offset>
|
template <uint8_t sub_rows, uint8_t sub_columns, uint8_t row_offset,
|
||||||
|
uint8_t column_offset>
|
||||||
void SetSubMatrix(const Matrix<sub_rows, sub_columns> &sub_matrix);
|
void SetSubMatrix(const Matrix<sub_rows, sub_columns> &sub_matrix);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -210,8 +212,9 @@ public:
|
|||||||
static float DotProduct(const Matrix<vector_size, 1> &vec1,
|
static float DotProduct(const Matrix<vector_size, 1> &vec1,
|
||||||
const Matrix<vector_size, 1> &vec2);
|
const Matrix<vector_size, 1> &vec2);
|
||||||
|
|
||||||
static float DotProduct(const Matrix<1, 1> &vec1,
|
static float DotProduct(const Matrix<1, 1> &vec1, const Matrix<1, 1> &vec2) {
|
||||||
const Matrix<1, 1> &vec2) { return vec1.Get(0, 0) * vec2.Get(0, 0); }
|
return vec1.Get(0, 0) * vec2.Get(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::array<float, rows * columns> matrix;
|
std::array<float, rows * columns> matrix;
|
||||||
|
|||||||
Reference in New Issue
Block a user