fork download
  1. #include <stdio.h>
  2.  
  3. // matrix multiply float?
  4. void matmulf(double *y , double A[][2], double *x)
  5. {
  6. y[0] = A[0][0] * x[0] + A[0][1] * x[1];
  7. y[1] = A[1][0] * x[0] + A[1][1] * x[1];
  8. }
  9.  
  10. int main()
  11. {
  12. double A[][2] = {
  13. {1,0},
  14. {0,1},
  15. };
  16. double x[] = {10,20};
  17. double y[2];
  18.  
  19. matmulf(y, A, x);
  20. printf("y=(%f,%f)\n", y[0], y[1]);
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
y=(10.000000,20.000000)