Hexadroid

Blah

Nov 27th, 2020
523
129 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #pragma hdrstop
  2. #pragma argsused
  3.  
  4. #ifdef _WIN32
  5. #include <tchar.h>
  6. #else
  7.   typedef char _TCHAR;
  8.   #define _tmain main
  9. #endif
  10.  
  11. #include <stdio.h>
  12. #include <vector>
  13.  
  14. double a[2][2];
  15. double b[2][2];
  16. double z;
  17.  
  18. std::vector<std::vector<double>> outcome = { {0.00, 0.00}, {0.00, 0.00}};
  19.  
  20.  
  21. std::vector<std::vector<double>> dotproduct(double (*arrax)[2][2], double (*array)[2][2])
  22. {
  23.    double v,w,x,y;
  24.    std::vector<std::vector<double>> f_out = { {0.00, 0.00}, {0.00, 0.00}};
  25.  
  26.    v = (*arrax)[0][0] * (*array)[0][0] +
  27.        (*arrax)[0][1] * (*array)[1][0];
  28.  
  29.    w = (*arrax)[0][0] * (*array)[0][1] +
  30.        (*arrax)[0][1] * (*array)[1][1];
  31.  
  32.  
  33.  
  34.    x = (*arrax)[1][0] * (*array)[0][0] +
  35.        (*arrax)[1][1] * (*array)[1][0];
  36.  
  37.    y = (*arrax)[1][0] * (*array)[0][1] +
  38.        (*arrax)[1][1] * (*array)[1][1];
  39.  
  40.    printf("\n %lf, %lf", v, w);
  41.    printf("\n %lf, %lf", x,y);
  42.    printf("\n");
  43.  
  44.    f_out[0][0] = v;
  45.    f_out[0][1] = w;
  46.    f_out[1][0] = x;
  47.    f_out[1][1] = y;
  48.  
  49.  
  50.    return f_out;
  51. }
  52.  
  53. int _tmain(int argc, _TCHAR* argv[])
  54. {
  55.     //test !
  56.  
  57.     a[0][0] = 3.00;
  58.     a[0][1] = -2.00;
  59.     a[1][0] = -1.00;
  60.     a[1][1] = 4.00;
  61.  
  62.     b[0][0] = 3.50;
  63.     b[0][1] = 1.70;
  64.     b[1][0] = 2.20;
  65.     b[1][1] = 4.30;
  66.  
  67.     outcome = dotproduct(&a,&b);
  68.  
  69.    printf("\n outcome :");
  70.    printf("\nv %lf, %lf", outcome[0][0], outcome[0][1]);
  71.    printf("\nv %lf, %lf", outcome[1][0], outcome[1][1]);
  72.  
  73.  
  74.  
  75.  
  76.     scanf("%lf", &z);
  77.  
  78.     return 0;
  79. }
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87. //    for(auto& rows: training_set_inputs)
  88. //    {
  89. //      for(auto& elem: rows)
  90. //      {
  91. //        elem =  1/elem;
  92. //
  93. //      }
  94. //   }
RAW Paste Data