Skip to content

Conversation

Altanali
Copy link
Collaborator

@Altanali Altanali commented Aug 1, 2021

Create the quantum-js-util package which creates workspaces and rewrites Q.js files as CommonJS modules. No visualization included in this PR.

@Altanali Altanali requested a review from mdpratt August 1, 2021 00:34
@Altanali
Copy link
Collaborator Author

Altanali commented Aug 3, 2021

While the PR shows a large amount of file deletions/additions and lines of code changes, this is mostly due to me copy pasting all the files in the Q/ folder into separate packages and them registering as new content entirely. Key differences will be listed below:

  • Functions in Q.js (all functions besides Q()) were split out into the following files:
    - Misc.js: createConstant/createConstants; shuffleNames$, getRandomName$, and their associated constants
    - Math-Functions.js: isUsefulNumber/Integer and related math functions and their associated constants
    - Logging.js: logging related functions such as warn(), help(), toTitleCase(), or error().

  • All other files in Q/ were changed to meet the requirements of node modules.

  • In Q.Gate: All instances of applyToQubit were removed; this is to maintain a one way dependency from Q-Gate.js to Q-Qubit.js; Q-Qubit.js will handle the application of a gate operation to a qubit object from now on.
    gate.updateMatrix$(...args); return new Qubit(gate.matrix.multiply(qubit));

  • In Q.Circuit: Changed the order of qubit Evaluation to reverse the probability output (see the following ticket: Bit order: State Vector Results Inconsistent with Other Simulators #21 (comment))
    `for( let i = 0; i < qubitIndices.length; i ++ ){

      	//qubitIndices[ i ] = ( circuitBandwidth - 1 ) - qubitIndices[ i ]
      	qubitIndices[ i ] -= 1
      }`
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants