T
T. Crane
Hi all,
I have some data that I am using a vector<vector<double> > container
to hold. The data is n sets of (x,y,z,intensity) data points. I can
either group my data like this:
vector<vector<double> > v(n, vector<double>(4)); // method A
or like this:
vector<vector<double> > v(4, vector<double>(n)); // method B
This difference, of course, is that in the first method, I have n 4-
element vectors and in the second I have 4 n-element vectors.
Next, I want to find the (x,y,z) coordinates of the point that has the
highest intensity. Finding the highest intensity is easy when I use
method B to group the data.
All I have to do is:
vector<double>::iterator maxInt = max_element(v[3].begin(),
v[3].end());
The max intensity is found by dereferencing maxInt. However, at this
point I'm at a loss as to how to get the corresponding (x,y,z) values
for that max intensity.
Alternatively, if I were to group the data using method A, once I have
a max intensity, it's trivial to find the (x,y,z) values, but I don't
know a good (i.e. easy, elegant, whatever) way to find the max
intensity short of writing a max_element-like function.
Any suggestions?
thanks,
trevis
I have some data that I am using a vector<vector<double> > container
to hold. The data is n sets of (x,y,z,intensity) data points. I can
either group my data like this:
vector<vector<double> > v(n, vector<double>(4)); // method A
or like this:
vector<vector<double> > v(4, vector<double>(n)); // method B
This difference, of course, is that in the first method, I have n 4-
element vectors and in the second I have 4 n-element vectors.
Next, I want to find the (x,y,z) coordinates of the point that has the
highest intensity. Finding the highest intensity is easy when I use
method B to group the data.
All I have to do is:
vector<double>::iterator maxInt = max_element(v[3].begin(),
v[3].end());
The max intensity is found by dereferencing maxInt. However, at this
point I'm at a loss as to how to get the corresponding (x,y,z) values
for that max intensity.
Alternatively, if I were to group the data using method A, once I have
a max intensity, it's trivial to find the (x,y,z) values, but I don't
know a good (i.e. easy, elegant, whatever) way to find the max
intensity short of writing a max_element-like function.
Any suggestions?
thanks,
trevis