Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
EMAM2Cpp
Commits
ce277f76
Commit
ce277f76
authored
Apr 15, 2018
by
Christoph Richter
Browse files
MathBackend: Introduced usesZeroBasedIndexing to define indexing type
parent
c1d25d27
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/generator/MathBackend.java
View file @
ce277f76
...
...
@@ -37,4 +37,11 @@ public interface MathBackend {
String
getDivisionEEString
(
MathMatrixArithmeticExpressionSymbol
mathExpressionSymbol
,
String
valueListString
);
/**
* Does the backend use 0-based or 1-based indexing for matrix element access?
*
* @return whether the backend uses zero based indexing (true) or one based indexing (false)
*/
boolean
usesZeroBasedIndexing
();
}
src/main/java/de/monticore/lang/monticar/generator/cpp/ArmadilloBackend.java
View file @
ce277f76
...
...
@@ -101,4 +101,9 @@ public class ArmadilloBackend implements MathBackend {
return
ExecuteMethodGenerator
.
generateExecuteCode
(
mathExpressionSymbol
.
getLeftExpression
(),
new
ArrayList
<>())
+
"/"
+
ExecuteMethodGenerator
.
generateExecuteCode
(
mathExpressionSymbol
.
getRightExpression
(),
new
ArrayList
<>());
}
@Override
public
boolean
usesZeroBasedIndexing
()
{
return
true
;
}
}
src/main/java/de/monticore/lang/monticar/generator/cpp/LinalgBackend.java
View file @
ce277f76
...
...
@@ -88,4 +88,10 @@ public class LinalgBackend implements MathBackend {
Log
.
error
(
"Not supported yet"
);
return
null
;
}
@Override
public
boolean
usesZeroBasedIndexing
()
{
// TODO: check this! Do not know this backend...
return
false
;
}
}
src/main/java/de/monticore/lang/monticar/generator/cpp/OctaveBackend.java
View file @
ce277f76
...
...
@@ -92,5 +92,8 @@ public class OctaveBackend implements MathBackend {
return
OctaveHelper
.
getCallOctaveFunctionFirstResult
(
mathExpressionSymbol
.
getLeftExpression
(),
"ldivide"
,
valueListString
,
false
);
}
@Override
public
boolean
usesZeroBasedIndexing
()
{
return
false
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment