OscProb
PMNS_Deco.cxx File Reference
#include <cassert>
#include <iostream>
#include "PMNS_Deco.h"

Go to the source code of this file.

Functions

vectorI sort3 (const vectorD &x)
 

Function Documentation

◆ sort3()

vectorI sort3 ( const vectorD x)

Simple index sorting of 3-vector

Definition at line 255 of file PMNS_Deco.cxx.

256{
257 vectorI out(3, 0);
258
259 // 1st element is smallest
260 if (x[0] < x[1] && x[0] < x[2]) {
261 // 3rd element is largest
262 if (x[1] < x[2]) {
263 out[1] = 1;
264 out[2] = 2;
265 }
266 // 2nd element is largest
267 else {
268 out[1] = 2;
269 out[2] = 1;
270 }
271 }
272 // 2nd element is smallest
273 else if (x[1] < x[2]) {
274 out[0] = 1;
275 // 3rd element is largest
276 if (x[0] < x[2]) out[2] = 2;
277 // 1st element is largest
278 else
279 out[1] = 2;
280 }
281 // 3rd element is smallest
282 else {
283 out[0] = 2;
284 // 2nd element is largest
285 if (x[0] < x[1]) out[2] = 1;
286 // 1st element is largest
287 else
288 out[1] = 1;
289 }
290
291 return out;
292}
std::vector< int > vectorI
Definition: Definitions.h:16

Referenced by OscProb::PMNS_Deco::PropagatePath().