Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
ag-ohlberger
dune-community
dune-xt
Commits
6fc30684
Commit
6fc30684
authored
9 years ago
by
René Fritze
Browse files
Options
Downloads
Patches
Plain Diff
[common/float_cmp] changes complex comparison mode to element-wise
refs #59 and also tests float_cmp for actual floats
parent
79bd4ed7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/stuff/common/float_cmp_internal.hh
+4
-5
4 additions, 5 deletions
dune/stuff/common/float_cmp_internal.hh
dune/stuff/test/common_float_cmp.cc
+1
-1
1 addition, 1 deletion
dune/stuff/test/common_float_cmp.cc
with
5 additions
and
6 deletions
dune/stuff/common/float_cmp_internal.hh
+
4
−
5
View file @
6fc30684
...
...
@@ -115,10 +115,8 @@ typename std::enable_if<std::is_arithmetic<T>::value, bool>::type cmp_gt(const T
template
<
class
T
>
bool
cmp_gt
(
const
std
::
complex
<
T
>&
xx
,
const
std
::
complex
<
T
>&
yy
)
{
T
x
=
std
::
abs
(
xx
);
T
y
=
std
::
abs
(
yy
);
static_assert
(
std
::
is_arithmetic
<
T
>::
value
,
""
);
return
std
::
greater
<
double
>
()(
x
,
y
);
using
namespace
std
;
return
cmp_gt
({
real
(
xx
),
real
(
yy
)},
{
imag
(
xx
),
imag
(
yy
)});
}
template
<
class
XType
,
class
YType
>
...
...
@@ -147,7 +145,8 @@ typename std::enable_if<std::is_arithmetic<T>::value, bool>::type cmp_lt(const T
template
<
class
T
>
bool
cmp_lt
(
const
std
::
complex
<
T
>&
xx
,
const
std
::
complex
<
T
>&
yy
)
{
return
std
::
less
<
T
>
()(
std
::
abs
(
xx
),
std
::
abs
(
yy
));
using
namespace
std
;
return
cmp_lt
({
real
(
xx
),
real
(
yy
)},
{
imag
(
xx
),
imag
(
yy
)});
}
template
<
class
XType
,
class
YType
>
...
...
This diff is collapsed.
Click to expand it.
dune/stuff/test/common_float_cmp.cc
+
1
−
1
View file @
6fc30684
...
...
@@ -436,7 +436,7 @@ struct FloatCmpVector : public FloatCmpBase
};
// struct FloatCmpVector
typedef
testing
::
Types
<
double
,
std
::
complex
<
double
>
typedef
testing
::
Types
<
double
,
std
::
complex
<
double
>
,
float
,
// , long double // <- this requires a patch in dune/common/float_cmp.cc
// (bc. of std::max and 1e-6)
>
ScalarTypes
;
...
...
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