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

Why do you check for symmetry in factrs()? Isn't that redundant? #67

Open
ewheelerinc opened this issue Aug 31, 2021 · 0 comments
Open

Comments

@ewheelerinc
Copy link

Notice below that you could omit the check if (nrow==np) because num_symmetric_modes = nrow/np = 1 .

Thus, the loop iterates only once and mode=0, so mode_offset = mode*np = 0*np = 0 when there is only one iteration and that a == a.segment()

Maybe its a touch faster if a.segment actually copies the array, but if it generates a reference then it is sthe same.

Is this redundant, or am I missing something?

-Eric

void factrs(nec_output_file& s_output,  int64_t np, int64_t nrow, complex_array& a, int_array& ip )
{
  DEBUG_TRACE("factrs(" << np << "," << nrow << ")");
  if (nrow == np) { // no symmetry
    lu_decompose(s_output,  np, a, ip, nrow );
    return;
  }
  
  int num_symmetric_modes = static_cast<int>(nrow / np);
  DEBUG_TRACE("\tnum_symmetric_modes = " << num_symmetric_modes);
  
  for (int mode = 0; mode < num_symmetric_modes; mode++ ) {
    int64_t mode_offset = mode * np;
    
    complex_array a_temp = a.segment(mode_offset, a.size()-mode_offset);
    int_array ip_temp = ip.segment(mode_offset, ip.size()-mode_offset);
    
    lu_decompose(s_output,  np, a_temp, ip_temp, nrow );
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant