Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymatlib
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
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rahil Doshi
pymatlib
Commits
1d67844f
Commit
1d67844f
authored
2 months ago
by
Rahil Doshi
Browse files
Options
Downloads
Patches
Plain Diff
Refactor interpolate_double_lookup_cpp.h
parent
ceccff04
No related branches found
No related tags found
No related merge requests found
Pipeline
#77629
passed
2 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pymatlib/core/cpp/include/pymatlib_interpolators/interpolate_double_lookup_cpp.h
+4
-4
4 additions, 4 deletions
...de/pymatlib_interpolators/interpolate_double_lookup_cpp.h
with
4 additions
and
4 deletions
src/pymatlib/core/cpp/include/pymatlib_interpolators/interpolate_double_lookup_cpp.h
+
4
−
4
View file @
1d67844f
...
@@ -29,12 +29,12 @@ double interpolate_double_lookup_cpp(
...
@@ -29,12 +29,12 @@ double interpolate_double_lookup_cpp(
idx_y_neq
+=
arrs
.
y_neq
[
idx_y_neq
+
1
]
<
y_target
;
idx_y_neq
+=
arrs
.
y_neq
[
idx_y_neq
+
1
]
<
y_target
;
// Get interpolation points
// Get interpolation points
const
double
y1
=
arrs
.
y_neq
[
idx_y_neq
];
const
double
y2
=
arrs
.
y_neq
[
idx_y_neq
+
1
];
const
double
x1
=
arrs
.
x_eq
[
idx_y_neq
];
const
double
x1
=
arrs
.
x_eq
[
idx_y_neq
];
const
double
x2
=
arrs
.
x_eq
[
idx_y_neq
+
1
];
const
double
x2
=
arrs
.
x_eq
[
idx_y_neq
+
1
];
const
double
y1
=
arrs
.
y_neq
[
idx_y_neq
];
const
double
y2
=
arrs
.
y_neq
[
idx_y_neq
+
1
];
// Linear interpolation
// Linear interpolation
const
double
slope
=
(
x2
-
x1
)
/
(
y2
-
y1
);
const
double
inv_
slope
=
(
x2
-
x1
)
/
(
y2
-
y1
);
return
x1
+
slope
*
(
y_target
-
y1
);
return
x1
+
inv_
slope
*
(
y_target
-
y1
);
}
}
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