Skip to content

[RFC]: add blas/ext/base/glogspace #509

Description

@kgryte

This is similar to blas/ext/base/glinspace, except for generating logarithmically spaced values.

API signatures:

glogspace( N, base, start, stop, endpoint, x, strideX )
glogspace( N, base, start, stop, endpoint, x, strideX, offsetX )

where

  • N: number of indexed elements.
  • base: base of the logspace.
  • start: exponent of the starting value of the sequence, where the starting value is given by base^start.
  • stop: exponent of the final value of the sequence, where the final value is given by base^stop.
  • endpoint: boolean indicating whether to include the final value when writing values to the input array. If true, the input array is filled with logarithmically spaced values over the closed interval [base^start, base^stop]. If false, the input array is filled with logarithmically spaced values over the half-open interval [base^start, base^stop).
  • x: input strided array.
  • strideX: stride length of x.
  • offsetX: starting index for x.

To calculate the increment, one computes exactly as done in linspace, taking into account whether endpoint is true or false. To compute the values, one then does

pow( base, start+(d*i) )

where d is the increment.

The notes in https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/dlinspace#notes are largely applicable to logspace.

Follow-on Work

Once completed, the following packages can be created:

  • [RFC] add blas/ext/base/dlogspace
  • [RFC] add blas/ext/base/slogspace
  • [RFC] add blas/ext/base/clogspace
  • [RFC] add blas/ext/base/zlogspace
  • [RFC] add blas/ext/base/ndarray/dlogspace
  • [RFC] add blas/ext/base/ndarray/slogspace
  • [RFC] add blas/ext/base/ndarray/glogspace
  • [RFC] add blas/ext/base/ndarray/clogspace
  • [RFC] add blas/ext/base/ndarray/zlogspace
  • [RFC] add blas/ext/logspace

Note that for complex support, base should be restricted to a positive real base, start and stop are complex, and be conceptually implemented in a manner equivalent to (but NOT directly as)

logspace(base, start, stop) == exp( linspace(start, stop) * ln(base) )

For complex support, we should document that

  1. Generated values follow a logarithmic spiral in the complex plane.
  2. Imaginary components control phase rotation.

Metadata

Metadata

Assignees

Labels

AI Model: SOTALatest-generation AI model used on the issue.FeatureTask to add a new feature.difficulty: 3Likely to be challenging but manageable.estimate: 2-4hrsTask which should take between 2 to 4 hours.priority: HighHigh priority concern or feature request.🤖 AIAllowed to use AI.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions