function validateIndexSourceSize (value, index) {
  const valueSize = value.isMatrix ? value._size : arraySize(value)
  const sourceSize = index._sourceSize
  // checks if the source size is not null and matches the valueSize
  sourceSize.forEach((sourceDim, i) => {
    if (sourceDim !== null && sourceDim !== valueSize[i]) { throw new DimensionError(sourceDim, valueSize[i]) }
  })
}
Validate whether the source of the index matches the size of the Array
@param {Array | Matrix} value    Array to be validated
@param {Index} index  Index with the source information to validate
@throws DimensionError