Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

solve linear NxM system mkl ifort

diedro
Beginner
378 Views
hi everyone,
I would like to solve a general nxm system in fortran ifort intel using mkl libraries or lapack.
Is this possible?
what subroutine should I use?
The system is not quadratic (nxn) but a general system.
thank you very much
0 Kudos
4 Replies
mecej4
Honored Contributor III
377 Views
First of all, you need to specify what you mean by "solve" when you have an overdetermined (more equations than unknowns) or underdetermined (too few equations to determine the unknowns) problem.

In the former case, usually the norm of the residual is to be minimized; see the section Linear Least Squares (LLS) Problems in the MKL Reference Manual.

In the latter case, if the variables have been suitably scaled, you may look for the solution of minimal norm, or you may look for the analytic center.
0 Kudos
diedro
Beginner
378 Views
hi,
I am trying to apply a "moving last square" to get the gradient and second derivaive af a known distribution of value.
This means that my sytem isoverdetermined. I would like simple inverte the matrix to solve the problem. I red on MKL manual that this is more stable and precise.
What do you suggest? Are there any subs that do this?
tahnk you
0 Kudos
mecej4
Honored Contributor III
377 Views
> This means that my sytem isoverdetermined.

May be so, depending on how you define "moving least square".

> I would like simple inverte the matrix to solve the problem.

If the system is overdetermined, the matrix is not square and therefore has no inverse in the usual sense.

> I red on MKL manual that this is more stable and precise

Overdetermined equations are usually solved in the least-square-residual sense using the A = Q R decomposition, where Q is orthogonal and R is upper-triangular. MKL provides routines (?gels?) to do this.
0 Kudos
diedro
Beginner
377 Views
hi,
now it works
this is the porblem
[bash]PROGRAM solve_mn[/bash][bash]USE LAPACK95 IMPLICIT NONE ! ! | .000000000 2.000000000 | ! | 2.000000000 -1.000000000 | ! A = | 2.000000000 -1.000000000 | ! | .000000000 1.500000000 | ! | 2.000000000 -1.000000000 | ! | 2.000000000 -1.000000000 | ! ! ! B = | 1.000000000 | ! | 1.000000000 | ! | . | ! | . | ! | . | ! | . | ! INTEGER M INTEGER N INTEGER NB INTEGER info CHARACTER*1 trans !type solver REAL, ALLOCATABLE ,DIMENSION(:,:) ::AA !SYSTEM REAL, ALLOCATABLE ,DIMENSION(:) ::XX !UNKNOWN REAL, ALLOCATABLE ,DIMENSION(:) ::BB !KNOWN M = 6 !ROWS N = 2 !COLUMNS ALLOCATE (AA (M,N )) ALLOCATE (BB (M)) AA(:,:) = 0.d0 BB(:) = 0.d0 XX(:) = 0.d0 !---------------------------------------------------------------------------------- AA(1,1) = 0.d0 AA(1,2) = 2.d0 AA(2,1) = 2.d0 AA(2,2) = -1.d0 AA(3,1) = 2.d0 AA(3,2) = -1.d0 AA(4,1) = 0.d0 AA(4,2) = -1.5d0 AA(5,1) = 2.d0 AA(5,2) = -1.d0 AA(6,1) = 2.d0 AA(6,2) = -1.d0 BB(1) = 1.d0 BB(2) = 1.d0 BB(3) = 0.d0 BB(4) = 0.d0 BB(5) = 0.d0 BB(6) = 0.d0 !---------------------------------------------------------------------------------- CALL GELS(AA,BB,'N',info) ENDPROGRAM[/bash]
THANKS
0 Kudos
Reply