it.grypho.scala.leonardo.transform

Members list

Type members

Classlikes

case class _Conv(x: _Expression, h: _Expression) extends _Expression

conv(x, h) (F_0137): convolve at the prompt, a row when x is a row, else a column.

conv(x, h) (F_0137): convolve at the prompt, a row when x is a row, else a column.

Its budget is the work, not only the output (F_0144): the output's length is n + m − 1 but the products are n·m, so two columns of 5·10⁵ passed an output cap and asked for 2.5·10¹¹ products — an uninterruptible browser tab. A floating-point convolution is held to Limit.MaxConvWork products and an exact one to the far smaller Limit.MaxConvExactWork.

Value parameters

h

the second

x

the first sequence

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait _Expression
class Object
trait Matchable
class Any
Show all
case class _Dft(x: _Expression, inverse: Boolean) extends _Expression

dft(x) / idft(X) (F_0137): the transform of a row or column of real or complex values, the shape kept. An exact operand is demoted — the twiddle factors are irrational — and a length past the environment's Limit.MaxDftLength stays unevaluated.

dft(x) / idft(X) (F_0137): the transform of a row or column of real or complex values, the shape kept. An exact operand is demoted — the twiddle factors are irrational — and a length past the environment's Limit.MaxDftLength stays unevaluated.

Value parameters

inverse

whether this is idft

x

the samples

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait _Expression
class Object
trait Matchable
class Any
Show all
case class _Fourier(e: _Expression, t: _Variable, w: _Variable) extends _Functional

AST node for the two-sided Fourier transform: fourier(e, t, w) in the grammar.

AST node for the two-sided Fourier transform: fourier(e, t, w) in the grammar.

Computes F{e(t)} = ∫ e(t)·e^(−iwt) dt over the whole line (F_0141; it was the one-sided transform, unchecked, until then) as the Laplace transforms of the causal and the reflected anti-causal part at s = ±i·w, and stays unevaluated unless both converge on the imaginary axis — see fourierOf. The binder t is excluded from children; w appears free in the result.

eval applies fourierOf and guards against the fixpoint.

Value parameters

e

the time-domain expression to transform

t

the time variable (binder -- excluded from children)

w

the angular frequency variable (free in the result)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class _Functional
trait _Expression
class Object
trait Matchable
class Any
Show all
case class _FourierCausal(e: _Expression, t: _Variable, w: _Variable) extends _Functional

AST node for the causal Fourier transform: fourierCausal(e, t, w) in the grammar (F_0141).

AST node for the causal Fourier transform: fourierCausal(e, t, w) in the grammar (F_0141).

The transform of e(t)·u(t), L{e}(i·w), which is what fourier answered before it became two-sided — now only when every pole of L{e} lies strictly left of the imaginary axis; see causalFourierOf. The binder t is excluded from children; w appears free in the result.

Value parameters

e

the time-domain expression to transform

t

the time variable (binder -- excluded from children)

w

the angular frequency variable (free in the result)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class _Functional
trait _Expression
class Object
trait Matchable
class Any
Show all
case class _InverseLaplace(f: _Expression, s: _Variable, t: _Variable) extends _Functional

AST node for the inverse Laplace transform: invlaplace(f, s, t) in the grammar.

AST node for the inverse Laplace transform: invlaplace(f, s, t) in the grammar.

Computes L^-1{f(s)} as a function of t via the rule table in inverseLaplaceOf. The frequency binder s is excluded from children (dual of _Laplace); t names the output variable and appears free in the result.

eval applies inverseLaplaceOf and guards against the fixpoint.

Value parameters

f

the frequency-domain expression to invert

s

the Laplace frequency variable (binder -- excluded from children)

t

the time variable (free in the result)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class _Functional
trait _Expression
class Object
trait Matchable
class Any
Show all

AST node for the inverse z-transform: invztrans(X, z, n) in the grammar.

AST node for the inverse z-transform: invztrans(X, z, n) in the grammar.

Recovers x[n] from a rational X(z) via the rule table in inverseZTransformOf. The frequency binder z is excluded from children (dual of _ZTransform); n names the output index and appears free in the result.

eval applies inverseZTransformOf and guards against the fixpoint.

Value parameters

f

the frequency-domain expression to invert

n

the discrete index variable (free in the result)

z

the z-domain variable (binder -- excluded from children)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class _Functional
trait _Expression
class Object
trait Matchable
class Any
Show all
case class _Laplace(e: _Expression, t: _Variable, s: _Variable) extends _Functional

AST node for the Laplace transform: laplace(e, t, s) in the grammar.

AST node for the Laplace transform: laplace(e, t, s) in the grammar.

Computes L{e(t)} with Laplace variable s via the rule table in laplaceOf. The integration binder t is excluded from children per the _Functional convention; s names the output variable and appears free in the result.

eval applies laplaceOf and guards against the fixpoint (stays symbolic when the rule table cannot reduce the expression).

Value parameters

e

the time-domain expression to transform

s

the complex frequency variable (free in the result)

t

the time variable (binder -- excluded from children)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class _Functional
trait _Expression
class Object
trait Matchable
class Any
Show all
case class _ZTransform(x: _Expression, n: _Variable, z: _Variable) extends _Functional

AST node for the z-transform: ztrans(x, n, z) in the grammar.

AST node for the z-transform: ztrans(x, n, z) in the grammar.

Computes the one-sided (unilateral) transform X(z) = sum(k >= 0) x[k]*z^-k via the rule table in zTransformOf. The summation binder n is excluded from children per the _Functional convention; z names the output variable and appears free in the result.

One-sided rather than bilateral by design, matching laplace, which is itself unilateral. A bilateral transform would have to carry a region of convergence on every result — without one the same X(z) inverts to a causal or an anti-causal signal, so the inverse would have to guess — and that is deferred as future work.

eval applies zTransformOf and guards against the fixpoint (stays symbolic when the rule table cannot reduce the expression), the convention shared with _Laplace.

Value parameters

n

the discrete index variable (binder -- excluded from children)

x

the sequence expression to transform, in terms of the index n

z

the complex frequency variable (free in the result)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class _Functional
trait _Expression
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

The Fourier transform of e(t)·u(t), L{e}(iω), or the unevaluated _FourierCausal node when the Laplace transform has a pole on or right of the imaginary axis.

The Fourier transform of e(t)·u(t), L{e}(iω), or the unevaluated _FourierCausal node when the Laplace transform has a pole on or right of the imaginary axis.

Value parameters

e

the time-domain expression to transform

t

the time variable

w

the angular frequency variable

Attributes

Returns

the transform, or the call unevaluated

def convolve(xs: Vector[_Value], hs: Vector[_Value], env: Environment): Vector[_Value]

Discrete linear convolution (x ∗ h)ₖ = Σⱼ xⱼ·hₖ₋ⱼ, length n + m − 1 (F_0137).

Discrete linear convolution (x ∗ h)ₖ = Σⱼ xⱼ·hₖ₋ⱼ, length n + m − 1 (F_0137).

Exact on exact input, since it is only products and sums: two all-rational operands give rational cells; anything else is computed on (re, im) pairs.

Value parameters

env

supplies the reduction policy for the exact path

hs

the second

xs

the first sequence

Attributes

Returns

the convolution's cells

def dft(xs: Vector[(Double, Double)], inverse: Boolean): Vector[(Double, Double)]

The discrete Fourier transform Xₖ = Σₙ xₙ·e^(−2πikn/N), or with inverse the inverse xₙ = (1/N)·Σₖ Xₖ·e^(2πikn/N).

The discrete Fourier transform Xₖ = Σₙ xₙ·e^(−2πikn/N), or with inverse the inverse xₙ = (1/N)·Σₖ Xₖ·e^(2πikn/N).

Value parameters

inverse

whether to invert

xs

the samples, as (re, im)

Attributes

Returns

the transform, the same length

def fourierDecline(e: _Expression, t: _Variable, w: _Variable, causal: Boolean): Option[String]

Why the transform of e declines, in prose, or None when it answers.

Why the transform of e declines, in prose, or None when it answers.

Value parameters

causal

whether the causal form was asked for

e

the time-domain expression

t

the time variable

w

the angular frequency variable

Attributes

Returns

the reason, or None

The two-sided Fourier transform of e, or the unevaluated _Fourier node when it declines.

The two-sided Fourier transform of e, or the unevaluated _Fourier node when it declines.

Value parameters

e

the time-domain expression to transform

t

the time variable

w

the angular frequency variable

Attributes

Returns

the transform, or the call unevaluated

Computes L^-1{f} with Laplace variable s and time variable t.

Computes L^-1{f} with Laplace variable s and time variable t.

Applies simplifyFully to the result when a rule fires, keeping the output readable.

Value parameters

f

the frequency-domain expression to invert

s

the Laplace frequency variable

t

the time variable

Attributes

Returns

the inverse Laplace transform of f, or _InverseLaplace(f, s, t) if no rule applies

Recovers x[n] from f = X(z).

Recovers x[n] from f = X(z).

Value parameters

f

the z-domain expression

n

the discrete index variable

z

the z-domain variable

Attributes

Returns

the sequence in terms of n, or _InverseZTransform(f, z, n) if no rule applies

Computes L{e} with time variable t and Laplace variable s.

Computes L{e} with time variable t and Laplace variable s.

Delegates to laplaceImpl which carries the string name of t for fast pattern matching without re-boxing. Returns _Laplace(e, t, s) when no rule fires.

Value parameters

e

the time-domain expression

s

the Laplace frequency variable

t

the time variable

Attributes

Returns

the Laplace transform of e, or _Laplace(e, t, s) if no rule applies

Computes Z{x} with index variable n and frequency variable z.

Computes Z{x} with index variable n and frequency variable z.

Value parameters

n

the discrete index variable

x

the sequence expression, in terms of n

z

the z-domain variable

Attributes

Returns

the z-transform of x, or _ZTransform(x, n, z) if no rule applies