1
0
forked from leto/LeMA

Reflected changes to README

This commit is contained in:
Leto 2024-12-24 14:33:22 +01:00
parent 3c596e9601
commit 57fa219441
2 changed files with 13 additions and 25 deletions

View File

@ -24,7 +24,7 @@ LeMA will eventually be used for graphical and machine learning usage in my othe
#include "matrices.h" #include "matrices.h"
``` ```
That's it! You're ready to use Lema. That's it! You're ready to use LeMA.
### Example Usage ### Example Usage
@ -45,18 +45,15 @@ int main() {
```cpp ```cpp
#include "matrices.h" #include "matrices.h"
#include <iostream>
int main() { int main() {
Matrix a(2,2); Matrix a(2,2);
Matrix b(2,2); a.Set(2.0F); // Fill A with 2s
a.Set(2.0F); // Fill both matrices Matrix b = a;
b.Set(3.0F); Matrix result = a + &b; // Basic operations are possible with pointers
a.Add(&b); result.Print("A + B"); // Is full of 4s !
a.Print("A + B");
return 0; return 0;
} }
``` ```
@ -65,15 +62,14 @@ int main() {
```cpp ```cpp
#include "matrices.h" #include "matrices.h"
#include <iostream>
int main() { int main() {
Matrix a(3, 3); Matrix a(3, 3);
Matrix b(3, 1); // Let's multiply by a vector Matrix b(3, 1); // Let's multiply by a vector
Matrix result = a.Multiply(&b); Matrix result = a * &b;
result.Print("A x B"); result.Print("A x B"); // Result is a 3 by 1 vector
return 0; return 0;
} }

View File

@ -1,20 +1,12 @@
#include "matrices.h" #include "matrices.h"
// using namespace std;
int main() int main() {
{ Matrix a(3, 3);
srand(time(0)); Matrix b(3, 1); // Let's multiply by a vector
Matrix a(3,3);
a.Randomize();
Matrix b(3, 1);
b.Set(2.0F);
a.Print("A");
b.Print("B");
Matrix result = a * &b; Matrix result = a * &b;
result.Print("A x B");
result.Print("A x B"); // Result is a 3 by 1 vector
return 0; return 0;
} }