Comparing large sparse matrices for differences close to machine precision
Afficher commentaires plus anciens
Basically what I am doing right now is creating the same matrix k in two very different ways. As it turned out simply comparing them by the find command results in almost no matches as the single elements are somehow very slightly different. as in if I subtract one element from the other the result is either close to or at machine precision. I am now looking for a way to compare those two matrices in a way, so I get an Idea of how bad the differences are.
Réponse acceptée
Plus de réponses (1)
Bruno Luong
le 21 Sep 2022
Modifié(e) : Bruno Luong
le 21 Sep 2022
One way to compare matrices is to display
norm(A-B, Inf) / norm(A, Inf)
It should be at machine precision (~1e-15) of at worst about 1e-12 if they supposed to be identical but computed with different thread/cu/instruction order etc...
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!