We only hand out function values for those basis functions whose support overlaps the current knot span. However, in the preceding loop we still computed all values_. This won't scale.
This method is a hack! I computes the derivatives of ALL B-splines, even the ones that are zero on the current knot span. I need it as an intermediate step to get the derivatives working. It will/must be removed as soon as possible.