Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alta
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alta
alta
Commits
f519aa73
Commit
f519aa73
authored
Nov 05, 2013
by
Laurent Belcour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The matlab interpolator is returning Nans for a lot of values
parent
df6b8a59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
sources/plugins/data_interpolant_matlab/data.cpp
sources/plugins/data_interpolant_matlab/data.cpp
+7
-15
No files found.
sources/plugins/data_interpolant_matlab/data.cpp
View file @
f519aa73
...
...
@@ -25,11 +25,15 @@ data_interpolant::data_interpolant()
{
std
::
cerr
<<
"<ERROR>> can't start MATLAB engine"
<<
std
::
endl
;
}
output
[
BUFFER_SIZE
]
=
'\0'
;
engOutputBuffer
(
ep
,
output
,
BUFFER_SIZE
)
;
}
data_interpolant
::~
data_interpolant
()
{
delete
_data
;
delete
[]
output
;
mxDestroyArray
(
x
);
mxDestroyArray
(
y
);
...
...
@@ -74,17 +78,8 @@ void data_interpolant::load(const std::string& filename)
Y
=
mxCreateDoubleMatrix
(
_data
->
size
(),
dimY
(),
mxREAL
);
memcpy
((
void
*
)
mxGetPr
(
Y
),
(
void
*
)
eY
.
data
(),
_data
->
size
()
*
dimY
()
*
sizeof
(
double
));
engPutVariable
(
ep
,
"Y"
,
Y
);
output
[
BUFFER_SIZE
]
=
'\0'
;
engOutputBuffer
(
ep
,
output
,
BUFFER_SIZE
)
;
engEvalString
(
ep
,
"display(X)"
);
std
::
cout
<<
output
<<
std
::
endl
;
engEvalString
(
ep
,
"display(Y)"
);
std
::
cout
<<
output
<<
std
::
endl
;
x
=
mxCreateDoubleMatrix
(
1
,
dimX
(),
mxREAL
);
engPutVariable
(
ep
,
"x"
,
x
);
}
void
data_interpolant
::
load
(
const
std
::
string
&
filename
,
const
arguments
&
)
{
...
...
@@ -124,16 +119,13 @@ vec data_interpolant::value(vec ax) const
// Copy the input vector to matlab code
memcpy
((
void
*
)
mxGetPr
(
x
),
(
void
*
)
&
ax
[
0
],
dimX
()
*
sizeof
(
double
));
engPutVariable
(
ep
,
"x"
,
x
);
// Evaluate the matlab routine
std
::
stringstream
cmd
;
cmd
<<
"y = griddatan(X(:, 1:"
<<
dimX
()
<<
"), Y(:, 1), x)"
;
cmd
<<
"y = griddatan(X(:, 1:"
<<
dimX
()
<<
"), Y(:, 1), x)
;
"
;
engEvalString
(
ep
,
cmd
.
str
().
c_str
());
std
::
cout
<<
output
<<
std
::
endl
;
engEvalString
(
ep
,
"display(y)"
);
std
::
cout
<<
output
<<
std
::
endl
;
// Get results and copy it
y
=
engGetVariable
(
ep
,
"y"
)
;
double
*
y_val
=
(
double
*
)
mxGetData
(
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