Options
All
  • Public
  • Public/Protected
  • All
Menu

Dimension class, e.g.

Hierarchy

  • Dimension

Index

Constructors

  • new Dimension(name: string, size: number, coordNames: string[]): Dimension
  • Creates a dimentions - to be used in a Vector or Operator object

    Parameters

    • name: string

      Name of a dimension (e.g. "qubit", "spin", "x", etc)

    • size: number

      Size of a dimension

    • coordNames: string[]

      Name of each coordinate

    Returns Dimension

Properties

coordNames: string[]
identity: symbol

A symbol used for Dimension comparison

name: string
size: number

Accessors

  • get coordString(): string

Methods

  • coordNameToIndex(coordName: string): number
  • Retrieves a coordinates index from the coordinates list

    Parameters

    • coordName: string

      one coord bame

    Returns number

    error or the coord index

  • hashKey(): string
  • A string used for dimension equality test.

    remark

    do not assume any particular format. The only important quality of this value is that it fully encodes all relevant dimension data and can be used as a hash key

    Returns string

    identification string

  • reassignCoordNames(coordNames: string[]): Dimension
  • Creates a copy with different coord names. Used in operators that change basis.

    Parameters

    • coordNames: string[]

    Returns Dimension

  • toString(): string
  • Overrides toString() method

    Returns string

    formatted string

  • Check multiple dimensions for equality Needs rewrite imo

    Parameters

    Returns void

  • Create dimension for polarization

    Parameters

    • basis: string[] = ...

      denote basis, ['H', 'V'], ['D', 'A'] or ['L', 'R']

    Returns Dimension

    polarization dimension

  • position(size: number, name?: string): Dimension
  • Creates a dimension with positions from 0 to size-1

    Parameters

    • size: number

      A positive integer - size of steps.

    • name: string = 'x'

      Dimension name, e.g. 'x', 'y' or 'z'.

    Returns Dimension

  • Create dimension for qubit (an abstract two-level system)

    note

    Equivalent to Dimension.position(2, 'qubit')

    Parameters

    • basis: string[] = ...

      denote basis, ['0', '1'], ['+', '-'] or ['+i', '-i']

    Returns Dimension

    qubit dimension

  • Create dimensions for n qubits.

    Parameters

    • n: number

      Number of qubits.

    Returns Dimension[]

    Qubit dimensions.

  • Create dimension for spin

    Parameters

    • basis: string[] = ...

      denote basis, ['u', 'd'], ['ux', 'dx'] or ['dy', 'dy']

    Returns Dimension

    spin dimensions

  • stringToCoordIndices(s: string | string[], dimensions: Dimension[]): number[]
  • Parameters

    • s: string | string[]

      string, such as "udH" or ['u', 'd', 'H']

    • dimensions: Dimension[]

      Dimensions to be used

    Returns number[]

Generated using TypeDoc