const double dx = fe.JxW(k) * factor;
for (unsigned int i=0; i<n_dofs; ++i)
- for (unsigned int j=0; j<n_dofs; ++j)
+ for (unsigned int j=i; j<n_dofs; ++j)
for (unsigned int d=0; d<n_components; ++d)
M(i,j) += dx
* fe.shape_value_component(j,k,d)
* fe.shape_value_component(i,k,d);
}
+
+ // exploit symmetry
+ for (unsigned int i=0; i<n_dofs; ++i)
+ for (unsigned int j=i+1; j<n_dofs; ++j)
+ M(j,i) = M(i,j);
}
/**
const double dx = fe.JxW(k) * weights[k];
for (unsigned int i=0; i<n_dofs; ++i)
- for (unsigned int j=0; j<n_dofs; ++j)
+ for (unsigned int j=i; j<n_dofs; ++j)
for (unsigned int d=0; d<n_components; ++d)
M(i,j) += dx
* fe.shape_value_component(j,k,d)
* fe.shape_value_component(i,k,d);
}
+
+ //exploit symmetry
+ for (unsigned int i=0; i<n_dofs; ++i)
+ for (unsigned int j=i+1; j<n_dofs; ++j)
+ M(j,i) = M(i,j);
}
/**
const double dx = fe.JxW(k) * factor;
for (unsigned int i=0; i<n_dofs; ++i)
{
- for (unsigned int j=0; j<n_dofs; ++j)
+ for (unsigned int j=i; j<n_dofs; ++j)
for (unsigned int d=0; d<n_components; ++d)
M(i,j) += dx *
(fe.shape_grad_component(j,k,d) * fe.shape_grad_component(i,k,d));
}
}
+
+ // exploit symmetry
+ for (unsigned int i=0; i<n_dofs; ++i)
+ for (unsigned int j=i+1; j<n_dofs; ++j)
+ M(j,i) = M(i,j);
+
}
/**