Skip to content

Commit

Permalink
Pass output views by const ref (#161)
Browse files Browse the repository at this point in the history
* Pass output views by const ref

* Update accordingly the documentation
  • Loading branch information
tpadioleau authored Oct 9, 2024
1 parent c8ba790 commit 0d3a662
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/api/hermitian/hfft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::hfft
---------------

.. doxygenfunction:: KokkosFFT::hfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
.. doxygenfunction:: KokkosFFT::hfft(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
2 changes: 1 addition & 1 deletion docs/api/hermitian/ihfft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::ihfft
----------------

.. doxygenfunction:: KokkosFFT::ihfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
.. doxygenfunction:: KokkosFFT::ihfft(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
2 changes: 1 addition & 1 deletion docs/api/real/irfft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::irfft
----------------

.. doxygenfunction:: KokkosFFT::irfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
.. doxygenfunction:: KokkosFFT::irfft(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
2 changes: 1 addition & 1 deletion docs/api/real/irfft2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
KokkosFFT::irfft2
-----------------
.. doxygenfunction:: KokkosFFT::irfft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
.. doxygenfunction:: KokkosFFT::irfft2(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
2 changes: 1 addition & 1 deletion docs/api/real/irfftn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
KokkosFFT::irfftn
-----------------

.. doxygenfunction:: KokkosFFT::irfftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization, shape_type<DIM> s)
.. doxygenfunction:: KokkosFFT::irfftn(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization, shape_type<DIM> s)

2 changes: 1 addition & 1 deletion docs/api/real/rfft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::rfft
---------------

.. doxygenfunction:: KokkosFFT::rfft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
.. doxygenfunction:: KokkosFFT::rfft(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
2 changes: 1 addition & 1 deletion docs/api/real/rfft2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::rfft2
----------------

.. doxygenfunction:: KokkosFFT::rfft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
.. doxygenfunction:: KokkosFFT::rfft2(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
2 changes: 1 addition & 1 deletion docs/api/real/rfftn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::rfftn
----------------

.. doxygenfunction:: KokkosFFT::rfftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization, shape_type<DIM> s)
.. doxygenfunction:: KokkosFFT::rfftn(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization, shape_type<DIM> s)
2 changes: 1 addition & 1 deletion docs/api/standard/fft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::fft
--------------

.. doxygenfunction:: KokkosFFT::fft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
.. doxygenfunction:: KokkosFFT::fft(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
2 changes: 1 addition & 1 deletion docs/api/standard/fft2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::fft2
---------------

.. doxygenfunction:: KokkosFFT::fft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
.. doxygenfunction:: KokkosFFT::fft2(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
2 changes: 1 addition & 1 deletion docs/api/standard/fftn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::fftn
---------------

.. doxygenfunction:: KokkosFFT::fftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization norm, shape_type<DIM> s)
.. doxygenfunction:: KokkosFFT::fftn(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization norm, shape_type<DIM> s)
2 changes: 1 addition & 1 deletion docs/api/standard/ifft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::ifft
---------------

.. doxygenfunction:: KokkosFFT::ifft(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
.. doxygenfunction:: KokkosFFT::ifft(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, int axis, std::optional<std::size_t> n)
2 changes: 1 addition & 1 deletion docs/api/standard/ifft2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::ifft2
----------------

.. doxygenfunction:: KokkosFFT::ifft2(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
.. doxygenfunction:: KokkosFFT::ifft2(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, KokkosFFT::Normalization, axis_type<2> axes, shape_type<2> s)
2 changes: 1 addition & 1 deletion docs/api/standard/ifftn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
KokkosFFT::ifftn
----------------

.. doxygenfunction:: KokkosFFT::ifftn(const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization, shape_type<DIM> s)
.. doxygenfunction:: KokkosFFT::ifftn(const ExecutionSpace& exec_space, const InViewType& in, const OutViewType& out, axis_type<DIM> axes, KokkosFFT::Normalization, shape_type<DIM> s)
32 changes: 18 additions & 14 deletions fft/src/KokkosFFT_Transform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace KokkosFFT {
/// nullopt)
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void fft(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
int axis = -1, std::optional<std::size_t> n = std::nullopt) {
static_assert(
Expand Down Expand Up @@ -159,7 +159,7 @@ void fft(const ExecutionSpace& exec_space, const InViewType& in,
/// nullopt)
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void ifft(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
int axis = -1, std::optional<std::size_t> n = std::nullopt) {
static_assert(
Expand Down Expand Up @@ -189,7 +189,7 @@ void ifft(const ExecutionSpace& exec_space, const InViewType& in,
/// nullopt)
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void rfft(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
int axis = -1, std::optional<std::size_t> n = std::nullopt) {
static_assert(
Expand Down Expand Up @@ -225,7 +225,7 @@ void rfft(const ExecutionSpace& exec_space, const InViewType& in,
/// nullopt)
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void irfft(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
int axis = -1, std::optional<std::size_t> n = std::nullopt) {
static_assert(
Expand Down Expand Up @@ -262,7 +262,7 @@ void irfft(const ExecutionSpace& exec_space, const InViewType& in,
/// nullopt)
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void hfft(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
int axis = -1, std::optional<std::size_t> n = std::nullopt) {
static_assert(
Expand Down Expand Up @@ -306,7 +306,7 @@ void hfft(const ExecutionSpace& exec_space, const InViewType& in,
/// nullopt)
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void ihfft(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
int axis = -1, std::optional<std::size_t> n = std::nullopt) {
static_assert(
Expand Down Expand Up @@ -347,7 +347,7 @@ void ihfft(const ExecutionSpace& exec_space, const InViewType& in,
/// \param s [in] Shape of the transformed axis of the output (default, {})
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void fft2(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
axis_type<2> axes = {-2, -1}, shape_type<2> s = {}) {
static_assert(
Expand Down Expand Up @@ -376,7 +376,7 @@ void fft2(const ExecutionSpace& exec_space, const InViewType& in,
/// \param s [in] Shape of the transformed axis of the output (default, {})
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void ifft2(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
axis_type<2> axes = {-2, -1}, shape_type<2> s = {}) {
static_assert(
Expand Down Expand Up @@ -406,7 +406,7 @@ void ifft2(const ExecutionSpace& exec_space, const InViewType& in,
/// \param s [in] Shape of the transformed axis of the output (default, {})
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void rfft2(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
axis_type<2> axes = {-2, -1}, shape_type<2> s = {}) {
static_assert(
Expand Down Expand Up @@ -442,7 +442,7 @@ void rfft2(const ExecutionSpace& exec_space, const InViewType& in,
/// \param s [in] Shape of the transformed axis of the output (default, {})
template <typename ExecutionSpace, typename InViewType, typename OutViewType>
void irfft2(const ExecutionSpace& exec_space, const InViewType& in,
OutViewType& out,
const OutViewType& out,
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
axis_type<2> axes = {-2, -1}, shape_type<2> s = {}) {
static_assert(
Expand Down Expand Up @@ -486,7 +486,8 @@ template <typename ExecutionSpace, typename InViewType, typename OutViewType,
std::size_t DIM = InViewType::rank()>
#endif
void fftn(
const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out,
const ExecutionSpace& exec_space, const InViewType& in,
const OutViewType& out,
axis_type<DIM> axes =
KokkosFFT::Impl::index_sequence<int, DIM, -static_cast<int>(DIM)>(),
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
Expand Down Expand Up @@ -526,7 +527,8 @@ template <typename ExecutionSpace, typename InViewType, typename OutViewType,
std::size_t DIM = InViewType::rank()>
#endif
void ifftn(
const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out,
const ExecutionSpace& exec_space, const InViewType& in,
const OutViewType& out,
axis_type<DIM> axes =
KokkosFFT::Impl::index_sequence<int, DIM, -static_cast<int>(DIM)>(),
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
Expand Down Expand Up @@ -568,7 +570,8 @@ template <typename ExecutionSpace, typename InViewType, typename OutViewType,
std::size_t DIM = InViewType::rank()>
#endif
void rfftn(
const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out,
const ExecutionSpace& exec_space, const InViewType& in,
const OutViewType& out,
axis_type<DIM> axes =
KokkosFFT::Impl::index_sequence<int, DIM, -static_cast<int>(DIM)>(),
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
Expand Down Expand Up @@ -616,7 +619,8 @@ template <typename ExecutionSpace, typename InViewType, typename OutViewType,
std::size_t DIM = InViewType::rank()>
#endif
void irfftn(
const ExecutionSpace& exec_space, const InViewType& in, OutViewType& out,
const ExecutionSpace& exec_space, const InViewType& in,
const OutViewType& out,
axis_type<DIM> axes =
KokkosFFT::Impl::index_sequence<int, DIM, -static_cast<int>(DIM)>(),
KokkosFFT::Normalization norm = KokkosFFT::Normalization::backward,
Expand Down

0 comments on commit 0d3a662

Please sign in to comment.