[go: up one dir, main page]

File: lasymmatrix.cpp

package info (click to toggle)
iminuit 2.30.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 8,660 kB
  • sloc: cpp: 14,591; python: 11,177; makefile: 11; sh: 5
file content (17 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "lasymmatrix.hpp"

namespace py = pybind11;
using namespace ROOT::Minuit2;

py::tuple lasymmatrix2py(const LASymMatrix& self) {
  py::list ls;
  for (unsigned i = 0; i < self.size(); ++i) ls.append(self.Data()[i]);
  return py::make_tuple(self.Nrow(), ls);
}

LASymMatrix py2lasymmatrix(py::tuple tp) {
  LASymMatrix v(tp[0].cast<unsigned>());
  auto ls = tp[1].cast<py::list>();
  for (unsigned i = 0; i < v.size(); ++i) v.Data()[i] = ls[i].cast<double>();
  return v;
}