You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
955 B

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __CORTEX_MATRIX_HEADER__
  2. #define __CORTEX_MATRIX_HEADER__
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <assert.h>
  7. #include <stdint.h>
  8. #include <math.h>
  9. #include "basicUtils.h"
  10. typedef struct S_MATRIX{
  11. uint32_t rows;
  12. uint32_t cols;
  13. float **values;
  14. } cortexMATRIX;
  15. cortexMATRIX make_matrix(uint32_t rows, uint32_t cols);
  16. cortexMATRIX copy_matrix(cortexMATRIX m);
  17. void print_matrix(cortexMATRIX m);
  18. void scale_matrix(cortexMATRIX m, float scale);
  19. void matrix_add_matrix(cortexMATRIX from, cortexMATRIX to);
  20. cortexMATRIX hold_out_matrix(cortexMATRIX *m, uint32_t n);
  21. cortexMATRIX resize_matrix(cortexMATRIX m, uint32_t size);
  22. float matrix_topk_accuracy(cortexMATRIX truth, cortexMATRIX guess, uint32_t k);
  23. float *pop_column(cortexMATRIX *m, uint32_t c);
  24. void free_matrix(cortexMATRIX m);
  25. cortexMATRIX csv_to_matrix(char *filename);
  26. void matrix_to_csv(cortexMATRIX m);
  27. #endif