
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
@nomyx/qcomplex
Advanced tools
High-performance quantum computing library with WASM acceleration
A high-performance quantum computing library with WASM acceleration.
npm install @qcomplex/core
import { complexWASM, init } from '@qcomplex/core';
// Initialize WASM module
await init();
// Create complex numbers
const z1 = complexWASM.createComplex(1, 2); // 1 + 2i
const z2 = complexWASM.createComplex(3, -1); // 3 - i
// Basic operations
console.log(z1.abs()); // Magnitude
console.log(z1.phase()); // Phase angle
import { quantum, complexWASM, init } from '@qcomplex/core';
await init();
// Create a quantum state
const state = quantum.createState([
complexWASM.createComplex(1, 0), // |0⟩
complexWASM.createComplex(0, 0) // |1⟩
]);
// Get state properties
console.log(state.get_probability(0)); // Probability of measuring |0⟩
console.log(state.get_probability(1)); // Probability of measuring |1⟩
import { quantum, init } from '@qcomplex/core';
await init();
// Create a basis state |0⟩
const state = quantum.utils.create_basis_state(0, 2);
// Apply Hadamard gate to create superposition
const hadamard = quantum.gates.hadamard();
const superposition = hadamard.apply(state);
// Apply CNOT gate
const cnot = quantum.gates.cnot();
const entangled = cnot.apply(superposition);
import { quantum, init } from '@qcomplex/core';
await init();
// Create Bell state |Φ+⟩ = (|00⟩ + |11⟩)/√2
const bellState = quantum.utils.create_bell_state(0);
// Measure the state
const result = quantum.utils.measure(bellState);
console.log(`Measured: ${result}`); // Will be either 0 or 3
real()
: Get real partimag()
: Get imaginary partabs()
: Get magnitudephase()
: Get phase anglescale(factor)
: Scale by real numberadd(other)
: Add complex numbersmultiply(other)
: Multiply complex numbersget_amplitude(index)
: Get amplitude at indexget_probability(index)
: Get probability at indexdimension()
: Get state space dimensiontensor_product(other)
: Tensor product with another statehadamard()
: Create Hadamard gatepauli_x()
: Create Pauli-X (NOT) gatepauli_y()
: Create Pauli-Y gatepauli_z()
: Create Pauli-Z gatecnot()
: Create CNOT gatephase(theta)
: Create phase shift gatecreate_basis_state(n, dimension)
: Create basis state |n⟩create_bell_state(index)
: Create Bell statemeasure(state)
: Perform measurement# Install dependencies
npm install
# Build WASM and TypeScript
npm run build
# Run tests
npm test
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
High-performance quantum computing library with WASM acceleration
The npm package @nomyx/qcomplex receives a total of 2 weekly downloads. As such, @nomyx/qcomplex popularity was classified as not popular.
We found that @nomyx/qcomplex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.