Function hercules::utils::invert

source ·
pub fn invert(x: &Array1<f64>) -> Array1<f64>
Expand description

Flips every bit in a point.

Example:

use hercules::qubo::Qubo;
use smolprng::{PRNG, JsfLarge};
use hercules::{initial_points, utils};

// generate a random QUBO
let mut prng = PRNG {
    generator: JsfLarge::default(),
};
let p = Qubo::make_random_qubo(10, &mut prng, 0.5);

// generate a random point inside with x in {0, 1}^10
let x_0 = utils::make_binary_point(p.num_x(), &mut prng);

// flip all of the bits
let x_1 = utils::invert(&x_0);