Search found 29 matches

by Iyassou
Sat Aug 25, 2018 5:43 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

Just an aside, what are you using these 3x3 matrices for? At the moment I'm not actively using umatrix. Back when I needed it I wanted to handle RGB and later RGB-IR photosensor measurements for a particular application. I decided to write it because the alternative 350 ms were too costly for me. I...
by Iyassou
Thu Aug 23, 2018 5:13 am
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

You seem to care a lot about time savings. Just wanted it to go as fast as possible :) Coding in C is going to give you the maximum time savings The part about adding your module to the firmware is clear, it's writing the library in C that seems daunting to me. As I've said before, I'm not proficie...
by Iyassou
Wed Aug 22, 2018 6:22 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

Roberthh wrote:
Wed Aug 22, 2018 4:53 pm
So using the native decorators with unchanged code may be the most effective improvement.
I just tried the inverse and __add__ functions with nothing different other than the micropython.native decorator and the time savings were about 0.1 ms for both, nothing monumental.
by Iyassou
Wed Aug 22, 2018 12:17 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

Alas it isn't well documented. That's unfortunate. So far I'm trying to modify "inverse" to use Viper and I'm coming across a surprising error. My code: @micropython.viper @property def inverse(self): order = int(len(self.rows)) assert order == int(len(self.rows[0])), "Matrix must be square." if or...
by Iyassou
Wed Aug 22, 2018 6:55 am
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

Iyassou wrote:
Mon Aug 20, 2018 6:49 am
I'll report back as soon as I've done this.
Are there any fleshed-out guides for writing code for the Viper emitter? I'm not at all familiar with it and so far I've just been firing in the dark and not getting anywhere.
by Iyassou
Mon Aug 20, 2018 6:49 am
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

I'm considering merging umatrix_np into umatrix and changing the size method to shape (I'm not really a fan of the word shape in this scenario and was hanging on to prejudice, but if it's what's preferred I am flexible :) ). I decided to merge umatrix_np into umatrix. The new umatrix, v1.1, now sup...
by Iyassou
Sun Aug 19, 2018 6:14 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

Write it in C and it’ll be much faster. Out of curiosity, what do you do with the C program once you've written it to make it work with MicroPython? I can actually program very simple things in C but don't have the same usage experience as with Python 3 and MicroPython and if this is accessible it ...
by Iyassou
Sun Aug 19, 2018 5:23 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

There is another way to get more performance while remaining in MicroPython: use @micropython.viper https://www.kickstarter.com/projects/214379695/micro-python-python-for-microcontrollers/posts/664832 http://docs.micropython.org/en/v1.9.3/pyboard/reference/speed_python.html#the-viper-code-emitter I...
by Iyassou
Sun Aug 19, 2018 5:01 pm
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

Thanks Peter! :) Although I don't know when you would need numpy-like matrix slicing on a microcontroller, I've added the functionality on a separate flavour of umatrix called umatrix_np. This flavour also supports the shape method. The reason why I made it its own file is because I believe it's the...
by Iyassou
Fri Aug 17, 2018 10:52 am
Forum: Programs, Libraries and Tools
Topic: Matrix library for MicroPython
Replies: 31
Views: 2955

Re: Matrix library for MicroPython

Essentially, hardcoding the determinant and inverse functions and using local variables as often as possible to avoid referencing globals often or at least twice in the method's body. For example, certain methods require property checking before doing their job and those property checks often access...