Skip to content

Commit d77369e

Browse files
committed
replace Shape.Length to Shape.NDim
1 parent 3bab08c commit d77369e

18 files changed

Lines changed: 35 additions & 35 deletions

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,5 @@ NumSharp is referenced by:
9090
NumSharp is a member project of [SciSharp.org](https://github.com/SciSharp) which is the .NET based ecosystem of open-source software for mathematics, science, and engineering.
9191
Welcome to fork and pull request to add more APIs, and make reference list longer.
9292

93-
<img src="https://avatars3.githubusercontent.com/u/44989469?s=200&v=4" width="80">
93+
<img src="https://avatars3.githubusercontent.com/u/44989469?s=200&v=4" width="80">
94+
Star me on [Github](https://github.com/SciSharp/NumSharp) if you like it.

src/NumSharp.Core/Extensions/NDArrayWithDType.AMin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public NDArray AMin(int? axis = null)
2323
}
2424
else
2525
{
26-
if (axis < 0 || axis >= Shape.Length)
26+
if (axis < 0 || axis >= Shape.NDim)
2727
throw new Exception("Invalid input: axis");
2828
int[] resShapes = new int[Shape.Shapes.Count - 1];
2929
int index = 0; //index for result shape set

src/NumSharp.Core/Extensions/NdArray.AMax.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static NDArrayGeneric<double> AMax(this NDArrayGeneric<double> np, int? a
2727
}
2828
else
2929
{
30-
if (axis < 0 || axis >= np.Shape.Length)
30+
if (axis < 0 || axis >= np.NDim)
3131
throw new Exception("Invalid input: axis");
3232
int[] resShapes = new int[np.Shape.Shapes.Count - 1];
3333
int index = 0; //index for result shape set

src/NumSharp.Core/Extensions/NdArray.AMin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static NDArrayGeneric<double> AMin(this NDArrayGeneric<double> np, int? a
1717
}
1818
else
1919
{
20-
if (axis < 0 || axis >= np.Shape.Length)
20+
if (axis < 0 || axis >= np.NDim)
2121
throw new Exception("Invalid input: axis");
2222
int[] resShapes = new int[np.Shape.Shapes.Count - 1];
2323
int index = 0; //index for result shape set

src/NumSharp.Core/Extensions/NdArray.HStack.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public static NDArrayGeneric<T> HStack<T>(this NDArrayGeneric<T> np1, params NDA
2323
if (nps[0].Shape != ele.Shape)
2424
throw new Exception("Arrays mush have same shapes");
2525
}
26-
int total = nps[0].Shape.Length == 1 ? 1 : nps[0].Shape.Shapes[0];
27-
int pageSize = nps[0].Shape.Length == 1 ? nps[0].Shape.Shapes[0] : nps[0].Shape.DimOffset[0];
26+
int total = nps[0].NDim == 1 ? 1 : nps[0].Shape.Shapes[0];
27+
int pageSize = nps[0].NDim == 1 ? nps[0].Shape.Shapes[0] : nps[0].Shape.DimOffset[0];
2828

2929
//int i = 0;
3030
//Enumerable.Range(0, total)

src/NumSharp.Core/Extensions/NdArray.VStack.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static NDArrayGeneric<T> VStack<T>(this NDArrayGeneric<T> np1, params NDA
2525
list.AddRange(ele.Data);
2626
}
2727
np.Data = list.ToArray();
28-
if (nps[0].Shape.Length == 1)
28+
if (nps[0].NDim == 1)
2929
{
3030
np.Shape = new Shape(new int[] { nps.Length, nps[0].Shape.Shapes[0] });
3131
}

src/NumSharp.Core/LinearAlgebra/NdArray.Dot.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public partial class NDArray
1818
/// <returns></returns>
1919
public NDArray dot<T>(NDArray np2)
2020
{
21-
if ((this.Shape.Length == 1) & (np2.Shape.Length == 1))
21+
if ((this.Shape.NDim == 1) & (np2.Shape.NDim == 1))
2222
if (this.Shape.Shapes[0] != np2.Shape.Shapes[0])
2323
throw new Exception("The Dot method does not work with this shape or was not already implemented.");
2424
else
@@ -104,7 +104,7 @@ public NDArray dot<T>(NDArray np2)
104104
throw new Exception("The Dot method is not implemented for the " + typeof(T).Name);
105105
}
106106
}
107-
if ((this.Shape.Length == 1) & (np2.Shape.Length == 1))
107+
if ((this.Shape.NDim == 1) & (np2.Shape.NDim == 1))
108108
{
109109
this.Shape = new Shape(Size);
110110
np2.Shape = new Shape(np2.Size);
@@ -126,7 +126,7 @@ public partial class NDArrayGeneric<T>
126126
/// <returns></returns>
127127
public NDArrayGeneric<T> dot(NDArrayGeneric<T> np2)
128128
{
129-
if ((this.Shape.Length == 1 ) & (np2.Shape.Length == 1))
129+
if ((this.Shape.NDim == 1 ) & (np2.Shape.NDim == 1))
130130
if (this.Shape.Shapes[0] != np2.Shape.Shapes[0])
131131
throw new Exception("The Dot method does not work with this shape or was not already implemented.");
132132
else
@@ -214,7 +214,7 @@ public NDArrayGeneric<T> dot(NDArrayGeneric<T> np2)
214214
throw new Exception("The Dot method is not implemented for the " + typeof(T).Name);
215215
}
216216
}
217-
if ((this.Shape.Length == 1 ) & (np2.Shape.Length == 1))
217+
if ((this.Shape.NDim == 1 ) & (np2.Shape.NDim == 1))
218218
{
219219
this.Shape = new Shape(this.Data.Length);
220220
np2.Shape = new Shape(np2.Data.Length);

src/NumSharp.Core/LinearAlgebra/NdArray.multi_dot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public NDArrayGeneric<T> multi_dot(params NDArrayGeneric<T>[] np2Multi)
2020
{
2121
var np2 = np2Multi.Last();
2222

23-
if ((this.Shape.Length == 1 ) & (np2.Shape.Length == 1))
23+
if ((this.Shape.NDim == 1 ) & (np2.Shape.NDim == 1))
2424
if (this.Shape.Shapes[0] != np2.Shape.Shapes[0])
2525
throw new Exception("The Dot method does not work with this shape or was not already implemented.");
2626
else

src/NumSharp.Core/Manipulation/NumPy.vstack.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public NDArray vstack<T>(params NDArray[] nps)
2525
list.AddRange(ele.Data<T>());
2626
}
2727
np.Set(list.ToArray());
28-
if (nps[0].Shape.Length == 1)
28+
if (nps[0].NDim == 1)
2929
{
3030
np.Shape = new Shape(new int[] { nps.Length, nps[0].Shape.Shapes[0] });
3131
}

src/NumSharp.Core/Math/NumPy.amax.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public NDArray amax(NDArray nd, int? axis = null)
1818
}
1919
else
2020
{
21-
if (axis < 0 || axis >= nd.Shape.Length)
21+
if (axis < 0 || axis >= nd.NDim)
2222
throw new Exception("Invalid input: axis");
2323
int[] resShapes = new int[nd.NDim - 1];
2424
int index = 0; //index for result shape set

0 commit comments

Comments
 (0)