Hi,
Sorry for the typing error. Sensor means ITensor obviously:)
I first checked that my code is working properly before I've tried to create Itensors inside different functions. For example:
void jacobian(const struct cella_stru& c, ITensor& dPhi ){
auto k = Index("index k",2);
auto l = Index("index l",2);
struct cella_stru stress = stress_easy (c);
dPhi.set(k(1),l(1),stress.c11);
dPhi.set(k(1),l(2),0.5*stress.c12);
dPhi.set(k(2),l(1),0.5*stress.c12);
dPhi.set(k(2),l(2),stress.c22);
}
If I use dPhi returned by this function inside the main, the tensor contraction does not work properly. When I try to contract it with another matrix (with index k and index l initiated inside the main), instead of contracting the tensors, the rank of the resulting tensor increases.
I think somehow it is related to the way I use k and l but I couldn't figure it out.
Thanks