This repository has been archived on 2025-02-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Pivot/src/Matrix.h
Persson-dev 5a5c247019
Some checks failed
Linux arm64 / Build (push) Failing after 1m56s
english name for symbols
2024-02-23 11:03:38 +01:00

51 lines
1.3 KiB
C++

#pragma once
#include <cmath>
#include <cstddef>
#include <string>
#include <vector>
class Matrix {
private:
std::size_t m_Raws;
std::size_t m_Columns;
std::vector<long double> m_Data;
public:
Matrix(const std::string& fileNameInput);
Matrix(std::size_t raws, std::size_t columns);
Matrix(std::size_t raws, std::size_t columns, std::initializer_list<long double>&& initList);
~Matrix();
std::size_t GetRawCount() const;
std::size_t GetColumnCount() const;
void Insert();
void Print() const;
void Save(const std::string& fileName);
void Load(const std::string& filename);
void Transpose();
static Matrix Identity(std::size_t size);
void Augment(const Matrix& right);
Matrix SubMatrix(std::size_t raw_origin, std::size_t column_origin, std::size_t raw, std::size_t column) const;
bool operator==(const Matrix& other) const;
Matrix operator*(const Matrix& other) const;
long double& operator[](std::size_t index);
long double& at(std::size_t raw, std::size_t column);
long double at(std::size_t raw, std::size_t column) const;
friend std::ostream& operator<<(std::ostream& stream, const Matrix& mat);
friend std::istream& operator>>(std::istream& stream, Matrix& mat);
};
template <typename T>
bool IsEqualZero(T var) {
return std::abs(var) < std::pow(10, -5);
}