58 lines
1.4 KiB
C
58 lines
1.4 KiB
C
#include <inttypes.h>
|
|
#include <stdlib.h>
|
|
#include <stdint.h>
|
|
#include <string.h>
|
|
|
|
#include "libmatrix.h"
|
|
#include "mathshell.c"
|
|
|
|
#define HELP "\nUsage: a.out [options]\n\n\
|
|
Options: Type Default Desc\n\
|
|
--help Show this menu\n\
|
|
--fps [float] 30 Set the FPS and Updating interval\n\
|
|
\n"
|
|
|
|
uint8_t roundOut = 0;
|
|
|
|
void fetchArgs(int argc, const char *argv[]){
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
if (!strcmp(argv[i], "--help")) { printf(HELP); exit(EXIT_SUCCESS); }
|
|
else if (!strcmp(argv[i], "--round-output")) roundOut = 1;
|
|
else {
|
|
printf("Unknown parameter '%s'\nTry '--help' for help\n", argv[i]);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
int main(int argc, const char *argv[]){
|
|
printf("A Math program to test libmatrix.c\n\n");
|
|
fetchArgs(argc, argv);
|
|
|
|
struct matrix *a = &(struct matrix) {};
|
|
matrixNewFromUser(a,3,3);
|
|
printf("Det: %f\n", matrixDet(a));
|
|
//matrixPrint(a, "a");
|
|
|
|
struct matrix *i = &(struct matrix) {};
|
|
matrixNew(i, 3, 3);
|
|
matrixIdentity(i);
|
|
matrixMultiplyByNumber(i, 4);
|
|
matrixPrint(i, "I");
|
|
|
|
struct matrix *out = &(struct matrix) {};
|
|
matrixMultiply(a, i, out);
|
|
matrixPrint(out, "a * I");
|
|
|
|
//printf("%d\n", stringHash("Hello"));
|
|
|
|
//initShell();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
|
|
|