diff --git a/expui/BiorthBasis.cc b/expui/BiorthBasis.cc index ecc320a9f..f9237bc65 100644 --- a/expui/BiorthBasis.cc +++ b/expui/BiorthBasis.cc @@ -24,6 +24,7 @@ namespace BasisClasses "pcavar", "pcadiag", "pcavtk", + "pcaeof", "subsamp", "snr", "samplesz", diff --git a/expui/CoefStruct.H b/expui/CoefStruct.H index d438dc408..4afca4cf9 100644 --- a/expui/CoefStruct.H +++ b/expui/CoefStruct.H @@ -51,6 +51,14 @@ namespace CoefClasses //! Read-write access to coefficient data (no copy) Eigen::Ref setCoefs() { return store; } + //! Set new coefficient data (no copy) + void setCoefs(Eigen::VectorXcd& STORE) + { + if (STORE.size() != store.size()) + throw std::invalid_argument("CoefStruct::setCoefs: coefficient vector size does not match"); + store = STORE; + } + //! Read-only access to coefficient data (no copy) Eigen::Ref getCoefs() { return store; } diff --git a/pyEXP/CoefWrappers.cc b/pyEXP/CoefWrappers.cc index 21408b3ba..97c394db0 100644 --- a/pyEXP/CoefWrappers.cc +++ b/pyEXP/CoefWrappers.cc @@ -724,25 +724,53 @@ void CoefficientClasses(py::module &m) { Returns ------- numpy.ndarray - complex-valued matrix as a NumPy array of complex values + complex-valued matrix as a flattened NumPy array of complex values See also -------- setCoefs : read-write access to Coefs )") - .def("setCoefs", &CoefStruct::setCoefs, + .def("setCoefs", // Member function overload + static_cast(&CoefStruct::setCoefs), + py::arg("mat"), + R"( + Set the coefficient matrix with the coefficient vector in the same form as returned + by getCoefs + + Parameters + ---------- + mat : numpy.ndarray + Flattened array of coefficients + + Returns + ------- + None + + Notes + ----- + The rank data array must match the rank of the CoefStruct. Use getCoefs to create + such an array with the correct rank. + + See also + -------- + getCoefs : read-only access to Coefs + )") + .def("setCoefs", // Member function overload + static_cast(CoefStruct::*)()>(&CoefStruct::setCoefs), R"( Read-write access to the underlying data store Returns ------- numpy.ndarray - complex-valued matrix represented as a NumPy array of complex values + reference to a complex-valued matrix represented as a NumPy array of complex + values Notes ----- - Changes made to the data array will be automatically mapped - back to the C++ CoefStruct instance. + Changes made to the data array will be automatically mapped back to the C++ + CoefStruct instance. You may use the setCoefs(array) call to set the data array + directly. See also --------