installing GNU Scientific Library

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Has anyone installed the GNU Scientific Library for use in a C project in Atmel Studio?  I need to invert a 6x6 matrix.  Any hints would be welcomed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What's to "install" exactly? Surely you just pull the source and build it? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There is a lot of talk about installing it in Ubuntu.  I found a site where I can download the library, and then instructions to add it to a Visual Studio project in the usual way.  I will try that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Most such libraries are designed for "infinite resource" PCs so does this give any guarantees about resource requirements?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jack Crenshaw wrote a column at Embedded Systems Design on applied numerical analysis, and IIRC, one or more books on that.

embedded.com

Reusing code and inverting matrices

July 30, 2008

(page 3)

http://www.embedded.com/electronics-blogs/programmer-s-toolbox/4007639/3/Reusing-code-and-inverting-matrices

Back to the Matrix class

...

via

embedded.com

Programmer's Toolbox  RSS

 

Jack Crenshaw's column features algorithms and plug-and-play routines, along with explanations of how they work.

http://www.embedded.com/electronics-blogs/26/Programmer-s-Toolbox


http://www.embedded.com/user/JackCrens

...

Jack Crenshaw is a systems engineer and the author of Math Toolkit for Real-Time Programming.

...

https://www.crcpress.com/Math-Toolkit-for-Real-Time-Programming/Crenshaw/p/book/9781929629091 

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My first thought was,"On an AVR?" But then, some of them ARE bigger and faster than computers we used to do this stuff on.

 

But what do you need a library for? Inverting a matrix is easy. http://bfy.tw/BaWl

The largest known prime number: 282589933-1

It's easy to stop breaking the 10th commandment! Break the 8th instead. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I got the GSL-2-3 files from the GNU website and unzipped them.  I am out of my depth trying to build it.  I don't suppose anyone here has the Atmel Studio library built for this and the include files they could just give me.  It is not that I am lazy, just frustrated and ignorant on how to proceed.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know how to invert a matrix, but there are subtlies if it is sparse or banded and so forth.  GSL would have all of that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TORBY SAID:

My first thought was, "On an AVR?" But then, some of them ARE bigger and faster than computers we used to do this stuff on.

It's true, an ATmega256 has more memory than the mainframe I did my PhD thesis on, and that required inverting a 40x40 matrix.

 

TORBY SAID:

But what do you need a library for? Inverting a matrix is easy.

 Try row reducing a 6x6 to the unity matrix and tell me how easy it is.  Doing a Google search is easy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarkThomas wrote:
I know how to invert a matrix, but there are subtlies if it is sparse or banded and so forth.
Could see how the following would be inadequate :

/* General-purpose matrix inversion routine
     The n x n matrix a is inverted in place.

    This subroutine has a long history, dating back to the IBM
    scientific subroutine package routine of the same name.
    the subroutine uses the gauss-jordan method of pivotal
    condensation, with complete pivoting. this means that for each
    column of a, a search is executed for the largest element below
    or to the right of the current  diagonal element. this largest
    element is moved to the position of the pivotal element.
    the history of the interchanges is retained in the working
    vectors irow and icol, which are used to restore the inverse
    matrix to the correct order. the user must supply storage
    for irow and icol. usage is

            double a[n][n];
      size_t irow[n], icol[n];
      ...
            det = minv(a, irow, icol, n)
*/

double mInv(double a[], size_t irow[], size_t icol[], const size_t n){

from

embedded.com

SimpleMat.cpp

October 21, 2008

http://www.embedded.com/design/embedded/source-code/4200225/SimpleMat-cpp


embedded.com

Reusing code and inverting matrices

July 30, 2008

(page 6 of 7)

http://www.embedded.com/electronics-blogs/programmer-s-toolbox/4007639/6/Reusing-code-and-inverting-matrices

...

 

mInv, the matrix inversion algorithm I'm providing in SimpleMat.cpp, is an oldie but goodie.

...

I should mention that Gauss-Jordan is not the only way to invert a matrix. More modern methods involve factoring the matrix into two parts. The LU decomposition, for example, involves factoring the matrix into two triangular matrices. ... However, if you have to solve many such linear equations, involving the same matrix A, LU decomposition is much faster.

Several other decomposition algorithms exist. Each has its advantages. However, if you want the matrix inverse explicitly, and your matrix is relatively small (say less than 20x20), you'll find mInv hard to beat.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

gchapman, that is actually a pretty good inversion algorithm, and I will probably use something like it and hope my matricies are not sparse or otherwise weird.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Years ago I fond a (Legal) distribution of the book "numerical Recipes in C" online & made a copy, but haven't done much with it since.

It's filled with math concepts and C algorithms  to calculate them (Also matrices) and might be relevant to this post.

 

https://en.wikipedia.org/wiki/Nu...

http://numerical.recipes/

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Paul,

That would be a nice book to have.  It is sort of pricey on Amazon.  What sort of algorithms does it have for inverting a matrix bigger than 4x4?  I will probably end up using a Gauss-Jordon I can find code for on line. 

 

It would be a copywrite violation for you to email me the pages of interest, or the whole book for that matter.

 

mark

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paul,

I found the Gauss-Jordan code from Numerical Recipes.  Thanks for the tip.

mark