Skip to content

Commit

Permalink
update separations under permute and convolve
Browse files Browse the repository at this point in the history
  • Loading branch information
tianluyuan committed Dec 22, 2023
1 parent 4826d37 commit 2b03fde
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions include/photospline/detail/convolve.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ void splinetable<Alloc>::convolve(const uint32_t dim, const double* conv_knots,
double* src = (i!=dim ? knots_store[i].get() : rho);
std::copy(src,src+nknots[i],&knots[i][0]);
}

// Update knot separations
dknot_bounds();

/*
* NB: A monotonic function remains monotonic after convolution
Expand Down
5 changes: 4 additions & 1 deletion include/photospline/detail/permute.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,11 @@ void splinetable<Alloc>::permuteDimensions(const std::vector<size_t>& permutatio
extents[i][1]=t_extents[i][1];
}
std::copy(t_coefficients.get(),t_coefficients.get()+ncoeffs,coefficients);

// Update knot separations
dknot_bounds();
}

} //namespace photospline

#endif
#endif
10 changes: 8 additions & 2 deletions include/photospline/splinetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ class splinetable{
snew->nknots = snew->allocate<uint64_t>(s2->ndim);
std::copy_n(s2->nknots,s2->ndim,snew->nknots);

snew->rmin_sep = snew->allocate<double>(s2->ndim);
std::copy_n(s2->rmin_sep,s2->ndim,snew->rmin_sep);

snew->rmax_sep = snew->allocate<double>(s2->ndim);
std::copy_n(s2->rmax_sep,s2->ndim,snew->rmax_sep);

snew->knots = snew->allocate<double_ptr>(s2->ndim);
for(unsigned int i=0; i<s2->ndim; i++){
snew->knots[i] = snew->allocate<double>(s2->nknots[i]+2*s2->order[i]) + s2->order[i];
Expand All @@ -211,8 +217,6 @@ class splinetable{
}

snew->periods = NULL;
snew->rmin_sep = NULL;
snew->rmax_sep = NULL;
snew->naux = 0;
snew->aux = NULL;

Expand Down Expand Up @@ -273,6 +277,8 @@ class splinetable{
lastKnots[nknots[inputDim]-1]=2*lastKnots[nknots[inputDim]-2]-lastKnots[nknots[inputDim]-3];
}

rmin_sep=allocate<double>(ndim);
rmax_sep=allocate<double>(ndim);
dknot_bounds();

//set naxes
Expand Down

0 comments on commit 2b03fde

Please sign in to comment.