Matrix Math in HAL

More
28 Apr 2011 23:21 #9484 by meisu
Matrix Math in HAL was created by meisu
Does anyone know how to implement matrix math in HAL? I haven't been able to initialize two dimensional array variables and I can't get C functions to compile that would do the arithmetic for me, once the 2-d arrays were implemented. Any help or direction to help would be appreciated.

Thanks,
Peter

Please Log in or Create an account to join the conversation.

More
28 Apr 2011 23:26 #9485 by BigJohnT
Replied by BigJohnT on topic Re:Matrix Math in HAL
Are you attempting this in comp?

John

Please Log in or Create an account to join the conversation.

More
28 Apr 2011 23:46 #9488 by andypugh
Replied by andypugh on topic Re:Matrix Math in HAL
BigJohnT wrote:

Are you attempting this in comp?


If so, you might find this patch pushed to the 2.5 branch a couple of days ago is helpful:
git.linuxcnc.org/gitweb?p=emc2.git;a=com...74df2f35e4b636d85b9d

Please Log in or Create an account to join the conversation.

More
29 Apr 2011 12:45 #9498 by meisu
Replied by meisu on topic Re:Matrix Math in HAL
Yes, I am attempting this in comp.

Please Log in or Create an account to join the conversation.

More
29 Apr 2011 12:47 #9499 by meisu
Replied by meisu on topic Re:Matrix Math in HAL
So, if I put an asterisk in front of the variable name I can make it a pointer to a 2-d array? Then can I define the 2-d array with #define?

Such As:

variable float *2darray;

function(main);

;;
#define 2darray[2][2] = {3,5,2,7};


Will this work?

Please Log in or Create an account to join the conversation.

More
29 Apr 2011 14:08 #9506 by andypugh
Replied by andypugh on topic Re:Matrix Math in HAL
No, that won't work, the define will be overridden in the generated code
Would that work in normal C?
You should be able to define the pointer then kmalloc it then index into it as an array.
It might be easier to switch to editing the generated C code if this is a one-off for your own use.

Please Log in or Create an account to join the conversation.

Time to create page: 0.071 seconds
Powered by Kunena Forum