LCOV - code coverage report
Current view: top level - src/util - eigen_meta.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 2 2 100.0 %
Date: 2025-03-25 01:19:55 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : #pragma once
       2                 :            : 
       3                 :            : #include <Eigen/Core>
       4                 :            : #include <Eigen/LU>
       5                 :            : 
       6                 :            : 
       7                 :            : namespace m {
       8                 :            : 
       9                 :            : /** Use closed-form solution for linear regression
      10                 :            :  * @param X the feature matrix
      11                 :            :  * @param y the target vector
      12                 :            :  * @return a vector of coefficients that represent the linear model
      13                 :            :  */
      14                 :          2 : Eigen::VectorXd regression_linear_closed_form(const Eigen::MatrixXd &X, const Eigen::VectorXd &y)
      15                 :            : {
      16                 :          2 :     return (X.transpose() * X).inverse() * X.transpose() * y;
      17                 :            : }
      18                 :            : 
      19                 :            : }

Generated by: LCOV version 1.16