10#include "utils/vec_clone.hpp"
13#include <initializer_list>
20 #include "backend/Scalar.hpp"
25 class MPO_impl :
public intrusive_ptr_base<MPO_impl> {
28 std::vector<UniTensor> _TNs;
33 boost::intrusive_ptr<MPO_impl> clone()
const {
34 boost::intrusive_ptr<MPO_impl> out(
new MPO_impl());
35 out->_TNs = vec_clone(this->_TNs);
39 virtual std::ostream &Print(std::ostream &os);
41 virtual UniTensor get_op(
const cytnx_uint64 &site_idx);
44 class RegularMPO :
public MPO_impl {
46 std::ostream &Print(std::ostream &os);
48 UniTensor get_op(
const cytnx_uint64 &site_idx);
57 boost::intrusive_ptr<MPO_impl> _impl;
59 : _impl(
new RegularMPO()){
63 MPO(
const MPO &rhs) { _impl = rhs._impl; }
77 std::vector<UniTensor> &
get_all() {
return this->_impl->_TNs; }
79 const std::vector<UniTensor> &
get_all()
const {
return this->_impl->_TNs; }
83 return this->_impl->get_op(site_idx);
An Enhanced tensor specifically designed for physical Tensor network simulation.
Definition UniTensor.hpp:1783
const std::vector< UniTensor > & get_all() const
Definition MPO.hpp:79
cytnx_uint64 size()
Definition MPO.hpp:71
MPO & operator=(const MPO &rhs)
Definition MPO.hpp:66
virtual UniTensor get_op(const cytnx_uint64 &site_idx)
Definition MPO.hpp:82
std::vector< UniTensor > & get_all()
Definition MPO.hpp:77
void assign(const cytnx_uint64 &N, const UniTensor &rc)
Definition MPO.hpp:75
void append(const UniTensor &rc)
Definition MPO.hpp:73
std::ostream & operator<<(std::ostream &os, const MPO &in)
Helper function to print vector with ODT:
Definition Accessor.hpp:12
uint64_t cytnx_uint64
Definition Type.hpp:55