+1 vote
asked by (760 points)

I found that in C++ version, the function operator* for matrix-vector multiplication seems not implemented for complex matrix CMatrix and complex vector CVector. The sample code is as follows.

CMatrix a (2,2);
CVector v (2);
auto b = a * v;

The error message is

error: no match for ‘operator*’ (operand types are ‘itensor::CMatrix’ {aka ‘itensor::Ten<itensor::MatRangeT<0>, std::complex >’} and ‘itensor::CVector’ {aka ‘itensor::Ten<itensor::VecRangeT<0>, std::complex >’})

Is there a chance that it will be implemented?

commented by (70.1k points)
Hi Chiamin,
I reviewed the code for real-valued vector matrix multiplication and it should be pretty straightforward to add the complex case. Let me try to do this soon for you and please remind me if you don't hear back about it in a week or so.

Miles

1 Answer

+1 vote
answered by (70.1k points)
selected by
 
Best answer

After writing the comment above, I realized this feature could be added rather quickly so I just added it. Please see the following PR to see the lines of code that were changed (the important ones are in tensor/mat_impl.h) which I thought might interest you:
https://github.com/ITensor/ITensor/pull/409

Thanks for pointing this out -

Miles

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

...