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

operator== for vector types #76

Open
niermann999 opened this issue Oct 6, 2022 · 4 comments
Open

operator== for vector types #76

niermann999 opened this issue Oct 6, 2022 · 4 comments
Labels
question Further information is requested

Comments

@niermann999
Copy link
Contributor

Is there an operator== for vector types? I am comparing point types in detray on device and get a warning that this is a __host__ function

@niermann999 niermann999 added the question Further information is requested label Oct 6, 2022
@beomki-yeo
Copy link
Contributor

Is there warning Even with --expt-relaxed-constexpr CUDA compiler flag? Anyway, I very much like to have operator == for vector type for cmath plugin, but it's not possible because it is just std::array type. We need to refactor the vector and matrix type of cmath plugin, which I want to do.

@niermann999
Copy link
Contributor Author

Is there warning Even with --expt-relaxed-constexpr CUDA compiler flag? Anyway, I very much like to have operator == for vector type for cmath plugin, but it's not possible because it is just std::array type. We need to refactor the vector and matrix type of cmath plugin, which I want to do.

Hm, yes, I do get a warning in the detray grid unittest (complete and attach populator), but maybe I am comparing apples and oranges there. Essentially, the populator tries to find out where to put the next point3 by checking against an invalid point value. And that check, which involves operator== on std::array, works, but gives a warning. On cppreference at least the operator== is not listed as a constexpr function for c++17?

Anyway, it is not a priority right now, since it is only really needed for traccc, I guess

@niermann999
Copy link
Contributor Author

Oh, yes, I see. I might also have to figure out how to do boolean operations like these for vectorized types at some point...

@beomki-yeo
Copy link
Contributor

OK. In the end, we might want to have something like the following for cmath:

template <typename scalar_t, int COLS, int ROWS>
struct matrix{
   std::array< std::array<scalar_t, COLS>, ROWS> m_data;
}

template < typename scalar_t, int ROWS>
struct vector: public_matrix<scalar_t, 1, ROWS>{};

Then we will be able to define the operators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants