Data Race Condition while using AddElementMatrixSymmetric

More
5 years 10 months ago #1369 by jhauser
With this I get the error:
‘class std::shared_ptr<ngla::SparseMatrixSymmetric<double> >’ has no member named ‘SetZero’

I used
Code:
for(int i=0; i<ndof_y;i++) { FlatVector<double> mat_rowvals = maty->GetRowValues(i); for (int k=0; k<mat_rowvals.Size(); k++) { mat_rowvals[k]=0.0; } }
as a work around, but I still get a similar wrong matrix. Different every time I run the program.
At least with the python script. (I use python 3 to execute it) If I use "MyMaxwellAssembleSMALL" in jupyter notebook, I get the correct matrix. (which is printed in my terminal, when I use this function)
More
5 years 10 months ago #1370 by joachim
Code:
matrix -> SetZero()
if matrix is a shared pointer
More
5 years 10 months ago #1371 by jhauser
Oh, you're absolutely right. Thank you!
However the problem still remains. This doesn't change the every changing entries of the matrix. It's still different every time I run it.
More
5 years 10 months ago #1373 by christopher
With maty->SetZero() I get consistent results, can you repost the new version of your code?

(which is printed in my terminal, when I use this function)

This is because jupyter pipes only the python stdout and not the c++ one. You can use
Code:
pybind11::print(maty)
to get the output in jupyter (you need to include pybind11/pybind11.h to have that).
More
5 years 10 months ago #1375 by jhauser
I cleaned out the cmake-files of ml-ngs and build/compiled everything anew.
Now it works. I have absolutly no idea why it didn't work before since I haven't changed the code.
Thank you very much for your time! I am sorry, that it took so long.

And thank you for the jupyter suggestion.
Time to create page: 0.094 seconds