Skip to content

Commit 2a1f109

Browse files
hjabirdFMarno
andauthored
[oneMKL] dft::descriptor copy and move (#487) (#490)
* [oneMKL] dft::descriptor copy and move (#487) * Relates to #487 * Adds move constructor/assignment to descriptor class * Otherwise implicitly deleted. * Add explicit copy constructor/assignment to descriptor class * Otherwise ambigiuous * Notes that copy operation is by value. * Correct assignment signatures; Clarify copy by value to deep-copy * Reword (Suggestion FMarno) Co-authored-by: Finlay <finlay.marno@codeplay.com> --------- Co-authored-by: Finlay <finlay.marno@codeplay.com>
1 parent da2fcac commit 2a1f109

1 file changed

Lines changed: 86 additions & 1 deletion

File tree

source/elements/oneMKL/source/domains/dft/descriptor.rst

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,15 @@ The descriptor class lives in the ``oneapi::mkl::dft`` namespace.
3939
4040
// Syntax for d-dimensional DFT
4141
descriptor(std::vector<std::int64_t> dimensions);
42-
42+
43+
descriptor(const descriptor&);
44+
45+
descriptor(descriptor&&);
46+
47+
descriptor& operator=(const descriptor&);
48+
49+
descriptor& operator=(descriptor&&);
50+
4351
~descriptor();
4452
4553
@@ -78,6 +86,8 @@ The descriptor class lives in the ``oneapi::mkl::dft`` namespace.
7886
- Description
7987
* - :ref:`constructors<onemkl_dft_descriptor_constructor>`
8088
- Initialize descriptor for 1-dimensional or N-dimensional transformations
89+
* - :ref:`assignment operators<onemkl_dft_descriptor_assignment_operator>`
90+
- Assignment operator.
8191
* - :ref:`onemkl_dft_descriptor_set_value`
8292
- Sets one particular configuration parameter with the specified configuration value.
8393
* - :ref:`onemkl_dft_descriptor_get_value`
@@ -104,6 +114,8 @@ factors. The function :ref:`onemkl_dft_descriptor_commit` does this work
104114
after use of the function :ref:`onemkl_dft_descriptor_set_value` to set values
105115
of all necessary parameters.
106116

117+
The copy constructor performs a deep copy of the descriptor.
118+
107119
.. rubric:: Syntax (one-dimensional transform)
108120

109121
.. code-block:: cpp
@@ -127,6 +139,28 @@ of all necessary parameters.
127139
128140
}
129141
142+
.. rubric:: Copy constructor
143+
144+
.. code-block:: cpp
145+
146+
namespace oneapi::mkl::dft {
147+
148+
template <oneapi::mkl::dft::precision prec, oneapi::mkl::dft::domain dom>
149+
descriptor<prec,dom>(const descriptor<prec,dom>& other);
150+
151+
}
152+
153+
.. rubric:: Move constructor
154+
155+
.. code-block:: cpp
156+
157+
namespace oneapi::mkl::dft {
158+
159+
template <oneapi::mkl::dft::precision prec, oneapi::mkl::dft::domain dom>
160+
descriptor<prec,dom>(descriptor<prec,dom>&& other);
161+
162+
}
163+
130164
131165
.. container:: section
132166

@@ -138,6 +172,9 @@ of all necessary parameters.
138172
dimensions
139173
vector of :math:`d\geq 0` dimensions(lengths) of data for a d-dimensional transform.
140174

175+
other
176+
another descriptor of the same type to copy or move
177+
141178
.. container:: section
142179

143180
.. rubric:: Throws
@@ -154,6 +191,54 @@ of all necessary parameters.
154191
**Descriptor class member table:** :ref:`onemkl_dft_descriptor_member_table`
155192

156193

194+
.. _onemkl_dft_descriptor_assignment_operator:
195+
196+
Descriptor class assignment operators
197+
+++++++++++++++++++++++++++++++++++++
198+
199+
The copy assignment operator results in a deep copy.
200+
201+
.. rubric:: Copy assignment
202+
203+
.. code-block:: cpp
204+
205+
namespace oneapi::mkl::dft {
206+
207+
template <oneapi::mkl::dft::precision prec, oneapi::mkl::dft::domain dom>
208+
descriptor<prec,dom>& descriptor<prec,dom>::operator=(const descriptor<prec,dom>& other);
209+
210+
}
211+
212+
.. rubric:: Move assignment
213+
214+
.. code-block:: cpp
215+
216+
namespace oneapi::mkl::dft {
217+
218+
template <oneapi::mkl::dft::precision prec, oneapi::mkl::dft::domain dom>
219+
descriptor<prec,dom>& descriptor<prec,dom>::operator=(descriptor<prec,dom>&& other);
220+
221+
}
222+
223+
224+
.. container:: section
225+
226+
.. rubric:: Input Parameters
227+
228+
other
229+
The descriptor to copy or move from.
230+
231+
.. container:: section
232+
233+
.. rubric:: Throws
234+
235+
The assignment opererator shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here:
236+
237+
:ref:`oneapi::mkl::host_bad_alloc()<onemkl_exception_host_bad_alloc>`
238+
If any memory allocations on host have failed, for instance due to insufficient memory.
239+
240+
241+
**Descriptor class member table:** :ref:`onemkl_dft_descriptor_member_table`
157242

158243
.. _onemkl_dft_descriptor_set_value:
159244

0 commit comments

Comments
 (0)