Skip to content

Commit

Permalink
Fix NumPy capitalization in comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Mar 24, 2022
1 parent a9e1f9b commit d86609b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions galois/_fields/_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def _lapack_linalg(a, b, function, out=None, n_sum=None):
a = a.astype(dtype)
b = b.astype(dtype)

# Compute result using native numpy LAPACK/BLAS implementation
# Compute result using native NumPy LAPACK/BLAS implementation
if function in [np.inner, np.vdot]:
# These functions don't have and `out` keyword argument
c = function(a, b)
Expand Down Expand Up @@ -88,7 +88,7 @@ def vdot(a, b):
return _lapack_linalg(a, b, np.vdot)

a = a.flatten()
b = b.flatten().reshape(a.shape) # This is done to mimic numpy's error scenarios
b = b.flatten().reshape(a.shape) # This is done to mimic NumPy's error scenarios

return np.sum(a * b)

Expand Down
8 changes: 4 additions & 4 deletions galois/_fields/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,7 +1144,7 @@ def _get_dtype(cls, dtype):
if dtype is None:
return cls.dtypes[0]

# Convert "dtype" to a numpy dtype. This does platform specific conversion, if necessary.
# Convert "dtype" to a NumPy dtype. This does platform specific conversion, if necessary.
# For example, np.dtype(int) == np.int64 (on some systems).
dtype = np.dtype(dtype)
if dtype not in cls.dtypes:
Expand Down Expand Up @@ -1217,14 +1217,14 @@ def _check_array_types_dtype_object(cls, array):
return array
if array.ndim == 0:
if not isinstance(array[()], (int, np.integer, FieldArray)):
raise TypeError(f"When {cls.name} arrays are created/assigned with a numpy array with `dtype=object`, each element must be an integer. Found type {type(array[()])}.")
raise TypeError(f"When {cls.name} arrays are created/assigned with a NumPy array with `dtype=object`, each element must be an integer. Found type {type(array[()])}.")
return int(array)

iterator = np.nditer(array, flags=["multi_index", "refs_ok"])
for _ in iterator:
a = array[iterator.multi_index]
if not isinstance(a, (int, np.integer, FieldArray)):
raise TypeError(f"When {cls.name} arrays are created/assigned with a numpy array with `dtype=object`, each element must be an integer. Found type {type(a)}.")
raise TypeError(f"When {cls.name} arrays are created/assigned with a NumPy array with `dtype=object`, each element must be an integer. Found type {type(a)}.")

# Ensure the type is int so dtype=object classes don't get all mixed up
array[iterator.multi_index] = int(a)
Expand Down Expand Up @@ -2430,7 +2430,7 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
return getattr(field, field._OVERRIDDEN_UFUNCS[ufunc])(ufunc, method, inputs, kwargs, meta)

elif ufunc in field._UNSUPPORTED_UFUNCS:
raise NotImplementedError(f"The numpy ufunc {ufunc.__name__!r} is not supported on {field.name} arrays. If you believe this ufunc should be supported, please submit a GitHub issue at https://github.com/mhostetter/galois/issues.")
raise NotImplementedError(f"The NumPy ufunc {ufunc.__name__!r} is not supported on {field.name} arrays. If you believe this ufunc should be supported, please submit a GitHub issue at https://github.com/mhostetter/galois/issues.")

else:
if ufunc in [np.bitwise_and, np.bitwise_or, np.bitwise_xor] and method not in ["reduce", "accumulate", "at", "reduceat"]:
Expand Down
2 changes: 1 addition & 1 deletion tests/fields/test_numpy_functions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
A pytest module to test numpy methods, both supported and unsupported.
A pytest module to test NumPy methods, both supported and unsupported.
Numpy methods are selected from this API reference:
https://numpy.org/doc/stable/reference/routines.array-manipulation.html
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def array_equal(a, b):
# Weird numpy comparison bug, see https://github.com/mhostetter/galois/issues/37
# Weird NumPy comparison bug, see https://github.com/mhostetter/galois/issues/37
if a.dtype == np.object_:
return np.array_equal(a, np.array(b, dtype=np.object_))
else:
Expand Down

0 comments on commit d86609b

Please sign in to comment.