Options
All
  • Public
  • Public/Protected
  • All
Menu

Class NumericMemoizer<T>

Cache values in an internal array, marking absent values with a NaN.

Type parameters

  • T: number

Hierarchy

  • MemoizerBase<T>
    • NumericMemoizer

Implements

  • Memoizer<T>

Index

Constructors

constructor

  • new NumericMemoizer(f: (n: number) => T, stepsize?: number, bufsize?: number): NumericMemoizer
  • Parameters

    • f: (n: number) => T
        • (n: number): T
        • Parameters

          • n: number

          Returns T

    • Default value stepsize: number = MemoizerBase.stepsize
    • Default value bufsize: number = MemoizerBase.bufsize

    Returns NumericMemoizer

Properties

Readonly bufsize

bufsize: number

Protected Readonly f

f: (n: number) => T

Type declaration

    • (n: number): T
    • Parameters

      • n: number

      Returns T

Readonly stepsize

stepsize: number

Static bufsize

bufsize: number = 1024

Static stepsize

stepsize: number = 1 / 1024

Methods

growDown

  • growDown(buffer: MemoBuffer<T>, bufMin: number, min: number, max: number, t: number): [MemoBuffer<T>, number]
  • Parameters

    • buffer: MemoBuffer<T>
    • bufMin: number
    • min: number
    • max: number
    • t: number

    Returns [MemoBuffer<T>, number]

growUp

  • growUp(buffer: MemoBuffer<T>, bufMin: number, min: number, max: number, t: number): [MemoBuffer<T>, number]
  • Parameters

    • buffer: MemoBuffer<T>
    • bufMin: number
    • min: number
    • max: number
    • t: number

    Returns [MemoBuffer<T>, number]

memo

  • memo(): (t: number) => T
  • Returns (t: number) => T

      • (t: number): T
      • Parameters

        • t: number

        Returns T

newBuffer

  • newBuffer(size: number): MemoBuffer<T>
  • Parameters

    • size: number

    Returns MemoBuffer<T>

Static memoize

  • memoize(f: (t: number) => number, stepsize?: number): (t: number) => number
  • Parameters

    • f: (t: number) => number
        • (t: number): number
        • Parameters

          • t: number

          Returns number

    • Default value stepsize: number = MemoizerBase.stepsize

    Returns (t: number) => number

      • (t: number): number
      • Parameters

        • t: number

        Returns number

Generated using TypeDoc