Hi!
It seems to me that asm_mass_matrix() will add elements to the provided matrix, i.e. not start by clearing the matrix. Maybe its by design and the same for the other assembly functions, so that it is easy for several assembly functions can add to the same matrix, but I don't see it documented anywhere.
Unless I'm overlooking something in the documentation, perhaps it would be good to add a note to the documentation of each of the assembly functions, explaining that values will be added to the provided matrix?