Skip to content

Commit

Permalink
Use 'amplitudeFloor' for 'REAL1_EPSILON' in QEngineCPU
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Nov 3, 2024
1 parent 8f951b9 commit cbd2f7e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required (VERSION 3.9)
project (Qrack VERSION 9.12.0 DESCRIPTION "High Performance Quantum Bit Simulation" LANGUAGES CXX)
project (Qrack VERSION 9.12.3 DESCRIPTION "High Performance Quantum Bit Simulation" LANGUAGES CXX)

# Installation commands
include (GNUInstallDirs)
Expand Down
24 changes: 24 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
libqrack (9.12.3) bionic; urgency=medium

* Optimize TryDecompose(); Copy() method (Bionic 4/4)

-- Daniel Strano <iamu@sekhmet> Sun, 03 Nov 2024 03:44:15 -0500

libqrack (9.12.2) focal; urgency=medium

* Optimize TryDecompose(); Copy() method (Focal 3/4)

-- Daniel Strano <dan@unitary.fund> Sun, 03 Nov 2024 03:42:16 -0500

libqrack (9.12.1) jammy; urgency=medium

* Optimize TryDecompose(); Copy() method (Jammy 2/4)

-- Daniel Strano <dan@unitary.fund> Sun, 03 Nov 2024 03:40:30 -0500

libqrack (9.12.0) noble; urgency=medium

* Optimize TryDecompose(); Copy() method (Noble 1/4)

-- Daniel Strano <dan@unitary.fund> Sun, 03 Nov 2024 03:37:15 -0500

libqrack (9.11.19) bionic; urgency=medium

* Debug OpenCL/CUDA Decompose()/Dispose(); optimize for CPU (Bionic 4/4)
Expand Down
8 changes: 3 additions & 5 deletions src/qengine/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,12 +1183,11 @@ void QEngineCPU::DecomposeDispose(bitLenInt start, bitLenInt length, QEngineCPUP
const complex amp = stateVec->read(j | (k << start));
const real1 nrm = norm(amp);
remainderStateProb[lcv] += nrm;
if (nrm > REAL1_EPSILON) {
if (nrm > amplitudeFloor) {
partStateAngle[k] += arg(amp) * nrm;
}
}
});

par_for(0U, partPower, [&](const bitCapIntOcl& lcv, const unsigned& cpu) {
const bitCapIntOcl startMask = pow2MaskOcl(start);
const bitCapIntOcl j = lcv << start;
Expand All @@ -1200,7 +1199,7 @@ void QEngineCPU::DecomposeDispose(bitLenInt start, bitLenInt length, QEngineCPUP
const complex amp = stateVec->read(l);
const real1 nrm = norm(amp);
partStateProb[lcv] += nrm;
if (nrm > REAL1_EPSILON) {
if (nrm > amplitudeFloor) {
remainderStateAngle[k] += arg(amp) * nrm;
}
}
Expand All @@ -1225,7 +1224,6 @@ void QEngineCPU::DecomposeDispose(bitLenInt start, bitLenInt length, QEngineCPUP
remainderStateProb[lcv] += norm(stateVec->read(j | (k << start)));
}
});

par_for(0U, partPower, [&](const bitCapIntOcl& lcv, const unsigned& cpu) {
const bitCapIntOcl startMask = pow2MaskOcl(start);
const bitCapIntOcl j = lcv << start;
Expand All @@ -1236,7 +1234,7 @@ void QEngineCPU::DecomposeDispose(bitLenInt start, bitLenInt length, QEngineCPUP

const complex amp = stateVec->read(l);
const real1 nrm = norm(amp);
if (nrm > REAL1_EPSILON) {
if (nrm > amplitudeFloor) {
remainderStateAngle[k] += arg(amp) * nrm;
}
}
Expand Down

0 comments on commit cbd2f7e

Please sign in to comment.