0 votes
asked by (320 points)
retagged by

Hi,

I am currently trying to use ITensor as library for some tensor network projects. I am working with CLion which relies on CMake. I got the CMake files ready such that my project can find the respective files. However, when I am building my super trivial test code:

#include <iostream>
#include <itensor/all.h>

using namespace itensor;

int main(int argc, char* argv[]) {
     return 0;
}

what i get is these error messages (repeated for many times, due to the usage of the function I expect) (here the full log file):

1)

CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/iqtensor.cc.o: In function `void itensor::detail::OneArg<itensor::CPData>::call<itensor::detail::RegisterTask<itensor::detail::OneArg<itensor::CPData>, itensor::ToITensor&&, itensor::ITensorT<itensor::Index> >, itensor::ToITensor, itensor::Scalar<double>, itensor::ITensorT<itensor::Index> >(itensor::detail::RegisterTask<itensor::detail::OneArg<itensor::CPData>, itensor::ToITensor&&, itensor::ITensorT<itensor::Index> >&, itensor::ToITensor&, itensor::Scalar<double>&, itensor::ManageStore&, itensor::ITensorT<itensor::Index>&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:524: undefined reference to `itensor::typeNameOf(itensor::Scalar<double> const&)'

2)

CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/itensor_operators.cc.o: In function `void itensor::detail::CallWrap<itensor::detail::RegisterTask<itensor::detail::TwoArgs<std::shared_ptr<itensor::ITData>, itensor::CPData>, itensor::NCProd<itensor::Index>&&, itensor::NoneType>, itensor::NCProd<itensor::Index>, itensor::Scalar<double>, itensor::NoneType, std::shared_ptr<itensor::ITData>, itensor::CPData>::applyToImpl<itensor::Scalar<double> >(itensor::Scalar<double>&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:611: undefined reference to `itensor::typeNameOf(itensor::Scalar<double> const&)'

3)

CMakeFiles/tutorial.dir/home/anietner/development/cpp/libraries/itensor/itensor/iqtensor.cc.o: In function `void itensor::detail::CallWrap<itensor::detail::RegisterTask<itensor::detail::TwoArgs<std::shared_ptr<itensor::ITData>, itensor::CPData>, itensor::AddITensor&&, itensor::NoneType>, itensor::AddITensor, itensor::Dense<double>, itensor::NoneType, std::shared_ptr<itensor::ITData>, itensor::CPData>::applyToImpl<itensor::Scalar<std::complex<double> > const>(itensor::Scalar<std::complex<double> > const&)':
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/dotask.h:612: undefined reference to `itensor::typeNameOf(itensor::Scalar<std::complex<double> > const&)'

The CMake file can be found here

Maybe someone can help me and tell me how to fix this :) ?

EDIT:

Maybe this is of interest to the question: As one can see I do not include the files itlazy.h and itlazy.cc. This is because if I do so and build the project I get the following errors (full log file):

1)

/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:14:25: error: ‘ITReal’ does not name a type
 doTask(PrintStore,const ITReal& R) { println("Storage type of P is ITReal"); }

2)

/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc: In function ‘itensor::PData itensor::evaluate(itensor::ITLazy&)’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:81:25: error: ‘using IndexSetBuilder = class itensor::RangeBuilderT<itensor::IndexSetT<itensor::Index> >’ has no member named ‘setExtent’
                 cis.setExtent(cn++,In);

3)

In file included from /home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.h:9:0,
from /home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:1:
 /home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h: In instantiation of ‘class itensor::ITWrap<itensor::ITLazy>’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:262:9:   required from ‘StorageT* itensor::ManageStore::makeNewData(VArgs&& ...) [with StorageT = itensor::ITLazy; Args = {const itensor::ITLazy&}]’
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:178:39:   required from here
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:81:5: error: static assertion failed: Data type not in list of registered storage types
 static_assert(containsType<StorageTypes,stdx::decay_t<T>>{},"Data type not in list of registered storage types");
 ^
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h: In instantiation of ‘void itensor::ITWrap<T>::plugInto(itensor::FuncBase&) const [with T = itensor::ITLazy; itensor::FuncBase = itensor::FuncBaseT<itensor::TypeList<itensor::Dense<double>, itensor::Dense<std::complex<double> >, itensor::Combiner, itensor::Diag<double>, itensor::Diag<std::complex<double> >, itensor::QDense<double>, itensor::QDense<std::complex<double> >, itensor::QCombiner, itensor::QDiag<double>, itensor::QDiag<std::complex<double> >, itensor::QMixed<double>, itensor::QMixed<std::complex<double> >, itensor::Scalar<double>, itensor::Scalar<std::complex<double> > > >]’:
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itlazy.cc:182:1:   required from here
/home/anietner/development/cpp/libraries/itensor/itensor/itdata/itdata.h:104:9: error: no matching function for call to ‘itensor::FuncBaseT<itensor::TypeList<itensor::Dense<double>, itensor::Dense<std::complex<double> >, itensor::Combiner, itensor::Diag<double>, itensor::Diag<std::complex<double> >, itensor::QDense<double>, itensor::QDense<std::complex<double> >, itensor::QCombiner, itensor::QDiag<double>, itensor::QDiag<std::complex<double> >, itensor::QMixed<double>, itensor::QMixed<std::complex<double> >, itensor::Scalar<double>, itensor::Scalar<std::complex<double> > > >::applyTo(const itensor::ITLazy&)’
     f.applyTo(d);

1 Answer

+1 vote
answered by (320 points)

UPDATE ;)

it seems the error was somewhere hidden in the CMake file (not too surprising as I am still new to this framework).... THIS new CMake file seems to work with the code and I can also run the tutorials (after copying them into my project)

:)

commented by (70.1k points)
Thanks for sharing about using CMake with ITensor and your CMake file
Welcome to ITensor Support Q&A, where you can ask questions and receive answers from other members of the community.

Formatting Tips:
  • To format code, indent by four spaces
  • To format inline LaTeX, surround it by @@ on both sides
  • To format LaTeX on its own line, surround it by $$ above and below
  • For LaTeX, it may be necessary to backslash-escape underscore characters to obtain proper formatting. So for example writing \sum\_i to represent a sum over i.
If you cannot register due to firewall issues (e.g. you cannot see the capcha box) please email Miles Stoudenmire to ask for an account.

To report ITensor bugs, please use the issue tracker.

Categories

...