Skip to content

Conversion of symbolic objects to base linear algebra objects (vectors, matrices, sparse matrices, etc)ย #118

@Krastanov

Description

@Krastanov

This is one of 3 independent bounties which share the type of work that needs to be done:

One of the main value-adds of QuantumSymbolics.jl is to enable converting symbolic expressions into the appropriate numerical representation for use with a variety of simulators. We have such capabilities with respect to a few simulators now, e.g. converting the symbolic Z1 into either a Ket (from QuantumOptics.jl) or a Stabilizer tableau (from QuantumClifford.jl). Here is an example:

julia> using QuantumSavory, QuantumOpticsBase, QuantumClifford

julia> express(X1, QuantumOpticsRepr())
Ket(dim=2)
  basis: Spin(1/2)
 0.7071067811865475 + 0.0im
 0.7071067811865475 + 0.0im

julia> express(X1, CliffordRepr())
๐’Ÿโ„ฏ๐“ˆ๐“‰๐’ถ๐’ท
+ Z
๐’ฎ๐“‰๐’ถ๐’ท
+ X

This bounty is on providing even simpler conversion to "state vector" objects without having them wrapped in additional structure.

Libraries like QuantumOptics.jl, QuantumToolbox.jl, and qutip are "just" convenience wrappers around standard vectors and matrices as available in any linear algebra toolkit (julia's LinearAlgebra or python's numpy). Such libraries provide a lot of syntactic sugar and nice utilities, but occasionally one just needs the basic underlying vectors and matrices. Providing this capability is what this bounty is about.

This bounty requires the creation of a new representation type, StateVectorRepr under which symbolic objects will be converted to Vector{ComplexF64} and Matrix{ComplexF64} and comparable sparse matrices. The implementation of this capability can be extremely simple: just use express(symbolic_object, QuantumOpticsRepr()) and then take the .data field of the QuantumOptics.jl datastructure. As such, this capability would still depend on QuantumOptics internally, but the returned structure would be much simpler.

Basically we get express(symbolic_object, StateVectorRepr(config)) = express(symbolic_object, QuantumOpticsRepr(config)).data.

Nonetheless, this needs to be properly packaged and tested.

The most useful references would be:

For this bounty to be completed, one would need:

  • matching the express capabilities that exist for QuantumOptics.jl, but now simply for conversion to vectors and matrices
  • preparing the implementation in the form of a package extension (as is done for QuantumOptics)
  • adding tests for correctness, potentially comparing numerical representations against the existing QuantumOptics
  • a brief mention of the new backend in the documentation, e.g. towards the bottom of the front page of the docs

If you are new to julia, make sure to:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions