# add sites to MPS/MPO in C++

**URL:** https://itensor.discourse.group/t/add-sites-to-mps-mpo-in-c/1347
**Category:** ITensor C++ Questions
**Created:** [December 10, 2023, 9:47am UTC](https://itensor.discourse.group/t/add-sites-to-mps-mpo-in-c/1347 "2023-12-10T09:47:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![TrudySun](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/trudysun/32/380_2.png) [@TrudySun](https://itensor.discourse.group/u/TrudySun)
#### Post date: [December 10, 2023, 9:47am UTC](https://itensor.discourse.group/t/add-sites-to-mps-mpo-in-c/1347/1 "2023-12-10T09:47:17Z")

</div>

Dear ITensor,

Hi!

I’m using ITensor C++ version. I noticed that in Julia ver, we can extend an MPS/MPO by adding a site, i was wondering if this operation can be done in C++?

What I’m planning to do is basically as follows:

```auto
auto M1 = MPO(sites);// of length N
auto M2 = MPO(sites); // of length N
auto M3 = sum(M1,M2, {"Cutoff",1E-8});

```

Then I want to add a site to M3 such that it is an MPO of length N+1, and then set the (N+1) site of M3 to be an ITensor T.

```auto
M3.set(N+1, T);

```

I’ve tried several ways but they’re all failed. Is this operation possible in C++?

Thank you.

Best,  
Trudy
