Cytnx v0.9.4
Loading...
Searching...
No Matches
Physics.hpp
Go to the documentation of this file.
1#ifndef _Physics_H_
2#define _Physics_H_
3#include "Type.hpp"
4#include "Device.hpp"
5#include "cytnx_error.hpp"
6#include <vector>
7#include <initializer_list>
8#include <string>
9
10#include "Tensor.hpp"
11#include "UniTensor.hpp"
12
13#ifdef BACKEND_TORCH
14#else
15
16namespace cytnx {
17 namespace physics {
19
30 Tensor spin(const cytnx_double &S, const std::string &Comp, const int &device = Device.cpu);
31
33 Tensor spin(const cytnx_double &S, const char &Comp, const int &device = Device.cpu);
35
37
47 Tensor pauli(const std::string &Comp, const int &device = Device.cpu);
48
50 Tensor pauli(const char &Comp, const int &device = Device.cpu);
52
53 #define kBoltz cytnx_double(1.380649e-23) // J/K
54 #define hPlanck cytnx_double(6.62607015e-34) // J-s
55 #define hBar cytnx_double(1.05457181e-34) // J-s
56
57 } // namespace physics
58} // namespace cytnx
59
60namespace cytnx {
61 namespace operators {
62
63 UniTensor Sz_shalf(const int &device = Device.cpu, const bool &conserve_qns = false);
64 UniTensor Sp_shalf(const int &device = Device.cpu, const bool &conserve_qns = false,
65 const std::string &aux_dir = "r");
66 UniTensor Sn_shalf(const int &device = Device.cpu, const bool &conserve_qns = false,
67 const std::string &aux_dir = "r");
68
69 } // namespace operators
70} // namespace cytnx
71
73namespace cytnx {
74 namespace qgates {
75 UniTensor pauli_x(const int &device = Device.cpu);
76 UniTensor pauli_y(const int &device = Device.cpu);
77 UniTensor pauli_z(const int &device = Device.cpu);
78 UniTensor hadamard(const int &device = Device.cpu);
79 UniTensor phase_shift(const cytnx_double &phase, const int &device = Device.cpu);
80 UniTensor swap(const int &device = Device.cpu);
81 UniTensor sqrt_swap(const int &device = Device.cpu);
82 UniTensor toffoli(const int &device = Device.cpu);
83 UniTensor cntl_gate_2q(const UniTensor &gate_1q);
84
85 } // namespace qgates
86
87} // namespace cytnx
89
90#endif // BACKEND_TORCH
91
92#endif
an tensor (multi-dimensional array)
Definition Tensor.hpp:41
An Enhanced tensor specifically designed for physical Tensor network simulation.
Definition UniTensor.hpp:1706
UniTensor Sn_shalf(const int &device=Device.cpu, const bool &conserve_qns=false, const std::string &aux_dir="r")
UniTensor Sp_shalf(const int &device=Device.cpu, const bool &conserve_qns=false, const std::string &aux_dir="r")
UniTensor Sz_shalf(const int &device=Device.cpu, const bool &conserve_qns=false)
Tensor pauli(const std::string &Comp, const int &device=Device.cpu)
create Pauli matrix.
Tensor spin(const cytnx_double &S, const std::string &Comp, const int &device=Device.cpu)
create Spin-S representation matrix.
Helper function to print vector with ODT:
Definition Accessor.hpp:12
Device_class Device
data on which devices.
double cytnx_double
Definition Type.hpp:53