Skip to content

Commit 97b3a93

Browse files
author
Marcus Walther
committed
- oeprator() defined for SparseMatrix-type
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22035 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent 47ae17a commit 97b3a93

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

SimulationRuntime/cpp/Include/Core/Math/SparseMatrix.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ using std::map;
1010
using std::pair;
1111
using std::make_pair;
1212

13-
struct sparse_inserter {
13+
struct sparse_inserter {
1414
struct t2 {
1515
int i;
1616
int j;
1717
map< pair<int,int>, double> & content;
1818
t2(int i, int j, map< pair<int,int>, double> & c): i(i), j(j), content(c) {}
19-
void operator=(double t) {
19+
inline void operator=(double t) {
2020
content[make_pair(j,i)]=t;
2121
}
2222
};
@@ -25,19 +25,25 @@ struct sparse_inserter {
2525
int i;
2626
map< pair<int,int>, double> & content;
2727
t1(int i,map< pair<int,int>, double> & c): i(i), content(c) {}
28-
t2 operator[](size_t j) {
28+
inline t2 operator[](size_t j) {
2929
t2 res(i,j,content);
3030
return res;
3131
}
3232
};
3333

3434

3535
map< pair<int,int>, double> content;
36-
t1 operator[](size_t i) {
36+
inline t1 operator[](size_t i) {
3737
t1 res(i,content);
3838
return res;
3939
}
4040

41+
inline t2 operator()(const unsigned int i, const unsigned int j)
42+
{
43+
t2 res(i,j,content);
44+
return res;
45+
}
46+
4147
};
4248

4349
struct sparse_matrix {

0 commit comments

Comments
 (0)