1 #include "QuaternionMathsBenchmarksF32.h" 2 #include "Error.h" 3 4 test_quaternion_norm_f32()5 void QuaternionMathsBenchmarksF32::test_quaternion_norm_f32() 6 { 7 arm_quaternion_norm_f32(this->inp1,this->outp,this->nb); 8 9 } 10 test_quaternion_inverse_f32()11 void QuaternionMathsBenchmarksF32::test_quaternion_inverse_f32() 12 { 13 14 arm_quaternion_inverse_f32(this->inp1,this->outp,this->nb); 15 16 17 } 18 test_quaternion_conjugate_f32()19 void QuaternionMathsBenchmarksF32::test_quaternion_conjugate_f32() 20 { 21 22 arm_quaternion_conjugate_f32(this->inp1,this->outp,this->nb); 23 24 } 25 test_quaternion_normalize_f32()26 void QuaternionMathsBenchmarksF32::test_quaternion_normalize_f32() 27 { 28 29 arm_quaternion_normalize_f32(this->inp1,this->outp,this->nb); 30 31 32 } 33 test_quaternion_prod_single_f32()34 void QuaternionMathsBenchmarksF32::test_quaternion_prod_single_f32() 35 { 36 37 for(int i=0; i < this->nb; i++) 38 { 39 arm_quaternion_product_single_f32(this->inp1,this->inp2,this->outp); 40 this->outp += 4; 41 this->inp1 += 4; 42 this->inp2 += 4; 43 } 44 45 } 46 test_quaternion_product_f32()47 void QuaternionMathsBenchmarksF32::test_quaternion_product_f32() 48 { 49 50 arm_quaternion_product_f32(this->inp1,this->inp2,outp,this->nb); 51 52 53 54 } 55 test_quaternion2rotation_f32()56 void QuaternionMathsBenchmarksF32::test_quaternion2rotation_f32() 57 { 58 arm_quaternion2rotation_f32(this->inp1,this->outp,this->nb); 59 60 61 62 } 63 test_rotation2quaternion_f32()64 void QuaternionMathsBenchmarksF32::test_rotation2quaternion_f32() 65 { 66 67 68 arm_rotation2quaternion_f32(this->inp1,this->outp,this->nb); 69 70 71 72 } 73 74 setUp(Testing::testID_t id,std::vector<Testing::param_t> & params,Client::PatternMgr * mgr)75 void QuaternionMathsBenchmarksF32::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr) 76 { 77 78 this->setForceInCache(true); 79 std::vector<Testing::param_t>::iterator it = params.begin(); 80 this->nb = *it; 81 82 83 switch(id) 84 { 85 case QuaternionMathsBenchmarksF32::TEST_QUATERNION_NORM_F32_1: 86 input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4); 87 output.create(this->nb,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 88 89 this->inp1=input1.ptr(); 90 this->outp=output.ptr(); 91 break; 92 93 case QuaternionMathsBenchmarksF32::TEST_QUATERNION_INVERSE_F32_2: 94 input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4); 95 output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 96 97 this->inp1=input1.ptr(); 98 this->outp=output.ptr(); 99 break; 100 101 case QuaternionMathsBenchmarksF32::TEST_QUATERNION_CONJUGATE_F32_3: 102 input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4); 103 output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 104 105 this->inp1=input1.ptr(); 106 this->outp=output.ptr(); 107 break; 108 109 case QuaternionMathsBenchmarksF32::TEST_QUATERNION_NORMALIZE_F32_4: 110 input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4); 111 output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 112 113 this->inp1=input1.ptr(); 114 this->outp=output.ptr(); 115 break; 116 117 case QuaternionMathsBenchmarksF32::TEST_QUATERNION_PROD_SINGLE_F32_5: 118 input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4); 119 input2.reload(QuaternionMathsBenchmarksF32::INPUT2_F32_ID,mgr,this->nb*4); 120 output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 121 122 this->inp1=input1.ptr(); 123 this->inp2=input2.ptr(); 124 this->outp=output.ptr(); 125 break; 126 127 case QuaternionMathsBenchmarksF32::TEST_QUATERNION_PRODUCT_F32_6: 128 input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4); 129 input2.reload(QuaternionMathsBenchmarksF32::INPUT2_F32_ID,mgr,this->nb*4); 130 output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 131 132 this->inp1=input1.ptr(); 133 this->inp2=input2.ptr(); 134 this->outp=output.ptr(); 135 break; 136 137 case QuaternionMathsBenchmarksF32::TEST_QUATERNION2ROTATION_F32_7: 138 input1.reload(QuaternionMathsBenchmarksF32::INPUT1_F32_ID,mgr,this->nb*4); 139 output.create(this->nb*9,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 140 141 this->inp1=input1.ptr(); 142 this->outp=output.ptr(); 143 break; 144 145 case QuaternionMathsBenchmarksF32::TEST_ROTATION2QUATERNION_F32_8: 146 input1.reload(QuaternionMathsBenchmarksF32::INPUT_ROT_F32_ID,mgr,this->nb*9); 147 output.create(this->nb*4,QuaternionMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr); 148 149 this->inp1=input1.ptr(); 150 this->outp=output.ptr(); 151 break; 152 153 } 154 } 155 tearDown(Testing::testID_t id,Client::PatternMgr * mgr)156 void QuaternionMathsBenchmarksF32::tearDown(Testing::testID_t id,Client::PatternMgr *mgr) 157 { 158 } 159