Matrix in data structure
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
Updated by Santos, Edward over 10 years ago
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.
Updated by Taylor, Ian over 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!
Updated by Lane, Peter over 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>
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.