Project

General

Profile

Support #1311

Matrix in data structure

Added by Santos, Edward almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Data Structure
Target version:
Start date:
15 July 2013
Due date:
% Done:

100%

Estimated time:
Workflow:
New Issue

Description

I'm working on adding a covariance matrix to the data structure. I made a typedef

typedef std::vector< std::vector<double> > CovarianceMatrix;

and I'm trying to figure out a JsonProcessor for this.

Is the std::vector< std::vector<double> > format alright with you? Would you prefer a one-dimensional array?

What's your advice on the processor part? I'm looking at the ValueArrayProcessor. The Doxygen comments need a tiny fix (you forgot to edit the copy and past of the constructor part).

My issue is that I can't define a

ValueArrayProcessor<CovarianceMatrix> _matrix_proc;

Suggestions?

#1

Updated by Santos, Edward almost 10 years ago

Rogers replied:
"
Just beware the namespace clash - there is already a
MAUS::CovarianceMatrix defined in Optics. This is potentially an object
we will want in Globals, so you may want to define it as a
ReconstructionCovarianceMatrix (a bit verbose) or similar.

I would use a TSymMatrix or whatever the ROOT object is rather than a 2D
vector like this. Ian should also comment.

For the processor, best would be nested arrays. I think that a
ValueArrayProcessor of ValueArrayProcessors will work, but obviously let
me know if there is a problem.
"

#2

Updated by Taylor, Ian almost 10 years ago

The ROOT question in object is a TMatrixDSym (which is a typedef of a TMatrixTSym<double>). This has helpful GetMatrixArray and SetMatrixArray functions, which provides the data in a double* array. It would be sensible to document the order of the elements, so that some-one accessing the JSON can still use the data.

I'm assuming that ValueArrayProcessor will deal with a double*, and that the array size is only that of the unique elements. To quote Under Siege 2, "Assumption is the mother of all f**k-ups", but I'm making Ed's problem as of right... now!

#3

Updated by Rogers, Chris almost 10 years ago

Well, the JsonCppProcessors are mine so if you need a feature or whatever then complain to me and I will see what I can do.

#4

Updated by Lane, Peter almost 10 years ago

Yes, use of MAUS::CovarianceMatrix in code (i.e. aside from DataStructure/ classes) is encouraged. It already has double array initialization, so adding a constructor that accepts a TMatrixDSym is trivial. I'll add that to my dev branch, but if you need it before I merge just let me know.<br>
<br>
Should the DataStructure/Global classes also use covariance matrices for uncertainties? Right now in my global recon code I take the uncertainty arrays, square them, and make a diagonal matrix out of them anyway.

#5

Updated by Rogers, Chris almost 10 years ago

  • Category set to Data Structure
  • Assignee set to Rogers, Chris
  • Target version set to Future MAUS release

I think the question is answered and we can close this? Do you need any more info Ed?

#6

Updated by Santos, Edward almost 10 years ago

Yes, you can close it.

My matrices are of the type TMatrixD, so I used GetMatrixArray() like Ian suggested. I then converted this array into a std::vector so that I could use ValueArrayProcessor<double>.

Thanks!

#7

Updated by Rogers, Chris almost 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF