Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/NumSharp.Core/APIs/np.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ public static partial class np
/// <summary>
/// A convenient alias for None, useful for indexing arrays.
/// </summary>
/// <remarks>https://docs.scipy.org/doc/numpy-1.17.0/reference/arrays.indexing.html<br></br><br></br>https://stackoverflow.com/questions/42190783/what-does-three-dots-in-python-mean-when-indexing-what-looks-like-a-number</remarks>
/// <remarks>https://numpy.org/doc/stable/user/basics.indexing.html<br></br><br></br>https://stackoverflow.com/questions/42190783/what-does-three-dots-in-python-mean-when-indexing-what-looks-like-a-number</remarks>
public static readonly Slice newaxis = new Slice(null, null, 1) {IsNewAxis = true};

// https://docs.scipy.org/doc/numpy-1.16.0/user/basics.types.html
// https://numpy.org/doc/stable/user/basics.types.html
public static readonly Type bool_ = typeof(bool);
public static readonly Type bool8 = bool_;
public static readonly Type @bool = bool_;
Expand Down
2 changes: 1 addition & 1 deletion src/NumSharp.Core/APIs/np.cumsum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static partial class np
/// <param name="axis">Axis along which the cumulative sum is computed. The default (None) is to compute the cumsum over the flattened array.</param>
/// <param name="typeCode">Type of the returned array and of the accumulator in which the elements are summed. If dtype is not specified, it defaults to the dtype of a, unless a has an integer dtype with a precision less than that of the default platform integer. In that case, the default platform integer is used.</param>
/// <returns>A new array holding the result is returned unless out is specified, in which case a reference to out is returned. The result has the same size as a, and the same shape as a if axis is not None or a is a 1-d array.</returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.cumsum.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.cumsum.html</remarks>
public static NDArray cumsum(NDArray arr, int? axis = null, NPTypeCode? typeCode = null)
{
return arr.TensorEngine.ReduceCumAdd(arr, axis, typeCode);
Expand Down
4 changes: 2 additions & 2 deletions src/NumSharp.Core/APIs/np.fromfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static partial class np
/// <param name="file">filename.</param>
/// <param name="dtype">Data type of the returned array. For binary files, it is used to determine the size and byte-order of the items in the file.</param>
/// <returns></returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.fromfile.html</remarks>
public static NDArray fromfile(string file, NPTypeCode dtype)
{
return fromfile(file, dtype.AsType());
Expand All @@ -27,7 +27,7 @@ public static NDArray fromfile(string file, NPTypeCode dtype)
/// <param name="file">filename.</param>
/// <param name="dtype">Data type of the returned array. For binary files, it is used to determine the size and byte-order of the items in the file.</param>
/// <returns></returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.fromfile.html</remarks>
public static NDArray fromfile(string file, Type dtype)
{
unsafe
Expand Down
2 changes: 1 addition & 1 deletion src/NumSharp.Core/APIs/np.size.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class np
/// <param name="a">Input data.</param>
/// <param name="axis">Axis along which the elements are counted. By default, give the total number of elements.</param>
/// <returns>Number of elements along the specified axis.</returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ma.size.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ma.size.html</remarks>
public static int size(NDArray a, int? axis = null)
{
if (a == null)
Expand Down
2 changes: 1 addition & 1 deletion src/NumSharp.Core/APIs/np.tofile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public partial class NDArray
/// Data is always written in ‘C’ order, independent of the order of a. <br></br>The data produced by this method can be recovered using the function fromfile().
/// </summary>
/// <param name="fid">An open file object, or a string containing a filename.</param>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.tofile.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tofile.html</remarks>
public void tofile(string fid)
{
//TODO! support for sliced data (if sliced, clone and then save)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace NumSharp.Backends
{
public partial class DefaultEngine
{
/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public static Shape ResolveReturnShape(Shape leftShape, Shape rightShape)
{
if (leftShape == rightShape)
Expand Down Expand Up @@ -78,7 +78,7 @@ public static Shape ResolveReturnShape(Shape leftShape, Shape rightShape)
return mit; //implicit cast
}

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public static Shape ResolveReturnShape(params Shape[] shapes)
{
if (shapes.Length == 0)
Expand Down Expand Up @@ -134,7 +134,7 @@ public static Shape ResolveReturnShape(params Shape[] shapes)
return mit.Clean();
}

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public static Shape ResolveReturnShape(params NDArray[] shapes)
{
if (shapes.Length == 0)
Expand Down Expand Up @@ -191,7 +191,7 @@ public static Shape ResolveReturnShape(params NDArray[] shapes)
return mit.Clean();
}

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public static Shape[] Broadcast(params Shape[] shapes)
{
if (shapes.Length == 0)
Expand Down Expand Up @@ -268,7 +268,7 @@ public static Shape[] Broadcast(params Shape[] shapes)

//private static readonly int[][] _zeros = new int[][] {new int[0], new int[] {0}, new int[] {0, 0}, new int[] {0, 0, 0}, new int[] {0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},};

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public static (Shape LeftShape, Shape RightShape) Broadcast(Shape leftShape, Shape rightShape)
{
if (leftShape._hashCode != 0 && leftShape._hashCode == rightShape._hashCode)
Expand Down Expand Up @@ -373,7 +373,7 @@ public static (Shape LeftShape, Shape RightShape) Broadcast(Shape leftShape, Sha
return (leftResult, rightResult);
}

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public static NDArray[] Broadcast(params NDArray[] arrays)
{
if (arrays.Length == 0)
Expand All @@ -390,7 +390,7 @@ public static NDArray[] Broadcast(params NDArray[] arrays)
return arrays;
}

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public unsafe static bool AreBroadcastable(params Shape[] shapes)
{
if (shapes.Length <= 1)
Expand Down Expand Up @@ -442,7 +442,7 @@ public unsafe static bool AreBroadcastable(params Shape[] shapes)
return true;
}

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public unsafe static bool AreBroadcastable(params int[][] shapes)
{
if (shapes.Length <= 1)
Expand Down Expand Up @@ -494,7 +494,7 @@ public unsafe static bool AreBroadcastable(params int[][] shapes)
return true;
}

/// <remarks>Based on https://docs.scipy.org/doc/numpy-1.16.1/user/basics.broadcasting.html </remarks>
/// <remarks>Based on https://numpy.org/doc/stable/user/basics.broadcasting.html </remarks>
public static bool AreBroadcastable(params NDArray[] arrays)
{
if (arrays.Length <= 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace NumSharp.Backends
public partial class DefaultEngine
{

/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.dot.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.dot.html</remarks>
public override NDArray Dot(in NDArray left, in NDArray right)
{
//Dot product of two arrays.Specifically,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected static NDArray MultiplyMatrix(NDArray left, NDArray right, NDArray @ou
return null;
}
#else
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.multiply.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.multiply.html</remarks>
[SuppressMessage("ReSharper", "JoinDeclarationAndInitializer")]
[MethodImpl(OptimizeAndInline)]
protected static NDArray MultiplyMatrix(NDArray left, NDArray right, NDArray @out = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace NumSharp.Backends
{
public partial class DefaultEngine
{
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.matmul.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.matmul.html</remarks>
public override NDArray Matmul(NDArray lhs, NDArray rhs)
{
if (lhs.Shape.IsScalar || rhs.Shape.IsScalar)
Expand Down
14 changes: 7 additions & 7 deletions src/NumSharp.Core/Backends/NDArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace NumSharp
/// An associated data-type object describes the format of each element in the array (its byte-order,<br></br>
/// how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.)
/// </summary>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html</remarks>
[DebuggerTypeProxy(nameof(NDArrayDebuggerProxy))]
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public partial class NDArray : IIndex, ICloneable, IEnumerable
Expand Down Expand Up @@ -342,7 +342,7 @@ public int[] shape
/// <summary>
/// A 1-D iterator over the array.
/// </summary>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.flat.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.flat.html</remarks>
public NDArray flat
{
get
Expand All @@ -357,7 +357,7 @@ public NDArray flat
/// The transposed array. <br></br>
/// Same as self.transpose().
/// </summary>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.T.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.T.html</remarks>
public NDArray T
{
get
Expand Down Expand Up @@ -422,7 +422,7 @@ protected internal IArraySlice Array
/// <param name="dtype">The dtype to cast this array.</param>
/// <param name="copy">By default, astype always returns a newly allocated array. If this is set to false, the input internal array is replaced instead of returning a new NDArray with the casted data.</param>
/// <returns>An <see cref="NDArray"/> of given <paramref name="dtype"/>.</returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.astype.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.astype.html</remarks>
[SuppressMessage("ReSharper", "ParameterHidesMember")]
public NDArray astype(Type dtype, bool copy = true) => TensorEngine.Cast(this, dtype, copy);

Expand All @@ -432,7 +432,7 @@ protected internal IArraySlice Array
/// <param name="dtype">The dtype to cast this array.</param>
/// <param name="copy">By default, astype always returns a newly allocated array. If this is set to false, the input internal array is replaced instead of returning a new NDArray with the casted data.</param>
/// <returns>An <see cref="NDArray"/> of given <paramref name="dtype"/>.</returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.astype.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.astype.html</remarks>
public NDArray astype(NPTypeCode typeCode, bool copy = true) => TensorEngine.Cast(this, typeCode, copy);

/// <summary>
Expand Down Expand Up @@ -505,7 +505,7 @@ IEnumerable _empty()
/// This argument can also be specified as an ndarray sub-class, which then specifies the type of the returned object (this is equivalent to setting the type parameter).
/// </param>
/// <returns></returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.view.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.view.html</remarks>
public NDArray view(Type dtype = null)
{
//TODO! this shouldnt be a cast in case dtype != null, it should be an unsafe reinterpret (see remarks).
Expand All @@ -525,7 +525,7 @@ public NDArray view(Type dtype = null)
/// This argument can also be specified as an ndarray sub-class, which then specifies the type of the returned object (this is equivalent to setting the type parameter).
/// </param>
/// <returns></returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.view.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.view.html</remarks>
public NDArray<T> view<T>() where T : unmanaged
=> view(typeof(T)).AsGeneric<T>();

Expand Down
2 changes: 1 addition & 1 deletion src/NumSharp.Core/Creation/NDArray.Copy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public partial class NDArray
/// </summary>
/// <param name="order"></param>
/// <returns></returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.copy.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.copy.html</remarks>
public NDArray copy(char order = 'C') => Clone(); //TODO order support
}
}
2 changes: 1 addition & 1 deletion src/NumSharp.Core/Creation/NdArray.DStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public partial class NDArray
/// </summary>
/// <param name="tup">The arrays must have the same shape along all but the third axis. 1-D or 2-D arrays must have the same shape.</param>
/// <returns>The array formed by stacking the given arrays, will be at least 3-D.</returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.dstack.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.dstack.html</remarks>
public NDArray dstack(params NDArray[] tup)
{
if (tup == null)
Expand Down
2 changes: 1 addition & 1 deletion src/NumSharp.Core/Creation/NdArray.HStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public partial class NDArray
/// </summary>
/// <param name="tup">The arrays must have the same shape along all but the second axis, except 1-D arrays which can be any length.</param>
/// <returns>The array formed by stacking the given arrays.</returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.hstack.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.hstack.html</remarks>
public NDArray hstack(params NDArray[] tup)
{
if (tup == null)
Expand Down
2 changes: 1 addition & 1 deletion src/NumSharp.Core/Creation/NdArray.Mgrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public partial class NDArray
/// </summary>
/// <param name="rhs"></param>
/// <returns>mesh-grid `ndarrays` all of the same dimensions</returns>
/// <remarks>https://docs.scipy.org/doc/numpy/reference/generated/numpy.mgrid.html</remarks>
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.mgrid.html</remarks>
public (NDArray, NDArray) mgrid(NDArray rhs)
{
return np.mgrid(this, rhs);
Expand Down
Loading