You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by bassoy October 21, 2021
Right now index accessing is performed using the at member function in tensor e.g. in tensor_dynamic, see also in example.
for(auto i = 0u; i < B.size(0); ++i)
for(auto j = 0u; j < B.size(1); ++j)
C.at(i,j) = std::conj(B.at(i,j));
Is it possible to overload operator() for this purpose? Note that operator() will also be used for creating subtensors.
for(auto i = 0u; i < B.size(0); ++i)
for(auto j = 0u; j < B.size(1); ++j)
C(i,j) = std::conj(B(i,j));
We could also use operator[] for accessing single indices and multi-indices.
for(auto i = 0u; i < B.size(0); ++i)
for(auto j = 0u; j < B.size(1); ++j)
C[i,j] = std::conj(B[i,j]);
This will be again closer to a Matlab or Octave or R notation.
The text was updated successfully, but these errors were encountered:
bassoy
changed the title
Can we use function call operator for indexing instead of at?
Use function call operator for indexing instead of at
Feb 9, 2022
Discussed in #141
Originally posted by bassoy October 21, 2021
Right now index accessing is performed using the
at
member function in tensor e.g. in tensor_dynamic, see also in example.Is it possible to overload
operator()
for this purpose? Note thatoperator()
will also be used for creating subtensors.We could also use
operator[]
for accessing single indices and multi-indices.This will be again closer to a Matlab or Octave or R notation.
The text was updated successfully, but these errors were encountered: