# Is there a way to project a dense MPS into a symmetry sector?

**URL:** <https://itensor.discourse.group/t/is-there-a-way-to-project-a-dense-mps-into-a-symmetry-sector/2608>\
**Category:** DMRG and Numerical Methods\
**Created:** [April 20, 2026, 7:31pm UTC](https://itensor.discourse.group/t/is-there-a-way-to-project-a-dense-mps-into-a-symmetry-sector/2608 "2026-04-20T19:31:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joacop16](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/joacop16/32/560_2.png) [@Joacop16](https://itensor.discourse.group/u/Joacop16)\
**Post date:** [April 20, 2026, 7:31pm UTC](https://itensor.discourse.group/t/is-there-a-way-to-project-a-dense-mps-into-a-symmetry-sector/2608/1 "2026-04-20T19:31:34Z")

</div>

Hi, ITensor Teams！

First, a little bit of context, for a study in open quantum systems, I need to vectorize the identity:

I = \sum\_{n\_{1}, \cdots, n\_{N} = { 0,1}} |n\_{1} \cdots n\_{n} \rangle \langle n\_{1} \cdots n\_{n} | \rightarrow |I \rangle =\sum\_{n\_{1}, \cdots, n\_{N} = { 0,1}} |n\_{1} n\_{1}\cdots n\_{n} n\_{n} \rangle

Basically, I am adding ancilla sites at the right of each physical site, hence doubling the total number of physical sites. Implementing |I \rangle as dense MPS is straightforward for spinless fermions because it is a product state:

| I \rangle = \bigotimes \_{i =1}^{M} \left( |0 0 \rangle + | 1 1 \rangle \right)

```julia
using ITensors
using ITensorMPS

function Build_left_vacuum(sites::Vector{Index{Int64}})
    #The left vacuum |I> will be used to calculate the expectation values and the norms.

    M = Int(length(sites)/2)
    left_vacuum = MPS(sites,"0") #we can start with a simple state like this, and apply an operator to create the superposition that characterizes |I>.
    #Each site will be converted into a superposition upup + dndn in order to create the left_vacuum.
    Create_Superposition_Matrix = [1 0 0 0; 0 0 0 0; 0 0 0 0; 1 0 0 0] #Two-site operator that converts |0,0> into (|0,0> + |1,1>). Note that it is unnormalized.
    
    for i = 1:M 
        k = site_SF(i) 
        Create_Superposition_OP = op(Create_Superposition_Matrix, [sites[k], sites[k+1]]) #it affects the site and its ancilla
        left_vacuum = apply(Create_Superposition_OP, left_vacuum)
    end

    return left_vacuum
end

M = 10
sites = siteinds("S=1/2",2*M)
I_vec = Build_left_vacuum(sites); 

```

This build |I \rangle as a dense MPS and works for most of my calculations. However, in some calculations, my Liouvillian conserves the total number of fermions, so I can perform TEBD using symmetries; clearly, an MPS |\psi \rangle from that process would be a block-sparse MPS.

In general I need to project |\psi \rangle against \langle I | for calculating expectation values, so far what I am doing for that is taking the dense version of |\psi \rangle by using NDTensors.dense(), that works but it is not very efficient and sometimes has numerical errors from considering very small singular values. Note that I can not define | I \rangle directly in half-filling because its product state form has contributions from all particle number symmetry sectors (is based on the completeness of the Fock basis).

**I want to know if there is a way to project a dense MPS into a symmetry sector (say, half-filling).** In ED, this would be done by defining the projector \hat{P} with the eigenstates of \hat{N} that have N/2 particles as columns. However, I am not sure how to do it in the language of tensor networks. **I am not sure if it is possible to build an MPO with dense input indices and block-sparse output indices. Any idea that can help me?**
