Bhavik Gandhi
Bhavik Gandhi

Reputation: 13

lapack library in codeblocks, boundary value

I am a student from Germany, currently doing the master thesis. In my master thesis, I am writing a Fortran code in code blocks. In my code, I am using some of the LAPACK functions.

I want help regarding adding LAPACK library in code block software. I searched a lot on the internet but I couldn't find anything. It'll be better if you provide me all the source links extension of the previous question.

In my code, I need to solve the following system of equation, {K}{p} = {m}

Where

I have all the elements of vector {m} and matrix {K} computed and I have some known values of vector {p}. It's boundary value problem.

Now I want to find out only unknown values of elements of a vector {p}.

Which function should I use?
I went through the LAPACK manual available online but couldn't find.

Upvotes: 0

Views: 190

Answers (1)

Kaveh Vahedipour
Kaveh Vahedipour

Reputation: 3477

Well you did not go through the documentation so thoroughly :) You are looking for solvers of a linear equation. http://www.netlib.org/lapack/lug/node38.html

Please specify a little more about complex/real double/float. ill posed? Over or under determined or quadratic? If quadratic then symmetric or upper triangular? Banded?

There is a hord of different algorithms one would consider. Runtime / stability / convergence behaviour are very different dependent on K. The most stable would be [x]gelsd. It's a divide and conquer algorithm via SVD and gives you with proper conditioning the moore penrose generalised inverse. But it is by far the slowest algorithm too.

btw, http://www.netlib.org/lapack/lug/node27.html, outlines all general solvers.

If you already have some values of your p, you would like to go a different route than a straight forward inversion. You are a lot better off, if you use an iterative method like conjugate gradient least squares problem with regularization. This is discussed in length in Stoer, Bullirsch, Introduction to Numerical Analysis, Chapter 8.7 (The Conjugate-gradient Method of Heestens and Stiefel).

There are multiple implementations online. One you will find in a library I wrote during my PhD: https://github.com/kvahed/codeare/blob/master/src/optimisation/CGLS.hpp

Upvotes: 1

Related Questions