Loading [MathJax]/jax/output/HTML-CSS/jax.js

Template Function Pennylane::LightningQubit::Gates::AVXCommon::toParity

Function Documentation

template<typename PrecisionT, std::size_t packed_size, typename Func>
auto Pennylane::LightningQubit::Gates::AVXCommon::toParity(Func &&func) -> AVXIntrinsicType<PrecisionT, packed_size>

For a function f(x) with binary output, this function creates an AVX intrinsic floating-point type with values (1)f(x) where x is index of an array (viewed as a complex-valued array).

For example, when f(x)=x, this returns a packed array with values [1, 1, -1, -1, 1, 1, -1, -1]. Note that each value is repeated twice as it applies to the both real and imaginary parts. This function is used e.g. in CZ gate.

Template Parameters
  • PrecisionT – Floating point precision type

  • packed_size – Number of packed values for a AVX intrinsic type

  • Func – Type of a function

Parameters

func – Binary output function