10#include "utils/vec_clone.hpp"
13#include <initializer_list>
22 class MPO_impl:
public intrusive_ptr_base<MPO_impl>{
27 std::vector<UniTensor> _TNs;
32 boost::intrusive_ptr<MPO_impl> clone()
const{
33 boost::intrusive_ptr<MPO_impl> out(
new MPO_impl());
34 out->_TNs = vec_clone(this->_TNs);
39 virtual std::ostream& Print(std::ostream &os);
41 virtual UniTensor get_op(
const cytnx_uint64 &site_idx);
45 class RegularMPO:
public MPO_impl{
47 std::ostream& Print(std::ostream &os);
49 UniTensor get_op(
const cytnx_uint64 &site_idx);
60 boost::intrusive_ptr<MPO_impl> _impl;
61 MPO(): _impl(
new RegularMPO()){
76 return this->_impl->size();
80 this->_impl->_TNs.push_back(rc);
84 this->_impl->_TNs.assign(N,rc);
88 return this->_impl->_TNs;
91 const std::vector<UniTensor> &
get_all()
const{
92 return this->_impl->_TNs;
97 return this->_impl->get_op(site_idx);
An Enhanced tensor specifically designed for physical Tensor network simulation.
Definition UniTensor.hpp:1122
const std::vector< UniTensor > & get_all() const
Definition MPO.hpp:91
cytnx_uint64 size()
Definition MPO.hpp:75
MPO & operator=(const MPO &rhs)
Definition MPO.hpp:70
virtual UniTensor get_op(const cytnx_uint64 &site_idx)
Definition MPO.hpp:96
std::vector< UniTensor > & get_all()
Definition MPO.hpp:87
void assign(const cytnx_uint64 &N, const UniTensor &rc)
Definition MPO.hpp:83
void append(const UniTensor &rc)
Definition MPO.hpp:79
std::ostream & operator<<(std::ostream &os, const MPO &in)
Definition Accessor.hpp:12
uint64_t cytnx_uint64
Definition Type.hpp:22