Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
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
Container Registry
Model registry
Operate
Environments
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
FSL
miscmaths
Commits
0b7ca0db
Commit
0b7ca0db
authored
6 months ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
ENH: New function to copy spline coefficients
parent
34d41608
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!17
ENH: Allow `Splinterpolator` instances to be created from an existing set of spline coefficients, and extend extrapolation options
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
splinterpolator.h
+17
-2
17 additions, 2 deletions
splinterpolator.h
with
17 additions
and
2 deletions
splinterpolator.h
+
17
−
2
View file @
0b7ca0db
...
...
@@ -64,8 +64,7 @@ public:
ExtrapolationType
et
=
Zeros
,
unsigned
int
order
=
3
,
bool
copy_low_order
=
true
,
Utilities
::
NoOfThreads
nthr
=
Utilities
::
NoOfThreads
(
1
),
Utilities
::
NoOfThreads
nthr
=
Utilities
::
NoOfThreads
(
1
),
double
prec
=
1e-8
,
bool
data_are_coefs
=
false
)
:
_valid
(
false
),
_own_coef
(
false
),
_coef
(
0
),
_cptr
(
0
),
_ndim
(
0
),
_nthr
(
nthr
.
_n
)
...
...
@@ -84,6 +83,22 @@ public:
Splinterpolator
&
operator
=
(
const
Splinterpolator
&
src
)
{
if
(
_own_coef
)
delete
[]
_coef
;
assign
(
src
);
return
(
*
this
);
}
// Copy the spline coefficients into dest.
void
Copy
(
std
::
vector
<
T
>&
dest
)
{
unsigned
int
N
=
1
;
for
(
auto
d
:
_dim
)
{
N
*=
d
;
}
dest
.
resize
(
N
);
auto
coefs
=
coef_ptr
();
for
(
unsigned
int
i
=
0
;
i
<
N
;
i
++
)
{
dest
[
i
]
=
coefs
[
i
];
}
}
// Set new data in Splinterpolator.
void
Set
(
const
T
*
data_or_coefs
,
const
std
::
vector
<
unsigned
int
>&
dim
,
...
...
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