The constructors that take shape and fill value as input return a unintialized array by default if a fill value is not provided.
The fill value operation is vectorized.
Removed random argument from NDArray constructors.
RANDOM (Related to #96 ):
Added rand(*shape: Int, min: Scalar[dtype], max: Scalar[dtype]) and rand(shape: List[Int], min: Scalar[dtype], max: Scalar[dtype]) for creating random arrays with random values within a range [min, max].
Added randn(*shape: Int, mean: Scalar[dtype], variance: Scalar[dtype]) and rand(shape: List[Int], mean: Scalar[dtype], variance: Scalar[dtype]) for creating arrays with random values chosen from a normal distribution with given mean and variance. The name of this function could be changed to something else to remove any confusions.
Unit Tests
Updated unit tests with new rand methods
Added new unit tests files for NDArray constructors, array manipulation, boolean masks, slicing etc
Notes:
test_slicing.mojo doesn't work with .mojopkg in Mac currently.
test_bool_mask.mojo has problems in comparison with numpy arrays.
Not all tests are comprehensive, they are basic comparison checks against numpy arrays.
Cumulative reduce
Changed the cumvariance function to return sigma (variance) instead of sigma^2.
NDArray
shape
andfill
value as input return a unintialized array by default if afill
value is not provided.random
argument from NDArray constructors.RANDOM (Related to #96 ):
Added
rand(*shape: Int, min: Scalar[dtype], max: Scalar[dtype])
andrand(shape: List[Int], min: Scalar[dtype], max: Scalar[dtype])
for creating random arrays with random values within a range [min, max].Added
randn(*shape: Int, mean: Scalar[dtype], variance: Scalar[dtype])
andrand(shape: List[Int], mean: Scalar[dtype], variance: Scalar[dtype])
for creating arrays with random values chosen from a normal distribution with given mean and variance. The name of this function could be changed to something else to remove any confusions.Unit Tests
rand
methodsNDArray constructors
,array manipulation
,boolean masks
,slicing
etc Notes:test_slicing.mojo
doesn't work with .mojopkg in Mac currently.test_bool_mask.mojo
has problems in comparison with numpy arrays.Cumulative reduce
cumvariance
function to return sigma (variance) instead of sigma^2.