Using element-wise power in ndarray with num_complex::Complex64

⚓ Rust    📅 2025-08-20    👤 surdeus    👁️ 4      

surdeus

ndarray::ArrayBase's pow2, for example, does not work on num_complex::Complex64(trait bound Float).

The code I was trying to compile was like:

let array = array!(Complex64::new(1.0, 2.0));
let array_pow = array.pow2();

Can I get some guidance on how to use one of the power functions from ndarray on complex types?

I am new here, please excuse me if I posted at the wrong place.

4 posts - 2 participants

Read full topic

🏷️ Rust_feed