9 #include <TDecompSVD.h> 23 coeffs(n + 2), covar(n + 1),
corr(n + 1),
rotation(n, n),
35 if (values.size() !=
n)
37 <<
"add(): invalid array size!" << std::endl;
39 for(
unsigned int i = 0;
i <
n;
i++) {
40 for(
unsigned int j = 0; j <
n; j++)
59 <<
"add(): invalid array size!" << std::endl;
66 unsigned int n = coeffs.GetNrows() - 2;
69 coeffs.GetSub(0, n, tmp);
70 tmp[
n] = TVectorD(n + 1, coeffs[n + 1].GetPtr());
73 TDecompSVD decCoeffs(tmp);
75 return decCoeffs.Solve(TVectorD(n + 1, coeffs[n].GetPtr()), ok);
81 covar.GetSub(0, covar.GetNrows() - 2,
tmp);
82 TDecompSVD decCovar(tmp);
83 trace = decCovar.GetSig();
84 return decCovar.GetU();
91 for(
unsigned int i = 0;
i <=
n;
i++) {
93 for(
unsigned int j = 0; j <=
n; j++)
97 for(
unsigned int i = 0;
i <=
n;
i++) {
102 for(
unsigned int i = 0;
i <=
n;
i++) {
104 for(
unsigned int j = 0; j <=
n; j++) {
108 corr(
i, j) = (v >= 1.0e-9) ? (w / v) : (
i == j);
121 for(
unsigned int i = 0;
i <
n;
i++)
133 for(
unsigned int i = 0;
i <
n;
i++)
134 results.push_back(
coeffs(n + 1,
i) / N);
149 <<
"Expected matrix in data file." 152 unsigned int row = 0;
153 for(DOMNode *node = elem->getFirstChild();
154 node; node = node->getNextSibling()) {
155 if (node->getNodeType() != DOMNode::ELEMENT_NODE)
161 <<
"Expected row tag in data file." 166 <<
"Too many rows in data file." << std::endl;
168 elem =
static_cast<DOMElement*
>(node);
170 unsigned int col = 0;
171 for(DOMNode *subNode = elem->getFirstChild();
172 subNode; subNode = subNode->getNextSibling()) {
173 if (subNode->getNodeType() != DOMNode::ELEMENT_NODE)
179 <<
"Expected value tag in data file." 184 <<
"Too many columns in data file." 188 XMLDocument::readContent<double>(subNode);
194 <<
"Missing columns in data file." 201 <<
"Missing rows in data file." 210 <<
"Expected matrix in data file." 213 unsigned int col = 0;
214 for(DOMNode *node = elem->getFirstChild();
215 node; node = node->getNextSibling()) {
216 if (node->getNodeType() != DOMNode::ELEMENT_NODE)
222 <<
"Expected value tag in data file." 227 <<
"Too many columns in data file." 230 vector(col) = XMLDocument::readContent<double>(node);
236 <<
"Missing columns in data file." 241 const TMatrixDBase &
matrix)
244 XMLDocument::writeAttribute<unsigned int>(
root,
"size",
n);
246 for(
unsigned int i = 0;
i <
n;
i++) {
247 DOMElement *row = doc->createElement(
XMLUniStr(
"row"));
248 root->appendChild(row);
250 for(
unsigned int j = 0; j <
n; j++) {
253 row->appendChild(value);
255 XMLDocument::writeContent<double>(
value, doc,
264 const TVectorD &vector)
267 XMLDocument::writeAttribute<unsigned int>(
root,
"size",
n);
269 for(
unsigned int i = 0;
i <
n;
i++) {
272 root->appendChild(value);
274 XMLDocument::writeContent<double>(
value, doc, vector(
i));
283 "LinearAnalysis") != 0)
285 <<
"Expected LinearAnalysis in data file." 288 unsigned int version = XMLDocument::readAttribute<unsigned int>(
292 POS_COEFFS, POS_COVAR, POS_CORR, POS_ROTATION,
293 POS_SUMS, POS_WEIGHTS, POS_VARIANCE, POS_TRACE, POS_DONE
296 for(DOMNode *node = elem->getFirstChild();
297 node; node = node->getNextSibling()) {
298 if (node->getNodeType() != DOMNode::ELEMENT_NODE)
301 DOMElement *elem =
static_cast<DOMElement*
>(node);
308 for(
unsigned int i = 0;
i <=
n;
i++) {
339 for(
unsigned int i = 0;
i <=
n;
i++) {
350 pos = (Position)(pos + 1);
362 for(
unsigned int i = 0;
i <=
n;
i++) {
365 double c = (v >= 1.0e-9)
366 ? (w / v) : (
i ==
n);
379 <<
"Superfluous content in data file." 383 pos = (Position)(pos + 1);
388 <<
"Missing objects in data file." 394 DOMElement *
root = doc->createElement(
XMLUniStr(
"LinearAnalysis"));
395 XMLDocument::writeAttribute<unsigned int>(
root,
"version", 2);
396 XMLDocument::writeAttribute<unsigned int>(
root,
"size",
n);
def elem(elemtype, innerHTML='', html_class='', kwargs)
std::vector< std::vector< double > > tmp