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,
conjugated_ accessor< Accessor>
if the expression conj( E) is 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 U> U conj( const U& ) = delete ; ; otherwise,
Accessor . Returns : Let
MD be
mdspan< typename A:: element_ type, Extents, Layout, A> . MD( a. data_ handle( ) , a. mapping( ) , a. accessor( ) . nested_ accessor( ) )
if Accessor is a specialization of conjugated_ accessor ;otherwise,
a , if is_ same_ v< A, Accessor> is true ; otherwise,
MD( 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 ]