pub fn copy_conj_into<T: ElementOpApply + Send + Sync + 'static>(
dest: &mut StridedViewMut<'_, T>,
src: &StridedView<'_, T>,
exec: Exec<'_>,
) -> Result<()>Expand description
Copy elements with complex conjugation: dest[i] = conj(src[i]).
The same HPTT-inspired blocked permutation as copy_into, with the
conjugate applied as each element is stored — HPTT’s conjA, so conjugation
costs no extra pass over memory. The store is monomorphized, so the engine
keeps its native f64/f32 micro-kernels for a plain copy and its generic
element path for this one. The plan, the width selection
(copy_ns_per_element times the elements) and
the error set are those of copy_into.
T: ElementOpApply ([strided_view::ElementOpApply]) is the bound
strided_basic::copy_conj_into uses, so the two entries line up. The
operation is meaningful for the complex element types (Complex<f32>,
Complex<f64>). An element type whose conj is the identity (every real
type) is accepted and copied unchanged through the generic element store,
which is slower than the native kernels: use copy_into for those.
§Errors
Same rejection set as copy_into: [StridedError::RankMismatch],
[StridedError::ShapeMismatch], [StridedError::OffsetOverflow] and
[StridedError::NonInjectiveOutputLayout]. Nothing is written unless
validation succeeds.
§Examples
use num_complex::Complex64;
use threadteam::Exec;
use strided_perm::copy_conj_into;
use strided_view::StridedArray;
let src = StridedArray::<Complex64>::from_fn_col_major(&[2, 3], |idx| {
Complex64::new(idx[0] as f64, idx[1] as f64)
});
let mut dst = StridedArray::<Complex64>::col_major(&[3, 2]);
let src_t = src.view().permute(&[1, 0]).unwrap();
copy_conj_into(&mut dst.view_mut(), &src_t, Exec::serial()).unwrap();
assert_eq!(dst.get(&[2, 1]), Complex64::new(1.0, -2.0));