c++ - Any way to Implement Excel LINEST function using boost libraries? -


does boost::math have functions used implement function similar ms excel linest function ?

i parsed boost documentation (not in boost::math, looks more boost::ublas). now, couldn't find example simple enough not overkill non-mathematician.

from saw, rather advise using armadillo, use seems straightforward.

i have reproduced below simplified code example taken armadillo source archive:

int main(int argc, char** argv) {   // points fit line   mat data = "1 6; 2 5; 3 7; 4 10";    // transform problem armadillo use-case (ax = b problem)   vec b(data.n_rows);   mat c(data.n_rows, 2);   for(u32 i=0; i<data.n_rows; ++i)   {     b(i)   = data(i,1);     c(i,0) = 1;     c(i,1) = data(i,0);   }    // compute least-squares solution, should "3.5; 1.4"   vec solution = solve(c,b);   cout << "solution:" << endl << solution << endl;    return 0; } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -