Operator
Base class for all quantum operators.
Factories
operator_free(const ComplexSparseMatrix matrix) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the free operator.
operator_free(const RealMatrix matrix) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the free operator.
operator_free(const Operator operator) -> Operator
Generates an operator that represents the hopping terms of the input operator.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- operator: The operator representing a sum of hopping terms.
operator_free(const ComplexMatrix matrix) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the free operator.
operator_free(const RealSparseMatrix matrix) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the free operator.
operator_free(const RealSparseMatrix matrix, as_complex options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const ComplexSparseMatrix matrix, as_complex options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const Operator operator_sum, as_complex options) -> Operator
Generates an operator that represents the hopping terms of the input operator.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- operator_sum: The operator sum.
- options: A set of options used to dispatch the appropriate operator.
operator_free(const Operator operator_sum, as_real options) -> Operator
Generates an operator that represents the hopping terms of the input operator.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- operator_sum: The operator sum.
- options: A set of options used to dispatch the appropriate operator.
operator_free(const Operator operator_sum, const StateInfo options) -> Operator
Generates an operator that represents the hopping terms of the input operator.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- operator_sum: The operator sum.
- options: A set of options used to dispatch the appropriate operator.
operator_free(const RealSparseMatrix matrix, const StateInfo options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const RealMatrix matrix, as_real options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const RealMatrix matrix, as_complex options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const RealMatrix matrix, const StateInfo options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const ComplexSparseMatrix matrix, as_real options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const ComplexMatrix matrix, as_complex options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const ComplexMatrix matrix, as_real options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const ComplexMatrix matrix, const StateInfo options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const ComplexSparseMatrix matrix, const StateInfo options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_free(const RealSparseMatrix matrix, as_real options) -> Operator
Generates an operator that represents the hopping terms of the input matrix.
Unless specified otherwise, using the factory operator_free on an operator will default to complex. Valid options include (as_real, as_complex, unspecified) | (as_fermion, unspecified) | (as_singleparticle, unspecified) | (as_sparse, unspecified) and will default to (as_complex | as_fermion | as_singleparticle | as_sparse) respectively. When used on a matrix, the scalar field defaults to that of the provided matrix unless specified otherwise.
Parameters
- matrix: The matrix representation of the single-particle operator.
- options: A set of options used to specify the single particle operator type.
operator_stencil(const Map options) -> Operator
Generates a stencil operator.
A free stencil represents an operator of the form where are displacement vectors, are lattice position vectors, the are position independent coefficients and is the number of such coefficients.To construct a stencil, the above parameters must be passed explicitly, together with information about the lattice dimensions and the boundary conditions.
Parameters
- options: An option map to specify the parameters of the stencil.
Example
var stencil_vectors = [[-1,0],[1,0],[0,1],[0,-1]] //[[delta_{0,x},delta_{0,y}],[delta_{1,x},delta_{1,y}],[delta_{2,x},delta_{2,y}],[delta_{3,x},delta_{3,y}]]
var dimensions = [50,40] // [L_x, L_y]
var stencil_values = [0.5 + 1i, 0.2 + 1i, 0.3 + 0.1i, 2i + 2] // [alpha_0, alpha_1, alpha_2, alpha_3]
var boundary_conditions = [boundary_condition.periodic, boundary_condition.open]
var stencil = operator_stencil(["displacements":stencil_vectors,"dimensions":dimensions,"values":stencil_values,"boundary_conditions":boundary_conditions])
operator_stencil(const List<List<integer>> displacement_vectors", "The displacement vectors $\delta_n$ of the stencil., const List<integer> dimensions, const List<real> stencil_values", "The stencil values $\alpha_n$, const List<BC> boundary_conditions) -> Operator
Generates a stencil operator.
A free stencil represents an operator of the form where are displacement vectors, are lattice position vectors, the are position independent coefficients and is the number of such coefficients.To construct a stencil, the above parameters must be passed explicitly, together with information about the lattice dimensions and the boundary conditions.
Parameters
- displacement_vectors", "The displacement vectors of the stencil.:
- dimensions: The dimensions of the underlying lattice.
- stencil_values", "The stencil values :
- boundary_conditions: The boundary conditions of the lattice.
Example
var stencil_vectors = [[-1,0],[1,0],[0,1],[0,-1]] //[[delta_{0,x},delta_{0,y}],[delta_{1,x},delta_{1,y}],[delta_{2,x},delta_{2,y}],[delta_{3,x},delta_{3,y}]]
var dimensions = [50,40] // [L_x, L_y]
var stencil_values = [0.5 + 1i, 0.2 + 1i, 0.3 + 0.1i, 2i + 2] // [alpha_0, alpha_1, alpha_2, alpha_3]
var boundary_conditions = [boundary_condition.periodic, boundary_condition.open]
var stencil = operator_stencil(["displacements":stencil_vectors,"dimensions":dimensions,"values":stencil_values,"boundary_conditions":boundary_conditions])
operator_stencil(const List<List<integer>> displacement_vectors", "The displacement vectors $\delta_n$ of the stencil., const List<integer> dimensions, const List<complex> stencil_values", "The stencil values $\alpha_n$, const List<BC> boundary_conditions) -> Operator
Generates a stencil operator.
A free stencil represents an operator of the form where are displacement vectors, are lattice position vectors, the are position independent coefficients and is the number of such coefficients.To construct a stencil, the above parameters must be passed explicitly, together with information about the lattice dimensions and the boundary conditions.
Parameters
- displacement_vectors", "The displacement vectors of the stencil.:
- dimensions: The dimensions of the underlying lattice.
- stencil_values", "The stencil values :
- boundary_conditions: The boundary conditions of the lattice.
Example
var stencil_vectors = [[-1,0],[1,0],[0,1],[0,-1]] //[[delta_{0,x},delta_{0,y}],[delta_{1,x},delta_{1,y}],[delta_{2,x},delta_{2,y}],[delta_{3,x},delta_{3,y}]]
var dimensions = [50,40] // [L_x, L_y]
var stencil_values = [0.5 + 1i, 0.2 + 1i, 0.3 + 0.1i, 2i + 2] // [alpha_0, alpha_1, alpha_2, alpha_3]
var boundary_conditions = [boundary_condition.periodic, boundary_condition.open]
var stencil = operator_stencil(["displacements":stencil_vectors,"dimensions":dimensions,"values":stencil_values,"boundary_conditions":boundary_conditions])
Symbols
| Name | Description |
|---|---|
!= | Compares two Operator objects for inequality. Returns true if the operators differ in type or internal structure. |
* | Multiplies two operators together, creating a product operator. |
+ | Adds two operators together. Returns a generic Operator for basic additions, ComplexOperatorSum when explicitly working with complex coefficients. |
- | Subtracts one operator from another. Returns a generic Operator for basic subtractions, ComplexOperatorSum when explicitly working with complex coefficients. |
== | Compares two operators for equality.Two operators are equal if they are the same type and have identical parameters.Note that mathematically equivalent expressions may not be considered equal |
>> | In-place Operator-vector product operator. |
Members
| Name | Description |
|---|---|
| expval | Computes the expectation value of an Operator for a given state. Calculates <|O|>, where is a quantum state and is an operator. |
| name | Returns the name of an individual operator as a string. Note: This function only works with individual operators (X, Y, Z, XX, YY, etc.), not for OperatorProduct or OperatorSum. |
| norm | Computes the spectral norm (largest singular value) of the operator. Can be called using either function call syntax norm(op) or method call syntax op.norm(). |
| sites | Returns the sites of an individual operator in definition order. Unlike support(), this preserves the order of sites as they appear in the operator definition. Note: This function only works with individual operators (X, Y, Z, XX, YY, etc.). For OperatorProduct or OperatorSum, use support() instead. Important: The order returned is the constructor order, not necessarily the order of mathematical application. |
| support | Returns the support of the operator (the set of qubits it acts on) .Current limitation: This version only supports OperatorProduct and single operators. OperatorSum support may not work correctly in this version. |