SetMatrixArray returns error


I am trying to use TMatrix in ROOT for the first time, and can not get it to work. When trying to run the simple code below (based on an example in the user guide) I get an error. Thanks for any help on this.


#include "TArrayD.h"
#include "TMatrixD.h"
#include "TMatrixDBase.h"

TMatrixD h(5,5);
TArrayD data(25);

for (Int_t i = 0; i < 25; i++)  data[i] = 1.0;



Returns the following error,

root [0] .x matrix.cpp
Note: File “TMatrixT.h” already loaded
Error: Can’t call TMatrixT::SetMatrixArray(data) in current scope matrix.cpp:15:
Possible candidates are…
(in TMatrixT)
(in TMatrixTBase)
/usr/lib/root/5.18/ -1:-1 0 public: virtual TMatrixTBase& TMatrixTBase::SetMatrixArray(const double* data,Option_t* option="");
*** Interpreter error recovered ***
root [1]

Thanks for reporting this typo in the doc. Instead of

h.SetMatrixArray(data); it must be

h.SetMatrixArray(data.GetArray()); //as shown in all other lines in the doc

The online User’s Guide is now fixed.
Thanks for reporting this error.