Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Jacupo/MSub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Idea:

We have a set of N variables α=[α_1,α_2,...,α_N] minus the identity.
We define the set of substitutions of degree m with the tensor Tm[i_1,i_2,...,i_m] such that α_{i_1}*α_{i_2}*...α_{i_m}=Tm[i_1,i_2,...,i_m].
The number of elements of the tensor is N^m.
The general substitution will work by iterating over all indices of the tensor for all the specified degrees m the sub_monomial() function

sub_monomial(mon1,α_{i_1}*α_{i_2}*...α_{i_m},Tm_{i_1,i_2,...,i_m},recursive=true);.

It has to be iterated until no possible substitutions are found.

Deciding when to stop is critical, we can easily fall in cyclical substitutions.

example 1
We define

  • α = [x,y,z]
  • T1 = [y,x,z]
  • mon1= x

then we have the following chain

  • first iteration x→y→x
  • second iteration x→y→x
  • ...

This is because there was a closed path of substitutions. This must be avoided. How can we avoid it? There is any theory for it?

💡If the degree of each element of Tm[i_1,i_2,…,i_m] is strictly smaller than m then we do not have closed path of substitutions. This can be a first rudimentary check, but we are not considering all the possible substitutions, see next example.

example 2
We define

  • α = [x,y,z]
  • T1 = [y,y,z]
  • mon1= x

then we have the following chain

  • first iteration x→y

Here there are no closed path of substitutions in T1.

💡 We will write an algorithm for checking if there is any closed path and in case resolve it.

Substitution tensor

The program should work with these steps:

  1. Accept a tensor of substitutions T.
  2. Optimise the substitutions' tensor.
  3. Apply recursively the substitutions.

The optimisation step should return a T such that a recursive substitutions routine eventually stops.

Form of the substitution tensor

Defined an array of variables α=[α_1,α_2,...,α_N] the elements of the substitutions tensor Tm must be Union{T, PolyVar{C}, Monomial{C}, Term{C, T}} we call this variables form.
Once decided how to deal with Polynomial{C,T} we should extend the substitutions to the whole MPolynomialLike. It must be even possible to specify each element of Tm as a Tuple{Int} of at most (m+1)-element.
Each array will specify how to build the monomial to substitute.
example

  • T2[1,2]=(1,3,4) indicate the substitution α_1α_2α_3α_4.
  • T2[1,2]=(1,4) indicate the substitution α_1α_2α_4.
  • T2[1,2]=(7,4) indicate the substitution α_1α_27*α_4.
  • T2[1,2]=(2,0) indicate the substitution α_1α_22.

When a susbstitution tensor is written in this form we will say it is in tuples form.

We must be able to specify the maximum degree m of the substitutions when calling the recursive substitution algorithm. In this case we have to specify a tuple of m different substitution tensors. In the case Tm is specified and T^(m-1) is not specified, T^(m-1) will be assumed to be T^(m-1)[i_1,...,i_{m-1}]=(1,i_1,...,i_{m-1}).

Optimisation of the substitution tensor

The optimisation steps consist in expressing the substitutions tensors in standard form and then optimising it in order to avoid closed substitution cycles.

Standard form of the substitution tensor

The standard form of the substitution tensor has the same structure for every value of m. Each element of Tm is a 3-element tuple with:

  • first element equal to the first element of the tuple of the tuple form,

  • second element equal the degree of the substitution,

  • third element equal to the linear index associated to the cartesian index encoded in the other elements of the tuple in the tuple form.

    example

    Consider the 3x3 substitution tensor T2 associated to the variables vector α=[α_1,α_2,α_3].
    The following are the representation of the same element in different forms:

    • variables formT2[1,2]=7*α_2α_3,
    • tuple formT2[1,2]=(7,2,3),
    • standard formT2[1,2]=(7,2,8);

or

  • variables formT2[1,2]=5*α_2,
  • tuple formT2[1,2]=(5,2),
  • standard formT2[1,2]=(5,1,2).

or

  • variables formT2[1,2]=5*α_2^2,
  • tuple formT2[1,2]=(5,2,2),
  • standard formT2[1,2]=(5,2,5).

or

  • variables formT2[1,2]=5*α_2^2*α_3,
  • tuple formT2[1,2]=(5,2,2,3),
  • standard formnot admitted, the degree of the substitution is bigger then m.

Checking and solving closed cycles

For avoiding closed cycles we use the following algorithm on the standard form of Tm for every m.

  1. Set index=1 and the reset setting to cindex=[], coeffs=[], chain=0.
  2. If index=N^m then finish.
  3. push!(cindex,index), push!(coeffs,1) and chain++
  • If Tm[cindex[chain]][2]>m then refuse the substitution tensor.
  • If Tm[cindex[chain]][2]<m then then index++ and set_chain(Tm,cindex,coeffs) and reset() and go to point 2.
  • If Tm[cindex[chain]][2]=m then push!(cindex,Tm[cindex[end]][3]), push!(coeffs,Tm[cindex[end]][1]) and chain++.
  1. Define first=findfirst(x->x==cindex[chain],cindex)then
  • If first!=chain , then index++ and set_cycle(Tm,cindex[first:chain],coeffs[first:chain]) then, after set_cycle set_chain(Tm,cindex[1:(first)],coeffs[1:first] and reset() and then go to point 2.
  • If first==chain go to point 4.
function set_chain(Tm,cindex,coeff)
    for i=1:(end-1)
      Tm[cindex[i]][2:3] = Tm[cindex[end]][2:3];
      Tm[cindex[i]][1]  = prod(coeff[(i+1):end]);
    end
  end
function set_cycle(Tm,cindex,coeff)
    @assert prod(coeff)==1
    set_chain(Tm,cindex,coeff)
  end

❓Is it possible to be blocked in the loop of point 4 and 5 forever?

It is important to check for all the Tm starting from the bigger m and moving to the smaller m

drawing
Figure1. This is the notation used.

drawing
Figure2. Representation of a possible set of substitutions.

drawing
Figure3. Substitutions after having solved cycles and chains.

🈺 This algorithm works for substitutions of MMonomialLikeMMonomialLike.
      In the case one has to deal with substitutions of MMonomialLikePolynomial there are different possibilities.
      Suppose we are dealing with substitutions tensor of order m. Let us consider Tm[i_1,...,i_m]=P, where P is a Polynomial.

      ✅All the monomial in P of order smaller then m are accepted.
      ❌All the monomial in P of order bigger then m are not accepted and we will not accept T.
      ✅If in P there is a single monomial of order m than one runs the algorithm for MMonomialLikeMMonomialLikefollowing single monomials of order m.
      ❌If in P thare are more then one monomial of order m we will not accept the T.

      Possibly multiple monomial of degree m and monomial of degree higher then m are acceptable. We should ask Marc-Olivier.

First physical example:

We consider the vector of Pauli operators α={X,Y,Z}.
We indicate with [A,B] and {A,B} respectively the commutator and anticommutator of A and B.
The commutation and anticommutation rules of this set are known.
Given [α_1,α_2] and {α_1,α_2} we know that α_1*α_2=([α_1,α_2]+{α_1,α_2})/2.
The set of substitutions of degree 1 is

T1=[_,_,_]

We can then build the set of substitutions of degree 2:

        1   +iZ   -iY
T2 = -iZ     1    iX
       iY   -iX     1

The degree of the elements of T is at most 1 thus there are no cyclic paths. We can use it.

Second physical example:

We consider the vector of Pauli operators α=[X_1,Y_1,Z_1,X_2,Y_2,Z_2].
The set of substitutions of degree 2 is the direct sum of the set of substitutions of order 2 for α_1=[X_1,Y_1,Z_1] T2_1 and the set of substitutions of order 2 for  α_2=[X_2,Y_2,Z_2] T2_2.
This sparsity should be exploited for bigger systems.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages