Skip to content

Commit

Permalink
More style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Bollay committed Feb 28, 2018
1 parent d83c060 commit 1f9a683
Show file tree
Hide file tree
Showing 9 changed files with 482 additions and 333 deletions.
6 changes: 3 additions & 3 deletions .clang-format
Expand Up @@ -8,7 +8,7 @@ AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
Expand All @@ -35,7 +35,7 @@ BraceWrapping:
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBinaryOperators: None
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
Expand All @@ -53,7 +53,7 @@ Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
Expand Down
2 changes: 1 addition & 1 deletion complex16simd.cpp
Expand Up @@ -114,4 +114,4 @@ Complex16Simd polar(const double rho, const double theta = 0)
{
return Complex16Simd(_mm_set1_pd(rho) * _mm_set_pd(cos(theta), sin(theta)));
}
}
} // namespace Qrack
2 changes: 1 addition & 1 deletion complex16simd.hpp
Expand Up @@ -45,4 +45,4 @@ Complex16Simd conj(const Complex16Simd& cmplx);
double norm(const Complex16Simd& cmplx);
double abs(const Complex16Simd& cmplx);
Complex16Simd polar(const double rho, const double theta);
}
} // namespace Qrack
2 changes: 1 addition & 1 deletion par_for.cpp
Expand Up @@ -70,4 +70,4 @@ double par_norm(const bitCapInt maxQPower, const Complex16* stateArray)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// THIS ENDS THE EXCERPTED SECTION FROM "GILGAMESH."
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
} // namespace Qrack
30 changes: 15 additions & 15 deletions par_for.hpp
Expand Up @@ -116,21 +116,21 @@ void par_for_skip(const bitCapInt begin, const bitCapInt end, const bitCapInt sk
int num_cpus = std::thread::hardware_concurrency();
std::vector<std::future<void>> futures(num_cpus);
for (int cpu = 0; cpu != num_cpus; ++cpu) {
futures[cpu]
= std::async(std::launch::async, [cpu, &idx, end, skipPower, stateArray, bciArgs, nStateVec, &fn]() {
bitCapInt i, iLow, iHigh;
for (;;) {
iHigh = idx++;
i = 0;
iLow = iHigh % skipPower;
i += iLow;
iHigh = (iHigh - iLow) << 1;
i += iHigh;
if (i >= end)
break;
fn(i, cpu, stateArray, bciArgs, nStateVec);
}
});
futures[cpu] =
std::async(std::launch::async, [cpu, &idx, end, skipPower, stateArray, bciArgs, nStateVec, &fn]() {
bitCapInt i, iLow, iHigh;
for (;;) {
iHigh = idx++;
i = 0;
iLow = iHigh % skipPower;
i += iLow;
iHigh = (iHigh - iLow) << 1;
i += iHigh;
if (i >= end)
break;
fn(i, cpu, stateArray, bciArgs, nStateVec);
}
});
}

for (int cpu = 0; cpu != num_cpus; ++cpu) {
Expand Down

0 comments on commit 1f9a683

Please sign in to comment.