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

Function getNormalised

tests/utils/linalg.cpp:143–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141
142
143qvector getNormalised(qvector vec) {
144
145 // prob[i] = abs(vec[i])^2
146 vector<qreal> probs(vec.size());
147 for (size_t i=0; i<vec.size(); i++)
148 probs[i] = std::norm(vec[i]);
149
150 // normalise vector
151 qreal norm = getSum(probs);
152 qreal fac = 1 / std::sqrt(norm);
153 for (auto& x : vec)
154 x *= fac;
155
156 return vec;
157}
158
159
160qvector getDisceteFourierTransform(qvector in) {

Callers 4

getRandomStateVectorFunction · 0.70
getOrthonormalisedRowsFunction · 0.70
SECTIONFunction · 0.50

Calls 1

getSumFunction · 0.85

Tested by

no test coverage detected