logspace

Contents

logspace#

class saiunit.math.logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None)#

Return numbers spaced evenly on a log scale.

In linear space, the sequence starts at base ** start and ends with base ** stop in num steps.

Parameters:
  • start (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – base ** start is the starting value of the sequence.

  • stop (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – base ** stop is the final value of the sequence (unless endpoint is False). Must share the same unit as start when either is a Quantity.

  • num (int | None) – Number of samples to generate. Default is 50.

  • endpoint (bool | None) – If True, stop is the last sample. Otherwise, it is not included. Default is True.

  • base (float | None) – The base of the log space. Default is 10.0.

  • dtype (str | type[Any] | dtype | SupportsDType | None) – The type of the output array.

Returns:

samplesnum samples, equally spaced on a log scale.

Return type:

Quantity or jax.Array

Raises:

UnitMismatchError – If start and stop do not share the same unit.

Examples

>>> import saiunit as u
>>> u.math.logspace(0, 2, 4)
Array([  1.       ,   4.6415887,  21.544348 , 100.       ], dtype=float32)