Hi Peter,
Thank you for your email. Here is what I have so far:
```c++
// This will be filled in by looping over number of orbitals, with each orbital containing an array of coefs.
struct Orbital_Data{
\\TODO: need a constructor that allocates memory for all the orbital's info here?
private:
std::shared_ptr<std::complex<double>[ ] > orbital_coefs;
std::shared_ptr<uint42_t[ ]> orbital_coefs_index;
}
struct Orbital{
\\TODO: How to handle the ith_orbital index?
\\ Something like: Orbital(const uint32_t &a_ith_orbital)
inline std:complex<double>
coef(uint32_t i) const {
uint32_t coef_index =
orbital_data->orbital_coefs_index[ith_orbital*size_of_coefs_array + i]; // Note the ith_orbital here used as a stride
return orbital_data->orbital_coefs[ coefs_index];
}
private:
Orbital_Data *orbital_data;
uint32_t ith_orbital; // This is the heart of SOA
}
```
I would rather allocate enough space instead of using std::vectors in a constructor possible. Does this look reasonable to you?
My two questions are my TODOs. I'm thinking about passing in the size the arrays need to be into a constructor for Orbital_Data. I am looking to fill in this data inside a loop over orbitals. So I need to know the ith_orbital and pass it into the Orbital struct somehow.
This follows Prof. Wolfgang's example in his lecture. I am just missing a few little things conceptually.
Cheers,
Zachary