LuxurySparse

LuxurySparse

We provide more detailed optimization through a self-defined sparse library which is more efficient for operations related to quantum gates.

IMatrix{N, Tv}()
IMatrix{N}() where N = IMatrix{N, Int64}()
IMatrix(A::AbstractMatrix{T}) where T -> IMatrix

IMatrix matrix, with size N as label, use Int64 as its default type, both * and kron are optimized.

source
PermMatrix{Tv, Ti}(perm::Vector{Ti}, vals::Vector{Tv}) where {Tv, Ti<:Integer}
PermMatrix(perm::Vector{Ti}, vals::Vector{Tv}) where {Tv, Ti}
PermMatrix(ds::AbstractMatrix)

PermMatrix represents a special kind linear operator: Permute and Multiply, which means M * v = v[perm] * val Optimizations are used to make it much faster than SparseMatrixCSC.

  • perm is the permutation order,

  • vals is the multiplication factor.

Generalized Permutation Matrix

source

faster invperm

source
notdense(M) -> Bool

Return true if a matrix is not dense.

Note: It is not exactly same as isparse, e.g. Diagonal, IMatrix and PermMatrix are both notdense but not isparse.

source
pmrand(T::Type, n::Int) -> PermMatrix

Return random PermMatrix.

source
statify(A::AbstractMatrix) -> AbastractMatrix

transform a matrix to a static form.

source
matvec(x::VecOrMat) -> MatOrVec

Return vector if a matrix is a column vector, else untouched.

source
mulcol!(v::Vector, i::Int, f) -> VecOrMat

multiply col i of v by f inplace.

source
mulrow!(v::Vector, i::Int, f) -> VecOrMat

multiply row i of v by f inplace.

source
swapcols!(v::VecOrMat, i::Int, j::Int[, f1, f2]) -> VecOrMat

swap col i and col j of v inplace, with f1, f2 factors applied on i and j (before swap).

source
swaprows!(v::VecOrMat, i::Int, j::Int[, f1, f2]) -> VecOrMat

swap row i and row j of v inplace, with f1, f2 factors applied on i and j (before swap).

source
u1rows!(state::VecOrMat, i::Int, j::Int, a, b, c, d) -> VecOrMat

apply u1 on row i and row j of state inplace.

source