You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function that computes a series of linearly spaced values starting from "start" to "stop" with given size. Wrapper function for _linspace_serial, _linspace_parallel.
88
89
89
90
Raises:
90
-
Error if both dtype and dtype are integers or if dtype is a float and dtype is an integer.
91
+
Error if dtype is an integer.
91
92
92
93
Parameters:
93
-
dtype: Datatype of the input values.
94
-
dtype: Datatype of the output NDArray.
94
+
dtype: Datatype of the output array.
95
95
96
96
Args:
97
97
start: Start value.
@@ -220,11 +220,10 @@ fn logspace[
220
220
Generate a logrithmic spaced NDArray of `num` elements between `start` and `stop`. Wrapper function for _logspace_serial, _logspace_parallel functions.
221
221
222
222
Raises:
223
-
Error if both dtype and dtype are integers or if dtype is a float and dtype is an integer.
223
+
Error if dtype is an integer.
224
224
225
225
Parameters:
226
-
dtype: Datatype of the input values.
227
-
dtype: Datatype of the output NDArray.
226
+
dtype: Datatype of the output array.
228
227
229
228
Args:
230
229
start: The starting value of the NDArray.
@@ -361,11 +360,10 @@ fn geomspace[
361
360
Generate a NDArray of `num` elements between `start` and `stop` in a geometric series.
362
361
363
362
Raises:
364
-
Error if both dtype and dtype are integers or if dtype is a float and dtype is an integer.
363
+
Error if dtype is an integer.
365
364
366
365
Parameters:
367
366
dtype: Datatype of the input values.
368
-
dtype: Datatype of the output NDArray.
369
367
370
368
Args:
371
369
start: The starting value of the NDArray.
@@ -543,8 +541,28 @@ fn full[
543
541
return NDArray[dtype](shape, fill=tens_value)
544
542
545
543
546
-
fndiagflat():
547
-
pass
544
+
fndiagflat[dtype: DType](inoutv: NDArray[dtype], k: Int =0) raises -> NDArray[dtype]:
545
+
"""
546
+
Generate a 2-D NDArray with the flattened input as the diagonal.
547
+
548
+
Parameters:
549
+
dtype: Datatype of the NDArray elements.
550
+
551
+
Args:
552
+
v: NDArray to be flattened and used as the diagonal.
553
+
k: Diagonal offset.
554
+
555
+
Returns:
556
+
A 2-D NDArray with the flattened input as the diagonal.
557
+
"""
558
+
v.reshape(v.ndshape.ndsize, 1)
559
+
varn: Int= v.ndshape.ndsize +abs(k)
560
+
varresult: NDArray[dtype]= NDArray[dtype](n, n, random=False)
0 commit comments