-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath-matrix-test1.c
54 lines (43 loc) · 1.29 KB
/
math-matrix-test1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
/*
* $Id: math-matrix-test1.c 133 2013-03-10 15:15:38Z xander $
*/
/**
* matrix-float .h provides an API for the some simple Matrix operations.
*
* Changelog:
* - 0.1: Initial release
*
* Credits:
* - Charlie Matlack for writing the Arduino version of this. I merely ported it to
* ROBOTC and tweaked a few things.
*
* License: You may use this code as you wish, provided you give credit where it's due.
*
* THIS CODE WILL ONLY WORK WITH ROBOTC VERSION 3.59 AND HIGHER.
* Xander Soldaat (xander_at_botbench.com)
* 03 March 2013
* version 0.1
*/
#include "drivers/math-matrix.h"
task main ()
{
float one[2][2] = {{2.7, 2.1}, {1.1, 1.6}};
float two[2][2] = {{12.1, 11.9}, {21, 82.1}};
float three[2][2];
long four[3][3] = {{1, 3, 3},
{1, 4, 3},
{1, 3, 4}};
long five[3][3] = {{2, 1, 7},
{3, 4, 1},
{4, 2, 1}};
long six[3][3];
matrixPrintF(one, 2, 2, "one");
matrixMultF(one, two, 2, 2, 2, three);
matrixPrintF(three, 2, 2, "three");
matrixCopyF(one, 2, 2, two);
matrixPrintF(one, 2, 2, "one");
matrixPrintF(two, 2, 2, "two");
matrixAddL(four, five, 3, 3, six);
matrixPrintL(six, 3, 3, "six");
}