# PartialOperator

PartialOperator(op,indices) takes an operator and a list of indices and returns any part of op that acts on the index-set indices.

## Input

• op : An Operator.
• indices : A list of indices.

## Output

• partialOp : The part of op acting on indices.

## Example

### Input

Example.Quanty
NF = 4

op1 = NewOperator("Number",NF,{1},{1},{0.1+I}) + NewOperator("U",NF,{0},{1},{5}) + 3
op2 = NewOperator("Number",NF,{1},{1},{0.00001 + I}) + NewOperator("Number",NF,{2},{2},{1}) + NewOperator("U",NF,{0},{1},{0},{1},{2},{3},{2},{3},{3}) + NewOperator("U",NF,{0},{1},{5})

print("op1:")
print(op1)
print("PartialOperator(op1, {0,1})")
print(PartialOperator(op1, {0,1}))
print("PartialOperator(op1, {2})")
print(PartialOperator(op1, {2}))
print("\n\n\n")
print("op2:")
print(op2)
print("PartialOperator(op2, {0,1})")
print(PartialOperator(op2, {0,1}))
print("PartialOperator(op2, {2})")
print(PartialOperator(op2, {2}))

### Result

op1:

Operator: CrAn
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   0
QComplex      =          0 (Real==0 or Complex==1)
N             =          1 (number of operators of length   0)
|  3.000000000000000E+00

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          1 (number of operators of length   2)
C  1 A  1 |  1.000000000000000E-01  1.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          1 (number of operators of length   4)
C  1 C  0 A  1 A  0 | -5.000000000000000E+00

PartialOperator(op1, {0,1})

Operator:
QComplex         =          1 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          1 (number of operators of length   2)
C  1 A  1 |  1.000000000000000E-01  1.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          1 (number of operators of length   4)
C  1 C  0 A  1 A  0 | -5.000000000000000E+00

PartialOperator(op1, {2})

Operator:
QComplex         =          0 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

op2:

Operator: CrAn
QComplex         =          2 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          2 (number of operators of length   2)
C  1 A  1 |  1.000000000000000E-05  1.000000000000000E+00
C  2 A  2 |  1.000000000000000E+00  0.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          2 (number of operators of length   4)
C  1 C  0 A  3 A  2 | -3.000000000000000E+00
C  1 C  0 A  1 A  0 | -5.000000000000000E+00

PartialOperator(op2, {0,1})

Operator:
QComplex         =          1 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          1 (number of operators of length   2)
C  1 A  1 |  1.000000000000000E-05  1.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          2 (number of operators of length   4)
C  1 C  0 A  3 A  2 | -3.000000000000000E+00
C  1 C  0 A  1 A  0 | -5.000000000000000E+00

PartialOperator(op2, {2})

Operator:
QComplex         =          1 (Real==0 or Complex==1 or Mixed==2)
MaxLength        =          4 (largest number of product of lader operators)
NFermionic modes =          4 (Number of fermionic modes (site, spin, orbital, ...) in the one particle basis)
NBosonic modes   =          0 (Number of bosonic modes (phonon modes, ...) in the one particle basis)

Operator of Length   2
QComplex      =          1 (Real==0 or Complex==1)
N             =          1 (number of operators of length   2)
C  2 A  2 |  1.000000000000000E+00  0.000000000000000E+00

Operator of Length   4
QComplex      =          0 (Real==0 or Complex==1)
N             =          1 (number of operators of length   4)
C  1 C  0 A  3 A  2 | -3.000000000000000E+00