vkostyukov / la4j

Linear Algebra for Java
http://la4j.org
Apache License 2.0
373 stars 109 forks source link

Revise all the calls to System.arraycopy() #235

Closed vkostyukov closed 9 years ago

vkostyukov commented 9 years ago

We have to make sure that we don't call it with zero elements to copy. Something like this check should be done:

if (cardinality - k > 0) {
  System.arraycopy(values, k, values, k + 1, cardinality - k);
  System.arraycopy(indices, k, indices, k + 1, cardinality - k);
}