This is a test Program for the Class Matrix version 1.6.4

Dependencies:   Matrix Kinematics mbed TrackVector2D MatrixMath

Files at this revision

API Documentation at this revision

Comitter:
Yo_Robot
Date:
Sat Oct 22 23:20:26 2011 +0000
Parent:
0:63af78c5943c
Child:
2:e3b963c560d8
Commit message:
Added Invert, Determinant.

Changed in this revision

Matrix.lib Show annotated file Show diff for this revision Revisions of this file
MatrixMath.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Matrix.lib	Fri Oct 21 03:35:03 2011 +0000
+++ b/Matrix.lib	Sat Oct 22 23:20:26 2011 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Yo_Robot/code/Matrix/#589fb80932b5
+http://mbed.org/users/Yo_Robot/code/Matrix/#c0c8f3edd60e
--- a/MatrixMath.lib	Fri Oct 21 03:35:03 2011 +0000
+++ b/MatrixMath.lib	Sat Oct 22 23:20:26 2011 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/Yo_Robot/code/MatrixMath/#eb69bbfb6486
+http://mbed.org/users/Yo_Robot/code/MatrixMath/#c74cdf14aea2
--- a/main.cpp	Fri Oct 21 03:35:03 2011 +0000
+++ b/main.cpp	Sat Oct 22 23:20:26 2011 +0000
@@ -5,7 +5,11 @@
 int main() {
 
     DigitalOut myled(LED1);
+    Timer t;
     
+    t.start();
+ 
+//---
     Matrix myMatrix(3,3);
     Matrix anotherMatrix;
 
@@ -14,7 +18,7 @@
              << 4  << 5  << 6
              << 7  << 8  << 9;
 
-    printf( "\myMatrix \n");
+    printf( "\nmyMatrix \n");
     myMatrix.print();
     printf( "\n" );
 
@@ -50,7 +54,7 @@
 
     // Resize Matrix
     temp.Resize(4,4);
-    printf("\nAdded one Column, one Row to the limitsof myMatrix saved in temp Matrix");
+    printf("\nAdded one Column, one Row to the limitsof myMatrix saved in temp Matrix\n");
     temp.print();
 
     //Delete those new elements, we don't need them anyway.
@@ -63,7 +67,8 @@
     
     // Make room at the begining of Matrix
     Matrix::AddRow( temp, 1 );
-    Matrix::AddColumn( temp, 1 );
+    Matrix::AddCol( temp, 1 );
+    
     printf("\nAdded Just one Row and column to the beginning\n");
     temp.print();
 
@@ -83,7 +88,39 @@
     printf("\nInitial Matrix turned into a single Row\n");
     temp.print();
            
-    // That's all for now!!!
+    /**  Mtrix Math  **/
+    printf("\n Matrix Inverse and Determinant\n");
+    
+    Matrix BigMat( 5, 5 );
+    BigMat   << 1 << 0  << 1 << 1 << 3
+             << 2 << 3  << 4 << 0 << 4
+             << 1 << 6  << 1 << 1 << 2
+             << 1 << 0  << 2 << 1 << 1
+             << 2 << 3  << 4 << 2 << 0;
+
+    printf( "\nBigMat:\n");
+    BigMat.print();
+    printf( "\n" );
+
+    float determ = MatrixMath::det( BigMat );
+
+    printf( "\nBigMat's Determinant is: %f \n", determ);
+    printf( "\n" );
+
+    Matrix myInv = MatrixMath::Inv( BigMat );
+
+    printf( "\nBigMat's Inverse is:\n");
+    myInv.print();
+    printf( "\n" );
+
+//---
+
+
+    t.stop();
+    
+    printf( "\nThe time for all those operations in mbed was : %f seconds\n", t.read() );
+    printf( "\nMost of it is due to printf though in my core i5 takes 100ms with printf() \n" );
+    printf( "\nOnly operations witout any print takes: 0.025 seconds :) \n" );
            
     while(1) {
         myled = 1;