# \[ANN\] FLOYao.jl - Fermionic linear optics for Yao.jl

**URL:** https://discourse.julialang.org/t/ann-floyao-jl-fermionic-linear-optics-for-yao-jl/87837
**Category:** Package Announcements
**Tags:** quantum, yao
**Created:** [September 26, 2022, 8:21pm UTC](https://discourse.julialang.org/t/ann-floyao-jl-fermionic-linear-optics-for-yao-jl/87837 "2022-09-26T20:21:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jlbosse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jlbosse/32/11274_2.png) [@jlbosse](https://discourse.julialang.org/u/jlbosse)
#### Post date: [September 26, 2022, 8:21pm UTC](https://discourse.julialang.org/t/ann-floyao-jl-fermionic-linear-optics-for-yao-jl/87837/1 "2022-09-26T20:21:28Z")

</div>

# [FLOYao.jl](https://github.com/QuantumBFS/FLOYao.jl)

Is a [Yao.jl](https://github.com/QuantumBFS/Yao.jl) backend to efficiently simulated fermionic linear optics (FLO) circuits in based on [Classical simulation of noninteracting-fermion quantum circuits](https://arxiv.org/abs/quant-ph/0108010) and [Disorder-assisted error correction in Majorana chains](https://arxiv.org/abs/1108.3845).

FLO circuits are a class of quantum circuits that are closely related to non-interacting fermions and can be efficiently simulated on classical computers, similar to the way Clifford circuits can be efficiently classically simulated, as is done in [YaoClifford.jl](https://github.com/QuantumBFS/YaoClifford.jl).

## Features

The goal of `FLOYao` is that if you have code written in `Yao.jl` that only uses [FLO gates](https://quantumbfs.github.io/FLOYao.jl/stable/supported_gates/) and other primitives that are efficiently simulatable in polynomial time and space, that you can simply replace your `AbstractArrayReg` with a `MajoranaReg` and run exactly the same simulation, with the same code but exponentially faster.

## Simple example

Here is a simple example, to show how seamlessly FLOYao.jl takes your existing Yao.jl code and gives you immediate speed-ups:

First import `FLOYao` and `Yao`

```jl
julia> using FLOYao, Yao

```

then create a circuit

```julia
julia> nq = 4
julia> θ = π/8
julia> circuit = chain(nq)
julia> push!(circuit, put(nq, 3=>Rz(0.5))) # all of the following are FLO gates
julia> xxg1 = kron(nq, 1 => X, 2 => X)
julia> push!(circuit, rot(xxg1, θ))  
julia> xxg2 = kron(nq, 2 => X, 3 => Z, 4 => X)
julia> push!(circuit, rot(xxg2, θ)) 

```

and create a FLO state, pipe it through the circuit and measure the result

```julia
julia> FLOYao.zero_state(nq) |> circuit |> measure!

```

Note, that the only difference to using a normal `ArrayReg` from Yao.jl is the usage of `FLOYao.zero_state()` instead of `zero_state()`.
