Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use function call operator for indexing instead of at #159

Open
bassoy opened this issue Feb 9, 2022 Discussed in #141 · 2 comments
Open

Use function call operator for indexing instead of at #159

bassoy opened this issue Feb 9, 2022 Discussed in #141 · 2 comments
Assignees

Comments

@bassoy
Copy link
Collaborator

bassoy commented 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.

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.

@bassoy bassoy self-assigned this Feb 9, 2022
@bassoy
Copy link
Collaborator Author

bassoy commented Feb 9, 2022

The implementation should follow #141 (reply in thread)

@bassoy 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
@adrishyantee
Copy link

I want to work for the proposal here. Can you guide me through this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants