1

what is the maximum length for matrix can be used for matrix inversion on atmega32,for example,can we implement matrix inversion for 15x15 matrix on atmega32? And if it can be done on atmega32..does this will make the atmega32 to be slower? I want to implement kalamn filter 15 states for euler angles estimation...the data of the matrix will be floating point..

5
  • This is not a very well defined question. Did you have a particular application in mind (so it can be optimized) or do you need a general matrix inversion algorithm? What do you mean by “would this make the ATMega32 slower”? No, the ATMega32 would remain just as fast. Your code might become slower, but that depends on question #1: what do you need this for?
    – StarCat
    Sep 7, 2020 at 6:15
  • What data type do you store in the matrix? How is the matrix defined? Please show us some code. Sep 7, 2020 at 6:30
  • I want to implement kalamn filter 15 states for euler angles estimation...the data of the matrix will be floating point..
    – user255471
    Sep 7, 2020 at 6:38
  • I want to implement kalamn filter 15 states for euler angles estimation...the data of the matrix will be floating point..
    – user255471
    Sep 7, 2020 at 6:39
  • 1
    does this will make the atmega32 to be slower? - slower than what? It would certainly be slower than not inverting any matrices, of course.
    – Nick Gammon
    Sep 7, 2020 at 7:07

1 Answer 1

1

Floats in the Arduino IDE are normally 4 bytes. So you can work out with a calculator that your matrix will take at least 15 x 15 x 4 bytes (900 bytes). That is out of a total of 2048 bytes of RAM on the Atmega32.

That may seem to be enough RAM, but other things, like the libraries, will also take RAM. I did an answer to a question about RAM a while back. Even a very simple sketch (in this case) took 346 bytes.

Also, your library, or whatever-it-is you are using for matrix inversion, may require RAM for variables, etc.

My suggestion would be to make your code invert a very small matrix (eg. 1 x 1) and see how much RAM that uses. Then you can extrapolate out fairly simply to how much would be needed for a larger matrix.

3
  • To invert, you will need at least 2 arrays (src, dest), so 15x15 is very questionable. Sep 8, 2020 at 13:13
  • Couldn't you do it in place? Not that the library they are proposing to use would necessarily do that.
    – Nick Gammon
    Sep 9, 2020 at 7:54
  • I may well be wrong about that. After reading Inverse of a Matrix using Elementary Row Operations it sounds like you may well need more memory for the inversion operation.
    – Nick Gammon
    Sep 9, 2020 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.