-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRObjects.h
More file actions
50 lines (37 loc) · 1.32 KB
/
RObjects.h
File metadata and controls
50 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Created by simonepanzeri on 24/11/2021.
//
#ifndef DEV_FDAPDE_ROBJECTS_H
#define DEV_FDAPDE_ROBJECTS_H
#include "FdaPDE.h"
class RNumericMatrix {
public:
RNumericMatrix(Real * const matr, const UInt nrows, const UInt ncols) :
matr_(matr), nrows_(nrows), ncols_(ncols) {}
Real& operator()(UInt i, UInt j) {return matr_[i+nrows_*j];}
const Real& operator()(UInt i, UInt j) const {return matr_[i+nrows_*j];}
Real& operator[](UInt i) {return matr_[i];}
const Real& operator[](UInt i) const {return matr_[i];}
const UInt& nrows() const {return nrows_;}
const UInt& ncols() const {return ncols_;}
private:
Real * const matr_;
const UInt nrows_;
const UInt ncols_;
};
class RIntegerMatrix{
public:
RIntegerMatrix(UInt * const matr, const UInt nrows, const UInt ncols) :
matr_(matr), nrows_(nrows), ncols_(ncols) {}
UInt& operator()(UInt i, UInt j) {return matr_[i+nrows_*j];}
const UInt& operator()(UInt i, UInt j) const {return matr_[i+nrows_*j];}
UInt& operator[](UInt i) {return matr_[i];}
const UInt& operator[](UInt i) const {return matr_[i];}
const UInt& nrows() const {return nrows_;}
const UInt& ncols() const {return ncols_;}
private:
UInt * const matr_;
const UInt nrows_;
const UInt ncols_;
};
#endif //DEV_FDAPDE_ROBJECTS_H