Matrix.hpp 892 Bytes
Newer Older
1
2
#ifndef MATRIX_HPP
#define MATRIX_HPP
Mario Bajer's avatar
cleanup  
Mario Bajer committed
3
4
5
6
7
8

#include <iostream>
#include <filesystem>
#include <fstream>
#include <vector>
#include <string>
9
10
11
12
#include <cstdio>
#include <cstdlib>

#include <nlohmann/json.hpp>
Mario Bajer's avatar
cleanup  
Mario Bajer committed
13
14
15
16
17
18
19
20
21
22

#include <cgicc/CgiDefs.h>
#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTMLClasses.h>

using namespace std;
using namespace cgicc;
using json = nlohmann::json;

23
class Matrix{
Mario Bajer's avatar
cleanup  
Mario Bajer committed
24
public:
25
26
    Matrix(int dim);

Mario Bajer's avatar
cleanup  
Mario Bajer committed
27
28
29
    int ID;
    int dim;
    int *data;
30
31
    int generateMatrix(int dimension);
    void print();
Mario Bajer's avatar
cleanup  
Mario Bajer committed
32

Mario Bajer's avatar
cleanup    
Mario Bajer committed
33
    inline int& operator()(unsigned row, unsigned col) {
34
        return data[dim*row + col];
Mario Bajer's avatar
cleanup  
Mario Bajer committed
35
36
37
    }

    inline int operator()(unsigned row, unsigned col) const {
38
        return data[dim*row + col];
Mario Bajer's avatar
cleanup  
Mario Bajer committed
39
40
    }

41
42
43
44
    Matrix operator+(Matrix b);

    Matrix operator-(Matrix b);

Mario Bajer's avatar
cleanup  
Mario Bajer committed
45
private:
46

Mario Bajer's avatar
cleanup  
Mario Bajer committed
47
48
};

49
void htmlHeader(string title);
Mario Bajer's avatar
Mario Bajer committed
50
bool existsm(string filename);
Mario Bajer's avatar
cleanup  
Mario Bajer committed
51

52
#endif