Those loop nests that set every element of a multi-dimensional array to (floating-point) zero could perhaps be replaced with memset (not officially portable) or memcpy (from a local variable of the same type with an initialiser).