QuaternionMathsBenchmarksF32.cpp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #include "QuaternionMathsBenchmarksF32.h"
  2. #include "Error.h"
  3. void QuaternionMathsBenchmarksF32::test_quaternion_norm_f32()
  4. {
  5. arm_quaternion_norm_f32(this->inp1,this->outp,this->nb);
  6. }
  7. void QuaternionMathsBenchmarksF32::test_quaternion_inverse_f32()
  8. {
  9. arm_quaternion_inverse_f32(this->inp1,this->outp,this->nb);
  10. }
  11. void QuaternionMathsBenchmarksF32::test_quaternion_conjugate_f32()
  12. {
  13. arm_quaternion_conjugate_f32(this->inp1,this->outp,this->nb);
  14. }
  15. void QuaternionMathsBenchmarksF32::test_quaternion_normalize_f32()
  16. {
  17. arm_quaternion_normalize_f32(this->inp1,this->outp,this->nb);
  18. }
  19. void QuaternionMathsBenchmarksF32::test_quaternion_prod_single_f32()
  20. {
  21. for(int i=0; i < this->nb; i++)
  22. {
  23. arm_quaternion_product_single_f32(this->inp1,this->inp2,this->outp);
  24. this->outp += 4;
  25. this->inp1 += 4;
  26. this->inp2 += 4;
  27. }
  28. }
  29. void QuaternionMathsBenchmarksF32::test_quaternion_product_f32()
  30. {
  31. arm_quaternion_product_f32(this->inp1,this->inp2,outp,this->nb);
  32. }
  33. void QuaternionMathsBenchmarksF32::test_quaternion2rotation_f32()
  34. {
  35. arm_quaternion2rotation_f32(this->inp1,this->outp,this->nb);
  36. }
  37. void QuaternionMathsBenchmarksF32::test_rotation2quaternion_f32()
  38. {
  39. arm_rotation2quaternion_f32(this->inp1,this->outp,this->nb);
  40. }
  41. void QuaternionMathsBenchmarksF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  42. {
  43. this->setForceInCache(true);
  44. std::vector<Testing::param_t>::iterator it = params.begin();
  45. this->nb = *it;
  46. switch(id)
  47. {
  48. case QuaternionMathsBenchmarksF32::TEST_QUATERNION_NORM_F32_1:
  49. input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4);
  50. output.create(this->nb,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  51. this->inp1=input1.ptr();
  52. this->outp=output.ptr();
  53. break;
  54. case QuaternionMathsBenchmarksF32::TEST_QUATERNION_INVERSE_F32_2:
  55. input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4);
  56. output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  57. this->inp1=input1.ptr();
  58. this->outp=output.ptr();
  59. break;
  60. case QuaternionMathsBenchmarksF32::TEST_QUATERNION_CONJUGATE_F32_3:
  61. input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4);
  62. output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  63. this->inp1=input1.ptr();
  64. this->outp=output.ptr();
  65. break;
  66. case QuaternionMathsBenchmarksF32::TEST_QUATERNION_NORMALIZE_F32_4:
  67. input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4);
  68. output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  69. this->inp1=input1.ptr();
  70. this->outp=output.ptr();
  71. break;
  72. case QuaternionMathsBenchmarksF32::TEST_QUATERNION_PROD_SINGLE_F32_5:
  73. input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4);
  74. input2.reload(QuaternionMathsBenchmarksF32::INPUT2_F32_ID,mgr,this->nb*4);
  75. output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  76. this->inp1=input1.ptr();
  77. this->inp2=input2.ptr();
  78. this->outp=output.ptr();
  79. break;
  80. case QuaternionMathsBenchmarksF32::TEST_QUATERNION_PRODUCT_F32_6:
  81. input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4);
  82. input2.reload(QuaternionMathsBenchmarksF32::INPUT2_F32_ID,mgr,this->nb*4);
  83. output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  84. this->inp1=input1.ptr();
  85. this->inp2=input2.ptr();
  86. this->outp=output.ptr();
  87. break;
  88. case QuaternionMathsBenchmarksF32::TEST_QUATERNION2ROTATION_F32_7:
  89. input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4);
  90. output.create(this->nb*9,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  91. this->inp1=input1.ptr();
  92. this->outp=output.ptr();
  93. break;
  94. case QuaternionMathsBenchmarksF32::TEST_ROTATION2QUATERNION_F32_8:
  95. input1.reload(QuaternionMathsBenchmarksF32::INPUT_ROT_F32_ID,mgr,this->nb*9);
  96. output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
  97. this->inp1=input1.ptr();
  98. this->outp=output.ptr();
  99. break;
  100. }
  101. }
  102. void QuaternionMathsBenchmarksF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  103. {
  104. }