Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
iwr
amdis
Commits
a6df9bdc
Commit
a6df9bdc
authored
Jan 22, 2019
by
Praetorius, Simon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small updates in simplify and functor expressions
parent
8aa43b17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
10 deletions
+23
-10
AMDiS/src/expressions/functorN_expr.hpp
AMDiS/src/expressions/functorN_expr.hpp
+2
-7
AMDiS/src/expressions/simplify_expr.hpp
AMDiS/src/expressions/simplify_expr.hpp
+21
-3
No files found.
AMDiS/src/expressions/functorN_expr.hpp
View file @
a6df9bdc
...
...
@@ -109,13 +109,13 @@ namespace AMDiS
template
<
class
R
,
class
C
,
class
...
As
>
struct
Function
<
R
(
C
::*
)(
As
...)
>
{
typedef
R
result_
type
;
typedef
R
type
;
};
template
<
class
R
,
class
C
,
class
...
As
>
struct
Function
<
R
(
C
::*
)(
As
...)
const
>
{
typedef
R
type
;
typedef
R
type
;
};
template
<
class
T
>
...
...
@@ -128,11 +128,6 @@ namespace AMDiS
typedef
decltype
(
function_helper
(
&
F
::
operator
()))
type
;
};
template
<
class
R
,
class
...
As
>
struct
Functor
<
std
::
function
<
R
(
As
...)
>
>
{
typedef
R
type
;
};
template
<
class
F
>
struct
Functor
<
F
,
typename
void_
<
typename
F
::
value_type
>::
type
>
...
...
AMDiS/src/expressions/simplify_expr.hpp
View file @
a6df9bdc
...
...
@@ -74,6 +74,16 @@ namespace AMDiS
static
type
eval
(
RValue
<
T
>
const
&
t
)
{
return
t
;
}
};
/// -(n) -> (-n)
template
<
class
T
>
struct
Simplify
<
Negative
<
RValue
<
T
>
>
>
{
typedef
RValue
<
T
>
type
;
static
type
eval
(
Negative
<
RValue
<
T
>
>
const
&
t
)
{
return
RValue
<
T
>
(
-
t
.
term
.
value
);
}
};
/// -(N) -> (-N)
template
<
int
N
>
struct
Simplify
<
Negative
<
CValue
<
N
>
>
>
...
...
@@ -82,7 +92,6 @@ namespace AMDiS
static
type
eval
(
Negative
<
CValue
<
N
>
>
const
&
t
)
{
return
CValue
<-
N
>
();
}
};
/// -0 -> 0
...
...
@@ -439,14 +448,23 @@ namespace AMDiS
/// (X + (-Y)) -> X - Y
template
<
typename
X
,
typename
Y
>
struct
Simplify
<
Negative
<
Add
<
X
,
Negative
<
Y
>
>
>
>
struct
Simplify
<
Add
<
X
,
Negative
<
Y
>
>
>
{
typedef
Subtract
<
X
,
Y
>
type
;
static
type
eval
(
Negative
<
Add
<
X
,
Negative
<
Y
>
>
>
const
&
t
)
static
type
eval
(
Add
<
X
,
Negative
<
Y
>
>
const
&
t
)
{
return
t
.
term1
-
t
.
term2
.
term
;
}
};
template
<
typename
Y
>
struct
Simplify
<
Add
<
CValue
<
0
>
,
Negative
<
Y
>
>
>
{
typedef
Negative
<
Y
>
type
;
static
type
eval
(
Add
<
CValue
<
0
>
,
Negative
<
Y
>
>
const
&
t
)
{
return
t
.
term2
;
}
};
/// -(X - Y) -> Y - X
template
<
typename
X
,
typename
Y
>
struct
Simplify
<
Negative
<
Subtract
<
X
,
Y
>
>
>
...
...
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