linspace¶
- kgpy.linspace(start, stop, num, axis=0)¶
A modified version of
numpy.linspace()that returns a value in the center of the range between start and stop if num == 1 unlikenumpy.linspace()which would just return start. This function is often helfpul when creating a grid. Sometimes you want to test with only a single element, but you want that element to be in the center of the range and not off to one side.- Parameters
start (
numpy.ndarray) – The starting value of the sequence.stop (
numpy.ndarray) – The end value of the sequence, must be broadcastable with start.num (
int) – Number of samples to generate for this sequence.axis (
int) – The axis in the result used to store the samples. The default is the first axis.
- Return type
typing.Union[typing.Sequence[typing.Sequence[typing.Sequence[typing.Sequence[typing.Sequence[typing.Any]]]]],numpy.typing._array_like._SupportsArray[numpy.dtype],typing.Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]],typing.Sequence[typing.Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]],typing.Sequence[typing.Sequence[typing.Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]],typing.Sequence[typing.Sequence[typing.Sequence[typing.Sequence[numpy.typing._array_like._SupportsArray[numpy.dtype]]]]],bool,int,float,complex,str,bytes,typing.Sequence[typing.Union[bool,int,float,complex,str,bytes]],typing.Sequence[typing.Sequence[typing.Union[bool,int,float,complex,str,bytes]]],typing.Sequence[typing.Sequence[typing.Sequence[typing.Union[bool,int,float,complex,str,bytes]]]],typing.Sequence[typing.Sequence[typing.Sequence[typing.Sequence[typing.Union[bool,int,float,complex,str,bytes]]]]]]- Returns
An array the size of the broadcasted shape of start and stop with an additional dimension of length num.