Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

constructor

  • new Vector(elements?: number[]): Vector

Properties

elements

elements: number[] = []

Static N_DIMENSIONS

N_DIMENSIONS: number = -1

Accessors

nDimensions

  • get nDimensions(): number

serializationLabel

  • get serializationLabel(): any

x

  • get x(): number
  • set x(val: number): void

y

  • get y(): number
  • set y(val: number): void

Methods

L2

  • L2(): number

_setToDefault

  • _setToDefault(): void

addVector

clone

dot

fmax

  • fmax(): number

forEach

  • forEach(fn: (e: number, i: number) => any, context: any): void
  • Parameters

    • fn: (e: number, i: number) => any

      function to be executed on each element

        • (e: number, i: number): any
        • Parameters

          • e: number
          • i: number

          Returns any

    • context: any

      context for execution

    Returns void

getMapped

  • getMapped(fn: (e: number, i: number) => number, context?: any): Vector
  • Returns a VectorType with each of its elements replaced by fn(e) where e is the corresponding element of this vector

    Parameters

    • fn: (e: number, i: number) => number

      function to be run on each element. e is the element value, and i is its index. Should return a new element.

        • (e: number, i: number): number
        • Parameters

          • e: number
          • i: number

          Returns number

    • Optional context: any

      the context for the function call. In other words, what is to be used as the 'this' variable when running the call.

    Returns Vector

    • Vectgor of the results from running fn on each element of this.elements

getNormalized

getRounded

inspect

  • inspect(): string

isEqualTo

  • isEqualTo(other: VectorType, tolerance?: number): boolean

minus

normalize

  • normalize(): void

plus

setElements

  • setElements(els: number[]): Vector

sstring

  • sstring(): string

subtractVector

times

timesElementWise

toJSON

  • toJSON(): {}

Static Ones

Static Random

Static Zeros

Static flatten

  • flatten(...vecs: (number | any[] | ExtendsVector)[]): number[]

Generated using TypeDoc