Struct qmc::sse::fast_ops::FastOpsTemplate[][src]

pub struct FastOpsTemplate<O: Op, ALLOC: FastOpAllocator = DefaultFastOpAllocator> { /* fields omitted */ }
Expand description

A fast op container.

Implementations

impl<O: Op + Clone, ALLOC: FastOpAllocator> FastOpsTemplate<O, ALLOC>[src]

pub fn new_from_nvars_and_nbonds_and_alloc(
    nvars: usize,
    nbonds: Option<usize>,
    alloc: ALLOC
) -> Self
[src]

A new manager which can handle nvars and is optimized for nbonds, will allocate memory using the given allocator.

pub fn new_from_nvars_and_nbonds(nvars: usize, nbonds: Option<usize>) -> Self[src]

A new manager which can handle nvars and is optimized for nbonds.

pub fn new_from_nvars(nvars: usize) -> Self[src]

New manager which can handle nvars

pub fn new_from_ops<I>(nvars: usize, ps_and_ops: I) -> Self where
    I: IntoIterator<Item = (usize, O)>, 
[src]

Make a new Manager from an interator of ops, and number of variables.

Trait Implementations

impl<O: Clone + Op, ALLOC: Clone + FastOpAllocator> Clone for FastOpsTemplate<O, ALLOC>[src]

fn clone(&self) -> FastOpsTemplate<O, ALLOC>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<O: Op + Clone, ALLOC: FastOpAllocator> ClusterUpdater for FastOpsTemplate<O, ALLOC>[src]

fn flip_each_cluster_ising_symmetry_rng<R: Rng>(
    &mut self,
    prob: f64,
    rng: &mut R,
    state: &mut [bool]
)
[src]

Flip each cluster in the graph using an rng instance, add to state changes in acc. Use this version if there’s ising symmetry in your graph. Read more

fn flip_each_cluster_rng<R: Rng, F>(
    &mut self,
    prob: f64,
    rng: &mut R,
    state: &mut [bool],
    weight_change_on_global_flip: Option<F>
) where
    F: Fn(&Self::Node) -> f64
[src]

Flip each cluster in the graph using an rng instance, add to state changes in acc. You can provide a function to adjust the weights for flipping each cluster based off the nodes within it. Edges of the cluster will always be constant ops but the total weight change inside the cluster will affect the probability of acceptance (multiplied by a global prob for each cluster). This function should take a node reference and return the ratio of the new weight divided by old weight if a global spin flip were to take place. Read more

fn find_constant_op(&self) -> Option<usize>[src]

Find a site with a constant op.

fn post_cluster_update_hook(&mut self)[src]

Called after an update.

impl<O: Debug + Op, ALLOC: Debug + FastOpAllocator> Debug for FastOpsTemplate<O, ALLOC>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<O: Op, ALLOC: FastOpAllocator> DebugOps for FastOpsTemplate<O, ALLOC>[src]

fn count_diagonal_and_off(&self) -> (usize, usize)[src]

Count the number of diagonal and offdiagonal ops. Sum is self.get_n()

fn count_constant_ops(&self) -> usize[src]

Count the number of constant ops.

impl<O: Op + Clone, ALLOC: FastOpAllocator> DiagonalSubsection for FastOpsTemplate<O, ALLOC>[src]

type Args = FastOpMutateArgs

The type required for mutating p values.

fn mutate_p<T, F>(
    &mut self,
    f: F,
    p: usize,
    t: T,
    args: Self::Args
) -> (T, Self::Args) where
    F: Fn(&Self, Option<&Self::Op>, T) -> (Option<Option<Self::Op>>, T)
[src]

Mutate a single p value.

fn mutate_subsection<T, F>(
    &mut self,
    pstart: usize,
    pend: usize,
    t: T,
    f: F,
    args: Option<Self::Args>
) -> T where
    F: Fn(&Self, Option<&Self::Op>, T) -> (Option<Option<Self::Op>>, T)
[src]

Mutate using a restricted prange and args. Allows for running on smaller subsections of the variables. Read more

fn mutate_subsection_ops<T, F>(
    &mut self,
    pstart: usize,
    pend: usize,
    t: T,
    f: F,
    args: Option<Self::Args>
) -> T where
    F: Fn(&Self, &Self::Op, usize, T) -> (Option<Option<Self::Op>>, T)
[src]

Mutate ops using a restricted prange and args. Allows for running on smaller subsections of the variables. Read more

fn get_empty_args(
    &mut self,
    vars: SubvarAccess<'_, FastOpMutateArgs>
) -> FastOpMutateArgs
[src]

Get empty args for a subsection of variables, or from an existing set of args (does not clear).

fn fill_args_at_p(&self, p: usize, empty_args: Self::Args) -> Self::Args[src]

Get the args required for mutation.

fn fill_args_at_p_with_hint<It>(
    &self,
    p: usize,
    args: &mut Self::Args,
    vars: &[usize],
    hint: It
) where
    It: IntoIterator<Item = Option<usize>>, 
[src]

Use a list of ps to make args. Hint provides up to one ps per var in order. Read more

fn return_args(&mut self, args: Self::Args)[src]

Returns arg made for the mutation

fn get_propagated_substate_with_hint<It>(
    &self,
    p: usize,
    substate: &mut [bool],
    state: &[bool],
    vars: &[usize],
    hint: It
) where
    It: IntoIterator<Item = Option<usize>>, 
[src]

Get the substate at p using ps to set values. Hint provides up to one ps per var in order. substate should start in p=0 configuration. Read more

fn iter_ops_above_p<T, F, G>(&self, p: usize, t: T, f: F, f_at_p: G) -> T where
    F: Fn(usize, &Self::Node, T) -> (T, bool),
    G: Fn(&Self::Node, T) -> (T, bool)
[src]

Iterate over ops at indices less than or equal to p. Applies function f_at_p only to the op at p. Applies f to all other ops above p. Read more

impl<O: Op + Clone, ALLOC: FastOpAllocator> DiagonalUpdater for FastOpsTemplate<O, ALLOC>[src]

fn mutate_ps<F, T>(&mut self, pstart: usize, pend: usize, t: T, f: F) -> T where
    F: Fn(&Self, Option<&Self::Op>, T) -> (Option<Option<Self::Op>>, T)
[src]

Folds across the p values, passing T down. Mutates op if returned values is Some(…)

fn mutate_ops<F, T>(&mut self, pstart: usize, pend: usize, t: T, f: F) -> T where
    F: Fn(&Self, &Self::Op, usize, T) -> (Option<Option<Self::Op>>, T)
[src]

Mutate only the ops. Override with more efficient solutions if needed.

fn try_iterate_ps<F, T, V>(
    &self,
    pstart: usize,
    pend: usize,
    t: T,
    f: F
) -> Result<T, V> where
    F: Fn(&Self, Option<&Self::Op>, T) -> Result<T, V>, 
[src]

Iterate through the ops and call f. Exit early with Err(v).

fn try_iterate_ops<F, T, V>(
    &self,
    pstart: usize,
    pend: usize,
    t: T,
    f: F
) -> Result<T, V> where
    F: Fn(&Self, &Self::Op, usize, T) -> Result<T, V>, 
[src]

Iterate through ops only. Can override with more efficient implementation.

fn iterate_ps<F, T>(&self, pstart: usize, pend: usize, t: T, f: F) -> T where
    F: Fn(&Self, Option<&Self::Op>, T) -> T, 
[src]

Iterate through the ops and call f.

fn iterate_ops<F, T>(&self, pstart: usize, pend: usize, t: T, f: F) -> T where
    F: Fn(&Self, &Self::Op, usize, T) -> T, 
[src]

Iterate through ops only. Calls try_iterate_ops by default. Read more

fn make_diagonal_update<'b, H: Hamiltonian<'b>>(
    &mut self,
    cutoff: usize,
    beta: f64,
    state: &[bool],
    hamiltonian: &H
)
[src]

Perform a diagonal update step with thread rng.

fn make_diagonal_update_with_rng<'b, H: Hamiltonian<'b>, R: Rng>(
    &mut self,
    cutoff: usize,
    beta: f64,
    state: &[bool],
    hamiltonian: &H,
    rng: &mut R
)
[src]

Perform a diagonal update step.

fn make_diagonal_update_with_rng_and_state_ref<'b, H: Hamiltonian<'b>, R: Rng>(
    &mut self,
    cutoff: usize,
    beta: f64,
    state: &mut [bool],
    hamiltonian: &H,
    rng: &mut R
)
[src]

Perform a diagonal update step using in place edits to state.

fn post_diagonal_update_hook(&mut self)[src]

Called after an update.

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<BinaryHeap<Reverse<usize>>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> BinaryHeap<Reverse<usize>>[src]

Get an instance of T

fn return_instance(&mut self, t: BinaryHeap<Reverse<usize>>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<BondContainer<VarPos>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> BondContainer<VarPos>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<VarPos>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<BondContainer<usize>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> BondContainer<usize>[src]

Get an instance of T

fn return_instance(&mut self, t: BondContainer<usize>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<Vec<(usize, OpSide), Global>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> Vec<(usize, OpSide)>[src]

Get an instance of T

fn return_instance(&mut self, t: Vec<(usize, OpSide)>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<Vec<OpSide, Global>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> Vec<OpSide>[src]

Get an instance of T

fn return_instance(&mut self, t: Vec<OpSide>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<Vec<Option<usize>, Global>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> Vec<Option<usize>>[src]

Get an instance of T

fn return_instance(&mut self, t: Vec<Option<usize>>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<Vec<bool, Global>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> Vec<bool>[src]

Get an instance of T

fn return_instance(&mut self, t: Vec<bool>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<Vec<f64, Global>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> Vec<f64>[src]

Get an instance of T

fn return_instance(&mut self, t: Vec<f64>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> Factory<Vec<usize, Global>> for FastOpsTemplate<O, ALLOC>[src]

fn get_instance(&mut self) -> Vec<usize>[src]

Get an instance of T

fn return_instance(&mut self, t: Vec<usize>)[src]

Return an instance of T

impl<O: Op + Clone, ALLOC: FastOpAllocator> HeatBathDiagonalUpdater for FastOpsTemplate<O, ALLOC>[src]

fn make_heatbath_diagonal_update<'b, H: Hamiltonian<'b>>(
    &mut self,
    cutoff: usize,
    beta: f64,
    state: &[bool],
    hamiltonian: &H,
    bond_weights: &BondWeights
)
[src]

Perform a single heatbath update.

fn make_heatbath_diagonal_update_with_rng<'b, H: Hamiltonian<'b>, R: Rng>(
    &mut self,
    cutoff: usize,
    beta: f64,
    state: &[bool],
    hamiltonian: &H,
    bond_weights: &BondWeights,
    rng: &mut R
)
[src]

Perform a single heatbath update.

fn make_heatbath_diagonal_update_with_rng_and_state_ref<'b, H: Hamiltonian<'b>, R: Rng>(
    &mut self,
    cutoff: usize,
    beta: f64,
    state: &mut [bool],
    hamiltonian: &H,
    bond_weights: &BondWeights,
    rng: &mut R
)
[src]

Perform a single heatbath update.

fn make_bond_weights<'b, H, E>(
    hamiltonian: H,
    num_bonds: usize,
    bonds_fn: E
) -> BondWeights where
    H: Fn(&[usize], usize, &[bool], &[bool]) -> f64,
    E: Fn(usize) -> &'b [usize]
[src]

Make the bond weights struct for this container.

fn heat_bath_single_diagonal_update<'b, H: Hamiltonian<'b>, R: Rng>(
    op: Option<&Self::Op>,
    cutoff: usize,
    n: usize,
    beta: f64,
    state: &mut [bool],
    hamiltonian_and_weights: (&H, &BondWeights),
    rng: &mut R
) -> Option<Option<Self::Op>>
[src]

Perform a single heatbath update.

impl<O: Op + Clone, ALLOC: FastOpAllocator> LoopUpdater for FastOpsTemplate<O, ALLOC>[src]

type Node = FastOpNodeTemplate<O>

The type used to contain the Op and handle movement around the worldlines.

fn get_node_ref(&self, p: usize) -> Option<&Self::Node>[src]

Get a ref to a node at position p

fn get_node_mut(&mut self, p: usize) -> Option<&mut Self::Node>[src]

Get a mutable ref to the node at position p

fn get_first_p(&self) -> Option<usize>[src]

Get the first occupied p if it exists.

fn get_last_p(&self) -> Option<usize>[src]

Get the last occupied p if it exists.

fn get_first_p_for_var(&self, var: usize) -> Option<PRel>[src]

Get the first p occupied which covers variable var, also returns the relative index.

fn get_last_p_for_var(&self, var: usize) -> Option<PRel>[src]

Get the last p occupied which covers variable var, also returns the relative index.

fn get_previous_p(&self, node: &Self::Node) -> Option<usize>[src]

Get the previous occupied p compared to node.

fn get_next_p(&self, node: &Self::Node) -> Option<usize>[src]

Get the next occupied p compared to node.

fn get_previous_p_for_rel_var(
    &self,
    relvar: usize,
    node: &Self::Node
) -> Option<PRel>
[src]

Get the previous p for a given var, takes the relative var index in node. Also returns the new relative var index. Read more

fn get_next_p_for_rel_var(
    &self,
    relvar: usize,
    node: &Self::Node
) -> Option<PRel>
[src]

Get the next p for a given var, takes the relative var index in node. Also returns the new relative var index. Read more

fn get_nth_p(&self, n: usize) -> usize[src]

Get the nth occupied p.

fn get_previous_p_for_var(
    &self,
    var: usize,
    node: &Self::Node
) -> Result<Option<PRel>, &str>
[src]

Get the previous p for a given var.

fn get_next_p_for_var(
    &self,
    var: usize,
    node: &Self::Node
) -> Result<Option<PRel>, &str>
[src]

Get the next p for a given var.

fn does_var_have_ops(&self, var: usize) -> bool[src]

Returns if a given variable is covered by any ops.

fn make_loop_update<H>(
    &mut self,
    initial_n: Option<usize>,
    hamiltonian: H,
    state: &mut [bool]
) where
    H: Fn(&[usize], usize, &[bool], &[bool]) -> f64
[src]

Make a loop update to the graph with thread rng.

fn make_loop_update_with_rng<H, R: Rng>(
    &mut self,
    initial_n: Option<usize>,
    hamiltonian: H,
    state: &mut [bool],
    rng: &mut R
) where
    H: Fn(&[usize], usize, &[bool], &[bool]) -> f64
[src]

Make a loop update to the graph.

fn post_loop_update_hook(&mut self)[src]

Called after an update.

impl<O: Op + Clone, ALLOC: FastOpAllocator> OpContainer for FastOpsTemplate<O, ALLOC>[src]

type Op = O

The op object to manage.

fn get_cutoff(&self) -> usize[src]

Get the cutoff for this container.

fn set_cutoff(&mut self, cutoff: usize)[src]

Set the cutoff for this container.

fn get_n(&self) -> usize[src]

Get the number of non-identity ops.

fn get_nvars(&self) -> usize[src]

Get the number of managed variables.

fn get_pth(&self, p: usize) -> Option<&Self::Op>[src]

Get the pth op, None is identity.

fn get_count(&self, bond: usize) -> usize[src]

Gets the count of bond ops in the graph.

fn itime_fold<F, T>(&self, state: &mut [bool], fold_fn: F, init: T) -> T where
    F: Fn(T, &[bool]) -> T, 
[src]

Iterate through the imaginary time states of the opcontainer.

fn verify(&self, state: &[bool]) -> bool[src]

Verify the integrity of the OpContainer.

impl<O: Op + Clone, ALLOC: FastOpAllocator> OpContainerConstructor for FastOpsTemplate<O, ALLOC>[src]

fn new(nvars: usize) -> Self[src]

Make a new container for nvars.

fn new_with_bonds(nvars: usize, nbonds: usize) -> Self[src]

Make a new container for nvars giving a hint as to the number of bonds.

impl<O: Op + Clone, ALLOC: FastOpAllocator> RvbUpdater for FastOpsTemplate<O, ALLOC>[src]

fn constant_ops_on_var(&self, var: usize, ps: &mut Vec<usize>)[src]

Fill ps with the p values of constant (Hij=k) ops for a given var. An implementation by the same name is provided for LoopUpdaters Read more

fn spin_flips_on_var(&self, var: usize, ps: &mut Vec<usize>)[src]

Fill ps with the p values of spin flips for a given var. An implementation by the same name is provided for LoopUpdaters Read more

fn rvb_update<R: Rng, EN: EdgeNavigator, H>(
    &mut self,
    edges: &EN,
    state: &mut [bool],
    updates: usize,
    diagonal_edge_hamiltonian: H,
    rng: &mut R
) -> usize where
    H: Fn(usize, bool, bool) -> f64
[src]

Perform a resonating bond update. edges lists all the 2-site bonds which define the lattice. state is the propagated state at time 0. updates is the number of updated to perform. diagonal_edge_hamiltonian gives the weight of a diagonal edge given a spin state. rng prng instance to use. Read more

fn rvb_update_with_ising_weight<R: Rng, EN: EdgeNavigator, H, F>(
    &mut self,
    edges: &EN,
    state: &mut [bool],
    updates: usize,
    diagonal_edge_hamiltonian: H,
    ising_ratio: F,
    rng: &mut R
) -> usize where
    H: Fn(usize, bool, bool) -> f64,
    F: Fn(&Self::Op) -> f64
[src]

Perform a resonating bond update. edges lists all the 2-site bonds which define the lattice. state is the propagated state at time 0. updates is the number of updated to perform. diagonal_edge_hamiltonian gives the weight of a diagonal edge given a spin state. ising_ratio provides the weight ratio of a node after a global ising flip to current. rng prng instance to use. Read more

impl<O: Op, ALLOC: FastOpAllocator> IsingManager for FastOpsTemplate<O, ALLOC>[src]

impl<O: Op, ALLOC: FastOpAllocator> QmcManager for FastOpsTemplate<O, ALLOC>[src]

Auto Trait Implementations

impl<O, ALLOC> RefUnwindSafe for FastOpsTemplate<O, ALLOC> where
    ALLOC: RefUnwindSafe,
    O: RefUnwindSafe

impl<O, ALLOC> Send for FastOpsTemplate<O, ALLOC> where
    ALLOC: Send,
    O: Send

impl<O, ALLOC> Sync for FastOpsTemplate<O, ALLOC> where
    ALLOC: Sync,
    O: Sync

impl<O, ALLOC> Unpin for FastOpsTemplate<O, ALLOC> where
    ALLOC: Unpin,
    O: Unpin

impl<O, ALLOC> UnwindSafe for FastOpsTemplate<O, ALLOC> where
    ALLOC: UnwindSafe,
    O: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V