MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / getSum

Function getSum

tests/utils/linalg.cpp:115–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114
115qcomp getSum(qvector vec) {
116
117 qcomp sum = qcomp(0,0);
118 qcomp y, t, c=sum;
119
120 // complex Kahan summation
121 for (auto& x : vec) {
122 y = x - c;
123 t = sum + y;
124 c = ( t - sum ) - y;
125 sum = t;
126 }
127
128 return sum;
129}
130
131
132qreal getSum(vector<qreal> vec) {

Callers 1

getNormalisedFunction · 0.85

Calls 1

getZeroVectorFunction · 0.85

Tested by

no test coverage detected