User Tools

Site Tools


material:qmodel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
material:qmodel [2024/10/09 12:20] – [Methods] markusmaterial:qmodel [2025/08/02 14:25] (current) – [Methods] markus
Line 288: Line 288:
 ===== Basis class ===== ===== Basis class =====
  
 +A basis is subscriptable, meaning that ''b[i]'' returns the //i//th element of the basis as a ''Vector'' (where ''i'' starts with 0).
 ==== Properties ==== ==== Properties ====
  
Line 334: Line 335:
 ''**Basis.diag([qn_key: str]) -> Operator**'' ''**Basis.diag([qn_key: str]) -> Operator**''
 <WRAP indent> <WRAP indent>
-Returns a diagonal operator $x\mapsto x$ for a given qn.+Returns a diagonal operator $x\mapsto x$ for a given qn. In a many-particle basis the values of all single-particle basis elements are summed.
  
 ''qn_key'' is a qn of the basis. If the basis has only a single qn then this argument can be omitted. ''qn_key'' is a qn of the basis. If the basis has only a single qn then this argument can be omitted.
Line 512: Line 513:
  
 Example: Let ''lb'' be a ''LatticeBasis'' and ''X'' a vector on a many-particle basis that includes particles on the lattice (possibly with additional degrees-of-freedom). Then ''X.trace(lb)'' gives the density on the lattice. Example: Let ''lb'' be a ''LatticeBasis'' and ''X'' a vector on a many-particle basis that includes particles on the lattice (possibly with additional degrees-of-freedom). Then ''X.trace(lb)'' gives the density on the lattice.
 +</WRAP>
 +
 +''**Vector.tensor(X: Vector, [tensor_basis: Basis]) -> Vector**''
 +<WRAP indent>
 +Computes the tensor product with another vector.
 +
 +''tensor_basis'' is an optional argument to fix a 2-particle basis for the returned vector. If it is not given, a new basis is constructed as a tensor product of the vectors' bases. It might be necessary to specify ''tensor_basis'' in many cases, since the new vector should be defined on a particular basis object. More importantly, the symmetry of the provided basis is also respected. If ''tensor_basis'' is symmetric, the tensor product is a symmetrized tensor product, $v\otimes w+w\otimes v$, if it is antisymmetric, the tensor product is a wedge product, $v\wedge w=v\otimes w-w\otimes v$.
 +</WRAP>
 +
 +''**Vector.proj() -> Operator**''
 +<WRAP indent>
 +Returns an operator that is the projector on the given vector.
 +The vector is always normalized in the procedure.
 </WRAP> </WRAP>
 ===== Operator class ===== ===== Operator class =====
Line 575: Line 589:
 </WRAP> </WRAP>
  
-''**Operator.expval(vec: Vector, [check_real: bool], [transform_real: bool]) -> float|complex**''+''**Operator.expval(vec: Vector, [check_real: bool], [transform_real: bool]) -> Number**''
 <WRAP indent> <WRAP indent>
 Return the expectation value of the operator w.r.t. the given vector. Return the expectation value of the operator w.r.t. the given vector.
Line 586: Line 600:
 ''**Operator.norm() -> float**'' ''**Operator.norm() -> float**''
 <WRAP indent> <WRAP indent>
-Return the 2-norm (largest singular value) of an operator.+Return the 2-norm (largest singular value) of the operator. 
 +</WRAP> 
 + 
 +''**Operator.trace() -> complex**'' 
 +<WRAP indent> 
 +Return the trace (sum over all diagonal values) of the operator.
 </WRAP> </WRAP>
  
Line 615: Line 634:
 Tensor product of the operator with another one. If the argument is an ''OperatorList'' then the tensor product is taken with every operator in the list and an ''OperatorList'' is returned. Tensor product of the operator with another one. If the argument is an ''OperatorList'' then the tensor product is taken with every operator in the list and an ''OperatorList'' is returned.
  
-''tensor_basis'' is an optional argument to fix a basis for the returned operator. If it is not given, a new basis is constructed as a tensor product itself. It might be necessary to specify ''tensor_basis'' in many cases, since the new operator should be defined on a particular basis object.+''tensor_basis'' is an optional argument to fix a basis for the returned operator. If it is not given, a new basis is constructed as a tensor product itself. It might be necessary to specify ''tensor_basis'' in many cases, since the new operator should be defined on a particular basis object. Note that this cannot be a (anti)symmetric tensor basis.
 </WRAP> </WRAP>
 ===== OperatorList class ===== ===== OperatorList class =====
Line 667: Line 686:
 </WRAP> </WRAP>
  
-''**OperatorList.expval(vec: Vector, [check_real: bool], [transform_real: bool]) -> float|complex**''+''**OperatorList.expval(vec: Vector, [check_real: bool], [transform_real: bool]) -> Number**''
 <WRAP indent> <WRAP indent>
 Return the expectation values of each operator in the list w.r.t. the given vector as a NumPy ''ndarray''. Flags are like in ''Operator.expval()''. Return the expectation values of each operator in the list w.r.t. the given vector as a NumPy ''ndarray''. Flags are like in ''Operator.expval()''.
Line 674: Line 693:
 ''**OperatorList.norm() -> float**'' ''**OperatorList.norm() -> float**''
 <WRAP indent> <WRAP indent>
-Return the Euclidean norm of the list of operators, $\sqrt{\sum_i \|\hat A_i\|^2}$.+Return the Euclidean norm of the list of operators, $\sqrt{\sum_i \|\hat A_i\|^2}$, using ''Operator.norm()'' for the individual operators.
 </WRAP> </WRAP>
  
-''**Operator.eig([hermitian: bool]) -> dict**''+''**OperatorList.sum() -> Operator**''
 <WRAP indent> <WRAP indent>
-Get the eigenvalues and the eigenvectors of the operator. Returns a dictionary with keys '' 'eigenvalues' '' and '' 'eigenvectors' '' where the first is a NumPy ''ndarray'' and the second a list of ''Vector'' objects. +Return the sum of all operators in the list, $\sum_i \hat A_i$.
- +
-If ''hermitian'' is set to ''True'' (default is ''False'') then a self-adjoint operator is assumed and the eigenvalues are returned in ascending order. Alsothe returned dictionary includes a further key '' 'degeneracy' '' which is a NumPy ''ndarray'' with the dimension of the eigenspaces ordered after the eigenvalues (e.g. ''[2,1,3]'' means a 2-fold degenerate groundstate, a non-degenerate 1st excited state and a 3-fold degenerate 2nd excited state). Note that even if ''hermitian'' is set to ''True'' the operator is not checked for self-adjointness (see method ''test_hermiticity()'').+
 </WRAP> </WRAP>
  
-''**Operator.test_hermiticity()**''+''**OperatorList.diag([trials: int]-> dict**''
 <WRAP indent> <WRAP indent>
-Raises an error if the operator is not self-adjoint (hermitian)No return value.+Simultaneous diagonalization of the operators in the list. Since this method uses randomization, a numer of trials can be specified. If the method is not successful in any trial, an error is raisedReturns the diagonals of the diagonalized operators as a list and the corresponding transformation matrix as NumPy ''ndarray'' in a dictionary with keys '' 'diag' '' and '' 'transform' ''. The relation to the operators is $\hat D_i = \hat U \hat A_i \hat U^\dagger$.
 </WRAP> </WRAP>
  
-''**Operator.diag() -> dict**''+''**OperatorList.extend(ext_basis: Basis) -> OperatorList**''
 <WRAP indent> <WRAP indent>
-The method first checks for self-adjointness, then returns the diagonal of the diagonalized operator $\hat D$ and the corresponding transformation matrix $\hat U$ as NumPy ''ndarray'' in dictionary with keys '' 'diag' '' and '' 'transform' ''. The relation to the operator is $\hat D = \hat U \hat A \hat U^\dagger$.+Extend each operator in the list to larger basis that includes the previous qn.
 </WRAP> </WRAP>
  
-''**Operator.extend(ext_basis: Basis) -> Operator**''+''**OperatorList.tensor(A: Operator, [tensor_basis: Basis]) -> OperatorList**''
 <WRAP indent> <WRAP indent>
-Extend the operator to a larger basis that includes the previous qn. If $\hat A$ was defined on $V$ and is extended to $V\otimes W$, the returned operator is $\hat A\otimes\hat I$. +Tensor product of each operator in the list with another operator that returns an ''OperatorList''The optional argument ''tensor_basis'' is like for ''Operator.tensor()''.
-</WRAP> +
- +
-''**Operator.tensor(A: Operator|OperatorList, [tensor_basis: Basis]) -> Operator|OperatorList**'' +
-<WRAP indent> +
-Tensor product of the operator with another one. If the argument is an ''OperatorList'' then the tensor product is taken with every operator in the list and an ''OperatorList'' is returned. +
- +
-''tensor_basis'' is an optional argument to fix a basis for the returned operatorIf it is not given, a new basis is constructed as a tensor product itself. It might be necessary to specify ''tensor_basis'' in many cases, since the new operator should be defined on a particular basis object.+
 </WRAP> </WRAP>
material/qmodel.1728469239.txt.gz · Last modified: 2024/10/09 12:20 by markus

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki