Skip to content

Commit ca7c472

Browse files
Nucsclaude
andcommitted
fix: correct 18 broken NumPy documentation URLs
Updates URLs that were pointing to incorrect paths: 1. Random functions (12 URLs): Added /random/ directory - reference/generated/numpy.random.* → reference/random/generated/numpy.random.* 2. arrays.indexing (1 URL): Corrected section path - reference/arrays.indexing.html → user/basics.indexing.html 3. c-api.dtype (1 URL): Fixed path format - reference/c-api.dtype.html → reference/c-api/dtype.html 4. routines.random (1 URL): Updated to new location - reference/routines.random.html → reference/random/index.html 5. asscalar (6 URLs): Function removed in NumPy 1.23, now links to replacement - numpy.asscalar.html → numpy.ndarray.item.html 6. find_common_type (6 URLs): Function deprecated, now links to replacement - numpy.find_common_type.html → numpy.result_type.html 7. itemset (4 URLs): Function removed in NumPy 2.4, now links to alternative - numpy.ndarray.itemset.html → numpy.put.html All 126 URLs now return HTTP 200. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 78c121d commit ca7c472

18 files changed

+40
-40
lines changed

src/NumSharp.Core/APIs/np.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static partial class np
1313
/// <summary>
1414
/// A convenient alias for None, useful for indexing arrays.
1515
/// </summary>
16-
/// <remarks>https://numpy.org/doc/stable/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>
16+
/// <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>
1717
public static readonly Slice newaxis = new Slice(null, null, 1) {IsNewAxis = true};
1818

1919
// https://numpy.org/doc/stable/user/basics.types.html

src/NumSharp.Core/Creation/np.dtype.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ internal enum NPY_SCALARKIND
377377
};
378378

379379
/// <summary>
380-
/// https://numpy.org/doc/stable/reference/c-api.dtype.html#enumerated-types
380+
/// https://numpy.org/doc/stable/reference/c-api/dtype.html#enumerated-types
381381
/// </summary>
382382
internal enum NPY_TYPECHAR
383383
{

src/NumSharp.Core/Logic/np.find_common_type.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ private static readonly (NPTypeCode Type, int Priority)[] powerPriorities =
644644
/// <param name="array_types">A list of dtypes or dtype convertible objects representing arrays. Can be null.</param>
645645
/// <param name="scalar_types">A list of dtypes or dtype convertible objects representing scalars.Can be null.</param>
646646
/// <returns>The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.</returns>
647-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.find_common_type.html</remarks>
647+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.result_type.html</remarks>
648648
public static NPTypeCode find_common_type(NPTypeCode[] array_types, NPTypeCode[] scalar_types)
649649
{
650650
return _FindCommonType(array_types ?? Array.Empty<NPTypeCode>(), scalar_types ?? Array.Empty<NPTypeCode>());
@@ -658,7 +658,7 @@ public static NPTypeCode find_common_type(NPTypeCode[] array_types, NPTypeCode[]
658658
/// <param name="array_types">A list of dtypes or dtype convertible objects representing arrays. Can be null.</param>
659659
/// <param name="scalar_types">A list of dtypes or dtype convertible objects representing scalars.Can be null.</param>
660660
/// <returns>The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.</returns>
661-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.find_common_type.html</remarks>
661+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.result_type.html</remarks>
662662
public static NPTypeCode find_common_type(Type[] array_types)
663663
{
664664
return _FindCommonType(array_types?.Select(v => v.GetTypeCode()).ToArray() ?? Array.Empty<NPTypeCode>(), Array.Empty<NPTypeCode>());
@@ -670,7 +670,7 @@ public static NPTypeCode find_common_type(Type[] array_types)
670670
/// <param name="array_types">A list of dtypes or dtype convertible objects representing arrays. Can be null.</param>
671671
/// <param name="scalar_types">A list of dtypes or dtype convertible objects representing scalars.Can be null.</param>
672672
/// <returns>The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.</returns>
673-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.find_common_type.html</remarks>
673+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.result_type.html</remarks>
674674
public static NPTypeCode find_common_type(Type[] array_types, Type[] scalar_types)
675675
{
676676
return _FindCommonType(array_types?.Select(v => v.GetTypeCode()).ToArray() ?? Array.Empty<NPTypeCode>(), scalar_types?.Select(v => v.GetTypeCode()).ToArray() ?? Array.Empty<NPTypeCode>());
@@ -682,7 +682,7 @@ public static NPTypeCode find_common_type(Type[] array_types, Type[] scalar_type
682682
/// <param name="array_types">A list of dtypes or dtype convertible objects representing arrays. Can be null.</param>
683683
/// <param name="scalar_types">A list of dtypes or dtype convertible objects representing scalars.Can be null.</param>
684684
/// <returns>The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.</returns>
685-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.find_common_type.html</remarks>
685+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.result_type.html</remarks>
686686
public static NPTypeCode find_common_type(string[] array_types, string[] scalar_types)
687687
{
688688
return _FindCommonType(array_types?.Select(v => np.dtype(v).typecode).ToArray() ?? Array.Empty<NPTypeCode>(), scalar_types?.Select(v => np.dtype(v).typecode).ToArray() ?? Array.Empty<NPTypeCode>());
@@ -694,7 +694,7 @@ public static NPTypeCode find_common_type(string[] array_types, string[] scalar_
694694
/// <param name="array_types">A list of dtypes or dtype convertible objects representing arrays. Can be null.</param>
695695
/// <param name="scalar_types">A list of dtypes or dtype convertible objects representing scalars.Can be null.</param>
696696
/// <returns>The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.</returns>
697-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.find_common_type.html</remarks>
697+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.result_type.html</remarks>
698698
public static NPTypeCode find_common_type(Type[] array_types, NPTypeCode[] scalar_types)
699699
{
700700
return _FindCommonType(array_types?.Select(v => v.GetTypeCode()).ToArray() ?? Array.Empty<NPTypeCode>(), scalar_types ?? Array.Empty<NPTypeCode>());
@@ -706,7 +706,7 @@ public static NPTypeCode find_common_type(Type[] array_types, NPTypeCode[] scala
706706
/// <param name="array_types">A list of dtypes or dtype convertible objects representing arrays. Can be null.</param>
707707
/// <param name="scalar_types">A list of dtypes or dtype convertible objects representing scalars.Can be null.</param>
708708
/// <returns>The common data type, which is the maximum of array_types ignoring scalar_types, unless the maximum of scalar_types is of a different kind (dtype.kind). If the kind is not understood, then None is returned.</returns>
709-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.find_common_type.html</remarks>
709+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.result_type.html</remarks>
710710
public static NPTypeCode find_common_type(NPTypeCode[] array_types, Type[] scalar_types)
711711
{
712712
return _FindCommonType(array_types ?? Array.Empty<NPTypeCode>(), scalar_types?.Select(v => v.GetTypeCode()).ToArray() ?? Array.Empty<NPTypeCode>());

src/NumSharp.Core/Manipulation/NDArray.itemset.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public partial class NDArray
77
/// <summary>
88
/// Insert scalar into an array (scalar is cast to array’s dtype, if possible)
99
/// </summary>
10-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.itemset.html</remarks>
10+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.put.html</remarks>
1111
public void itemset(ref Shape shape, ValueType val)
1212
{
1313
SetValue(val, shape.dimensions); //TODO! if T != dtype, we need to cast!
@@ -16,7 +16,7 @@ public void itemset(ref Shape shape, ValueType val)
1616
/// <summary>
1717
/// Insert scalar into an array (scalar is cast to array’s dtype, if possible)
1818
/// </summary>
19-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.itemset.html</remarks>
19+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.put.html</remarks>
2020
public void itemset(Shape shape, ValueType val)
2121
{
2222
SetValue(val, shape.dimensions); //TODO! if T != dtype, we need to cast!
@@ -25,7 +25,7 @@ public void itemset(Shape shape, ValueType val)
2525
/// <summary>
2626
/// Insert scalar into an array (scalar is cast to array’s dtype, if possible)
2727
/// </summary>
28-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.itemset.html</remarks>
28+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.put.html</remarks>
2929
public void itemset(int[] shape, ValueType val)
3030
{
3131
SetValue(val, shape); //TODO! if T != dtype, we need to cast!
@@ -34,7 +34,7 @@ public void itemset(int[] shape, ValueType val)
3434
/// <summary>
3535
/// Insert scalar into an array (scalar is cast to array’s dtype, if possible)
3636
/// </summary>
37-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.itemset.html</remarks>
37+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.put.html</remarks>
3838
public void itemset<T>(int[] shape, T val) where T : unmanaged
3939
{
4040
SetValue<T>(val, shape); //TODO! if T != dtype, we need to cast!

src/NumSharp.Core/Manipulation/np.asscalar.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static partial class np
1111
/// </summary>
1212
/// <param name="nd">Input NDArray of size 1.</param>
1313
/// <returns></returns>
14-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.asscalar.html</remarks>
14+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.item.html</remarks>
1515
public static T asscalar<T>(NDArray nd) where T : unmanaged
1616
{
1717
if (nd.size != 1)
@@ -27,7 +27,7 @@ public static T asscalar<T>(NDArray nd) where T : unmanaged
2727
/// </summary>
2828
/// <param name="arr">Input array of size 1.</param>
2929
/// <returns></returns>
30-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.asscalar.html</remarks>
30+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.item.html</remarks>
3131
public static T asscalar<T>(Array arr)
3232
{
3333
if (arr.Length != 1)
@@ -43,7 +43,7 @@ public static T asscalar<T>(Array arr)
4343
/// </summary>
4444
/// <param name="nd">Input NDArray of size 1.</param>
4545
/// <returns></returns>
46-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.asscalar.html</remarks>
46+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.item.html</remarks>
4747
public static ValueType asscalar(NDArray nd)
4848
{
4949
if (nd.size != 1)
@@ -56,7 +56,7 @@ public static ValueType asscalar(NDArray nd)
5656
/// </summary>
5757
/// <param name="arr">Input array of size 1.</param>
5858
/// <returns></returns>
59-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.asscalar.html</remarks>
59+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.item.html</remarks>
6060
public static ValueType asscalar(Array arr)
6161
{
6262
if (arr.Length != 1)
@@ -69,7 +69,7 @@ public static ValueType asscalar(Array arr)
6969
/// </summary>
7070
/// <param name="arr">Input array of size 1.</param>
7171
/// <returns></returns>
72-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.asscalar.html</remarks>
72+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.item.html</remarks>
7373
public static T asscalar<T>(ArraySlice<T> arr) where T : unmanaged
7474
{
7575
if (arr.Count != 1)
@@ -82,7 +82,7 @@ public static T asscalar<T>(ArraySlice<T> arr) where T : unmanaged
8282
/// </summary>
8383
/// <param name="arr">Input array of size 1.</param>
8484
/// <returns></returns>
85-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.asscalar.html</remarks>
85+
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.ndarray.item.html</remarks>
8686
public static T asscalar<T>(IArraySlice arr) where T : unmanaged
8787
{
8888
if (arr.Count != 1)

src/NumSharp.Core/RandomSampling/np.random.binomial.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public partial class NumPyRandom
1717
/// <param name="p">Parameter of the distribution, >= 0 and &lt;=1.</param>
1818
/// <param name="shape">Output Shape</param>
1919
/// <returns>Drawn samples from the parameterized binomial distribution, where each sample is equal to the number of successes over the n trials.</returns>
20-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.binomial.html</remarks>
20+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.binomial.html</remarks>
2121
public NDArray binomial(int n, double p, Shape shape) => binomial(n, p, shape.dimensions);
2222

2323
/// <summary>
@@ -28,7 +28,7 @@ public partial class NumPyRandom
2828
/// <param name="p">Parameter of the distribution, >= 0 and &lt;=1.</param>
2929
/// <param name="dims">Output Shape</param>
3030
/// <returns>Drawn samples from the parameterized binomial distribution, where each sample is equal to the number of successes over the n trials.</returns>
31-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.binomial.html</remarks>
31+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.binomial.html</remarks>
3232
public NDArray binomial(int n, double p, params int[] dims)
3333
{
3434
var x = np.zeros(dims);

src/NumSharp.Core/RandomSampling/np.random.chisquare.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public partial class NumPyRandom
1515
/// <param name="df">Number of degrees of freedom, should be > 0.</param>
1616
/// <param name="shape">Output Shape</param>
1717
/// <returns>Drawn samples from the parameterized chi-square distribution.</returns>
18-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.chisquare.html</remarks>
18+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.chisquare.html</remarks>
1919
public NDArray chisquare(double df, Shape shape) => chisquare(df, shape.dimensions);
2020

2121
/// <summary>
@@ -26,7 +26,7 @@ public partial class NumPyRandom
2626
/// <param name="df">Number of degrees of freedom, should be > 0.</param>
2727
/// <param name="dims">Output Shape</param>
2828
/// <returns>Drawn samples from the parameterized chi-square distribution.</returns>
29-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.chisquare.html</remarks>
29+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.chisquare.html</remarks>
3030
public NDArray chisquare(double df, params int[] dims)
3131
{
3232
if (df <= 0)

src/NumSharp.Core/RandomSampling/np.random.choice.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public partial class NumPyRandom
99
/// <param name="shape">Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.</param>
1010
/// <param name="replace">Whether the sample is with or without replacement</param>
1111
/// <param name="probabilities">The probabilities associated with each entry in a. If not given the sample assumes a uniform distribution over all entries in a.</param>
12-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.choice.html</remarks>
12+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.choice.html</remarks>
1313
public NDArray choice(NDArray arr, Shape shape = default, bool replace = true, double[] probabilities = null)
1414
{
1515
int arrSize = arr.size;
@@ -24,7 +24,7 @@ public NDArray choice(NDArray arr, Shape shape = default, bool replace = true, d
2424
/// <param name="shape">Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.</param>
2525
/// <param name="replace">Whether the sample is with or without replacement</param>
2626
/// <param name="probabilities">The probabilities associated with each entry in a. If not given the sample assumes a uniform distribution over all entries in a.</param>
27-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.choice.html</remarks>
27+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.choice.html</remarks>
2828
public NDArray choice(int a, Shape shape = default, bool replace = true, double[] probabilities = null)
2929
{
3030
if (shape.IsEmpty)

src/NumSharp.Core/RandomSampling/np.random.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// <summary>
44
/// A class that serves as numpy.random.RandomState in python.
55
/// </summary>
6-
/// <remarks>https://numpy.org/doc/stable/reference/routines.random.html</remarks>
6+
/// <remarks>https://numpy.org/doc/stable/reference/random/index.html</remarks>
77
public partial class NumPyRandom
88
{
99
protected internal Randomizer randomizer;

src/NumSharp.Core/RandomSampling/np.random.exponential.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public partial class NumPyRandom
1414
/// <param name="scale">The scale parameter, \beta = 1/\lambda.</param>
1515
/// <param name="shape">Output Shape</param>
1616
/// <returns>Drawn samples from the parameterized exponential distribution.</returns>
17-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.exponential.html</remarks>
17+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.exponential.html</remarks>
1818
public NDArray exponential(double scale, Shape shape) => exponential(scale, shape.dimensions);
1919

2020
/// <summary>
@@ -24,7 +24,7 @@ public partial class NumPyRandom
2424
/// <param name="scale">The scale parameter, \beta = 1/\lambda.</param>
2525
/// <param name="dims">Output Shape</param>
2626
/// <returns>Drawn samples from the parameterized exponential distribution.</returns>
27-
/// <remarks>https://numpy.org/doc/stable/reference/generated/numpy.random.exponential.html</remarks>
27+
/// <remarks>https://numpy.org/doc/stable/reference/random/generated/numpy.random.exponential.html</remarks>
2828
public NDArray exponential(double scale, params int[] dims)
2929
{
3030
var x = np.log(1 - np.random.uniform(0, 1, dims));

0 commit comments

Comments
 (0)