Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
David Youssefi
otb
Commits
453ee258
Commit
453ee258
authored
14 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
TEST: test the limit cases
parent
c08a077b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Testing/Utilities/ossimpluginsHermiteInterpolation.cxx
+47
-2
47 additions, 2 deletions
Testing/Utilities/ossimpluginsHermiteInterpolation.cxx
with
47 additions
and
2 deletions
Testing/Utilities/ossimpluginsHermiteInterpolation.cxx
+
47
−
2
View file @
453ee258
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include
<cstdlib>
#include
<cstdlib>
#include
<iostream>
#include
<iostream>
#include
<iomanip>
#include
<iomanip>
#include
<cmath>
#include
"otb/HermiteInterpolator.h"
#include
"otb/HermiteInterpolator.h"
int
ossimpluginsHermiteInterpolationTest
(
int
argc
,
char
*
argv
[])
int
ossimpluginsHermiteInterpolationTest
(
int
argc
,
char
*
argv
[])
{
{
double
epsilon
=
0.0000001
;
double
xref
[
11
];
double
xref
[
11
];
xref
[
0
]
=
56640.0
;
xref
[
0
]
=
56640.0
;
xref
[
1
]
=
56700.0
;
xref
[
1
]
=
56700.0
;
...
@@ -54,13 +74,39 @@ int ossimpluginsHermiteInterpolationTest(int argc, char * argv[])
...
@@ -54,13 +74,39 @@ int ossimpluginsHermiteInterpolationTest(int argc, char * argv[])
std
::
cout
<<
" *** Test y and dy ***"
<<
std
::
endl
;
std
::
cout
<<
" *** Test y and dy ***"
<<
std
::
endl
;
ossimplugins
::
HermiteInterpolator
*
interp
=
new
ossimplugins
::
HermiteInterpolator
(
11
,
xref
,
yref
,
dyref
);
ossimplugins
::
HermiteInterpolator
*
interp
=
new
ossimplugins
::
HermiteInterpolator
(
11
,
xref
,
yref
,
dyref
);
double
yExpected
=
-
1154600.87561283
;
double
dyExpected
=
1568.49913322402
;
double
y
=
0
;
double
y
=
0
;
double
dy
=
0
;
double
dy
=
0
;
interp
->
Interpolate
(
x
,
y
,
dy
);
interp
->
Interpolate
(
x
,
y
,
dy
);
std
::
cout
<<
std
::
setprecision
(
15
)
<<
"Value at "
<<
x
<<
" : "
<<
y
<<
" (derivative "
<<
dy
<<
")
\n
"
;
std
::
cout
<<
std
::
setprecision
(
15
)
<<
"Value at "
<<
x
<<
" : "
<<
y
<<
" (derivative "
<<
dy
<<
")
\n
"
;
std
::
cout
<<
"- Should be :
-1154600.87561283 (derivative 1568.49913322402
)"
<<
std
::
endl
;
std
::
cout
<<
"- Should be :
"
<<
yExpected
<<
" (derivative "
<<
dyExpected
<<
"
)"
<<
std
::
endl
;
if
(
std
::
isnan
(
y
)
||
(
(
y
-
yExpected
)
/
yExpected
>
epsilon
))
return
EXIT_FAILURE
;
if
(
std
::
isnan
(
dy
)
||
(
(
dy
-
dyExpected
)
/
dyExpected
>
epsilon
))
return
EXIT_FAILURE
;
//Test limit situation
x
=
56640.0
;
yExpected
=
-
1556122.3685
;
dyExpected
=
1042.82980
;
interp
->
Interpolate
(
x
,
y
,
dy
);
std
::
cout
<<
std
::
setprecision
(
15
)
<<
"Value at "
<<
x
<<
" : "
<<
y
<<
" (derivative "
<<
dy
<<
")
\n
"
;
std
::
cout
<<
"- Should be : "
<<
yExpected
<<
" (derivative "
<<
dyExpected
<<
")"
<<
std
::
endl
;
if
(
std
::
isnan
(
y
)
||
(
(
y
-
yExpected
)
/
yExpected
>
epsilon
))
return
EXIT_FAILURE
;
if
(
std
::
isnan
(
dy
)
||
(
(
dy
-
dyExpected
)
/
dyExpected
>
epsilon
))
return
EXIT_FAILURE
;
x
=
56700.0
;
yExpected
=
-
1489827.1436
;
dyExpected
=
1165.61122
;
interp
->
Interpolate
(
x
,
y
,
dy
);
std
::
cout
<<
std
::
setprecision
(
15
)
<<
"Value at "
<<
x
<<
" : "
<<
y
<<
" (derivative "
<<
dy
<<
")
\n
"
;
std
::
cout
<<
"- Should be : "
<<
yExpected
<<
" (derivative "
<<
dyExpected
<<
")"
<<
std
::
endl
;
if
(
std
::
isnan
(
y
)
||
(
(
y
-
yExpected
)
/
yExpected
>
epsilon
))
return
EXIT_FAILURE
;
if
(
std
::
isnan
(
dy
)
||
(
(
dy
-
dyExpected
)
/
dyExpected
>
epsilon
))
return
EXIT_FAILURE
;
//Performance test
//Performance test
int
nTest
=
1000000
;
int
nTest
=
1000000
;
...
@@ -87,7 +133,6 @@ int ossimpluginsHermiteInterpolationTest(int argc, char * argv[])
...
@@ -87,7 +133,6 @@ int ossimpluginsHermiteInterpolationTest(int argc, char * argv[])
std
::
cout
<<
std
::
setprecision
(
15
)
<<
"Value at "
<<
x
<<
" : "
<<
y2
<<
"
\n
"
;
std
::
cout
<<
std
::
setprecision
(
15
)
<<
"Value at "
<<
x
<<
" : "
<<
y2
<<
"
\n
"
;
std
::
cout
<<
"- Should be : -1154600.87561283"
<<
std
::
endl
;
std
::
cout
<<
"- Should be : -1154600.87561283"
<<
std
::
endl
;
//Performance test
//Performance test
clock_gettime
(
CLOCK_REALTIME
,
&
startClock
);
clock_gettime
(
CLOCK_REALTIME
,
&
startClock
);
...
...
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