Skip to content

Latest commit

 

History

History

linreg

🟪🔴 = 🔷🔺

Solves Ax = b by QR magic using the lapack in oneapi-mkl.

Ax  = b
AP  = QR
QRx = b
Rx  = Q'b

In general, it solves this scenario:

     _________     _____________     _____________
    |         |   |             |   |             |
 m  |   A     |   |     X       |   |      B      |
    |         | * |             | = |             | m
    |         |   |_____________|   |             |
    |_________|         p           |_____________|
         n                                 p

but it is written for p=1.

When m≠n it is not working.

Not really a problem, just do A ⟵ A'A & b ⟵ A'b using dtrsm & dgemm.

🗃

linregbuild.[sh, bat] compiles all examples.

  • linreg.f90 minimal example and well explained.
  • linreg_.f90 huge dense matrix 🤪.
  • parafit.f90 fit a parabola to a set of points.
  • linefit.f90 fit a line to a set of points.
  • alles/src/fortran/qrfits.f90 module wrapper for fitting stuff and shown in qrfits_ie.f90.

🚀⌚

do ii=1,n
   do jj=1,n
     A(ii,jj) = 1
   enddo
   A(ii,ii) = 0
   b(ii) = 0
 enddo
 b(1) = 1