NEWS
LinuxCNC 2.5.2 Release
There are no translations available.

LinuxCNC 2.5.2 Update Released (changelog).
 
LinuxCNC 2.5.1 Release
There are no translations available.

LinuxCNC 2.5.1 Update Released (changelog). If the Package Manager does not prompt you to upgrade see this page.

 
LinuxCNC 2.5.0 Release
There are no translations available.

New major release (changelog). See the instructions to update your system from EMC 2.4 to LinuxCNC 2.5.
 
Home Forum HAL HAL Components Matrix Math in HAL

Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Matrix Math in HAL

Matrix Math in HAL 28 Avr 2011 16:21 #9484

  • meisu
  • meisu's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
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
The administrator has disabled public write access.

Re:Matrix Math in HAL 28 Avr 2011 16:26 #9485

  • BigJohnT
  • BigJohnT's Avatar
  • NOW ONLINE
  • Administrator
  • Posts: 4944
  • Thank you received: 84
  • Karma: 133
Are you attempting this in comp?

John
The administrator has disabled public write access.

Re:Matrix Math in HAL 28 Avr 2011 16:46 #9488

  • andypugh
  • andypugh's Avatar
  • OFFLINE
  • Moderator
  • Posts: 4102
  • Thank you received: 139
  • Karma: 129
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
The administrator has disabled public write access.

Re:Matrix Math in HAL 29 Avr 2011 05:45 #9498

  • meisu
  • meisu's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
Yes, I am attempting this in comp.
The administrator has disabled public write access.

Re:Matrix Math in HAL 29 Avr 2011 05:47 #9499

  • meisu
  • meisu's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 10
  • Karma: 0
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?
The administrator has disabled public write access.

Re:Matrix Math in HAL 29 Avr 2011 07:08 #9506

  • andypugh
  • andypugh's Avatar
  • OFFLINE
  • Moderator
  • Posts: 4102
  • Thank you received: 139
  • Karma: 129
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.
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 1.121 seconds
Powered by Kunena Forum
© 2013 LinuxCNC.org
Joomla! is Free Software released under the GNU General Public License.