# How to create an array to store a variable h ?

**URL:** <https://itensor.discourse.group/t/how-to-create-an-array-to-store-a-variable-h/1089>\
**Category:** ITensor C++ Questions\
**Tags:** dmrg\
**Created:** [August 15, 2023, 1:03pm UTC](https://itensor.discourse.group/t/how-to-create-an-array-to-store-a-variable-h/1089 "2023-08-15T13:03:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tan](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/tan/32/344_2.png) [@Tan](https://itensor.discourse.group/u/Tan)\
**Post date:** [August 15, 2023, 1:03pm UTC](https://itensor.discourse.group/t/how-to-create-an-array-to-store-a-variable-h/1089/1 "2023-08-15T13:03:23Z")

</div>

I want to calculate the eigenvalues of a model under different variables, For example, in the xxz model,h can change.

What do I need to do to get a series of intrinsic energies under different parameters?

I tried to create an array directly in the program to store a series of values of a variable, but for some reason I reported an error.

Thank you very much if you can answer it

---

<div class="post-metadata">

**Author:** ![JanReimers](https://yyz2.discourse-cdn.com/free1/user_avatar/itensor.discourse.group/janreimers/32/171_2.png) [@JanReimers](https://itensor.discourse.group/u/JanReimers)\
**Post date:** [August 15, 2023, 4:11pm UTC](https://itensor.discourse.group/t/how-to-create-an-array-to-store-a-variable-h/1089/2 "2023-08-15T16:11:39Z")

</div>

Hi Tan, Without more information about your code and the error message, it is hard to provide any detailed help. The recommended 1D array in C++ is

```auto
#include <vector>
N=10
std::vector<double> myEnergies(N) 

```

It sounds like this is not an ITensors issue/question so maybe you can get more assistance on a C++ forum.  
I hope this helps.  
JR
