Home Reference Source
``import {MultiplyByConstantModN} from 'projectq/src/libs/math/gates.js'``
public class

# MultiplyByConstantModN

#### Extends:

BasicGateBasicMathGate → MultiplyByConstantModN

Multiply a quantum number represented by a quantum register by a constant modulo N.

The number is stored from low- to high-bit, i.e., qunum[0] is the LSB.

#### Example:

``````qunum = eng.allocateQureg(5) # 5-qubit number
X | qunum[2] # qunum is now equal to 4
MultiplyByConstantModN(3,5) | qunum # qunum is now 2.``````

## Constructor Summary

 Public Constructor public constructor(a: number, N: number)

## Member Summary

 Public Members public N: * public a: *

## Method Summary

 Public Methods public equal(other: *): * public toString(): string

## Inherited Summary

 From class BasicGate public static makeTupleOfQureg(qubits: Qubit | Qubit[] | Qureg | Qureg[]): Qureg[] Convert quantum input of "gate | quantum input" to internal formatting. public public copy(): BasicGate public equal(other: BasicGate | Object): boolean public generateCommand(qubits: *): Command Helper function to generate a command consisting of the gate and the qubits being acted upon. public public public inspect(): string public or(qubits: *) Operator| overload which enables the syntax Gate | qubits. public toString()
 From class BasicMathGate public mathFunc: * public getMathFunction(qubits: Array): function Return the math function which corresponds to the action of this math gate, given the input to the gate (a tuple of quantum registers). public toString(): string

## Public Constructors

### publicconstructor(a: number, N: number) source

#### Override:

BasicMathGate#constructor

#### Params:

 Name Type Attribute Description a number Number by which to multiply a quantum register (0 <= a < N). N number Number modulo which the multiplication is carried out. It also initializes its base class, BasicMathGate, with the corresponding function, so it can be emulated efficiently.

## Public Methods

### publicequal(other: *): * source

BasicGate#equal

#### Params:

 Name Type Attribute Description other *

 *

### publictoString(): string source

#### Override:

BasicMathGate#toString