apply
Applies an operator given as an Op or OpSum to a State \(\vert w \rangle = \mathcal{O} \vert v\rangle\).
Sources
apply.hpp
apply.cpp
apply.jl
Definition
An operator \(\mathcal{O}\) can be applied to a state \(\vert v\rangle\) in two ways:
-
Only the input state on which the operator acts is defined is given. The block of the output state is calculated and eventually created automatically.
-
The output state is also handed as an argument which is overwritten. The compatibility of quantum numbers is checked. This way the output block is not created automatically and, thus, can be used to save computation time if the output block appears repeatedly in the computation.
-
A low-level routine where given an OpSum with an input and output block, the operator is applied to a raw vector. This version is useful when using XDiag in conjuction with third-party libraries.
void apply(OpSum const &ops, Block const &block_in, arma::vec const &v, Block const &block_out, arma::vec &w); void apply(OpSum const &ops, Block const &block_in, arma::cx_vec const &v, Block const &block_out, arma::cx_vec &w); void apply(OpSum const &ops, Block const &block_in, arma::mat const &V, Block const &block_out, arma::mat &W); void apply(OpSum const &ops, Block const &block_in, arma::cx_mat const &V, Block const &block_out, arma::cx_mat &W);apply(ops::OpSum, block_in::Block, v::Vector{Float64}, block_out::Block, w::Vector{Float64}) apply(ops::OpSum, block_in::Block, v::Vector{ComplexF64}, block_out::Block, w::Vector{ComplexF64}) apply(ops::OpSum, block_in::Block, V::Matrix{Float64}, block_out::Block, W::Matrix{Float64}) apply(ops::OpSum, block_in::Block, V::Matrix{ComplexF64}, block_out::Block, W::Matrix{ComplexF64})
Parameters
| Name | Description | |
|---|---|---|
| ops / op | OpSum or Op defining the operator | |
| v | Input State $\vert v\rangle $ | |
| w | Output State \(\vert w \rangle = O \vert v\rangle\) |