Skip to content
Snippets Groups Projects
Commit a8b6192f authored by Pascal Engeler's avatar Pascal Engeler
Browse files

Fixed an indexing bug

parent d2d45e59
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,8 @@ class System{
//Calculates dynamical matrix for the currently pushed values
void calculate_matrix(const matelecalc_t& mec){
//for convenience
size_t N = drums_.size()-1;
//clear the matrix
matrix_.clear();
//prepare memory
......@@ -85,14 +87,14 @@ class System{
size_t n1_index = sysparams_.adjacency_vector[i][1];
size_t n2_index = sysparams_.adjacency_vector[i][2];
//diagonal
matrix_[i][i] = mec(i, drums_);
matrix_[N*i + i] = mec(i, drums_);
//couplings
if(n0_index != drums_.size()-1) [[likely]] //actually a neighbour
matrix_[i][n0_index] = mec(i, n0_index, drums_);
matrix_[N*i + n0_index] = mec(i, n0_index, drums_);
if(n1_index != drums_.size()-1) [[likely]] //actually a neighbour
matrix_[i][n1_index] = mec(i, n1_index, drums_);
matrix_[N*i + n1_index] = mec(i, n1_index, drums_);
if(n2_index != drums_.size()-1) [[likely]] //actually a neighbour
matrix_[i][n2_index] = mec(i, n2_index, drums_);
matrix_[N*i + n2_index] = mec(i, n2_index, drums_);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment