Skip to content

Commit 6212415

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/copilot/ndarray-core-type-factories' into copilot/ndarray-core-type-factories
2 parents 899aa89 + bc60626 commit 6212415

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

vecxt/src/ndarray.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import vecxt.BoundsCheck.BoundsCheck
66

77
object ndarray:
88

9-
class NDArray[@specialized(Double, Int, Float, Boolean) A] @publicInBinary() private[ndarray] (
9+
class NDArray[A] @publicInBinary() private[ndarray] (
1010
val data: Array[A],
1111
val shape: Array[Int],
1212
val strides: Array[Int],
@@ -68,7 +68,7 @@ object ndarray:
6868
object NDArray:
6969

7070
// Primary constructor — full control
71-
inline def apply[@specialized(Double, Int, Float, Boolean) A](
71+
inline def apply[A](
7272
data: Array[A],
7373
shape: Array[Int],
7474
strides: Array[Int],
@@ -79,7 +79,7 @@ object ndarray:
7979
end apply
8080

8181
// Convenience: column-major from data + shape
82-
inline def apply[@specialized(Double, Int, Float, Boolean) A](
82+
inline def apply[A](
8383
data: Array[A],
8484
shape: Array[Int]
8585
)(using inline boundsCheck: BoundsCheck): NDArray[A] =
@@ -88,12 +88,12 @@ object ndarray:
8888
end apply
8989

9090
// 1D from flat array
91-
inline def fromArray[@specialized(Double, Int, Float, Boolean) A](
91+
inline def fromArray[A](
9292
data: Array[A]
9393
)(using inline boundsCheck: BoundsCheck): NDArray[A] =
9494
new NDArray(data, Array(data.length), Array(1), 0)
9595

96-
inline def zeros[@specialized(Double, Int, Float, Boolean) A](
96+
inline def zeros[A](
9797
shape: Array[Int]
9898
)(using inline boundsCheck: BoundsCheck, oz: OneAndZero[A], ct: scala.reflect.ClassTag[A]): NDArray[A] =
9999
shapeCheck(shape)
@@ -102,7 +102,7 @@ object ndarray:
102102
new NDArray(data, shape.clone(), colMajorStrides(shape), 0)
103103
end zeros
104104

105-
inline def ones[@specialized(Double, Int, Float, Boolean) A](
105+
inline def ones[A](
106106
shape: Array[Int]
107107
)(using inline boundsCheck: BoundsCheck, oz: OneAndZero[A], ct: scala.reflect.ClassTag[A]): NDArray[A] =
108108
shapeCheck(shape)
@@ -111,7 +111,7 @@ object ndarray:
111111
new NDArray(data, shape.clone(), colMajorStrides(shape), 0)
112112
end ones
113113

114-
inline def fill[@specialized(Double, Int, Float, Boolean) A](
114+
inline def fill[A](
115115
shape: Array[Int],
116116
value: A
117117
)(using inline boundsCheck: BoundsCheck, ct: scala.reflect.ClassTag[A]): NDArray[A] =
@@ -123,7 +123,7 @@ object ndarray:
123123

124124
end NDArray
125125

126-
extension [@specialized(Double, Int, Float, Boolean) A](arr: NDArray[A]) inline def shapeArray: Array[Int] = arr.shape
126+
extension [A](arr: NDArray[A]) inline def shapeArray: Array[Int] = arr.shape
127127
end extension
128128

129129
// Compute column-major strides for a given shape

0 commit comments

Comments
 (0)