Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
preprocessor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
preprocessor
Commits
89832db1
Commit
89832db1
authored
6 years ago
by
Sébastien Villemot
Browse files
Options
Downloads
Patches
Plain Diff
C++11: convert MatrixForm to a class enum
parent
946d105c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/SigmaeInitialization.cc
+7
-7
7 additions, 7 deletions
src/SigmaeInitialization.cc
src/SigmaeInitialization.hh
+5
-5
5 additions, 5 deletions
src/SigmaeInitialization.hh
with
12 additions
and
12 deletions
src/SigmaeInitialization.cc
+
7
−
7
View file @
89832db1
...
...
@@ -27,24 +27,24 @@ SigmaeStatement::SigmaeStatement(matrix_t matrix_arg) noexcept(false) :
{
}
SigmaeStatement
::
m
atrix
_f
orm
_t
SigmaeStatement
::
M
atrix
F
orm
SigmaeStatement
::
determineMatrixForm
(
const
matrix_t
&
matrix
)
noexcept
(
false
)
{
size_t
nbe
;
int
inc
;
m
atrix
_f
orm
_t
type
;
M
atrix
F
orm
type
;
// Checking if first or last row has one element.
if
(
matrix
.
front
().
size
()
==
1
)
{
inc
=
1
;
nbe
=
2
;
type
=
eL
ower
;
type
=
MatrixForm
::
l
ower
;
}
else
if
(
matrix
.
back
().
size
()
==
1
)
{
inc
=
-
1
;
nbe
=
matrix
.
front
().
size
()
-
1
;
type
=
eU
pper
;
type
=
MatrixForm
::
u
pper
;
}
else
throw
MatrixFormException
();
...
...
@@ -70,17 +70,17 @@ SigmaeStatement::writeOutput(ostream &output, const string &basename, bool minim
{
for
(
ic
=
0
;
ic
<
matrix
.
size
();
ic
++
)
{
if
(
ic
>=
ir
&&
matrix_form
==
eU
pper
)
if
(
ic
>=
ir
&&
matrix_form
==
MatrixForm
::
u
pper
)
{
ic1
=
ic
-
ir
;
ir1
=
ir
;
}
else
if
(
ic
<
ir
&&
matrix_form
==
eU
pper
)
else
if
(
ic
<
ir
&&
matrix_form
==
MatrixForm
::
u
pper
)
{
ic1
=
ir
-
ic
;
ir1
=
ic
;
}
else
if
(
ic
>
ir
&&
matrix_form
==
eL
ower
)
else
if
(
ic
>
ir
&&
matrix_form
==
MatrixForm
::
l
ower
)
{
ic1
=
ir
;
ir1
=
ic
;
...
...
This diff is collapsed.
Click to expand it.
src/SigmaeInitialization.hh
+
5
−
5
View file @
89832db1
...
...
@@ -31,10 +31,10 @@ class SigmaeStatement : public Statement
{
public:
//! Matrix form (lower or upper triangular) enum
enum
m
atrix
_f
orm
_t
enum
class
M
atrix
F
orm
{
eL
ower
=
0
,
//!< Lower triangular matrix
eU
pper
=
1
//!< Upper triangular matrix
l
ower
,
//!< Lower triangular matrix
u
pper
//!< Upper triangular matrix
};
//! Type of a matrix row
using
row_t
=
vector
<
expr_t
>
;
...
...
@@ -49,11 +49,11 @@ private:
//! The matrix
const
matrix_t
matrix
;
//! Matrix form (lower or upper)
const
m
atrix
_f
orm
_t
matrix_form
;
const
M
atrix
F
orm
matrix_form
;
//! Returns the type (upper or lower triangular) of a given matrix
/*! Throws an exception if it is neither upper triangular nor lower triangular */
static
m
atrix
_f
orm
_t
determineMatrixForm
(
const
matrix_t
&
matrix
)
noexcept
(
false
);
static
M
atrix
F
orm
determineMatrixForm
(
const
matrix_t
&
matrix
)
noexcept
(
false
);
public
:
SigmaeStatement
(
matrix_t
matrix_arg
)
noexcept
(
false
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment