29.9 Basic linear algebra algorithms [linalg]
template<class ElementType, class Extents, class Layout, class Accessor>
constexpr auto conjugated(mdspan<ElementType, Extents, Layout, Accessor> a);
Let
A be
- remove_cvref_t<decltype(a.accessor().nested_accessor())>
if Accessor is a specialization of conjugated_accessor; otherwise,
- Accessor if remove_cvref_t<ElementType> is an arithmetic type; otherwise,
- Accessor if the expression conj(E) is not valid for any subexpression E
whose type is remove_cvref_t<ElementType>
with overload resolution performed in a context that includes the declaration
template<class T> conj(const T&) = delete;; and otherwise,
- conjugated_accessor<Accessor>.
Returns:
- The value
mdspan<typename A::element_type, Extents, Layout, A>(a.data_handle(), a.mapping(),
a.accessor().nested_accessor())
if Accessor is a specialization of conjugated_accessor; otherwise,
- a if remove_cvref_t<ElementType> is an arithmetic type; otherwise,
- a if the expression conj(E) is not valid for any subexpression E
whose type is remove_cvref_t<ElementType>
with overload resolution performed in a context that includes the declaration
template<class T> conj(const T&) = delete;; and otherwise,
- the value
mdspan<typename A::element_type, Extents, Layout, A>(a.data_handle(), a.mapping(),
conjugated_accessor(a.accessor()))
[
Example 1:
void test_conjugated_complex(mdspan<complex<double>, extents<int, 10>> a) {
auto a_conj = conjugated(a);
for (int i = 0; i < a.extent(0); ++i) {
assert(a_conj[i] == conj(a[i]);
}
auto a_conj_conj = conjugated(a_conj);
for (int i = 0; i < a.extent(0); ++i) {
assert(a_conj_conj[i] == a[i]);
}
}
void test_conjugated_real(mdspan<double, extents<int, 10>> a) {
auto a_conj = conjugated(a);
for (int i = 0; i < a.extent(0); ++i) {
assert(a_conj[i] == a[i]);
}
auto a_conj_conj = conjugated(a_conj);
for (int i = 0; i < a.extent(0); ++i) {
assert(a_conj_conj[i] == a[i]);
}
}
—
end example]