react-native-executorch 0.4.7 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1013) hide show
  1. package/android/CMakeLists.txt +17 -0
  2. package/android/build.gradle +76 -13
  3. package/android/libs/classes.jar +0 -0
  4. package/android/src/main/cpp/CMakeLists.txt +73 -0
  5. package/android/src/main/cpp/ETInstallerModule.cpp +76 -0
  6. package/android/src/main/cpp/ETInstallerModule.h +43 -0
  7. package/android/src/main/java/com/swmansion/rnexecutorch/ETInstaller.kt +66 -0
  8. package/android/src/main/java/com/swmansion/rnexecutorch/LLM.kt +3 -3
  9. package/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchPackage.kt +7 -113
  10. package/common/ada/ada.cpp +17406 -0
  11. package/common/ada/ada.h +10274 -0
  12. package/common/pfft/pfft.c +2205 -0
  13. package/common/pfft/pfft.h +185 -0
  14. package/common/rnexecutorch/Log.h +489 -0
  15. package/common/rnexecutorch/RnExecutorchInstaller.cpp +78 -0
  16. package/common/rnexecutorch/RnExecutorchInstaller.h +112 -0
  17. package/common/rnexecutorch/TokenizerModule.cpp +52 -0
  18. package/common/rnexecutorch/TokenizerModule.h +26 -0
  19. package/common/rnexecutorch/data_processing/FFT.cpp +21 -0
  20. package/common/rnexecutorch/data_processing/FFT.h +23 -0
  21. package/common/rnexecutorch/data_processing/FileUtils.h +30 -0
  22. package/common/rnexecutorch/data_processing/ImageProcessing.cpp +240 -0
  23. package/common/rnexecutorch/data_processing/ImageProcessing.h +55 -0
  24. package/common/rnexecutorch/data_processing/Numerical.cpp +82 -0
  25. package/common/rnexecutorch/data_processing/Numerical.h +23 -0
  26. package/common/rnexecutorch/data_processing/base64.cpp +110 -0
  27. package/common/rnexecutorch/data_processing/base64.h +46 -0
  28. package/common/rnexecutorch/data_processing/dsp.cpp +65 -0
  29. package/common/rnexecutorch/data_processing/dsp.h +12 -0
  30. package/common/rnexecutorch/host_objects/JSTensorViewIn.h +12 -0
  31. package/common/rnexecutorch/host_objects/JSTensorViewOut.h +22 -0
  32. package/common/rnexecutorch/host_objects/JsiConversions.h +410 -0
  33. package/common/rnexecutorch/host_objects/ModelHostObject.h +239 -0
  34. package/common/rnexecutorch/jsi/JsiHostObject.cpp +108 -0
  35. package/common/rnexecutorch/jsi/JsiHostObject.h +87 -0
  36. package/common/rnexecutorch/jsi/OwningArrayBuffer.h +40 -0
  37. package/common/rnexecutorch/jsi/Promise.cpp +20 -0
  38. package/common/rnexecutorch/jsi/Promise.h +69 -0
  39. package/common/rnexecutorch/jsi/RuntimeAwareCache.h +58 -0
  40. package/common/rnexecutorch/jsi/RuntimeLifecycleMonitor.cpp +53 -0
  41. package/common/rnexecutorch/jsi/RuntimeLifecycleMonitor.h +35 -0
  42. package/common/rnexecutorch/metaprogramming/ConstructorHelpers.h +131 -0
  43. package/common/rnexecutorch/metaprogramming/FunctionHelpers.h +50 -0
  44. package/common/rnexecutorch/metaprogramming/TypeConcepts.h +37 -0
  45. package/common/rnexecutorch/models/BaseModel.cpp +181 -0
  46. package/common/rnexecutorch/models/BaseModel.h +47 -0
  47. package/common/rnexecutorch/models/EncoderDecoderBase.cpp +21 -0
  48. package/common/rnexecutorch/models/EncoderDecoderBase.h +31 -0
  49. package/common/rnexecutorch/models/classification/Classification.cpp +72 -0
  50. package/common/rnexecutorch/models/classification/Classification.h +26 -0
  51. package/{ios/RnExecutorch/models/classification/Constants.mm → common/rnexecutorch/models/classification/Constants.h} +7 -2
  52. package/common/rnexecutorch/models/embeddings/BaseEmbeddings.cpp +27 -0
  53. package/common/rnexecutorch/models/embeddings/BaseEmbeddings.h +17 -0
  54. package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.cpp +45 -0
  55. package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.h +23 -0
  56. package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.cpp +61 -0
  57. package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.h +26 -0
  58. package/{ios/RnExecutorch/models/image_segmentation/Constants.mm → common/rnexecutorch/models/image_segmentation/Constants.h} +7 -2
  59. package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.cpp +173 -0
  60. package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.h +43 -0
  61. package/{ios/RnExecutorch/utils/Constants.mm → common/rnexecutorch/models/object_detection/Constants.h} +9 -2
  62. package/common/rnexecutorch/models/object_detection/ObjectDetection.cpp +82 -0
  63. package/common/rnexecutorch/models/object_detection/ObjectDetection.h +31 -0
  64. package/{ios/RnExecutorch/utils/ObjectDetectionUtils.mm → common/rnexecutorch/models/object_detection/Utils.cpp} +10 -30
  65. package/common/rnexecutorch/models/object_detection/Utils.h +17 -0
  66. package/common/rnexecutorch/models/ocr/CTCLabelConverter.cpp +88 -0
  67. package/common/rnexecutorch/models/ocr/CTCLabelConverter.h +29 -0
  68. package/common/rnexecutorch/models/ocr/Constants.h +34 -0
  69. package/common/rnexecutorch/models/ocr/Detector.cpp +102 -0
  70. package/common/rnexecutorch/models/ocr/Detector.h +30 -0
  71. package/common/rnexecutorch/models/ocr/DetectorUtils.cpp +703 -0
  72. package/common/rnexecutorch/models/ocr/DetectorUtils.h +80 -0
  73. package/common/rnexecutorch/models/ocr/OCR.cpp +52 -0
  74. package/common/rnexecutorch/models/ocr/OCR.h +36 -0
  75. package/common/rnexecutorch/models/ocr/RecognitionHandler.cpp +107 -0
  76. package/common/rnexecutorch/models/ocr/RecognitionHandler.h +40 -0
  77. package/common/rnexecutorch/models/ocr/RecognitionHandlerUtils.cpp +153 -0
  78. package/common/rnexecutorch/models/ocr/RecognitionHandlerUtils.h +72 -0
  79. package/common/rnexecutorch/models/ocr/Recognizer.cpp +80 -0
  80. package/common/rnexecutorch/models/ocr/Recognizer.h +36 -0
  81. package/common/rnexecutorch/models/ocr/RecognizerUtils.cpp +202 -0
  82. package/common/rnexecutorch/models/ocr/RecognizerUtils.h +70 -0
  83. package/common/rnexecutorch/models/ocr/Types.h +37 -0
  84. package/common/rnexecutorch/models/speech_to_text/SpeechToText.cpp +64 -0
  85. package/common/rnexecutorch/models/speech_to_text/SpeechToText.h +31 -0
  86. package/common/rnexecutorch/models/speech_to_text/SpeechToTextStrategy.h +27 -0
  87. package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.cpp +50 -0
  88. package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.h +25 -0
  89. package/common/rnexecutorch/models/style_transfer/StyleTransfer.cpp +55 -0
  90. package/common/rnexecutorch/models/style_transfer/StyleTransfer.h +29 -0
  91. package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.cpp +92 -0
  92. package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.h +49 -0
  93. package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.cpp +180 -0
  94. package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.h +78 -0
  95. package/common/rnexecutorch/tests/LogTest.cpp +530 -0
  96. package/common/rnexecutorch/tests/README.md +20 -0
  97. package/common/rnexecutorch/tests/run_all_tests.sh +14 -0
  98. package/common/rnexecutorch/tests/run_test.sh +18 -0
  99. package/ios/ExecutorchLib.xcframework/Info.plist +4 -4
  100. package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/ExecutorchLib +0 -0
  101. package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Info.plist +0 -0
  102. package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/ExecutorchLib +0 -0
  103. package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Info.plist +0 -0
  104. package/ios/RnExecutorch/ETInstaller.h +8 -0
  105. package/ios/RnExecutorch/ETInstaller.mm +56 -0
  106. package/ios/RnExecutorch/utils/Conversions.h +8 -9
  107. package/ios/RnExecutorch/utils/Numerical.h +2 -0
  108. package/ios/RnExecutorch.xcodeproj/project.pbxproj +73 -0
  109. package/lib/module/Error.js +8 -6
  110. package/lib/module/Error.js.map +1 -1
  111. package/lib/module/common/Logger.js +23 -0
  112. package/lib/module/common/Logger.js.map +1 -0
  113. package/lib/module/constants/llmDefaults.js +8 -0
  114. package/lib/module/constants/llmDefaults.js.map +1 -1
  115. package/lib/module/constants/modelUrls.js +328 -84
  116. package/lib/module/constants/modelUrls.js.map +1 -1
  117. package/lib/module/constants/ocr/models.js +181 -286
  118. package/lib/module/constants/ocr/models.js.map +1 -1
  119. package/lib/module/constants/ocr/symbols.js +63 -63
  120. package/lib/module/controllers/LLMController.js +17 -11
  121. package/lib/module/controllers/LLMController.js.map +1 -1
  122. package/lib/module/controllers/OCRController.js +16 -9
  123. package/lib/module/controllers/OCRController.js.map +1 -1
  124. package/lib/module/controllers/VerticalOCRController.js +16 -9
  125. package/lib/module/controllers/VerticalOCRController.js.map +1 -1
  126. package/lib/module/hooks/computer_vision/useClassification.js +5 -5
  127. package/lib/module/hooks/computer_vision/useClassification.js.map +1 -1
  128. package/lib/module/hooks/computer_vision/useImageEmbeddings.js +13 -0
  129. package/lib/module/hooks/computer_vision/useImageEmbeddings.js.map +1 -0
  130. package/lib/module/hooks/computer_vision/useImageSegmentation.js +4 -4
  131. package/lib/module/hooks/computer_vision/useImageSegmentation.js.map +1 -1
  132. package/lib/module/hooks/computer_vision/useOCR.js +14 -15
  133. package/lib/module/hooks/computer_vision/useOCR.js.map +1 -1
  134. package/lib/module/hooks/computer_vision/useObjectDetection.js +5 -5
  135. package/lib/module/hooks/computer_vision/useObjectDetection.js.map +1 -1
  136. package/lib/module/hooks/computer_vision/useStyleTransfer.js +5 -5
  137. package/lib/module/hooks/computer_vision/useStyleTransfer.js.map +1 -1
  138. package/lib/module/hooks/computer_vision/useVerticalOCR.js +16 -17
  139. package/lib/module/hooks/computer_vision/useVerticalOCR.js.map +1 -1
  140. package/lib/module/hooks/general/useExecutorchModule.js +5 -3
  141. package/lib/module/hooks/general/useExecutorchModule.js.map +1 -1
  142. package/lib/module/hooks/natural_language_processing/useLLM.js +22 -25
  143. package/lib/module/hooks/natural_language_processing/useLLM.js.map +1 -1
  144. package/lib/module/hooks/natural_language_processing/useSpeechToText.js +72 -33
  145. package/lib/module/hooks/natural_language_processing/useSpeechToText.js.map +1 -1
  146. package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js +4 -5
  147. package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js.map +1 -1
  148. package/lib/module/hooks/natural_language_processing/useTokenizer.js +20 -19
  149. package/lib/module/hooks/natural_language_processing/useTokenizer.js.map +1 -1
  150. package/lib/module/hooks/useNonStaticModule.js +52 -0
  151. package/lib/module/hooks/useNonStaticModule.js.map +1 -0
  152. package/lib/module/index.js +15 -4
  153. package/lib/module/index.js.map +1 -1
  154. package/lib/module/modules/BaseModule.js +6 -3
  155. package/lib/module/modules/BaseModule.js.map +1 -1
  156. package/lib/module/modules/BaseNonStaticModule.js +17 -0
  157. package/lib/module/modules/BaseNonStaticModule.js.map +1 -0
  158. package/lib/module/modules/computer_vision/ClassificationModule.js +13 -8
  159. package/lib/module/modules/computer_vision/ClassificationModule.js.map +1 -1
  160. package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js +19 -0
  161. package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js.map +1 -0
  162. package/lib/module/modules/computer_vision/ImageSegmentationModule.js +21 -19
  163. package/lib/module/modules/computer_vision/ImageSegmentationModule.js.map +1 -1
  164. package/lib/module/modules/computer_vision/OCRModule.js +13 -10
  165. package/lib/module/modules/computer_vision/OCRModule.js.map +1 -1
  166. package/lib/module/modules/computer_vision/ObjectDetectionModule.js +13 -8
  167. package/lib/module/modules/computer_vision/ObjectDetectionModule.js.map +1 -1
  168. package/lib/module/modules/computer_vision/StyleTransferModule.js +13 -8
  169. package/lib/module/modules/computer_vision/StyleTransferModule.js.map +1 -1
  170. package/lib/module/modules/computer_vision/VerticalOCRModule.js +15 -10
  171. package/lib/module/modules/computer_vision/VerticalOCRModule.js.map +1 -1
  172. package/lib/module/modules/general/ExecutorchModule.js +10 -36
  173. package/lib/module/modules/general/ExecutorchModule.js.map +1 -1
  174. package/lib/module/modules/natural_language_processing/LLMModule.js +18 -22
  175. package/lib/module/modules/natural_language_processing/LLMModule.js.map +1 -1
  176. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +79 -27
  177. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
  178. package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js +15 -8
  179. package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js.map +1 -1
  180. package/lib/module/modules/natural_language_processing/TokenizerModule.js +20 -14
  181. package/lib/module/modules/natural_language_processing/TokenizerModule.js.map +1 -1
  182. package/lib/module/native/NativeETInstaller.js +5 -0
  183. package/lib/module/native/NativeETInstaller.js.map +1 -0
  184. package/lib/module/native/RnExecutorchModules.js +2 -11
  185. package/lib/module/native/RnExecutorchModules.js.map +1 -1
  186. package/lib/module/types/common.js +25 -8
  187. package/lib/module/types/common.js.map +1 -1
  188. package/lib/module/types/stt.js +1 -79
  189. package/lib/module/types/stt.js.map +1 -1
  190. package/lib/module/utils/ResourceFetcher.js +276 -114
  191. package/lib/module/utils/ResourceFetcher.js.map +1 -1
  192. package/lib/module/utils/ResourceFetcherUtils.js +155 -0
  193. package/lib/module/utils/ResourceFetcherUtils.js.map +1 -0
  194. package/lib/module/utils/SpeechToTextModule/ASR.js +191 -0
  195. package/lib/module/utils/SpeechToTextModule/ASR.js.map +1 -0
  196. package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js +73 -0
  197. package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js.map +1 -0
  198. package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js +56 -0
  199. package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js.map +1 -0
  200. package/lib/module/utils/llm.js +41 -1
  201. package/lib/module/utils/llm.js.map +1 -1
  202. package/lib/typescript/Error.d.ts +2 -0
  203. package/lib/typescript/Error.d.ts.map +1 -1
  204. package/lib/typescript/common/Logger.d.ts +9 -0
  205. package/lib/typescript/common/Logger.d.ts.map +1 -0
  206. package/lib/typescript/constants/llmDefaults.d.ts +1 -0
  207. package/lib/typescript/constants/llmDefaults.d.ts.map +1 -1
  208. package/lib/typescript/constants/modelUrls.d.ts +240 -79
  209. package/lib/typescript/constants/modelUrls.d.ts.map +1 -1
  210. package/lib/typescript/constants/ocr/models.d.ts +882 -284
  211. package/lib/typescript/constants/ocr/models.d.ts.map +1 -1
  212. package/lib/typescript/controllers/LLMController.d.ts +3 -4
  213. package/lib/typescript/controllers/LLMController.d.ts.map +1 -1
  214. package/lib/typescript/controllers/OCRController.d.ts +5 -6
  215. package/lib/typescript/controllers/OCRController.d.ts.map +1 -1
  216. package/lib/typescript/controllers/VerticalOCRController.d.ts +5 -6
  217. package/lib/typescript/controllers/VerticalOCRController.d.ts.map +1 -1
  218. package/lib/typescript/hooks/computer_vision/useClassification.d.ts +8 -6
  219. package/lib/typescript/hooks/computer_vision/useClassification.d.ts.map +1 -1
  220. package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts +16 -0
  221. package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts.map +1 -0
  222. package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts +5 -3
  223. package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts.map +1 -1
  224. package/lib/typescript/hooks/computer_vision/useOCR.d.ts +4 -4
  225. package/lib/typescript/hooks/computer_vision/useOCR.d.ts.map +1 -1
  226. package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts +5 -3
  227. package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts.map +1 -1
  228. package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts +5 -3
  229. package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts.map +1 -1
  230. package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts +3 -5
  231. package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts.map +1 -1
  232. package/lib/typescript/hooks/general/useExecutorchModule.d.ts +1 -1
  233. package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts +6 -4
  234. package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts.map +1 -1
  235. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +15 -22
  236. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts.map +1 -1
  237. package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts +9 -5
  238. package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts.map +1 -1
  239. package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts +6 -4
  240. package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts.map +1 -1
  241. package/lib/typescript/hooks/useNonStaticModule.d.ts +21 -0
  242. package/lib/typescript/hooks/useNonStaticModule.d.ts.map +1 -0
  243. package/lib/typescript/index.d.ts +17 -4
  244. package/lib/typescript/index.d.ts.map +1 -1
  245. package/lib/typescript/modules/BaseModule.d.ts +1 -1
  246. package/lib/typescript/modules/BaseModule.d.ts.map +1 -1
  247. package/lib/typescript/modules/BaseNonStaticModule.d.ts +10 -0
  248. package/lib/typescript/modules/BaseNonStaticModule.d.ts.map +1 -0
  249. package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts +6 -6
  250. package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts.map +1 -1
  251. package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts +9 -0
  252. package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts.map +1 -0
  253. package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts +8 -28
  254. package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts.map +1 -1
  255. package/lib/typescript/modules/computer_vision/OCRModule.d.ts +8 -7
  256. package/lib/typescript/modules/computer_vision/OCRModule.d.ts.map +1 -1
  257. package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts +7 -5
  258. package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts.map +1 -1
  259. package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts +6 -5
  260. package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts.map +1 -1
  261. package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts +7 -8
  262. package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts.map +1 -1
  263. package/lib/typescript/modules/general/ExecutorchModule.d.ts +5 -8
  264. package/lib/typescript/modules/general/ExecutorchModule.d.ts.map +1 -1
  265. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts +16 -16
  266. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts.map +1 -1
  267. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +20 -13
  268. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
  269. package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts +7 -5
  270. package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts.map +1 -1
  271. package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts +10 -9
  272. package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts.map +1 -1
  273. package/lib/typescript/native/{NativeStyleTransfer.d.ts → NativeETInstaller.d.ts} +2 -3
  274. package/lib/typescript/native/NativeETInstaller.d.ts.map +1 -0
  275. package/lib/typescript/native/RnExecutorchModules.d.ts +3 -21
  276. package/lib/typescript/native/RnExecutorchModules.d.ts.map +1 -1
  277. package/lib/typescript/types/common.d.ts +30 -2
  278. package/lib/typescript/types/common.d.ts.map +1 -1
  279. package/lib/typescript/types/stt.d.ts +18 -88
  280. package/lib/typescript/types/stt.d.ts.map +1 -1
  281. package/lib/typescript/utils/ResourceFetcher.d.ts +18 -10
  282. package/lib/typescript/utils/ResourceFetcher.d.ts.map +1 -1
  283. package/lib/typescript/utils/ResourceFetcherUtils.d.ts +55 -0
  284. package/lib/typescript/utils/ResourceFetcherUtils.d.ts.map +1 -0
  285. package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts +27 -0
  286. package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts.map +1 -0
  287. package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts +23 -0
  288. package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts.map +1 -0
  289. package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts +13 -0
  290. package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts.map +1 -0
  291. package/lib/typescript/utils/llm.d.ts +4 -0
  292. package/lib/typescript/utils/llm.d.ts.map +1 -1
  293. package/package.json +23 -65
  294. package/react-native-executorch.podspec +75 -3
  295. package/src/Error.ts +8 -10
  296. package/src/common/Logger.ts +25 -0
  297. package/src/constants/llmDefaults.ts +11 -0
  298. package/src/constants/modelUrls.ts +401 -168
  299. package/src/constants/ocr/models.ts +826 -395
  300. package/src/constants/ocr/symbols.ts +63 -63
  301. package/src/controllers/LLMController.ts +28 -18
  302. package/src/controllers/OCRController.ts +24 -15
  303. package/src/controllers/VerticalOCRController.ts +24 -14
  304. package/src/hooks/computer_vision/useClassification.ts +10 -11
  305. package/src/hooks/computer_vision/useImageEmbeddings.ts +15 -0
  306. package/src/hooks/computer_vision/useImageSegmentation.ts +5 -8
  307. package/src/hooks/computer_vision/useOCR.ts +29 -21
  308. package/src/hooks/computer_vision/useObjectDetection.ts +6 -9
  309. package/src/hooks/computer_vision/useStyleTransfer.ts +6 -6
  310. package/src/hooks/computer_vision/useVerticalOCR.ts +30 -27
  311. package/src/hooks/general/useExecutorchModule.ts +3 -3
  312. package/src/hooks/natural_language_processing/useLLM.ts +38 -28
  313. package/src/hooks/natural_language_processing/useSpeechToText.ts +91 -88
  314. package/src/hooks/natural_language_processing/useTextEmbeddings.ts +11 -11
  315. package/src/hooks/natural_language_processing/useTokenizer.ts +22 -22
  316. package/src/hooks/useNonStaticModule.ts +74 -0
  317. package/src/index.ts +100 -0
  318. package/src/modules/BaseModule.ts +9 -3
  319. package/src/modules/BaseNonStaticModule.ts +26 -0
  320. package/src/modules/computer_vision/ClassificationModule.ts +20 -11
  321. package/src/modules/computer_vision/ImageEmbeddingsModule.ts +26 -0
  322. package/src/modules/computer_vision/ImageSegmentationModule.ts +35 -27
  323. package/src/modules/computer_vision/OCRModule.ts +23 -15
  324. package/src/modules/computer_vision/ObjectDetectionModule.ts +24 -11
  325. package/src/modules/computer_vision/StyleTransferModule.ts +20 -11
  326. package/src/modules/computer_vision/VerticalOCRModule.ts +25 -21
  327. package/src/modules/general/ExecutorchModule.ts +18 -48
  328. package/src/modules/natural_language_processing/LLMModule.ts +27 -30
  329. package/src/modules/natural_language_processing/SpeechToTextModule.ts +85 -68
  330. package/src/modules/natural_language_processing/TextEmbeddingsModule.ts +27 -12
  331. package/src/modules/natural_language_processing/TokenizerModule.ts +27 -17
  332. package/src/native/NativeETInstaller.ts +8 -0
  333. package/src/native/RnExecutorchModules.ts +4 -46
  334. package/src/types/common.ts +40 -12
  335. package/src/types/stt.ts +98 -89
  336. package/src/utils/ResourceFetcher.ts +338 -119
  337. package/src/utils/ResourceFetcherUtils.ts +186 -0
  338. package/src/utils/SpeechToTextModule/ASR.ts +303 -0
  339. package/src/utils/SpeechToTextModule/OnlineProcessor.ts +87 -0
  340. package/src/utils/SpeechToTextModule/hypothesisBuffer.ts +79 -0
  341. package/src/utils/llm.ts +65 -1
  342. package/third-party/android/libs/executorch/arm64-v8a/libexecutorch.so +0 -0
  343. package/third-party/android/libs/executorch/x86_64/libexecutorch.so +0 -0
  344. package/third-party/android/libs/opencv/arm64-v8a/libopencv_core.a +0 -0
  345. package/third-party/android/libs/opencv/arm64-v8a/libopencv_features2d.a +0 -0
  346. package/third-party/android/libs/opencv/arm64-v8a/libopencv_highgui.a +0 -0
  347. package/third-party/android/libs/opencv/arm64-v8a/libopencv_imgproc.a +0 -0
  348. package/third-party/android/libs/opencv/arm64-v8a/libopencv_photo.a +0 -0
  349. package/third-party/android/libs/opencv/arm64-v8a/libopencv_video.a +0 -0
  350. package/third-party/android/libs/opencv/x86_64/libopencv_core.a +0 -0
  351. package/third-party/android/libs/opencv/x86_64/libopencv_features2d.a +0 -0
  352. package/third-party/android/libs/opencv/x86_64/libopencv_highgui.a +0 -0
  353. package/third-party/android/libs/opencv/x86_64/libopencv_imgproc.a +0 -0
  354. package/third-party/android/libs/opencv/x86_64/libopencv_photo.a +0 -0
  355. package/third-party/android/libs/opencv/x86_64/libopencv_video.a +0 -0
  356. package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv.a +0 -0
  357. package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv_hal.a +0 -0
  358. package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv_thread.a +0 -0
  359. package/third-party/include/c10/macros/Export.h +163 -0
  360. package/third-party/include/c10/macros/Macros.h +497 -0
  361. package/third-party/include/c10/util/BFloat16-inl.h +342 -0
  362. package/third-party/include/c10/util/BFloat16-math.h +266 -0
  363. package/third-party/include/c10/util/BFloat16.h +125 -0
  364. package/third-party/include/c10/util/Half-inl.h +347 -0
  365. package/third-party/include/c10/util/Half.h +416 -0
  366. package/third-party/include/c10/util/TypeSafeSignMath.h +133 -0
  367. package/third-party/include/c10/util/bit_cast.h +43 -0
  368. package/third-party/include/c10/util/floating_point_utils.h +33 -0
  369. package/third-party/include/c10/util/irange.h +107 -0
  370. package/third-party/include/executorch/ExecuTorch.h +13 -0
  371. package/third-party/include/executorch/ExecuTorchError.h +16 -0
  372. package/third-party/include/executorch/ExecuTorchLog.h +76 -0
  373. package/third-party/include/executorch/ExecuTorchModule.h +286 -0
  374. package/third-party/include/executorch/ExecuTorchTensor.h +742 -0
  375. package/third-party/include/executorch/ExecuTorchValue.h +219 -0
  376. package/third-party/include/executorch/extension/module/module.h +492 -0
  377. package/third-party/include/executorch/extension/tensor/tensor.h +13 -0
  378. package/third-party/include/executorch/extension/tensor/tensor_accessor.h +190 -0
  379. package/third-party/include/executorch/extension/tensor/tensor_ptr.h +347 -0
  380. package/third-party/include/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
  381. package/third-party/include/executorch/runtime/backend/backend_execution_context.h +71 -0
  382. package/third-party/include/executorch/runtime/backend/backend_init_context.h +72 -0
  383. package/third-party/include/executorch/runtime/backend/interface.h +166 -0
  384. package/third-party/include/executorch/runtime/core/array_ref.h +235 -0
  385. package/third-party/include/executorch/runtime/core/data_loader.h +136 -0
  386. package/third-party/include/executorch/runtime/core/defines.h +20 -0
  387. package/third-party/include/executorch/runtime/core/error.h +229 -0
  388. package/third-party/include/executorch/runtime/core/evalue.h +521 -0
  389. package/third-party/include/executorch/runtime/core/event_tracer.h +565 -0
  390. package/third-party/include/executorch/runtime/core/event_tracer_hooks.h +323 -0
  391. package/third-party/include/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
  392. package/third-party/include/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
  393. package/third-party/include/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
  394. package/third-party/include/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
  395. package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
  396. package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
  397. package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
  398. package/third-party/include/executorch/runtime/core/freeable_buffer.h +107 -0
  399. package/third-party/include/executorch/runtime/core/hierarchical_allocator.h +107 -0
  400. package/third-party/include/executorch/runtime/core/memory_allocator.h +198 -0
  401. package/third-party/include/executorch/runtime/core/named_data_map.h +86 -0
  402. package/third-party/include/executorch/runtime/core/portable_type/bfloat16.h +27 -0
  403. package/third-party/include/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
  404. package/third-party/include/executorch/runtime/core/portable_type/bits_types.h +83 -0
  405. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
  406. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
  407. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
  408. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
  409. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
  410. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
  411. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
  412. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
  413. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
  414. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
  415. package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
  416. package/third-party/include/executorch/runtime/core/portable_type/complex.h +44 -0
  417. package/third-party/include/executorch/runtime/core/portable_type/device.h +70 -0
  418. package/third-party/include/executorch/runtime/core/portable_type/half.h +27 -0
  419. package/third-party/include/executorch/runtime/core/portable_type/optional.h +36 -0
  420. package/third-party/include/executorch/runtime/core/portable_type/qint_types.h +83 -0
  421. package/third-party/include/executorch/runtime/core/portable_type/scalar.h +110 -0
  422. package/third-party/include/executorch/runtime/core/portable_type/scalar_type.h +154 -0
  423. package/third-party/include/executorch/runtime/core/portable_type/string_view.h +29 -0
  424. package/third-party/include/executorch/runtime/core/portable_type/tensor.h +142 -0
  425. package/third-party/include/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
  426. package/third-party/include/executorch/runtime/core/portable_type/tensor_options.h +60 -0
  427. package/third-party/include/executorch/runtime/core/result.h +258 -0
  428. package/third-party/include/executorch/runtime/core/span.h +93 -0
  429. package/third-party/include/executorch/runtime/core/tag.h +71 -0
  430. package/third-party/include/executorch/runtime/core/tensor_layout.h +79 -0
  431. package/third-party/include/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
  432. package/third-party/include/executorch/runtime/executor/memory_manager.h +113 -0
  433. package/third-party/include/executorch/runtime/executor/method.h +387 -0
  434. package/third-party/include/executorch/runtime/executor/method_meta.h +251 -0
  435. package/third-party/include/executorch/runtime/executor/program.h +320 -0
  436. package/third-party/include/executorch/runtime/executor/pte_data_map.h +144 -0
  437. package/third-party/include/executorch/runtime/executor/tensor_parser.h +156 -0
  438. package/third-party/include/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
  439. package/third-party/include/executorch/runtime/kernel/operator_registry.h +278 -0
  440. package/third-party/include/executorch/runtime/platform/abort.h +36 -0
  441. package/third-party/include/executorch/runtime/platform/assert.h +119 -0
  442. package/third-party/include/executorch/runtime/platform/clock.h +43 -0
  443. package/third-party/include/executorch/runtime/platform/compat_unistd.h +75 -0
  444. package/third-party/include/executorch/runtime/platform/compiler.h +191 -0
  445. package/third-party/include/executorch/runtime/platform/log.h +177 -0
  446. package/third-party/include/executorch/runtime/platform/platform.h +133 -0
  447. package/third-party/include/executorch/runtime/platform/profiler.h +292 -0
  448. package/third-party/include/executorch/runtime/platform/runtime.h +35 -0
  449. package/third-party/include/executorch/runtime/platform/system.h +49 -0
  450. package/third-party/include/executorch/runtime/platform/types.h +24 -0
  451. package/third-party/include/executorch/schema/extended_header.h +76 -0
  452. package/third-party/include/opencv2/core/affine.hpp +676 -0
  453. package/third-party/include/opencv2/core/async.hpp +107 -0
  454. package/third-party/include/opencv2/core/base.hpp +735 -0
  455. package/third-party/include/opencv2/core/bindings_utils.hpp +279 -0
  456. package/third-party/include/opencv2/core/bufferpool.hpp +39 -0
  457. package/third-party/include/opencv2/core/check.hpp +231 -0
  458. package/third-party/include/opencv2/core/core.hpp +55 -0
  459. package/third-party/include/opencv2/core/core_c.h +3261 -0
  460. package/third-party/include/opencv2/core/cv_cpu_dispatch.h +404 -0
  461. package/third-party/include/opencv2/core/cv_cpu_helper.h +856 -0
  462. package/third-party/include/opencv2/core/cvdef.h +1003 -0
  463. package/third-party/include/opencv2/core/cvstd.hpp +196 -0
  464. package/third-party/include/opencv2/core/cvstd.inl.hpp +188 -0
  465. package/third-party/include/opencv2/core/cvstd_wrapper.hpp +187 -0
  466. package/third-party/include/opencv2/core/detail/async_promise.hpp +73 -0
  467. package/third-party/include/opencv2/core/detail/dispatch_helper.impl.hpp +48 -0
  468. package/third-party/include/opencv2/core/detail/exception_ptr.hpp +24 -0
  469. package/third-party/include/opencv2/core/dualquaternion.hpp +1054 -0
  470. package/third-party/include/opencv2/core/dualquaternion.inl.hpp +464 -0
  471. package/third-party/include/opencv2/core/eigen.hpp +405 -0
  472. package/third-party/include/opencv2/core/fast_math.hpp +433 -0
  473. package/third-party/include/opencv2/core/hal/hal.hpp +451 -0
  474. package/third-party/include/opencv2/core/hal/interface.h +191 -0
  475. package/third-party/include/opencv2/core/hal/intrin.hpp +1222 -0
  476. package/third-party/include/opencv2/core/hal/intrin_avx.hpp +3378 -0
  477. package/third-party/include/opencv2/core/hal/intrin_avx512.hpp +3688 -0
  478. package/third-party/include/opencv2/core/hal/intrin_cpp.hpp +3446 -0
  479. package/third-party/include/opencv2/core/hal/intrin_forward.hpp +195 -0
  480. package/third-party/include/opencv2/core/hal/intrin_lasx.hpp +3243 -0
  481. package/third-party/include/opencv2/core/hal/intrin_lsx.hpp +2671 -0
  482. package/third-party/include/opencv2/core/hal/intrin_math.hpp +772 -0
  483. package/third-party/include/opencv2/core/hal/intrin_msa.hpp +1973 -0
  484. package/third-party/include/opencv2/core/hal/intrin_neon.hpp +2710 -0
  485. package/third-party/include/opencv2/core/hal/intrin_rvv071.hpp +3452 -0
  486. package/third-party/include/opencv2/core/hal/intrin_rvv_scalable.hpp +2559 -0
  487. package/third-party/include/opencv2/core/hal/intrin_sse.hpp +3528 -0
  488. package/third-party/include/opencv2/core/hal/intrin_sse_em.hpp +175 -0
  489. package/third-party/include/opencv2/core/hal/intrin_vsx.hpp +1756 -0
  490. package/third-party/include/opencv2/core/hal/intrin_wasm.hpp +2911 -0
  491. package/third-party/include/opencv2/core/hal/msa_macros.h +2079 -0
  492. package/third-party/include/opencv2/core/hal/simd_utils.impl.hpp +313 -0
  493. package/third-party/include/opencv2/core/mat.hpp +3842 -0
  494. package/third-party/include/opencv2/core/mat.inl.hpp +2753 -0
  495. package/third-party/include/opencv2/core/matx.hpp +603 -0
  496. package/third-party/include/opencv2/core/matx.inl.hpp +1132 -0
  497. package/third-party/include/opencv2/core/neon_utils.hpp +127 -0
  498. package/third-party/include/opencv2/core/operations.hpp +610 -0
  499. package/third-party/include/opencv2/core/optim.hpp +362 -0
  500. package/third-party/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +66 -0
  501. package/third-party/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +148 -0
  502. package/third-party/include/opencv2/core/parallel/parallel_backend.hpp +108 -0
  503. package/third-party/include/opencv2/core/persistence.hpp +1321 -0
  504. package/third-party/include/opencv2/core/quaternion.hpp +1889 -0
  505. package/third-party/include/opencv2/core/quaternion.inl.hpp +907 -0
  506. package/third-party/include/opencv2/core/saturate.hpp +347 -0
  507. package/third-party/include/opencv2/core/simd_intrinsics.hpp +90 -0
  508. package/third-party/include/opencv2/core/softfloat.hpp +657 -0
  509. package/third-party/include/opencv2/core/sse_utils.hpp +861 -0
  510. package/third-party/include/opencv2/core/traits.hpp +417 -0
  511. package/third-party/include/opencv2/core/types.hpp +2368 -0
  512. package/third-party/include/opencv2/core/types_c.h +2064 -0
  513. package/third-party/include/opencv2/core/utility.hpp +1296 -0
  514. package/third-party/include/opencv2/core/utils/allocator_stats.hpp +31 -0
  515. package/third-party/include/opencv2/core/utils/allocator_stats.impl.hpp +111 -0
  516. package/third-party/include/opencv2/core/utils/filesystem.hpp +91 -0
  517. package/third-party/include/opencv2/core/utils/fp_control_utils.hpp +70 -0
  518. package/third-party/include/opencv2/core/utils/instrumentation.hpp +127 -0
  519. package/third-party/include/opencv2/core/utils/logger.defines.hpp +50 -0
  520. package/third-party/include/opencv2/core/utils/logger.hpp +258 -0
  521. package/third-party/include/opencv2/core/utils/logtag.hpp +27 -0
  522. package/third-party/include/opencv2/core/utils/tls.hpp +230 -0
  523. package/third-party/include/opencv2/core/utils/trace.hpp +281 -0
  524. package/third-party/include/opencv2/core/version.hpp +29 -0
  525. package/third-party/include/opencv2/core/vsx_utils.hpp +1115 -0
  526. package/third-party/include/opencv2/core.hpp +3699 -0
  527. package/third-party/include/opencv2/cvconfig.h +155 -0
  528. package/third-party/include/opencv2/dnn/dnn.hpp +51 -0
  529. package/third-party/include/opencv2/dnn.hpp +17 -0
  530. package/third-party/include/opencv2/features2d/features2d.hpp +55 -0
  531. package/third-party/include/opencv2/features2d/hal/interface.h +32 -0
  532. package/third-party/include/opencv2/features2d.hpp +1756 -0
  533. package/third-party/include/opencv2/highgui/highgui.hpp +113 -0
  534. package/third-party/include/opencv2/highgui.hpp +17 -0
  535. package/third-party/include/opencv2/imgproc/bindings.hpp +34 -0
  536. package/third-party/include/opencv2/imgproc/detail/gcgraph.hpp +355 -0
  537. package/third-party/include/opencv2/imgproc/detail/legacy.hpp +35 -0
  538. package/third-party/include/opencv2/imgproc/hal/hal.hpp +246 -0
  539. package/third-party/include/opencv2/imgproc/hal/interface.h +52 -0
  540. package/third-party/include/opencv2/imgproc/imgproc.hpp +55 -0
  541. package/third-party/include/opencv2/imgproc/imgproc_c.h +1261 -0
  542. package/third-party/include/opencv2/imgproc/segmentation.hpp +168 -0
  543. package/third-party/include/opencv2/imgproc/types_c.h +632 -0
  544. package/third-party/include/opencv2/imgproc.hpp +5956 -0
  545. package/third-party/include/opencv2/opencv.hpp +102 -0
  546. package/third-party/include/opencv2/opencv_modules.hpp +19 -0
  547. package/third-party/include/opencv2/photo/legacy/constants_c.h +10 -0
  548. package/third-party/include/opencv2/photo/photo.hpp +55 -0
  549. package/third-party/include/opencv2/photo.hpp +975 -0
  550. package/third-party/include/opencv2/video/background_segm.hpp +341 -0
  551. package/third-party/include/opencv2/video/detail/tracking.detail.hpp +435 -0
  552. package/third-party/include/opencv2/video/legacy/constants_c.h +15 -0
  553. package/third-party/include/opencv2/video/tracking.hpp +1014 -0
  554. package/third-party/include/opencv2/video/video.hpp +55 -0
  555. package/third-party/include/opencv2/video.hpp +65 -0
  556. package/third-party/include/tokenizers-cpp/tokenizers_c.h +61 -0
  557. package/third-party/include/tokenizers-cpp/tokenizers_cpp.h +118 -0
  558. package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.h +27 -0
  559. package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.mm +249 -0
  560. package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.h +14 -0
  561. package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.mm +80 -0
  562. package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.h +32 -0
  563. package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.mm +95 -0
  564. package/third-party/ios/ExecutorchLib/ExecutorchLib/InputType.h +12 -0
  565. package/third-party/ios/ExecutorchLib/ExecutorchLib/Utils.hpp +217 -0
  566. package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.cpp +11 -0
  567. package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.h +11 -0
  568. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/irunner.h +48 -0
  569. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/runner.cpp +278 -0
  570. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/runner.h +67 -0
  571. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/stats.h +164 -0
  572. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_decoder_runner.cpp +65 -0
  573. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_decoder_runner.h +105 -0
  574. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_prefiller.cpp +91 -0
  575. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_prefiller.h +51 -0
  576. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_token_generator.h +162 -0
  577. package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/util.h +108 -0
  578. package/third-party/ios/ExecutorchLib/ExecutorchLib/sampler/sampler.cpp +193 -0
  579. package/third-party/ios/ExecutorchLib/ExecutorchLib/sampler/sampler.h +64 -0
  580. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/base64.h +202 -0
  581. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.cpp +313 -0
  582. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.h +57 -0
  583. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.cpp +78 -0
  584. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.h +23 -0
  585. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.cpp +427 -0
  586. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.h +87 -0
  587. package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tokenizer.h +76 -0
  588. package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.pbxproj +683 -0
  589. package/third-party/ios/ExecutorchLib/build.sh +44 -0
  590. package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/Info.plist +43 -0
  591. package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64/libbackend_coreml_ios.a +0 -0
  592. package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64-simulator/libbackend_coreml_simulator.a +0 -0
  593. package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/Info.plist +43 -0
  594. package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64/libbackend_mps_ios.a +0 -0
  595. package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64-simulator/libbackend_mps_simulator.a +0 -0
  596. package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/Info.plist +43 -0
  597. package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64/libbackend_xnnpack_ios.a +0 -0
  598. package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64-simulator/libbackend_xnnpack_simulator.a +0 -0
  599. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/Info.plist +47 -0
  600. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Export.h +163 -0
  601. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Macros.h +497 -0
  602. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-inl.h +342 -0
  603. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-math.h +266 -0
  604. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16.h +125 -0
  605. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half-inl.h +347 -0
  606. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half.h +416 -0
  607. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/TypeSafeSignMath.h +133 -0
  608. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/bit_cast.h +43 -0
  609. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/floating_point_utils.h +33 -0
  610. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/irange.h +107 -0
  611. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorch.h +13 -0
  612. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchError.h +16 -0
  613. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchLog.h +76 -0
  614. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchModule.h +286 -0
  615. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchTensor.h +742 -0
  616. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchValue.h +219 -0
  617. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/module/module.h +492 -0
  618. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor.h +13 -0
  619. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_accessor.h +190 -0
  620. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr.h +347 -0
  621. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
  622. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_execution_context.h +71 -0
  623. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_init_context.h +72 -0
  624. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/interface.h +166 -0
  625. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/array_ref.h +235 -0
  626. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/data_loader.h +136 -0
  627. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/defines.h +20 -0
  628. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/error.h +229 -0
  629. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/evalue.h +521 -0
  630. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer.h +565 -0
  631. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks.h +323 -0
  632. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
  633. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
  634. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
  635. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
  636. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
  637. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
  638. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
  639. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/freeable_buffer.h +107 -0
  640. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/hierarchical_allocator.h +107 -0
  641. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/memory_allocator.h +198 -0
  642. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/named_data_map.h +86 -0
  643. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16.h +27 -0
  644. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
  645. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bits_types.h +83 -0
  646. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
  647. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
  648. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
  649. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
  650. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
  651. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
  652. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
  653. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
  654. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
  655. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
  656. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
  657. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/complex.h +44 -0
  658. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/device.h +70 -0
  659. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/half.h +27 -0
  660. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/optional.h +36 -0
  661. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/qint_types.h +83 -0
  662. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar.h +110 -0
  663. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar_type.h +154 -0
  664. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/string_view.h +29 -0
  665. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor.h +142 -0
  666. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
  667. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_options.h +60 -0
  668. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/result.h +258 -0
  669. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/span.h +93 -0
  670. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tag.h +71 -0
  671. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_layout.h +79 -0
  672. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
  673. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/memory_manager.h +113 -0
  674. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method.h +387 -0
  675. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method_meta.h +251 -0
  676. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/program.h +320 -0
  677. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/pte_data_map.h +144 -0
  678. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/tensor_parser.h +156 -0
  679. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
  680. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/operator_registry.h +278 -0
  681. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/abort.h +36 -0
  682. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/assert.h +119 -0
  683. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/clock.h +43 -0
  684. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compat_unistd.h +75 -0
  685. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compiler.h +191 -0
  686. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/log.h +177 -0
  687. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/platform.h +133 -0
  688. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/profiler.h +292 -0
  689. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/runtime.h +35 -0
  690. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/system.h +49 -0
  691. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/types.h +24 -0
  692. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/schema/extended_header.h +76 -0
  693. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/module.modulemap +5 -0
  694. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/libexecutorch_ios.a +0 -0
  695. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Export.h +163 -0
  696. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Macros.h +497 -0
  697. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-inl.h +342 -0
  698. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-math.h +266 -0
  699. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16.h +125 -0
  700. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half-inl.h +347 -0
  701. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half.h +416 -0
  702. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/TypeSafeSignMath.h +133 -0
  703. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/bit_cast.h +43 -0
  704. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/floating_point_utils.h +33 -0
  705. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/irange.h +107 -0
  706. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorch.h +13 -0
  707. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchError.h +16 -0
  708. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchLog.h +76 -0
  709. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchModule.h +286 -0
  710. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchTensor.h +742 -0
  711. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchValue.h +219 -0
  712. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/module/module.h +492 -0
  713. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor.h +13 -0
  714. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_accessor.h +190 -0
  715. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr.h +347 -0
  716. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
  717. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_execution_context.h +71 -0
  718. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_init_context.h +72 -0
  719. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/interface.h +166 -0
  720. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/array_ref.h +235 -0
  721. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/data_loader.h +136 -0
  722. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/defines.h +20 -0
  723. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/error.h +229 -0
  724. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/evalue.h +521 -0
  725. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer.h +565 -0
  726. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks.h +323 -0
  727. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
  728. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
  729. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
  730. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
  731. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
  732. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
  733. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
  734. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/freeable_buffer.h +107 -0
  735. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/hierarchical_allocator.h +107 -0
  736. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/memory_allocator.h +198 -0
  737. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/named_data_map.h +86 -0
  738. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16.h +27 -0
  739. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
  740. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bits_types.h +83 -0
  741. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
  742. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
  743. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
  744. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
  745. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
  746. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
  747. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
  748. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
  749. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
  750. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
  751. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
  752. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/complex.h +44 -0
  753. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/device.h +70 -0
  754. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/half.h +27 -0
  755. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/optional.h +36 -0
  756. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/qint_types.h +83 -0
  757. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar.h +110 -0
  758. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar_type.h +154 -0
  759. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/string_view.h +29 -0
  760. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor.h +142 -0
  761. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
  762. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_options.h +60 -0
  763. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/result.h +258 -0
  764. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/span.h +93 -0
  765. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tag.h +71 -0
  766. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_layout.h +79 -0
  767. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
  768. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/memory_manager.h +113 -0
  769. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method.h +387 -0
  770. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method_meta.h +251 -0
  771. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/program.h +320 -0
  772. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/pte_data_map.h +144 -0
  773. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/tensor_parser.h +156 -0
  774. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
  775. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/operator_registry.h +278 -0
  776. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/abort.h +36 -0
  777. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/assert.h +119 -0
  778. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/clock.h +43 -0
  779. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compat_unistd.h +75 -0
  780. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compiler.h +191 -0
  781. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/log.h +177 -0
  782. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/platform.h +133 -0
  783. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/profiler.h +292 -0
  784. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/runtime.h +35 -0
  785. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/system.h +49 -0
  786. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/types.h +24 -0
  787. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/schema/extended_header.h +76 -0
  788. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/module.modulemap +5 -0
  789. package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/libexecutorch_simulator.a +0 -0
  790. package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/Info.plist +43 -0
  791. package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64/libkernels_custom_ios.a +0 -0
  792. package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64-simulator/libkernels_custom_simulator.a +0 -0
  793. package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/Info.plist +43 -0
  794. package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64/libkernels_optimized_ios.a +0 -0
  795. package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64-simulator/libkernels_optimized_simulator.a +0 -0
  796. package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/Info.plist +43 -0
  797. package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64/libkernels_portable_ios.a +0 -0
  798. package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64-simulator/libkernels_portable_simulator.a +0 -0
  799. package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/Info.plist +43 -0
  800. package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64/libkernels_quantized_ios.a +0 -0
  801. package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64-simulator/libkernels_quantized_simulator.a +0 -0
  802. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/Info.plist +43 -0
  803. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/bitmap256.h +82 -0
  804. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/filtered_re2.h +111 -0
  805. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/pod_array.h +43 -0
  806. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter.h +130 -0
  807. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter_tree.h +139 -0
  808. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prog.h +483 -0
  809. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/re2.h +994 -0
  810. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/regexp.h +692 -0
  811. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/set.h +85 -0
  812. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_array.h +367 -0
  813. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_set.h +241 -0
  814. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/stringpiece.h +205 -0
  815. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_casefold.h +78 -0
  816. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_groups.h +64 -0
  817. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/walker-inl.h +235 -0
  818. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Info.plist +26 -0
  819. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/re2 +0 -0
  820. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/bitmap256.h +82 -0
  821. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/filtered_re2.h +111 -0
  822. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/pod_array.h +43 -0
  823. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter.h +130 -0
  824. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter_tree.h +139 -0
  825. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prog.h +483 -0
  826. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/re2.h +994 -0
  827. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/regexp.h +692 -0
  828. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/set.h +85 -0
  829. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_array.h +367 -0
  830. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_set.h +241 -0
  831. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/stringpiece.h +205 -0
  832. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_casefold.h +78 -0
  833. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_groups.h +64 -0
  834. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/walker-inl.h +235 -0
  835. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Info.plist +26 -0
  836. package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/re2 +0 -0
  837. package/third-party/ios/ios.toolchain.cmake +1122 -0
  838. package/LICENSE +0 -79
  839. package/README.md +0 -148
  840. package/android/src/main/java/com/swmansion/rnexecutorch/Classification.kt +0 -64
  841. package/android/src/main/java/com/swmansion/rnexecutorch/ETModule.kt +0 -90
  842. package/android/src/main/java/com/swmansion/rnexecutorch/ImageSegmentation.kt +0 -58
  843. package/android/src/main/java/com/swmansion/rnexecutorch/OCR.kt +0 -90
  844. package/android/src/main/java/com/swmansion/rnexecutorch/ObjectDetection.kt +0 -64
  845. package/android/src/main/java/com/swmansion/rnexecutorch/SpeechToText.kt +0 -91
  846. package/android/src/main/java/com/swmansion/rnexecutorch/StyleTransfer.kt +0 -54
  847. package/android/src/main/java/com/swmansion/rnexecutorch/TextEmbeddings.kt +0 -51
  848. package/android/src/main/java/com/swmansion/rnexecutorch/Tokenizer.kt +0 -86
  849. package/android/src/main/java/com/swmansion/rnexecutorch/VerticalOCR.kt +0 -179
  850. package/android/src/main/java/com/swmansion/rnexecutorch/models/BaseModel.kt +0 -54
  851. package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsModel.kt +0 -48
  852. package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsUtils.kt +0 -37
  853. package/android/src/main/java/com/swmansion/rnexecutorch/models/classification/ClassificationModel.kt +0 -46
  854. package/android/src/main/java/com/swmansion/rnexecutorch/models/classification/Constants.kt +0 -1005
  855. package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/Constants.kt +0 -26
  856. package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/ImageSegmentationModel.kt +0 -142
  857. package/android/src/main/java/com/swmansion/rnexecutorch/models/objectDetection/SSDLiteLargeModel.kt +0 -74
  858. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/Detector.kt +0 -82
  859. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/RecognitionHandler.kt +0 -117
  860. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/Recognizer.kt +0 -51
  861. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/VerticalDetector.kt +0 -89
  862. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/CTCLabelConverter.kt +0 -58
  863. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/Constants.kt +0 -31
  864. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/DetectorUtils.kt +0 -608
  865. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/RecognizerUtils.kt +0 -430
  866. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/BaseS2TDecoder.kt +0 -39
  867. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/BaseS2TModule.kt +0 -43
  868. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/Moonshine.kt +0 -16
  869. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/MoonshineDecoder.kt +0 -23
  870. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/MoonshineEncoder.kt +0 -20
  871. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/Whisper.kt +0 -16
  872. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/WhisperDecoder.kt +0 -22
  873. package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/WhisperEncoder.kt +0 -29
  874. package/android/src/main/java/com/swmansion/rnexecutorch/models/styleTransfer/StyleTransferModel.kt +0 -43
  875. package/android/src/main/java/com/swmansion/rnexecutorch/utils/ArrayUtils.kt +0 -87
  876. package/android/src/main/java/com/swmansion/rnexecutorch/utils/ETError.kt +0 -34
  877. package/android/src/main/java/com/swmansion/rnexecutorch/utils/ImageProcessor.kt +0 -237
  878. package/android/src/main/java/com/swmansion/rnexecutorch/utils/Numerical.kt +0 -8
  879. package/android/src/main/java/com/swmansion/rnexecutorch/utils/ObjectDetectionUtils.kt +0 -201
  880. package/android/src/main/java/com/swmansion/rnexecutorch/utils/STFT.kt +0 -50
  881. package/android/src/main/java/com/swmansion/rnexecutorch/utils/TensorUtils.kt +0 -103
  882. package/ios/RnExecutorch/Classification.h +0 -5
  883. package/ios/RnExecutorch/Classification.mm +0 -54
  884. package/ios/RnExecutorch/ETModule.h +0 -5
  885. package/ios/RnExecutorch/ETModule.mm +0 -75
  886. package/ios/RnExecutorch/ImageSegmentation.h +0 -5
  887. package/ios/RnExecutorch/ImageSegmentation.mm +0 -60
  888. package/ios/RnExecutorch/OCR.h +0 -5
  889. package/ios/RnExecutorch/OCR.mm +0 -96
  890. package/ios/RnExecutorch/ObjectDetection.h +0 -5
  891. package/ios/RnExecutorch/ObjectDetection.mm +0 -56
  892. package/ios/RnExecutorch/SpeechToText.h +0 -5
  893. package/ios/RnExecutorch/SpeechToText.mm +0 -125
  894. package/ios/RnExecutorch/StyleTransfer.h +0 -5
  895. package/ios/RnExecutorch/StyleTransfer.mm +0 -55
  896. package/ios/RnExecutorch/TextEmbeddings.h +0 -5
  897. package/ios/RnExecutorch/TextEmbeddings.mm +0 -62
  898. package/ios/RnExecutorch/Tokenizer.h +0 -5
  899. package/ios/RnExecutorch/Tokenizer.mm +0 -83
  900. package/ios/RnExecutorch/VerticalOCR.h +0 -5
  901. package/ios/RnExecutorch/VerticalOCR.mm +0 -183
  902. package/ios/RnExecutorch/models/BaseModel.h +0 -21
  903. package/ios/RnExecutorch/models/BaseModel.mm +0 -43
  904. package/ios/RnExecutorch/models/classification/ClassificationModel.h +0 -10
  905. package/ios/RnExecutorch/models/classification/ClassificationModel.mm +0 -53
  906. package/ios/RnExecutorch/models/classification/Constants.h +0 -3
  907. package/ios/RnExecutorch/models/image_segmentation/Constants.h +0 -4
  908. package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.h +0 -10
  909. package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.mm +0 -146
  910. package/ios/RnExecutorch/models/object_detection/SSDLiteLargeModel.hpp +0 -11
  911. package/ios/RnExecutorch/models/object_detection/SSDLiteLargeModel.mm +0 -64
  912. package/ios/RnExecutorch/models/ocr/Detector.h +0 -9
  913. package/ios/RnExecutorch/models/ocr/Detector.mm +0 -101
  914. package/ios/RnExecutorch/models/ocr/RecognitionHandler.h +0 -16
  915. package/ios/RnExecutorch/models/ocr/RecognitionHandler.mm +0 -135
  916. package/ios/RnExecutorch/models/ocr/Recognizer.h +0 -8
  917. package/ios/RnExecutorch/models/ocr/Recognizer.mm +0 -77
  918. package/ios/RnExecutorch/models/ocr/VerticalDetector.h +0 -10
  919. package/ios/RnExecutorch/models/ocr/VerticalDetector.mm +0 -118
  920. package/ios/RnExecutorch/models/ocr/utils/CTCLabelConverter.h +0 -16
  921. package/ios/RnExecutorch/models/ocr/utils/CTCLabelConverter.mm +0 -80
  922. package/ios/RnExecutorch/models/ocr/utils/Constants.h +0 -26
  923. package/ios/RnExecutorch/models/ocr/utils/DetectorUtils.h +0 -31
  924. package/ios/RnExecutorch/models/ocr/utils/DetectorUtils.mm +0 -754
  925. package/ios/RnExecutorch/models/ocr/utils/OCRUtils.h +0 -10
  926. package/ios/RnExecutorch/models/ocr/utils/OCRUtils.mm +0 -67
  927. package/ios/RnExecutorch/models/ocr/utils/RecognizerUtils.h +0 -35
  928. package/ios/RnExecutorch/models/ocr/utils/RecognizerUtils.mm +0 -331
  929. package/ios/RnExecutorch/models/stt/Moonshine.hpp +0 -13
  930. package/ios/RnExecutorch/models/stt/Moonshine.mm +0 -64
  931. package/ios/RnExecutorch/models/stt/MoonshineDecoder.hpp +0 -16
  932. package/ios/RnExecutorch/models/stt/MoonshineDecoder.mm +0 -24
  933. package/ios/RnExecutorch/models/stt/MoonshineEncoder.hpp +0 -15
  934. package/ios/RnExecutorch/models/stt/MoonshineEncoder.mm +0 -18
  935. package/ios/RnExecutorch/models/stt/SpeechToTextBaseModel.hpp +0 -26
  936. package/ios/RnExecutorch/models/stt/SpeechToTextBaseModel.mm +0 -19
  937. package/ios/RnExecutorch/models/stt/Whisper.hpp +0 -12
  938. package/ios/RnExecutorch/models/stt/Whisper.mm +0 -68
  939. package/ios/RnExecutorch/models/stt/WhisperDecoder.hpp +0 -16
  940. package/ios/RnExecutorch/models/stt/WhisperDecoder.mm +0 -22
  941. package/ios/RnExecutorch/models/stt/WhisperEncoder.hpp +0 -15
  942. package/ios/RnExecutorch/models/stt/WhisperEncoder.mm +0 -21
  943. package/ios/RnExecutorch/models/style_transfer/StyleTransferModel.h +0 -11
  944. package/ios/RnExecutorch/models/style_transfer/StyleTransferModel.mm +0 -50
  945. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.h +0 -15
  946. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.mm +0 -45
  947. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.h +0 -8
  948. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.mm +0 -49
  949. package/ios/RnExecutorch/utils/Constants.h +0 -8
  950. package/ios/RnExecutorch/utils/ObjectDetectionUtils.hpp +0 -23
  951. package/ios/RnExecutorch/utils/SFFT.hpp +0 -13
  952. package/ios/RnExecutorch/utils/SFFT.mm +0 -71
  953. package/lib/module/constants/sttDefaults.js +0 -72
  954. package/lib/module/constants/sttDefaults.js.map +0 -1
  955. package/lib/module/controllers/SpeechToTextController.js +0 -307
  956. package/lib/module/controllers/SpeechToTextController.js.map +0 -1
  957. package/lib/module/native/NativeClassification.js +0 -5
  958. package/lib/module/native/NativeClassification.js.map +0 -1
  959. package/lib/module/native/NativeETModule.js +0 -5
  960. package/lib/module/native/NativeETModule.js.map +0 -1
  961. package/lib/module/native/NativeImageSegmentation.js +0 -5
  962. package/lib/module/native/NativeImageSegmentation.js.map +0 -1
  963. package/lib/module/native/NativeOCR.js +0 -5
  964. package/lib/module/native/NativeOCR.js.map +0 -1
  965. package/lib/module/native/NativeObjectDetection.js +0 -5
  966. package/lib/module/native/NativeObjectDetection.js.map +0 -1
  967. package/lib/module/native/NativeSpeechToText.js +0 -5
  968. package/lib/module/native/NativeSpeechToText.js.map +0 -1
  969. package/lib/module/native/NativeStyleTransfer.js +0 -5
  970. package/lib/module/native/NativeStyleTransfer.js.map +0 -1
  971. package/lib/module/native/NativeTextEmbeddings.js +0 -5
  972. package/lib/module/native/NativeTextEmbeddings.js.map +0 -1
  973. package/lib/module/native/NativeTokenizer.js +0 -5
  974. package/lib/module/native/NativeTokenizer.js.map +0 -1
  975. package/lib/module/native/NativeVerticalOCR.js +0 -5
  976. package/lib/module/native/NativeVerticalOCR.js.map +0 -1
  977. package/lib/module/package.json +0 -1
  978. package/lib/typescript/constants/sttDefaults.d.ts +0 -28
  979. package/lib/typescript/constants/sttDefaults.d.ts.map +0 -1
  980. package/lib/typescript/controllers/SpeechToTextController.d.ts +0 -52
  981. package/lib/typescript/controllers/SpeechToTextController.d.ts.map +0 -1
  982. package/lib/typescript/native/NativeClassification.d.ts +0 -10
  983. package/lib/typescript/native/NativeClassification.d.ts.map +0 -1
  984. package/lib/typescript/native/NativeETModule.d.ts +0 -9
  985. package/lib/typescript/native/NativeETModule.d.ts.map +0 -1
  986. package/lib/typescript/native/NativeImageSegmentation.d.ts +0 -10
  987. package/lib/typescript/native/NativeImageSegmentation.d.ts.map +0 -1
  988. package/lib/typescript/native/NativeOCR.d.ts +0 -9
  989. package/lib/typescript/native/NativeOCR.d.ts.map +0 -1
  990. package/lib/typescript/native/NativeObjectDetection.d.ts +0 -9
  991. package/lib/typescript/native/NativeObjectDetection.d.ts.map +0 -1
  992. package/lib/typescript/native/NativeSpeechToText.d.ts +0 -12
  993. package/lib/typescript/native/NativeSpeechToText.d.ts.map +0 -1
  994. package/lib/typescript/native/NativeStyleTransfer.d.ts.map +0 -1
  995. package/lib/typescript/native/NativeTextEmbeddings.d.ts +0 -8
  996. package/lib/typescript/native/NativeTextEmbeddings.d.ts.map +0 -1
  997. package/lib/typescript/native/NativeTokenizer.d.ts +0 -12
  998. package/lib/typescript/native/NativeTokenizer.d.ts.map +0 -1
  999. package/lib/typescript/native/NativeVerticalOCR.d.ts +0 -9
  1000. package/lib/typescript/native/NativeVerticalOCR.d.ts.map +0 -1
  1001. package/src/constants/sttDefaults.ts +0 -86
  1002. package/src/controllers/SpeechToTextController.ts +0 -458
  1003. package/src/index.tsx +0 -47
  1004. package/src/native/NativeClassification.ts +0 -9
  1005. package/src/native/NativeETModule.ts +0 -14
  1006. package/src/native/NativeImageSegmentation.ts +0 -14
  1007. package/src/native/NativeOCR.ts +0 -16
  1008. package/src/native/NativeObjectDetection.ts +0 -10
  1009. package/src/native/NativeSpeechToText.ts +0 -17
  1010. package/src/native/NativeStyleTransfer.ts +0 -10
  1011. package/src/native/NativeTextEmbeddings.ts +0 -9
  1012. package/src/native/NativeTokenizer.ts +0 -13
  1013. package/src/native/NativeVerticalOCR.ts +0 -16
@@ -0,0 +1,1889 @@
1
+ // This file is part of OpenCV project.
2
+ // It is subject to the license terms in the LICENSE file found in the top-level
3
+ // directory of this distribution and at http://opencv.org/license.html.
4
+ //
5
+ //
6
+ // License Agreement
7
+ // For Open Source Computer Vision Library
8
+ //
9
+ // Copyright (C) 2020, Huawei Technologies Co., Ltd. All rights reserved.
10
+ // Third party copyrights are property of their respective owners.
11
+ //
12
+ // Licensed under the Apache License, Version 2.0 (the "License");
13
+ // you may not use this file except in compliance with the License.
14
+ // You may obtain a copy of the License at
15
+ //
16
+ // http://www.apache.org/licenses/LICENSE-2.0
17
+ //
18
+ // Unless required by applicable law or agreed to in writing, software
19
+ // distributed under the License is distributed on an "AS IS" BASIS,
20
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ // See the License for the specific language governing permissions and
22
+ // limitations under the License.
23
+ //
24
+ // Author: Liangqian Kong <chargerKong@126.com>
25
+ // Longbu Wang <riskiest@gmail.com>
26
+ #ifndef OPENCV_CORE_QUATERNION_HPP
27
+ #define OPENCV_CORE_QUATERNION_HPP
28
+
29
+ #include <iostream>
30
+ #include <opencv2/core.hpp>
31
+ #include <opencv2/core/utils/logger.hpp>
32
+ namespace cv {
33
+ //! @addtogroup core_quaternion
34
+ //! @{
35
+
36
+ //! Unit quaternion flag
37
+ enum QuatAssumeType {
38
+ /**
39
+ * This flag is specified by default.
40
+ * If this flag is specified, the input quaternions are assumed to be not unit
41
+ * quaternions. It can guarantee the correctness of the calculations, although
42
+ * the calculation speed will be slower than the flag QUAT_ASSUME_UNIT.
43
+ */
44
+ QUAT_ASSUME_NOT_UNIT,
45
+ /**
46
+ * If this flag is specified, the input quaternions are assumed to be unit
47
+ * quaternions which will save some computations. However, if this flag is
48
+ * specified without unit quaternion, the program correctness of the result
49
+ * will not be guaranteed.
50
+ */
51
+ QUAT_ASSUME_UNIT
52
+ };
53
+
54
+ class QuatEnum {
55
+ public:
56
+ /** @brief Enum of Euler angles type.
57
+ *
58
+ * Without considering the possibility of using two different convertions for
59
+ * the definition of the rotation axes , there exists twelve possible
60
+ * sequences of rotation axes, divided into two groups:
61
+ * - Proper Euler angles (Z-X-Z, X-Y-X, Y-Z-Y, Z-Y-Z, X-Z-X, Y-X-Y)
62
+ * - Tait–Bryan angles (X-Y-Z, Y-Z-X, Z-X-Y, X-Z-Y, Z-Y-X, Y-X-Z).
63
+ *
64
+ * The three elemental rotations may be
65
+ * [extrinsic](https://en.wikipedia.org/wiki/Euler_angles#Definition_by_extrinsic_rotations)
66
+ * (rotations about the axes *xyz* of the original coordinate system, which is
67
+ * assumed to remain motionless), or
68
+ * [intrinsic](https://en.wikipedia.org/wiki/Euler_angles#Definition_by_intrinsic_rotations)(rotations
69
+ * about the axes of the rotating coordinate system *XYZ*, solidary with the
70
+ * moving body, which changes its orientation after each elemental rotation).
71
+ *
72
+ *
73
+ * Extrinsic and intrinsic rotations are relevant.
74
+ *
75
+ * The definition of the Euler angles is as following,
76
+ * - \f$\theta_1 \f$ represents the first rotation angle,
77
+ * - \f$\theta_2 \f$ represents the second rotation angle,
78
+ * - \f$\theta_3 \f$ represents the third rotation angle.
79
+ *
80
+ * For intrinsic rotations in the order of X-Y-Z, the rotation matrix R can be
81
+ * calculated by:\f[R =X(\theta_1) Y(\theta_2) Z(\theta_3) \f] For extrinsic
82
+ * rotations in the order of X-Y-Z, the rotation matrix R can be calculated
83
+ * by:\f[R =Z({\theta_3}) Y({\theta_2}) X({\theta_1})\f] where
84
+ * \f[X({\theta_1})={\begin{bmatrix}1&0&0\\0&\cos {\theta_1} &-\sin {\theta_1}
85
+ * \\0&\sin {\theta_1} &\cos {\theta_1} \\\end{bmatrix}},
86
+ * Y({\theta_2})={\begin{bmatrix}\cos \theta_{2}&0&\sin \theta_{2}\\0&1 &0
87
+ * \\\ -sin \theta_2& 0&\cos \theta_{2} \\\end{bmatrix}},
88
+ * Z({\theta_3})={\begin{bmatrix}\cos\theta_{3} &-\sin \theta_3&0\\\sin
89
+ * \theta_3 &\cos \theta_3 &0\\0&0&1\\\end{bmatrix}}.
90
+ * \f]
91
+ *
92
+ * The function is designed according to this set of conventions:
93
+ * - [Right handed](https://en.wikipedia.org/wiki/Right_hand_rule) reference
94
+ * frames are adopted, and the [right hand
95
+ * rule](https://en.wikipedia.org/wiki/Right_hand_rule) is used to determine
96
+ * the sign of angles.
97
+ * - Each matrix is meant to represent an [active
98
+ * rotation](https://en.wikipedia.org/wiki/Active_and_passive_transformation)
99
+ * (the composing and composed matrices are supposed to act on the coordinates
100
+ * of vectors defined in the initial fixed reference frame and give as a
101
+ * result the coordinates of a rotated vector defined in the same reference
102
+ * frame).
103
+ * - For \f$\theta_1\f$ and \f$\theta_3\f$, the valid range is (−π, π].
104
+ *
105
+ * For \f$\theta_2\f$, the valid range is [−π/2, π/2] or [0, π].
106
+ *
107
+ * For Tait–Bryan angles, the valid range of \f$\theta_2\f$ is [−π/2, π/2].
108
+ * When transforming a quaternion to Euler angles, the solution of Euler
109
+ * angles is unique in condition of \f$ \theta_2 \in (−π/2, π/2)\f$ . If
110
+ * \f$\theta_2 = −π/2 \f$ or \f$ \theta_2 = π/2\f$, there are infinite
111
+ * solutions. The common name for this situation is gimbal lock. For Proper
112
+ * Euler angles,the valid range of \f$\theta_2\f$ is in [0, π]. The solutions
113
+ * of Euler angles are unique in condition of \f$ \theta_2 \in (0, π)\f$ . If
114
+ * \f$\theta_2 =0 \f$ or \f$\theta_2 =π \f$, there are infinite solutions and
115
+ * gimbal lock will occur.
116
+ */
117
+ enum EulerAnglesType {
118
+ INT_XYZ, ///< Intrinsic rotations with the Euler angles type X-Y-Z
119
+ INT_XZY, ///< Intrinsic rotations with the Euler angles type X-Z-Y
120
+ INT_YXZ, ///< Intrinsic rotations with the Euler angles type Y-X-Z
121
+ INT_YZX, ///< Intrinsic rotations with the Euler angles type Y-Z-X
122
+ INT_ZXY, ///< Intrinsic rotations with the Euler angles type Z-X-Y
123
+ INT_ZYX, ///< Intrinsic rotations with the Euler angles type Z-Y-X
124
+ INT_XYX, ///< Intrinsic rotations with the Euler angles type X-Y-X
125
+ INT_XZX, ///< Intrinsic rotations with the Euler angles type X-Z-X
126
+ INT_YXY, ///< Intrinsic rotations with the Euler angles type Y-X-Y
127
+ INT_YZY, ///< Intrinsic rotations with the Euler angles type Y-Z-Y
128
+ INT_ZXZ, ///< Intrinsic rotations with the Euler angles type Z-X-Z
129
+ INT_ZYZ, ///< Intrinsic rotations with the Euler angles type Z-Y-Z
130
+
131
+ EXT_XYZ, ///< Extrinsic rotations with the Euler angles type X-Y-Z
132
+ EXT_XZY, ///< Extrinsic rotations with the Euler angles type X-Z-Y
133
+ EXT_YXZ, ///< Extrinsic rotations with the Euler angles type Y-X-Z
134
+ EXT_YZX, ///< Extrinsic rotations with the Euler angles type Y-Z-X
135
+ EXT_ZXY, ///< Extrinsic rotations with the Euler angles type Z-X-Y
136
+ EXT_ZYX, ///< Extrinsic rotations with the Euler angles type Z-Y-X
137
+ EXT_XYX, ///< Extrinsic rotations with the Euler angles type X-Y-X
138
+ EXT_XZX, ///< Extrinsic rotations with the Euler angles type X-Z-X
139
+ EXT_YXY, ///< Extrinsic rotations with the Euler angles type Y-X-Y
140
+ EXT_YZY, ///< Extrinsic rotations with the Euler angles type Y-Z-Y
141
+ EXT_ZXZ, ///< Extrinsic rotations with the Euler angles type Z-X-Z
142
+ EXT_ZYZ, ///< Extrinsic rotations with the Euler angles type Z-Y-Z
143
+ #ifndef CV_DOXYGEN
144
+ EULER_ANGLES_MAX_VALUE
145
+ #endif
146
+ };
147
+ };
148
+
149
+ template <typename _Tp> class Quat;
150
+ template <typename _Tp>
151
+ std::ostream &operator<<(std::ostream &, const Quat<_Tp> &);
152
+
153
+ /**
154
+ * Quaternion is a number system that extends the complex numbers. It can be
155
+ * expressed as a rotation in three-dimensional space. A quaternion is generally
156
+ * represented in the form:
157
+ * \f[q = w + x\boldsymbol{i} + y\boldsymbol{j} + z\boldsymbol{k}\f]
158
+ * \f[q = [w, x, y, z]\f]
159
+ * \f[q = [w, \boldsymbol{v}] \f]
160
+ * \f[q = ||q||[\cos\psi, u_x\sin\psi,u_y\sin\psi, u_z\sin\psi].\f]
161
+ * \f[q = ||q||[\cos\psi, \boldsymbol{u}\sin\psi]\f]
162
+ * where \f$\psi = \frac{\theta}{2}\f$, \f$\theta\f$ represents rotation angle,
163
+ * \f$\boldsymbol{u} = [u_x, u_y, u_z]\f$ represents normalized rotation axis,
164
+ * and \f$||q||\f$ represents the norm of \f$q\f$.
165
+ *
166
+ * A unit quaternion is usually represents rotation, which has the form:
167
+ * \f[q = [\cos\psi, u_x\sin\psi,u_y\sin\psi, u_z\sin\psi].\f]
168
+ *
169
+ * To create a quaternion representing the rotation around the axis
170
+ * \f$\boldsymbol{u}\f$ with angle \f$\theta\f$, you can use
171
+ * ```
172
+ * using namespace cv;
173
+ * double angle = CV_PI;
174
+ * Vec3d axis = {0, 0, 1};
175
+ * Quatd q = Quatd::createFromAngleAxis(angle, axis);
176
+ * ```
177
+ *
178
+ * You can simply use four same type number to create a quaternion
179
+ * ```
180
+ * Quatd q(1, 2, 3, 4);
181
+ * ```
182
+ * Or use a Vec4d or Vec4f vector.
183
+ * ```
184
+ * Vec4d vec{1, 2, 3, 4};
185
+ * Quatd q(vec);
186
+ * ```
187
+ *
188
+ * ```
189
+ * Vec4f vec{1, 2, 3, 4};
190
+ * Quatf q(vec);
191
+ * ```
192
+ *
193
+ * If you already have a 3x3 rotation matrix R, then you can use
194
+ * ```
195
+ * Quatd q = Quatd::createFromRotMat(R);
196
+ * ```
197
+ *
198
+ * If you already have a rotation vector rvec which has the form of `angle *
199
+ * axis`, then you can use
200
+ * ```
201
+ * Quatd q = Quatd::createFromRvec(rvec);
202
+ * ```
203
+ *
204
+ * To extract the rotation matrix from quaternion, see toRotMat3x3()
205
+ *
206
+ * To extract the Vec4d or Vec4f, see toVec()
207
+ *
208
+ * To extract the rotation vector, see toRotVec()
209
+ *
210
+ * If there are two quaternions \f$q_0, q_1\f$ are needed to interpolate, you
211
+ * can use nlerp(), slerp() or spline()
212
+ * ```
213
+ * Quatd::nlerp(q0, q1, t)
214
+ *
215
+ * Quatd::slerp(q0, q1, t)
216
+ *
217
+ * Quatd::spline(q0, q0, q1, q1, t)
218
+ * ```
219
+ * spline can smoothly connect rotations of multiple quaternions
220
+ *
221
+ * Three ways to get an element in Quaternion
222
+ * ```
223
+ * Quatf q(1,2,3,4);
224
+ * std::cout << q.w << std::endl; // w=1, x=2, y=3, z=4
225
+ * std::cout << q[0] << std::endl; // q[0]=1, q[1]=2, q[2]=3, q[3]=4
226
+ * std::cout << q.at(0) << std::endl;
227
+ * ```
228
+ */
229
+ template <typename _Tp> class Quat {
230
+ static_assert(std::is_floating_point<_Tp>::value,
231
+ "Quaternion only make sense with type of float or double");
232
+ using value_type = _Tp;
233
+
234
+ public:
235
+ static constexpr _Tp CV_QUAT_EPS = (_Tp)1.e-6;
236
+ static constexpr _Tp CV_QUAT_CONVERT_THRESHOLD = (_Tp)1.e-6;
237
+
238
+ Quat();
239
+
240
+ /**
241
+ * @brief From Vec4d or Vec4f.
242
+ */
243
+ explicit Quat(const Vec<_Tp, 4> &coeff);
244
+
245
+ /**
246
+ * @brief from four numbers.
247
+ */
248
+ Quat(_Tp w, _Tp x, _Tp y, _Tp z);
249
+
250
+ /**
251
+ * @brief from an angle, axis. Axis will be normalized in this function. And
252
+ * it generates
253
+ * \f[q = [\cos\psi, u_x\sin\psi,u_y\sin\psi, u_z\sin\psi].\f]
254
+ * where \f$\psi = \frac{\theta}{2}\f$, \f$\theta\f$ is the rotation angle.
255
+ */
256
+ static Quat<_Tp> createFromAngleAxis(const _Tp angle,
257
+ const Vec<_Tp, 3> &axis);
258
+
259
+ /**
260
+ * @brief from a 3x3 rotation matrix.
261
+ */
262
+ static Quat<_Tp> createFromRotMat(InputArray R);
263
+
264
+ /**
265
+ * @brief from a rotation vector
266
+ * \f$r\f$ has the form \f$\theta \cdot \boldsymbol{u}\f$, where \f$\theta\f$
267
+ * represents rotation angle and \f$\boldsymbol{u}\f$ represents normalized
268
+ * rotation axis.
269
+ *
270
+ * Angle and axis could be easily derived as:
271
+ * \f[
272
+ * \begin{equation}
273
+ * \begin{split}
274
+ * \psi &= ||r||\\
275
+ * \boldsymbol{u} &= \frac{r}{\theta}
276
+ * \end{split}
277
+ * \end{equation}
278
+ * \f]
279
+ * Then a quaternion can be calculated by
280
+ * \f[q = [\cos\psi, \boldsymbol{u}\sin\psi]\f]
281
+ * where \f$\psi = \theta / 2 \f$
282
+ */
283
+ static Quat<_Tp> createFromRvec(InputArray rvec);
284
+
285
+ /**
286
+ * @brief
287
+ * from Euler angles
288
+ *
289
+ * A quaternion can be generated from Euler angles by combining the quaternion
290
+ * representations of the Euler rotations.
291
+ *
292
+ * For example, if we use intrinsic rotations in the order of
293
+ * X-Y-Z,\f$\theta_1 \f$ is rotation around the X-axis, \f$\theta_2 \f$ is
294
+ * rotation around the Y-axis,
295
+ * \f$\theta_3 \f$ is rotation around the Z-axis. The final quaternion q can
296
+ * be calculated by
297
+ *
298
+ * \f[ {q} = q_{X, \theta_1} q_{Y, \theta_2} q_{Z, \theta_3}\f]
299
+ * where \f$ q_{X, \theta_1} \f$ is created from @ref createFromXRot, \f$
300
+ * q_{Y, \theta_2} \f$ is created from @ref createFromYRot,
301
+ * \f$ q_{Z, \theta_3} \f$ is created from @ref createFromZRot.
302
+ * @param angles the Euler angles in a vector of length 3
303
+ * @param eulerAnglesType the convertion Euler angles type
304
+ */
305
+ static Quat<_Tp>
306
+ createFromEulerAngles(const Vec<_Tp, 3> &angles,
307
+ QuatEnum::EulerAnglesType eulerAnglesType);
308
+
309
+ /**
310
+ * @brief get a quaternion from a rotation about the Y-axis by \f$\theta\f$ .
311
+ * \f[q = \cos(\theta/2)+0 i+ sin(\theta/2) j +0k \f]
312
+ */
313
+ static Quat<_Tp> createFromYRot(const _Tp theta);
314
+
315
+ /**
316
+ * @brief get a quaternion from a rotation about the X-axis by \f$\theta\f$ .
317
+ * \f[q = \cos(\theta/2)+sin(\theta/2) i +0 j +0 k \f]
318
+ */
319
+ static Quat<_Tp> createFromXRot(const _Tp theta);
320
+
321
+ /**
322
+ * @brief get a quaternion from a rotation about the Z-axis by \f$\theta\f$.
323
+ * \f[q = \cos(\theta/2)+0 i +0 j +sin(\theta/2) k \f]
324
+ */
325
+ static Quat<_Tp> createFromZRot(const _Tp theta);
326
+
327
+ /**
328
+ * @brief a way to get element.
329
+ * @param index over a range [0, 3].
330
+ *
331
+ * A quaternion q
332
+ *
333
+ * q.at(0) is equivalent to q.w,
334
+ *
335
+ * q.at(1) is equivalent to q.x,
336
+ *
337
+ * q.at(2) is equivalent to q.y,
338
+ *
339
+ * q.at(3) is equivalent to q.z.
340
+ */
341
+ _Tp at(size_t index) const;
342
+
343
+ /**
344
+ * @brief return the conjugate of this quaternion.
345
+ * \f[q.conjugate() = (w, -x, -y, -z).\f]
346
+ */
347
+ Quat<_Tp> conjugate() const;
348
+
349
+ /**
350
+ *
351
+ * @brief return the value of exponential value.
352
+ * \f[\exp(q) = e^w (\cos||\boldsymbol{v}||+
353
+ * \frac{v}{||\boldsymbol{v}||})\sin||\boldsymbol{v}||\f] where
354
+ * \f$\boldsymbol{v} = [x, y, z].\f$
355
+ * @param q a quaternion.
356
+ *
357
+ * For example:
358
+ * ```
359
+ * Quatd q{1,2,3,4};
360
+ * cout << exp(q) << endl;
361
+ * ```
362
+ */
363
+ template <typename T> friend Quat<T> exp(const Quat<T> &q);
364
+
365
+ /**
366
+ * @brief return the value of exponential value.
367
+ * \f[\exp(q) = e^w (\cos||\boldsymbol{v}||+
368
+ * \frac{v}{||\boldsymbol{v}||}\sin||\boldsymbol{v}||)\f] where
369
+ * \f$\boldsymbol{v} = [x, y, z].\f$
370
+ *
371
+ * For example
372
+ * ```
373
+ * Quatd q{1,2,3,4};
374
+ * cout << q.exp() << endl;
375
+ * ```
376
+ */
377
+ Quat<_Tp> exp() const;
378
+
379
+ /**
380
+ * @brief return the value of logarithm function.
381
+ * \f[\ln(q) = \ln||q|| +
382
+ * \frac{\boldsymbol{v}}{||\boldsymbol{v}||}\arccos\frac{w}{||q||}.\f] where
383
+ * \f$\boldsymbol{v} = [x, y, z].\f$
384
+ * @param q a quaternion.
385
+ * @param assumeUnit if QUAT_ASSUME_UNIT, q assume to be a unit quaternion and
386
+ * this function will save some computations.
387
+ *
388
+ * For example
389
+ * ```
390
+ * Quatd q1{1,2,3,4};
391
+ * cout << log(q1) << endl;
392
+ * ```
393
+ */
394
+ template <typename T>
395
+ friend Quat<T> log(const Quat<T> &q, QuatAssumeType assumeUnit);
396
+
397
+ /**
398
+ * @brief return the value of logarithm function.
399
+ * \f[\ln(q) = \ln||q|| +
400
+ * \frac{\boldsymbol{v}}{||\boldsymbol{v}||}\arccos\frac{w}{||q||}\f]. where
401
+ * \f$\boldsymbol{v} = [x, y, z].\f$
402
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
403
+ * quaternion and this function will save some computations.
404
+ *
405
+ * For example
406
+ * ```
407
+ * Quatd q(1,2,3,4);
408
+ * q.log();
409
+ *
410
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
411
+ * Quatd q1(1,2,3,4);
412
+ * q1.normalize().log(assumeUnit);
413
+ * ```
414
+ */
415
+ Quat<_Tp> log(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
416
+
417
+ /**
418
+ * @brief return the value of power function with index \f$x\f$.
419
+ * \f[q^x = ||q||(cos(x\theta) + \boldsymbol{u}sin(x\theta))).\f]
420
+ * @param q a quaternion.
421
+ * @param x index of exponentiation.
422
+ * @param assumeUnit if QUAT_ASSUME_UNIT, quaternion q assume to be a unit
423
+ * quaternion and this function will save some computations.
424
+ *
425
+ * For example
426
+ * ```
427
+ * Quatd q(1,2,3,4);
428
+ * power(q, 2.0);
429
+ *
430
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
431
+ * double angle = CV_PI;
432
+ * Vec3d axis{0, 0, 1};
433
+ * Quatd q1 = Quatd::createFromAngleAxis(angle, axis); //generate a unit quat
434
+ * by axis and angle power(q1, 2.0, assumeUnit);//This assumeUnit means q1 is
435
+ * a unit quaternion.
436
+ * ```
437
+ * @note the type of the index should be the same as the quaternion.
438
+ */
439
+ template <typename T>
440
+ friend Quat<T> power(const Quat<T> &q, const T x, QuatAssumeType assumeUnit);
441
+
442
+ /**
443
+ * @brief return the value of power function with index \f$x\f$.
444
+ * \f[q^x = ||q||(\cos(x\theta) + \boldsymbol{u}\sin(x\theta))).\f]
445
+ * @param x index of exponentiation.
446
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
447
+ * quaternion and this function will save some computations.
448
+ *
449
+ * For example
450
+ * ```
451
+ * Quatd q(1,2,3,4);
452
+ * q.power(2.0);
453
+ *
454
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
455
+ * double angle = CV_PI;
456
+ * Vec3d axis{0, 0, 1};
457
+ * Quatd q1 = Quatd::createFromAngleAxis(angle, axis); //generate a unit quat
458
+ * by axis and angle q1.power(2.0, assumeUnit); //This assumeUnt means q1 is a
459
+ * unit quaternion
460
+ * ```
461
+ */
462
+ Quat<_Tp> power(const _Tp x,
463
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
464
+
465
+ /**
466
+ * @brief return \f$\sqrt{q}\f$.
467
+ * @param q a quaternion.
468
+ * @param assumeUnit if QUAT_ASSUME_UNIT, quaternion q assume to be a unit
469
+ * quaternion and this function will save some computations.
470
+ *
471
+ * For example
472
+ * ```
473
+ * Quatf q(1,2,3,4);
474
+ * sqrt(q);
475
+ *
476
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
477
+ * q = {1,0,0,0};
478
+ * sqrt(q, assumeUnit); //This assumeUnit means q is a unit quaternion.
479
+ * ```
480
+ */
481
+ template <typename T>
482
+ friend Quat<T> sqrt(const Quat<T> &q, QuatAssumeType assumeUnit);
483
+
484
+ /**
485
+ * @brief return \f$\sqrt{q}\f$.
486
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
487
+ * quaternion and this function will save some computations.
488
+ *
489
+ * For example
490
+ * ```
491
+ * Quatf q(1,2,3,4);
492
+ * q.sqrt();
493
+ *
494
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
495
+ * q = {1,0,0,0};
496
+ * q.sqrt(assumeUnit); //This assumeUnit means q is a unit quaternion
497
+ * ```
498
+ */
499
+ Quat<_Tp> sqrt(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
500
+
501
+ /**
502
+ * @brief return the value of power function with quaternion \f$q\f$.
503
+ * \f[p^q = e^{q\ln(p)}.\f]
504
+ * @param p base quaternion of power function.
505
+ * @param q index quaternion of power function.
506
+ * @param assumeUnit if QUAT_ASSUME_UNIT, quaternion \f$p\f$ assume to be a
507
+ * unit quaternion and this function will save some computations.
508
+ *
509
+ * For example
510
+ * ```
511
+ * Quatd p(1,2,3,4);
512
+ * Quatd q(5,6,7,8);
513
+ * power(p, q);
514
+ *
515
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
516
+ * p = p.normalize();
517
+ * power(p, q, assumeUnit); //This assumeUnit means p is a unit quaternion
518
+ * ```
519
+ */
520
+ template <typename T>
521
+ friend Quat<T> power(const Quat<T> &p, const Quat<T> &q,
522
+ QuatAssumeType assumeUnit);
523
+
524
+ /**
525
+ * @brief return the value of power function with quaternion \f$q\f$.
526
+ * \f[p^q = e^{q\ln(p)}.\f]
527
+ * @param q index quaternion of power function.
528
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
529
+ * quaternion and this function will save some computations.
530
+ *
531
+ * For example
532
+ * ```
533
+ * Quatd p(1,2,3,4);
534
+ * Quatd q(5,6,7,8);
535
+ * p.power(q);
536
+ *
537
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
538
+ * p = p.normalize();
539
+ * p.power(q, assumeUnit); //This assumeUnit means p is a unit quaternion
540
+ * ```
541
+ */
542
+ Quat<_Tp> power(const Quat<_Tp> &q,
543
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
544
+
545
+ /**
546
+ * @brief return the crossProduct between \f$p = (a, b, c, d) = (a,
547
+ * \boldsymbol{u})\f$ and \f$q = (w, x, y, z) = (w, \boldsymbol{v})\f$.
548
+ * \f[p \times q = \frac{pq- qp}{2}\f]
549
+ * \f[p \times q = \boldsymbol{u} \times \boldsymbol{v}\f]
550
+ * \f[p \times q = (cz-dy)i + (dx-bz)j + (by-xc)k \f]
551
+ *
552
+ * For example
553
+ * ```
554
+ * Quatd q{1,2,3,4};
555
+ * Quatd p{5,6,7,8};
556
+ * crossProduct(p, q);
557
+ * ```
558
+ */
559
+ template <typename T>
560
+ friend Quat<T> crossProduct(const Quat<T> &p, const Quat<T> &q);
561
+
562
+ /**
563
+ * @brief return the crossProduct between \f$p = (a, b, c, d) = (a,
564
+ * \boldsymbol{u})\f$ and \f$q = (w, x, y, z) = (w, \boldsymbol{v})\f$.
565
+ * \f[p \times q = \frac{pq- qp}{2}.\f]
566
+ * \f[p \times q = \boldsymbol{u} \times \boldsymbol{v}.\f]
567
+ * \f[p \times q = (cz-dy)i + (dx-bz)j + (by-xc)k. \f]
568
+ *
569
+ * For example
570
+ * ```
571
+ * Quatd q{1,2,3,4};
572
+ * Quatd p{5,6,7,8};
573
+ * p.crossProduct(q)
574
+ * ```
575
+ */
576
+ Quat<_Tp> crossProduct(const Quat<_Tp> &q) const;
577
+
578
+ /**
579
+ * @brief return the norm of quaternion.
580
+ * \f[||q|| = \sqrt{w^2 + x^2 + y^2 + z^2}.\f]
581
+ */
582
+ _Tp norm() const;
583
+
584
+ /**
585
+ * @brief return a normalized \f$p\f$.
586
+ * \f[p = \frac{q}{||q||}\f]
587
+ * where \f$p\f$ satisfies \f$(p.x)^2 + (p.y)^2 + (p.z)^2 + (p.w)^2 = 1.\f$
588
+ */
589
+ Quat<_Tp> normalize() const;
590
+
591
+ /**
592
+ * @brief return \f$q^{-1}\f$ which is an inverse of \f$q\f$
593
+ * which satisfies \f$q * q^{-1} = 1\f$.
594
+ * @param q a quaternion.
595
+ * @param assumeUnit if QUAT_ASSUME_UNIT, quaternion q assume to be a unit
596
+ * quaternion and this function will save some computations.
597
+ *
598
+ * For example
599
+ * ```
600
+ * Quatd q(1,2,3,4);
601
+ * inv(q);
602
+ *
603
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
604
+ * q = q.normalize();
605
+ * inv(q, assumeUnit);//This assumeUnit means p is a unit quaternion
606
+ * ```
607
+ */
608
+ template <typename T>
609
+ friend Quat<T> inv(const Quat<T> &q, QuatAssumeType assumeUnit);
610
+
611
+ /**
612
+ * @brief return \f$q^{-1}\f$ which is an inverse of \f$q\f$
613
+ * satisfying \f$q * q^{-1} = 1\f$.
614
+ * @param assumeUnit if QUAT_ASSUME_UNIT, quaternion q assume to be a unit
615
+ * quaternion and this function will save some computations.
616
+ *
617
+ * For example
618
+ * ```
619
+ * Quatd q(1,2,3,4);
620
+ * q.inv();
621
+ *
622
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
623
+ * q = q.normalize();
624
+ * q.inv(assumeUnit); //assumeUnit means p is a unit quaternion
625
+ * ```
626
+ */
627
+ Quat<_Tp> inv(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
628
+
629
+ /**
630
+ * @brief return sinh value of quaternion q, sinh could be calculated as:
631
+ * \f[\sinh(p) = \sin(w)\cos(||\boldsymbol{v}||) +
632
+ * \cosh(w)\frac{v}{||\boldsymbol{v}||}\sin||\boldsymbol{v}||\f] where
633
+ * \f$\boldsymbol{v} = [x, y, z].\f$
634
+ * @param q a quaternion.
635
+ *
636
+ * For example
637
+ * ```
638
+ * Quatd q(1,2,3,4);
639
+ * sinh(q);
640
+ * ```
641
+ */
642
+ template <typename T> friend Quat<T> sinh(const Quat<T> &q);
643
+
644
+ /**
645
+ * @brief return sinh value of this quaternion, sinh could be calculated as:
646
+ * \f$\sinh(p) = \sin(w)\cos(||\boldsymbol{v}||) +
647
+ * \cosh(w)\frac{v}{||\boldsymbol{v}||}\sin||\boldsymbol{v}||\f$ where
648
+ * \f$\boldsymbol{v} = [x, y, z].\f$
649
+ *
650
+ * For example
651
+ * ```
652
+ * Quatd q(1,2,3,4);
653
+ * q.sinh();
654
+ * ```
655
+ */
656
+ Quat<_Tp> sinh() const;
657
+
658
+ /**
659
+ * @brief return cosh value of quaternion q, cosh could be calculated as:
660
+ * \f[\cosh(p) = \cosh(w) * \cos(||\boldsymbol{v}||) +
661
+ * \sinh(w)\frac{\boldsymbol{v}}{||\boldsymbol{v}||}\sin(||\boldsymbol{v}||)\f]
662
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
663
+ * @param q a quaternion.
664
+ *
665
+ * For example
666
+ * ```
667
+ * Quatd q(1,2,3,4);
668
+ * cosh(q);
669
+ * ```
670
+ */
671
+ template <typename T> friend Quat<T> cosh(const Quat<T> &q);
672
+
673
+ /**
674
+ * @brief return cosh value of this quaternion, cosh could be calculated as:
675
+ * \f[\cosh(p) = \cosh(w) * \cos(||\boldsymbol{v}||) +
676
+ * \sinh(w)\frac{\boldsymbol{v}}{||\boldsymbol{v}||}sin(||\boldsymbol{v}||)\f]
677
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
678
+ *
679
+ * For example
680
+ * ```
681
+ * Quatd q(1,2,3,4);
682
+ * q.cosh();
683
+ * ```
684
+ */
685
+ Quat<_Tp> cosh() const;
686
+
687
+ /**
688
+ * @brief return tanh value of quaternion q, tanh could be calculated as:
689
+ * \f[ \tanh(q) = \frac{\sinh(q)}{\cosh(q)}.\f]
690
+ * @param q a quaternion.
691
+ *
692
+ * For example
693
+ * ```
694
+ * Quatd q(1,2,3,4);
695
+ * tanh(q);
696
+ * ```
697
+ * @sa sinh, cosh
698
+ */
699
+ template <typename T> friend Quat<T> tanh(const Quat<T> &q);
700
+
701
+ /**
702
+ * @brief return tanh value of this quaternion, tanh could be calculated as:
703
+ * \f[ \tanh(q) = \frac{\sinh(q)}{\cosh(q)}.\f]
704
+ *
705
+ * For example
706
+ * ```
707
+ * Quatd q(1,2,3,4);
708
+ * q.tanh();
709
+ * ```
710
+ * @sa sinh, cosh
711
+ */
712
+ Quat<_Tp> tanh() const;
713
+
714
+ /**
715
+ * @brief return tanh value of quaternion q, sin could be calculated as:
716
+ * \f[\sin(p) = \sin(w) * \cosh(||\boldsymbol{v}||) +
717
+ * \cos(w)\frac{\boldsymbol{v}}{||\boldsymbol{v}||}\sinh(||\boldsymbol{v}||)\f]
718
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
719
+ * @param q a quaternion.
720
+ *
721
+ * For example
722
+ * ```
723
+ * Quatd q(1,2,3,4);
724
+ * sin(q);
725
+ * ```
726
+ */
727
+ template <typename T> friend Quat<T> sin(const Quat<T> &q);
728
+
729
+ /**
730
+ * @brief return sin value of this quaternion, sin could be calculated as:
731
+ * \f[\sin(p) = \sin(w) * \cosh(||\boldsymbol{v}||) +
732
+ * \cos(w)\frac{\boldsymbol{v}}{||\boldsymbol{v}||}\sinh(||\boldsymbol{v}||)\f]
733
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
734
+ *
735
+ * For example
736
+ * ```
737
+ * Quatd q(1,2,3,4);
738
+ * q.sin();
739
+ * ```
740
+ */
741
+ Quat<_Tp> sin() const;
742
+
743
+ /**
744
+ * @brief return sin value of quaternion q, cos could be calculated as:
745
+ * \f[\cos(p) = \cos(w) * \cosh(||\boldsymbol{v}||) -
746
+ * \sin(w)\frac{\boldsymbol{v}}{||\boldsymbol{v}||}\sinh(||\boldsymbol{v}||)\f]
747
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
748
+ * @param q a quaternion.
749
+ *
750
+ * For example
751
+ * ```
752
+ * Quatd q(1,2,3,4);
753
+ * cos(q);
754
+ * ```
755
+ */
756
+ template <typename T> friend Quat<T> cos(const Quat<T> &q);
757
+
758
+ /**
759
+ * @brief return cos value of this quaternion, cos could be calculated as:
760
+ * \f[\cos(p) = \cos(w) * \cosh(||\boldsymbol{v}||) -
761
+ * \sin(w)\frac{\boldsymbol{v}}{||\boldsymbol{v}||}\sinh(||\boldsymbol{v}||)\f]
762
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
763
+ *
764
+ * For example
765
+ * ```
766
+ * Quatd q(1,2,3,4);
767
+ * q.cos();
768
+ * ```
769
+ */
770
+ Quat<_Tp> cos() const;
771
+
772
+ /**
773
+ * @brief return tan value of quaternion q, tan could be calculated as:
774
+ * \f[\tan(q) = \frac{\sin(q)}{\cos(q)}.\f]
775
+ * @param q a quaternion.
776
+ *
777
+ * For example
778
+ * ```
779
+ * Quatd q(1,2,3,4);
780
+ * tan(q);
781
+ * ```
782
+ */
783
+ template <typename T> friend Quat<T> tan(const Quat<T> &q);
784
+
785
+ /**
786
+ * @brief return tan value of this quaternion, tan could be calculated as:
787
+ * \f[\tan(q) = \frac{\sin(q)}{\cos(q)}.\f]
788
+ *
789
+ * For example
790
+ * ```
791
+ * Quatd q(1,2,3,4);
792
+ * q.tan();
793
+ * ```
794
+ */
795
+ Quat<_Tp> tan() const;
796
+
797
+ /**
798
+ * @brief return arcsin value of quaternion q, arcsin could be calculated as:
799
+ * \f[\arcsin(q) =
800
+ * -\frac{\boldsymbol{v}}{||\boldsymbol{v}||}arcsinh(q\frac{\boldsymbol{v}}{||\boldsymbol{v}||})\f]
801
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
802
+ * @param q a quaternion.
803
+ *
804
+ * For example
805
+ * ```
806
+ * Quatd q(1,2,3,4);
807
+ * asin(q);
808
+ * ```
809
+ */
810
+ template <typename T> friend Quat<T> asin(const Quat<T> &q);
811
+
812
+ /**
813
+ * @brief return arcsin value of this quaternion, arcsin could be calculated
814
+ * as:
815
+ * \f[\arcsin(q) =
816
+ * -\frac{\boldsymbol{v}}{||\boldsymbol{v}||}arcsinh(q\frac{\boldsymbol{v}}{||\boldsymbol{v}||})\f]
817
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
818
+ *
819
+ * For example
820
+ * ```
821
+ * Quatd q(1,2,3,4);
822
+ * q.asin();
823
+ * ```
824
+ */
825
+ Quat<_Tp> asin() const;
826
+
827
+ /**
828
+ * @brief return arccos value of quaternion q, arccos could be calculated as:
829
+ * \f[\arccos(q) = -\frac{\boldsymbol{v}}{||\boldsymbol{v}||}arccosh(q)\f]
830
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
831
+ * @param q a quaternion.
832
+ *
833
+ * For example
834
+ * ```
835
+ * Quatd q(1,2,3,4);
836
+ * acos(q);
837
+ * ```
838
+ */
839
+ template <typename T> friend Quat<T> acos(const Quat<T> &q);
840
+
841
+ /**
842
+ * @brief return arccos value of this quaternion, arccos could be calculated
843
+ * as:
844
+ * \f[\arccos(q) = -\frac{\boldsymbol{v}}{||\boldsymbol{v}||}arccosh(q)\f]
845
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
846
+ *
847
+ * For example
848
+ * ```
849
+ * Quatd q(1,2,3,4);
850
+ * q.acos();
851
+ * ```
852
+ */
853
+ Quat<_Tp> acos() const;
854
+
855
+ /**
856
+ * @brief return arctan value of quaternion q, arctan could be calculated as:
857
+ * \f[\arctan(q) =
858
+ * -\frac{\boldsymbol{v}}{||\boldsymbol{v}||}arctanh(q\frac{\boldsymbol{v}}{||\boldsymbol{v}||})\f]
859
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
860
+ * @param q a quaternion.
861
+ *
862
+ * For example
863
+ * ```
864
+ * Quatd q(1,2,3,4);
865
+ * atan(q);
866
+ * ```
867
+ */
868
+ template <typename T> friend Quat<T> atan(const Quat<T> &q);
869
+
870
+ /**
871
+ * @brief return arctan value of this quaternion, arctan could be calculated
872
+ * as:
873
+ * \f[\arctan(q) =
874
+ * -\frac{\boldsymbol{v}}{||\boldsymbol{v}||}arctanh(q\frac{\boldsymbol{v}}{||\boldsymbol{v}||})\f]
875
+ * where \f$\boldsymbol{v} = [x, y, z].\f$
876
+ *
877
+ * For example
878
+ * ```
879
+ * Quatd q(1,2,3,4);
880
+ * q.atan();
881
+ * ```
882
+ */
883
+ Quat<_Tp> atan() const;
884
+
885
+ /**
886
+ * @brief return arcsinh value of quaternion q, arcsinh could be calculated
887
+ * as:
888
+ * \f[arcsinh(q) = \ln(q + \sqrt{q^2 + 1})\f].
889
+ * @param q a quaternion.
890
+ *
891
+ * For example
892
+ * ```
893
+ * Quatd q(1,2,3,4);
894
+ * asinh(q);
895
+ * ```
896
+ */
897
+ template <typename T> friend Quat<T> asinh(const Quat<T> &q);
898
+
899
+ /**
900
+ * @brief return arcsinh value of this quaternion, arcsinh could be calculated
901
+ * as:
902
+ * \f[arcsinh(q) = \ln(q + \sqrt{q^2 + 1})\f].
903
+ *
904
+ * For example
905
+ * ```
906
+ * Quatd q(1,2,3,4);
907
+ * q.asinh();
908
+ * ```
909
+ */
910
+ Quat<_Tp> asinh() const;
911
+
912
+ /**
913
+ * @brief return arccosh value of quaternion q, arccosh could be calculated
914
+ * as:
915
+ * \f[arccosh(q) = \ln(q + \sqrt{q^2 - 1})\f].
916
+ * @param q a quaternion.
917
+ *
918
+ * For example
919
+ * ```
920
+ * Quatd q(1,2,3,4);
921
+ * acosh(q);
922
+ * ```
923
+ */
924
+ template <typename T> friend Quat<T> acosh(const Quat<T> &q);
925
+
926
+ /**
927
+ * @brief return arccosh value of this quaternion, arccosh could be calculated
928
+ * as:
929
+ * \f[arcosh(q) = \ln(q + \sqrt{q^2 - 1})\f].
930
+ *
931
+ * For example
932
+ * ```
933
+ * Quatd q(1,2,3,4);
934
+ * q.acosh();
935
+ * ```
936
+ */
937
+ Quat<_Tp> acosh() const;
938
+
939
+ /**
940
+ * @brief return arctanh value of quaternion q, arctanh could be calculated
941
+ * as:
942
+ * \f[arctanh(q) = \frac{\ln(q + 1) - \ln(1 - q)}{2}\f].
943
+ * @param q a quaternion.
944
+ *
945
+ * For example
946
+ * ```
947
+ * Quatd q(1,2,3,4);
948
+ * atanh(q);
949
+ * ```
950
+ */
951
+ template <typename T> friend Quat<T> atanh(const Quat<T> &q);
952
+
953
+ /**
954
+ * @brief return arctanh value of this quaternion, arctanh could be calculated
955
+ * as:
956
+ * \f[arcsinh(q) = \frac{\ln(q + 1) - \ln(1 - q)}{2}\f].
957
+ *
958
+ * For example
959
+ * ```
960
+ * Quatd q(1,2,3,4);
961
+ * q.atanh();
962
+ * ```
963
+ */
964
+ Quat<_Tp> atanh() const;
965
+
966
+ /**
967
+ * @brief return true if this quaternion is a unit quaternion.
968
+ * @param eps tolerance scope of normalization. The eps could be defined as
969
+ *
970
+ * \f[eps = |1 - dotValue|\f] where \f[dotValue = (this.w^2 + this.x^2 +
971
+ * this,y^2 + this.z^2).\f] And this function will consider it is normalized
972
+ * when the dotValue over a range \f$[1-eps, 1+eps]\f$.
973
+ */
974
+ bool isNormal(_Tp eps = CV_QUAT_EPS) const;
975
+
976
+ /**
977
+ * @brief to throw an error if this quaternion is not a unit quaternion.
978
+ * @param eps tolerance scope of normalization.
979
+ * @sa isNormal
980
+ */
981
+ void assertNormal(_Tp eps = CV_QUAT_EPS) const;
982
+
983
+ /**
984
+ * @brief transform a quaternion to a 3x3 rotation matrix.
985
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
986
+ quaternion and
987
+ * this function will save some computations. Otherwise, this function will
988
+ normalize this
989
+ * quaternion at first then do the transformation.
990
+ *
991
+ * @note Matrix A which is to be rotated should have the form
992
+ * \f[\begin{bmatrix}
993
+ * x_0& x_1& x_2&...&x_n\\
994
+ * y_0& y_1& y_2&...&y_n\\
995
+ * z_0& z_1& z_2&...&z_n
996
+ * \end{bmatrix}\f]
997
+ * where the same subscript represents a point. The shape of A assume to be
998
+ [3, n]
999
+ * The points matrix A can be rotated by toRotMat3x3() * A.
1000
+ * The result has 3 rows and n columns too.
1001
+
1002
+ * For example
1003
+ * ```
1004
+ * double angle = CV_PI;
1005
+ * Vec3d axis{0,0,1};
1006
+ * Quatd q_unit = Quatd::createFromAngleAxis(angle, axis); //quaternion could
1007
+ also be get by interpolation by two or more quaternions.
1008
+ *
1009
+ * //assume there is two points (1,0,0) and (1,0,1) to be rotated
1010
+ * Mat pointsA = (Mat_<double>(2, 3) << 1,0,0,1,0,1);
1011
+ * //change the shape
1012
+ * pointsA = pointsA.t();
1013
+ * // rotate 180 degrees around the z axis
1014
+ * Mat new_point = q_unit.toRotMat3x3() * pointsA;
1015
+ * // print two points
1016
+ * cout << new_point << endl;
1017
+ * ```
1018
+ */
1019
+ Matx<_Tp, 3, 3>
1020
+ toRotMat3x3(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
1021
+
1022
+ /**
1023
+ * @brief transform a quaternion to a 4x4 rotation matrix.
1024
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
1025
+ * quaternion and this function will save some computations. Otherwise, this
1026
+ * function will normalize this quaternion at first then do the
1027
+ * transformation.
1028
+ *
1029
+ * The operations is similar as toRotMat3x3
1030
+ * except that the points matrix should have the form
1031
+ * \f[\begin{bmatrix}
1032
+ * x_0& x_1& x_2&...&x_n\\
1033
+ * y_0& y_1& y_2&...&y_n\\
1034
+ * z_0& z_1& z_2&...&z_n\\
1035
+ * 0&0&0&...&0
1036
+ * \end{bmatrix}\f]
1037
+ *
1038
+ * @sa toRotMat3x3
1039
+ */
1040
+
1041
+ Matx<_Tp, 4, 4>
1042
+ toRotMat4x4(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
1043
+
1044
+ /**
1045
+ * @brief transform the this quaternion to a Vec<T, 4>.
1046
+ *
1047
+ * For example
1048
+ * ```
1049
+ * Quatd q(1,2,3,4);
1050
+ * q.toVec();
1051
+ * ```
1052
+ */
1053
+ Vec<_Tp, 4> toVec() const;
1054
+
1055
+ /**
1056
+ * @brief transform this quaternion to a Rotation vector.
1057
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
1058
+ * quaternion and this function will save some computations. Rotation vector
1059
+ * rVec is defined as:
1060
+ * \f[ rVec = [\theta v_x, \theta v_y, \theta v_z]\f]
1061
+ * where \f$\theta\f$ represents rotation angle, and \f$\boldsymbol{v}\f$
1062
+ * represents the normalized rotation axis.
1063
+ *
1064
+ * For example
1065
+ * ```
1066
+ * Quatd q(1,2,3,4);
1067
+ * q.toRotVec();
1068
+ *
1069
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
1070
+ * q.normalize().toRotVec(assumeUnit); //answer is same as q.toRotVec().
1071
+ * ```
1072
+ */
1073
+ Vec<_Tp, 3> toRotVec(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
1074
+
1075
+ /**
1076
+ * @brief get the angle of quaternion, it returns the rotation angle.
1077
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
1078
+ * quaternion and this function will save some computations.
1079
+ * \f[\psi = 2 *arccos(\frac{w}{||q||})\f]
1080
+ *
1081
+ * For example
1082
+ * ```
1083
+ * Quatd q(1,2,3,4);
1084
+ * q.getAngle();
1085
+ *
1086
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
1087
+ * q.normalize().getAngle(assumeUnit);//same as q.getAngle().
1088
+ * ```
1089
+ * @note It always return the value between \f$[0, 2\pi]\f$.
1090
+ */
1091
+ _Tp getAngle(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
1092
+
1093
+ /**
1094
+ * @brief get the axis of quaternion, it returns a vector of length 3.
1095
+ * @param assumeUnit if QUAT_ASSUME_UNIT, this quaternion assume to be a unit
1096
+ * quaternion and this function will save some computations.
1097
+ *
1098
+ * the unit axis \f$\boldsymbol{u}\f$ is defined by
1099
+ * \f[\begin{equation}
1100
+ * \begin{split}
1101
+ * \boldsymbol{v}
1102
+ * &= \boldsymbol{u} ||\boldsymbol{v}||\\
1103
+ * &= \boldsymbol{u}||q||sin(\frac{\theta}{2})
1104
+ * \end{split}
1105
+ * \end{equation}\f]
1106
+ * where \f$v=[x, y ,z]\f$ and \f$\theta\f$ represents rotation angle.
1107
+ *
1108
+ *
1109
+ * For example
1110
+ * ```
1111
+ * Quatd q(1,2,3,4);
1112
+ * q.getAxis();
1113
+ *
1114
+ * QuatAssumeType assumeUnit = QUAT_ASSUME_UNIT;
1115
+ * q.normalize().getAxis(assumeUnit);//same as q.getAxis()
1116
+ * ```
1117
+ */
1118
+ Vec<_Tp, 3> getAxis(QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT) const;
1119
+
1120
+ /**
1121
+ * @brief return the dot between quaternion \f$q\f$ and this quaternion.
1122
+ *
1123
+ * dot(p, q) is a good metric of how close the quaternions are.
1124
+ * Indeed, consider the unit quaternion difference \f$p^{-1} * q\f$, its real
1125
+ * part is dot(p, q). At the same time its real part is equal to
1126
+ * \f$\cos(\beta/2)\f$ where \f$\beta\f$ is an angle of rotation between p and
1127
+ * q, i.e., Therefore, the closer dot(p, q) to 1, the smaller rotation between
1128
+ * them.
1129
+ * \f[p \cdot q = p.w \cdot q.w + p.x \cdot q.x + p.y \cdot q.y + p.z \cdot
1130
+ * q.z\f]
1131
+ * @param q the other quaternion.
1132
+ *
1133
+ * For example
1134
+ * ```
1135
+ * Quatd q(1,2,3,4);
1136
+ * Quatd p(5,6,7,8);
1137
+ * p.dot(q);
1138
+ * ```
1139
+ */
1140
+ _Tp dot(Quat<_Tp> q) const;
1141
+
1142
+ /**
1143
+ * @brief To calculate the interpolation from \f$q_0\f$ to \f$q_1\f$ by Linear
1144
+ * Interpolation(Nlerp) For two quaternions, this interpolation curve can be
1145
+ * displayed as:
1146
+ * \f[Lerp(q_0, q_1, t) = (1 - t)q_0 + tq_1.\f]
1147
+ * Obviously, the lerp will interpolate along a straight line if we think of
1148
+ * \f$q_0\f$ and \f$q_1\f$ as a vector in a two-dimensional space. When \f$t =
1149
+ * 0\f$, it returns \f$q_0\f$ and when \f$t= 1\f$, it returns \f$q_1\f$.
1150
+ * \f$t\f$ should to be ranged in \f$[0, 1]\f$ normally.
1151
+ * @param q0 a quaternion used in linear interpolation.
1152
+ * @param q1 a quaternion used in linear interpolation.
1153
+ * @param t percent of vector \f$\overrightarrow{q_0q_1}\f$ over a range [0,
1154
+ * 1].
1155
+ * @note it returns a non-unit quaternion.
1156
+ */
1157
+ static Quat<_Tp> lerp(const Quat<_Tp> &q0, const Quat &q1, const _Tp t);
1158
+
1159
+ /**
1160
+ * @brief To calculate the interpolation from \f$q_0\f$ to \f$q_1\f$ by
1161
+ Normalized Linear Interpolation(Nlerp).
1162
+ * it returns a normalized quaternion of Linear Interpolation(Lerp).
1163
+ * \f[ Nlerp(q_0, q_1, t) = \frac{(1 - t)q_0 + tq_1}{||(1 - t)q_0 +
1164
+ tq_1||}.\f]
1165
+ * The interpolation will always choose the shortest path but the constant
1166
+ speed is not guaranteed.
1167
+ * @param q0 a quaternion used in normalized linear interpolation.
1168
+ * @param q1 a quaternion used in normalized linear interpolation.
1169
+ * @param t percent of vector \f$\overrightarrow{q_0q_1}\f$ over a range [0,
1170
+ 1].
1171
+ * @param assumeUnit if QUAT_ASSUME_UNIT, all input quaternions assume to be
1172
+ unit quaternion. Otherwise, all inputs quaternion will be normalized inside
1173
+ the function.
1174
+ * @sa lerp
1175
+ */
1176
+ static Quat<_Tp> nlerp(const Quat<_Tp> &q0, const Quat &q1, const _Tp t,
1177
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1178
+
1179
+ /**
1180
+ @brief To calculate the interpolation between \f$q_0\f$ and \f$q_1\f$ by
1181
+ Spherical Linear Interpolation(Slerp), which can be defined as:
1182
+ \f[ Slerp(q_0, q_1, t) = \frac{\sin((1-t)\theta)}{\sin(\theta)}q_0 +
1183
+ \frac{\sin(t\theta)}{\sin(\theta)}q_1\f] where \f$\theta\f$ can be calculated
1184
+ as:
1185
+ \f[\theta=cos^{-1}(q_0\cdot q_1)\f]
1186
+ resulting from the both of their norm is unit.
1187
+ @param q0 a quaternion used in Slerp.
1188
+ @param q1 a quaternion used in Slerp.
1189
+ @param t percent of angle between \f$q_0\f$ and \f$q_1\f$ over a range [0, 1].
1190
+ @param assumeUnit if QUAT_ASSUME_UNIT, all input quaternions assume to be unit
1191
+ quaternions. Otherwise, all input quaternions will be normalized inside the
1192
+ function.
1193
+ @param directChange if QUAT_ASSUME_UNIT, the interpolation will choose the
1194
+ nearest path.
1195
+ @note If the interpolation angle is small, the error between Nlerp and Slerp
1196
+ is not so large. To improve efficiency and avoid zero division error, we use
1197
+ Nlerp instead of Slerp.
1198
+ */
1199
+ static Quat<_Tp> slerp(const Quat<_Tp> &q0, const Quat &q1, const _Tp t,
1200
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT,
1201
+ bool directChange = true);
1202
+
1203
+ /**
1204
+ * @brief To calculate the interpolation between
1205
+ * \f$q_0\f$,\f$q_1\f$,\f$q_2\f$,\f$q_3\f$ by Spherical and
1206
+ * quadrangle(Squad). This could be defined as:
1207
+ * \f[Squad(q_i, s_i, s_{i+1}, q_{i+1}, t) = Slerp(Slerp(q_i, q_{i+1}, t),
1208
+ * Slerp(s_i, s_{i+1}, t), 2t(1-t))\f] where
1209
+ * \f[s_i = q_i\exp(-\frac{\log(q^*_iq_{i+1}) + \log(q^*_iq_{i-1})}{4})\f]
1210
+ *
1211
+ * The Squad expression is analogous to the \f$B\acute{e}zier\f$ curve, but
1212
+ * involves spherical linear interpolation instead of simple linear
1213
+ * interpolation. Each \f$s_i\f$ needs to be calculated by three quaternions.
1214
+ *
1215
+ * @param q0 the first quaternion.
1216
+ * @param s0 the second quaternion.
1217
+ * @param s1 the third quaternion.
1218
+ * @param q1 thr fourth quaternion.
1219
+ * @param t interpolation parameter of quadratic and linear interpolation over
1220
+ * a range \f$[0, 1]\f$.
1221
+ * @param assumeUnit if QUAT_ASSUME_UNIT, all input quaternions assume to be
1222
+ * unit quaternion. Otherwise, all input quaternions will be normalized inside
1223
+ * the function.
1224
+ * @param directChange if QUAT_ASSUME_UNIT, squad will find the nearest path
1225
+ * to interpolate.
1226
+ * @sa interPoint, spline
1227
+ */
1228
+ static Quat<_Tp> squad(const Quat<_Tp> &q0, const Quat<_Tp> &s0,
1229
+ const Quat<_Tp> &s1, const Quat<_Tp> &q1, const _Tp t,
1230
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT,
1231
+ bool directChange = true);
1232
+
1233
+ /**
1234
+ * @brief This is the part calculation of squad.
1235
+ * To calculate the intermedia quaternion \f$s_i\f$ between each three
1236
+ * quaternion
1237
+ * \f[s_i = q_i\exp(-\frac{\log(q^*_iq_{i+1}) + \log(q^*_iq_{i-1})}{4}).\f]
1238
+ * @param q0 the first quaternion.
1239
+ * @param q1 the second quaternion.
1240
+ * @param q2 the third quaternion.
1241
+ * @param assumeUnit if QUAT_ASSUME_UNIT, all input quaternions assume to be
1242
+ * unit quaternion. Otherwise, all input quaternions will be normalized inside
1243
+ * the function.
1244
+ * @sa squad
1245
+ */
1246
+ static Quat<_Tp> interPoint(const Quat<_Tp> &q0, const Quat<_Tp> &q1,
1247
+ const Quat<_Tp> &q2,
1248
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1249
+
1250
+ /**
1251
+ * @brief to calculate a quaternion which is the result of a \f$C^1\f$
1252
+ * continuous spline curve constructed by squad at the ratio t. Here, the
1253
+ * interpolation values are between \f$q_1\f$ and \f$q_2\f$. \f$q_0\f$ and
1254
+ * \f$q_2\f$ are used to ensure the \f$C^1\f$ continuity. if t = 0, it returns
1255
+ * \f$q_1\f$, if t = 1, it returns \f$q_2\f$.
1256
+ * @param q0 the first input quaternion to ensure \f$C^1\f$ continuity.
1257
+ * @param q1 the second input quaternion.
1258
+ * @param q2 the third input quaternion.
1259
+ * @param q3 the fourth input quaternion the same use of \f$q1\f$.
1260
+ * @param t ratio over a range [0, 1].
1261
+ * @param assumeUnit if QUAT_ASSUME_UNIT, \f$q_0, q_1, q_2, q_3\f$ assume to
1262
+ * be unit quaternion. Otherwise, all input quaternions will be normalized
1263
+ * inside the function.
1264
+ *
1265
+ * For example:
1266
+ *
1267
+ * If there are three double quaternions \f$v_0, v_1, v_2\f$ waiting to be
1268
+ * interpolated.
1269
+ *
1270
+ * Interpolation between \f$v_0\f$ and \f$v_1\f$ with a ratio \f$t_0\f$ could
1271
+ * be calculated as
1272
+ * ```
1273
+ * Quatd::spline(v0, v0, v1, v2, t0);
1274
+ * ```
1275
+ * Interpolation between \f$v_1\f$ and \f$v_2\f$ with a ratio \f$t_0\f$ could
1276
+ * be calculated as
1277
+ * ```
1278
+ * Quatd::spline(v0, v1, v2, v2, t0);
1279
+ * ```
1280
+ * @sa squad, slerp
1281
+ */
1282
+ static Quat<_Tp> spline(const Quat<_Tp> &q0, const Quat<_Tp> &q1,
1283
+ const Quat<_Tp> &q2, const Quat<_Tp> &q3, const _Tp t,
1284
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1285
+
1286
+ /**
1287
+ * @brief Return opposite quaternion \f$-p\f$
1288
+ * which satisfies \f$p + (-p) = 0.\f$
1289
+ *
1290
+ * For example
1291
+ * ```
1292
+ * Quatd q{1, 2, 3, 4};
1293
+ * std::cout << -q << std::endl; // [-1, -2, -3, -4]
1294
+ * ```
1295
+ */
1296
+ Quat<_Tp> operator-() const;
1297
+
1298
+ /**
1299
+ * @brief return true if two quaternions p and q are nearly equal, i.e. when
1300
+ * the absolute value of each \f$p_i\f$ and \f$q_i\f$ is less than
1301
+ * CV_QUAT_EPS.
1302
+ */
1303
+ bool operator==(const Quat<_Tp> &) const;
1304
+
1305
+ /**
1306
+ * @brief Addition operator of two quaternions p and q.
1307
+ * It returns a new quaternion that each value is the sum of \f$p_i\f$ and
1308
+ * \f$q_i\f$.
1309
+ *
1310
+ * For example
1311
+ * ```
1312
+ * Quatd p{1, 2, 3, 4};
1313
+ * Quatd q{5, 6, 7, 8};
1314
+ * std::cout << p + q << std::endl; //[6, 8, 10, 12]
1315
+ * ```
1316
+ */
1317
+ Quat<_Tp> operator+(const Quat<_Tp> &) const;
1318
+
1319
+ /**
1320
+ * @brief Addition assignment operator of two quaternions p and q.
1321
+ * It adds right operand to the left operand and assign the result to left
1322
+ * operand.
1323
+ *
1324
+ * For example
1325
+ * ```
1326
+ * Quatd p{1, 2, 3, 4};
1327
+ * Quatd q{5, 6, 7, 8};
1328
+ * p += q; // equivalent to p = p + q
1329
+ * std::cout << p << std::endl; //[6, 8, 10, 12]
1330
+ *
1331
+ * ```
1332
+ */
1333
+ Quat<_Tp> &operator+=(const Quat<_Tp> &);
1334
+
1335
+ /**
1336
+ * @brief Subtraction operator of two quaternions p and q.
1337
+ * It returns a new quaternion that each value is the sum of \f$p_i\f$ and
1338
+ * \f$-q_i\f$.
1339
+ *
1340
+ * For example
1341
+ * ```
1342
+ * Quatd p{1, 2, 3, 4};
1343
+ * Quatd q{5, 6, 7, 8};
1344
+ * std::cout << p - q << std::endl; //[-4, -4, -4, -4]
1345
+ * ```
1346
+ */
1347
+ Quat<_Tp> operator-(const Quat<_Tp> &) const;
1348
+
1349
+ /**
1350
+ * @brief Subtraction assignment operator of two quaternions p and q.
1351
+ * It subtracts right operand from the left operand and assign the result to
1352
+ * left operand.
1353
+ *
1354
+ * For example
1355
+ * ```
1356
+ * Quatd p{1, 2, 3, 4};
1357
+ * Quatd q{5, 6, 7, 8};
1358
+ * p -= q; // equivalent to p = p - q
1359
+ * std::cout << p << std::endl; //[-4, -4, -4, -4]
1360
+ *
1361
+ * ```
1362
+ */
1363
+ Quat<_Tp> &operator-=(const Quat<_Tp> &);
1364
+
1365
+ /**
1366
+ * @brief Multiplication assignment operator of two quaternions q and p.
1367
+ * It multiplies right operand with the left operand and assign the result to
1368
+ * left operand.
1369
+ *
1370
+ * Rule of quaternion multiplication:
1371
+ * \f[
1372
+ * \begin{equation}
1373
+ * \begin{split}
1374
+ * p * q &= [p_0, \boldsymbol{u}]*[q_0, \boldsymbol{v}]\\
1375
+ * &=[p_0q_0 - \boldsymbol{u}\cdot \boldsymbol{v}, p_0\boldsymbol{v} +
1376
+ * q_0\boldsymbol{u}+ \boldsymbol{u}\times \boldsymbol{v}].
1377
+ * \end{split}
1378
+ * \end{equation}
1379
+ * \f]
1380
+ * where \f$\cdot\f$ means dot product and \f$\times \f$ means cross product.
1381
+ *
1382
+ * For example
1383
+ * ```
1384
+ * Quatd p{1, 2, 3, 4};
1385
+ * Quatd q{5, 6, 7, 8};
1386
+ * p *= q; // equivalent to p = p * q
1387
+ * std::cout << p << std::endl; //[-60, 12, 30, 24]
1388
+ * ```
1389
+ */
1390
+ Quat<_Tp> &operator*=(const Quat<_Tp> &);
1391
+
1392
+ /**
1393
+ * @brief Multiplication assignment operator of a quaternions and a scalar.
1394
+ * It multiplies right operand with the left operand and assign the result to
1395
+ * left operand.
1396
+ *
1397
+ * Rule of quaternion multiplication with a scalar:
1398
+ * \f[
1399
+ * \begin{equation}
1400
+ * \begin{split}
1401
+ * p * s &= [w, x, y, z] * s\\
1402
+ * &=[w * s, x * s, y * s, z * s].
1403
+ * \end{split}
1404
+ * \end{equation}
1405
+ * \f]
1406
+ *
1407
+ * For example
1408
+ * ```
1409
+ * Quatd p{1, 2, 3, 4};
1410
+ * double s = 2.0;
1411
+ * p *= s; // equivalent to p = p * s
1412
+ * std::cout << p << std::endl; //[2.0, 4.0, 6.0, 8.0]
1413
+ * ```
1414
+ * @note the type of scalar should be equal to the quaternion.
1415
+ */
1416
+ Quat<_Tp> &operator*=(const _Tp s);
1417
+
1418
+ /**
1419
+ * @brief Multiplication operator of two quaternions q and p.
1420
+ * Multiplies values on either side of the operator.
1421
+ *
1422
+ * Rule of quaternion multiplication:
1423
+ * \f[
1424
+ * \begin{equation}
1425
+ * \begin{split}
1426
+ * p * q &= [p_0, \boldsymbol{u}]*[q_0, \boldsymbol{v}]\\
1427
+ * &=[p_0q_0 - \boldsymbol{u}\cdot \boldsymbol{v}, p_0\boldsymbol{v} +
1428
+ * q_0\boldsymbol{u}+ \boldsymbol{u}\times \boldsymbol{v}].
1429
+ * \end{split}
1430
+ * \end{equation}
1431
+ * \f]
1432
+ * where \f$\cdot\f$ means dot product and \f$\times \f$ means cross product.
1433
+ *
1434
+ * For example
1435
+ * ```
1436
+ * Quatd p{1, 2, 3, 4};
1437
+ * Quatd q{5, 6, 7, 8};
1438
+ * std::cout << p * q << std::endl; //[-60, 12, 30, 24]
1439
+ * ```
1440
+ */
1441
+ Quat<_Tp> operator*(const Quat<_Tp> &) const;
1442
+
1443
+ /**
1444
+ * @brief Division operator of a quaternions and a scalar.
1445
+ * It divides left operand with the right operand and assign the result to
1446
+ * left operand.
1447
+ *
1448
+ * Rule of quaternion division with a scalar:
1449
+ * \f[
1450
+ * \begin{equation}
1451
+ * \begin{split}
1452
+ * p / s &= [w, x, y, z] / s\\
1453
+ * &=[w/s, x/s, y/s, z/s].
1454
+ * \end{split}
1455
+ * \end{equation}
1456
+ * \f]
1457
+ *
1458
+ * For example
1459
+ * ```
1460
+ * Quatd p{1, 2, 3, 4};
1461
+ * double s = 2.0;
1462
+ * p /= s; // equivalent to p = p / s
1463
+ * std::cout << p << std::endl; //[0.5, 1, 1.5, 2]
1464
+ * ```
1465
+ * @note the type of scalar should be equal to this quaternion.
1466
+ */
1467
+ Quat<_Tp> operator/(const _Tp s) const;
1468
+
1469
+ /**
1470
+ * @brief Division operator of two quaternions p and q.
1471
+ * Divides left hand operand by right hand operand.
1472
+ *
1473
+ * Rule of quaternion division with a scalar:
1474
+ * \f[
1475
+ * \begin{equation}
1476
+ * \begin{split}
1477
+ * p / q &= p * q.inv()\\
1478
+ * \end{split}
1479
+ * \end{equation}
1480
+ * \f]
1481
+ *
1482
+ * For example
1483
+ * ```
1484
+ * Quatd p{1, 2, 3, 4};
1485
+ * Quatd q{5, 6, 7, 8};
1486
+ * std::cout << p / q << std::endl; // equivalent to p * q.inv()
1487
+ * ```
1488
+ */
1489
+ Quat<_Tp> operator/(const Quat<_Tp> &) const;
1490
+
1491
+ /**
1492
+ * @brief Division assignment operator of a quaternions and a scalar.
1493
+ * It divides left operand with the right operand and assign the result to
1494
+ * left operand.
1495
+ *
1496
+ * Rule of quaternion division with a scalar:
1497
+ * \f[
1498
+ * \begin{equation}
1499
+ * \begin{split}
1500
+ * p / s &= [w, x, y, z] / s\\
1501
+ * &=[w / s, x / s, y / s, z / s].
1502
+ * \end{split}
1503
+ * \end{equation}
1504
+ * \f]
1505
+ *
1506
+ * For example
1507
+ * ```
1508
+ * Quatd p{1, 2, 3, 4};
1509
+ * double s = 2.0;;
1510
+ * p /= s; // equivalent to p = p / s
1511
+ * std::cout << p << std::endl; //[0.5, 1.0, 1.5, 2.0]
1512
+ * ```
1513
+ * @note the type of scalar should be equal to the quaternion.
1514
+ */
1515
+ Quat<_Tp> &operator/=(const _Tp s);
1516
+
1517
+ /**
1518
+ * @brief Division assignment operator of two quaternions p and q;
1519
+ * It divides left operand with the right operand and assign the result to
1520
+ * left operand.
1521
+ *
1522
+ * Rule of quaternion division with a quaternion:
1523
+ * \f[
1524
+ * \begin{equation}
1525
+ * \begin{split}
1526
+ * p / q&= p * q.inv()\\
1527
+ * \end{split}
1528
+ * \end{equation}
1529
+ * \f]
1530
+ *
1531
+ * For example
1532
+ * ```
1533
+ * Quatd p{1, 2, 3, 4};
1534
+ * Quatd q{5, 6, 7, 8};
1535
+ * p /= q; // equivalent to p = p * q.inv()
1536
+ * std::cout << p << std::endl;
1537
+ * ```
1538
+ */
1539
+ Quat<_Tp> &operator/=(const Quat<_Tp> &);
1540
+
1541
+ _Tp &operator[](std::size_t n);
1542
+
1543
+ const _Tp &operator[](std::size_t n) const;
1544
+
1545
+ /**
1546
+ * @brief Subtraction operator of a scalar and a quaternions.
1547
+ * Subtracts right hand operand from left hand operand.
1548
+ *
1549
+ * For example
1550
+ * ```
1551
+ * Quatd p{1, 2, 3, 4};
1552
+ * double scalar = 2.0;
1553
+ * std::cout << scalar - p << std::endl; //[1.0, -2, -3, -4]
1554
+ * ```
1555
+ * @note the type of scalar should be equal to the quaternion.
1556
+ */
1557
+ template <typename T>
1558
+ friend Quat<T> cv::operator-(const T s, const Quat<T> &);
1559
+
1560
+ /**
1561
+ * @brief Subtraction operator of a quaternions and a scalar.
1562
+ * Subtracts right hand operand from left hand operand.
1563
+ *
1564
+ * For example
1565
+ * ```
1566
+ * Quatd p{1, 2, 3, 4};
1567
+ * double scalar = 2.0;
1568
+ * std::cout << p - scalar << std::endl; //[-1.0, 2, 3, 4]
1569
+ * ```
1570
+ * @note the type of scalar should be equal to the quaternion.
1571
+ */
1572
+ template <typename T>
1573
+ friend Quat<T> cv::operator-(const Quat<T> &, const T s);
1574
+
1575
+ /**
1576
+ * @brief Addition operator of a quaternions and a scalar.
1577
+ * Adds right hand operand from left hand operand.
1578
+ *
1579
+ * For example
1580
+ * ```
1581
+ * Quatd p{1, 2, 3, 4};
1582
+ * double scalar = 2.0;
1583
+ * std::cout << scalar + p << std::endl; //[3.0, 2, 3, 4]
1584
+ * ```
1585
+ * @note the type of scalar should be equal to the quaternion.
1586
+ */
1587
+ template <typename T>
1588
+ friend Quat<T> cv::operator+(const T s, const Quat<T> &);
1589
+
1590
+ /**
1591
+ * @brief Addition operator of a quaternions and a scalar.
1592
+ * Adds right hand operand from left hand operand.
1593
+ *
1594
+ * For example
1595
+ * ```
1596
+ * Quatd p{1, 2, 3, 4};
1597
+ * double scalar = 2.0;
1598
+ * std::cout << p + scalar << std::endl; //[3.0, 2, 3, 4]
1599
+ * ```
1600
+ * @note the type of scalar should be equal to the quaternion.
1601
+ */
1602
+ template <typename T>
1603
+ friend Quat<T> cv::operator+(const Quat<T> &, const T s);
1604
+
1605
+ /**
1606
+ * @brief Multiplication operator of a scalar and a quaternions.
1607
+ * It multiplies right operand with the left operand and assign the result to
1608
+ * left operand.
1609
+ *
1610
+ * Rule of quaternion multiplication with a scalar:
1611
+ * \f[
1612
+ * \begin{equation}
1613
+ * \begin{split}
1614
+ * p * s &= [w, x, y, z] * s\\
1615
+ * &=[w * s, x * s, y * s, z * s].
1616
+ * \end{split}
1617
+ * \end{equation}
1618
+ * \f]
1619
+ *
1620
+ * For example
1621
+ * ```
1622
+ * Quatd p{1, 2, 3, 4};
1623
+ * double s = 2.0;
1624
+ * std::cout << s * p << std::endl; //[2.0, 4.0, 6.0, 8.0]
1625
+ * ```
1626
+ * @note the type of scalar should be equal to the quaternion.
1627
+ */
1628
+ template <typename T>
1629
+ friend Quat<T> cv::operator*(const T s, const Quat<T> &);
1630
+
1631
+ /**
1632
+ * @brief Multiplication operator of a quaternion and a scalar.
1633
+ * It multiplies right operand with the left operand and assign the result to
1634
+ * left operand.
1635
+ *
1636
+ * Rule of quaternion multiplication with a scalar:
1637
+ * \f[
1638
+ * \begin{equation}
1639
+ * \begin{split}
1640
+ * p * s &= [w, x, y, z] * s\\
1641
+ * &=[w * s, x * s, y * s, z * s].
1642
+ * \end{split}
1643
+ * \end{equation}
1644
+ * \f]
1645
+ *
1646
+ * For example
1647
+ * ```
1648
+ * Quatd p{1, 2, 3, 4};
1649
+ * double s = 2.0;
1650
+ * std::cout << p * s << std::endl; //[2.0, 4.0, 6.0, 8.0]
1651
+ * ```
1652
+ * @note the type of scalar should be equal to the quaternion.
1653
+ */
1654
+ template <typename T>
1655
+ friend Quat<T> cv::operator*(const Quat<T> &, const T s);
1656
+
1657
+ template <typename S>
1658
+ friend std::ostream &cv::operator<<(std::ostream &, const Quat<S> &);
1659
+
1660
+ /**
1661
+ * @brief Transform a quaternion q to Euler angles.
1662
+ *
1663
+ *
1664
+ * When transforming a quaternion \f$q = w + x\boldsymbol{i} + y\boldsymbol{j}
1665
+ * + z\boldsymbol{k}\f$ to Euler angles, rotation matrix M can be calculated
1666
+ * by:
1667
+ * \f[ \begin{aligned} {M}
1668
+ * &={\begin{bmatrix}1-2(y^{2}+z^{2})&2(xy-zx)&2(xz+yw)\\2(xy+zw)&1-2(x^{2}+z^{2})&2(yz-xw)\\2(xz-yw)&2(yz+xw)&1-2(x^{2}+y^{2})\end{bmatrix}}\end{aligned}.\f]
1669
+ * On the other hand, the rotation matrix can be obtained from Euler angles.
1670
+ * Using intrinsic rotations with Euler angles type XYZ as an example,
1671
+ * \f$\theta_1 \f$, \f$\theta_2 \f$, \f$\theta_3 \f$ are three angles for
1672
+ * Euler angles, the rotation matrix R can be calculated by:\f[R
1673
+ * =X(\theta_1)Y(\theta_2)Z(\theta_3)
1674
+ * ={\begin{bmatrix}\cos\theta_{2}\cos\theta_{3}&-\cos\theta_{2}\sin\theta_{3}&\sin\theta_{2}\\\cos\theta_{1}\sin\theta_{3}+\cos\theta_{3}\sin\theta_{1}\sin\theta_{2}&\cos\theta_{1}\cos\theta_{3}-\sin\theta_{1}\sin\theta_{2}\sin\theta_{3}&-\cos\theta_{2}\sin\theta_{1}\\\sin\theta_{1}\sin\theta_{3}-\cos\theta_{1}\cos\theta_{3}\sin\theta_{2}&\cos\theta_{3}\sin\theta_{1}+\cos\theta_{1}\sin\theta_{2}\sin\theta_{3}&\cos\theta_{1}\cos_{2}\end{bmatrix}}\f]
1675
+ * Rotation matrix M and R are equal. As long as \f$ s_{2} \neq 1 \f$, by
1676
+ * comparing each element of two matrices ,the solution is\f$\begin{cases}
1677
+ * \theta_1 = \arctan2(-m_{23},m_{33})\\\theta_2 = arcsin(m_{13}) \\\theta_3 =
1678
+ * \arctan2(-m_{12},m_{11}) \end{cases}\f$.
1679
+ *
1680
+ * When \f$ s_{2}=1\f$ or \f$ s_{2}=-1\f$, the gimbal lock occurs. The
1681
+ * function will prompt "WARNING: Gimbal Lock will occur. Euler angles is
1682
+ * non-unique. For intrinsic rotations, we set the third angle to 0, and for
1683
+ * external rotation, we set the first angle to 0.".
1684
+ *
1685
+ * When \f$ s_{2}=1\f$ ,
1686
+ * The rotation matrix R is \f$R =
1687
+ * {\begin{bmatrix}0&0&1\\\sin(\theta_1+\theta_3)&\cos(\theta_1+\theta_3)&0\\-\cos(\theta_1+\theta_3)&\sin(\theta_1+\theta_3)&0\end{bmatrix}}\f$.
1688
+ *
1689
+ * The number of solutions is infinite with the condition \f$\begin{cases}
1690
+ * \theta_1+\theta_3 = \arctan2(m_{21},m_{22})\\ \theta_2=\pi/2
1691
+ * \end{cases}\ \f$.
1692
+ *
1693
+ * We set \f$ \theta_3 = 0\f$, the solution is \f$\begin{cases}
1694
+ * \theta_1=\arctan2(m_{21},m_{22})\\ \theta_2=\pi/2\\ \theta_3=0
1695
+ * \end{cases}\f$.
1696
+ *
1697
+ * When \f$ s_{2}=-1\f$,
1698
+ * The rotation matrix R is
1699
+ * \f$X_{1}Y_{2}Z_{3}={\begin{bmatrix}0&0&-1\\-\sin(\theta_1-\theta_3)&\cos(\theta_1-\theta_3)&0\\\cos(\theta_1-\theta_3)&\sin(\theta_1-\theta_3)&0\end{bmatrix}}\f$.
1700
+ *
1701
+ * The number of solutions is infinite with the condition \f$\begin{cases}
1702
+ * \theta_1+\theta_3 = \arctan2(m_{32},m_{22})\\ \theta_2=\pi/2
1703
+ * \end{cases}\ \f$.
1704
+ *
1705
+ * We set \f$ \theta_3 = 0\f$, the solution is \f$
1706
+ * \begin{cases}\theta_1=\arctan2(m_{32},m_{22})
1707
+ * \\ \theta_2=-\pi/2\\ \theta_3=0\end{cases}\f$.
1708
+ *
1709
+ * Since \f$ sin \theta\in [-1,1] \f$ and \f$ cos \theta \in [-1,1] \f$, the
1710
+ * unnormalized quaternion will cause computational troubles. For this reason,
1711
+ * this function will normalize the quaternion at first and @ref
1712
+ * QuatAssumeType is not needed.
1713
+ *
1714
+ * When the gimbal lock occurs, we set \f$\theta_3 = 0\f$ for intrinsic
1715
+ * rotations or \f$\theta_1 = 0\f$ for extrinsic rotations.
1716
+ *
1717
+ * As a result, for every Euler angles type, we can get solution as shown in
1718
+ * the following table. EulerAnglesType | Ordinary | \f$\theta_2 = π/2\f$ |
1719
+ * \f$\theta_2 = -π/2\f$
1720
+ * ------------- | -------------| -------------| -------------
1721
+ * INT_XYZ|\f$ \theta_1 = \arctan2(-m_{23},m_{33})\\\theta_2 = \arcsin(m_{13})
1722
+ * \\\theta_3= \arctan2(-m_{12},m_{11}) \f$|\f$
1723
+ * \theta_1=\arctan2(m_{21},m_{22})\\ \theta_2=\pi/2\\ \theta_3=0 \f$|\f$
1724
+ * \theta_1=\arctan2(m_{32},m_{22})\\ \theta_2=-\pi/2\\ \theta_3=0 \f$
1725
+ * INT_XZY|\f$ \theta_1 = \arctan2(m_{32},m_{22})\\\theta_2 = -\arcsin(m_{12})
1726
+ * \\\theta_3= \arctan2(m_{13},m_{11}) \f$|\f$
1727
+ * \theta_1=\arctan2(m_{31},m_{33})\\ \theta_2=\pi/2\\ \theta_3=0 \f$|\f$
1728
+ * \theta_1=\arctan2(-m_{23},m_{33})\\ \theta_2=-\pi/2\\ \theta_3=0 \f$
1729
+ * INT_YXZ|\f$ \theta_1 = \arctan2(m_{13},m_{33})\\\theta_2 = -\arcsin(m_{23})
1730
+ * \\\theta_3= \arctan2(m_{21},m_{22}) \f$|\f$
1731
+ * \theta_1=\arctan2(m_{12},m_{11})\\ \theta_2=\pi/2\\ \theta_3=0 \f$|\f$
1732
+ * \theta_1=\arctan2(-m_{12},m_{11})\\ \theta_2=-\pi/2\\ \theta_3=0 \f$
1733
+ * INT_YZX|\f$ \theta_1 = \arctan2(-m_{31},m_{11})\\\theta_2 = \arcsin(m_{21})
1734
+ * \\\theta_3= \arctan2(-m_{23},m_{22}) \f$|\f$
1735
+ * \theta_1=\arctan2(m_{13},m_{33})\\ \theta_2=\pi/2\\ \theta_3=0 \f$|\f$
1736
+ * \theta_1=\arctan2(m_{13},m_{12})\\ \theta_2=-\pi/2\\ \theta_3=0 \f$
1737
+ * INT_ZXY|\f$ \theta_1 = \arctan2(-m_{12},m_{22})\\\theta_2 = \arcsin(m_{32})
1738
+ * \\\theta_3= \arctan2(-m_{31},m_{33}) \f$|\f$
1739
+ * \theta_1=\arctan2(m_{21},m_{11})\\ \theta_2=\pi/2\\ \theta_3=0 \f$|\f$
1740
+ * \theta_1=\arctan2(m_{21},m_{11})\\ \theta_2=-\pi/2\\ \theta_3=0 \f$
1741
+ * INT_ZYX|\f$ \theta_1 = \arctan2(m_{21},m_{11})\\\theta_2 = \arcsin(-m_{31})
1742
+ * \\\theta_3= \arctan2(m_{32},m_{33}) \f$|\f$
1743
+ * \theta_1=\arctan2(m_{23},m_{22})\\ \theta_2=\pi/2\\ \theta_3=0 \f$|\f$
1744
+ * \theta_1=\arctan2(-m_{12},m_{22})\\ \theta_2=-\pi/2\\ \theta_3=0 \f$
1745
+ * EXT_XYZ|\f$ \theta_1 = \arctan2(m_{32},m_{33})\\\theta_2 = \arcsin(-m_{31})
1746
+ * \\\ \theta_3 = \arctan2(m_{21},m_{11})\f$|\f$ \theta_1=
1747
+ * 0\\ \theta_2=\pi/2\\ \theta_3=\arctan2(m_{23},m_{22}) \f$|\f$
1748
+ * \theta_1=0\\ \theta_2=-\pi/2\\ \theta_3=\arctan2(-m_{12},m_{22}) \f$
1749
+ * EXT_XZY|\f$ \theta_1 = \arctan2(-m_{23},m_{22})\\\theta_2 = \arcsin(m_{21})
1750
+ * \\\theta_3= \arctan2(-m_{31},m_{11})\f$|\f$ \theta_1=
1751
+ * 0\\ \theta_2=\pi/2\\ \theta_3=\arctan2(m_{13},m_{33}) \f$|\f$
1752
+ * \theta_1=0\\ \theta_2=-\pi/2\\ \theta_3=\arctan2(m_{13},m_{12}) \f$
1753
+ * EXT_YXZ|\f$ \theta_1 = \arctan2(-m_{31},m_{33}) \\\theta_2 =
1754
+ * \arcsin(m_{32}) \\\theta_3= \arctan2(-m_{12},m_{22})\f$|\f$ \theta_1=
1755
+ * 0\\ \theta_2=\pi/2\\ \theta_3=\arctan2(m_{21},m_{11}) \f$|\f$
1756
+ * \theta_1=0\\ \theta_2=-\pi/2\\ \theta_3=\arctan2(m_{21},m_{11}) \f$
1757
+ * EXT_YZX|\f$ \theta_1 = \arctan2(m_{13},m_{11})\\\theta_2 = -\arcsin(m_{12})
1758
+ * \\\theta_3= \arctan2(m_{32},m_{22})\f$|\f$ \theta_1=
1759
+ * 0\\ \theta_2=\pi/2\\ \theta_3=\arctan2(m_{31},m_{33}) \f$|\f$
1760
+ * \theta_1=0\\ \theta_2=-\pi/2\\ \theta_3=\arctan2(-m_{23},m_{33}) \f$
1761
+ * EXT_ZXY|\f$ \theta_1 = \arctan2(m_{21},m_{22})\\\theta_2 = -\arcsin(m_{23})
1762
+ * \\\theta_3= \arctan2(m_{13},m_{33})\f$|\f$ \theta_1=
1763
+ * 0\\ \theta_2=\pi/2\\ \theta_3=\arctan2(m_{12},m_{11}) \f$|\f$ \theta_1=
1764
+ * 0\\ \theta_2=-\pi/2\\ \theta_3=\arctan2(-m_{12},m_{11}) \f$ EXT_ZYX|\f$
1765
+ * \theta_1 = \arctan2(-m_{12},m_{11})\\\theta_2 = \arcsin(m_{13}) \\\theta_3=
1766
+ * \arctan2(-m_{23},m_{33})\f$|\f$
1767
+ * \theta_1=0\\ \theta_2=\pi/2\\ \theta_3=\arctan2(m_{21},m_{22}) \f$|\f$
1768
+ * \theta_1=0\\ \theta_2=-\pi/2\\ \theta_3=\arctan2(m_{32},m_{22}) \f$
1769
+ *
1770
+ * EulerAnglesType | Ordinary | \f$\theta_2 = 0\f$ | \f$\theta_2 = π\f$
1771
+ * ------------- | -------------| -------------| -------------
1772
+ * INT_XYX| \f$ \theta_1 = \arctan2(m_{21},-m_{31})\\\theta_2 =\arccos(m_{11})
1773
+ * \\\theta_3 = \arctan2(m_{12},m_{13}) \f$| \f$
1774
+ * \theta_1=\arctan2(m_{32},m_{33})\\ \theta_2=0\\ \theta_3=0 \f$| \f$
1775
+ * \theta_1=\arctan2(m_{23},m_{22})\\ \theta_2=\pi\\ \theta_3=0 \f$ INT_XZX|
1776
+ * \f$ \theta_1 = \arctan2(m_{31},m_{21})\\\theta_2 = \arccos(m_{11})
1777
+ * \\\theta_3 = \arctan2(m_{13},-m_{12}) \f$| \f$
1778
+ * \theta_1=\arctan2(m_{32},m_{33})\\ \theta_2=0\\ \theta_3=0 \f$| \f$
1779
+ * \theta_1=\arctan2(-m_{32},m_{33})\\ \theta_2=\pi\\ \theta_3=0 \f$ INT_YXY|
1780
+ * \f$ \theta_1 = \arctan2(m_{12},m_{32})\\\theta_2 = \arccos(m_{22})
1781
+ * \\\theta_3 = \arctan2(m_{21},-m_{23}) \f$| \f$
1782
+ * \theta_1=\arctan2(m_{13},m_{11})\\ \theta_2=0\\ \theta_3=0 \f$| \f$
1783
+ * \theta_1=\arctan2(-m_{31},m_{11})\\ \theta_2=\pi\\ \theta_3=0 \f$ INT_YZY|
1784
+ * \f$ \theta_1 = \arctan2(m_{32},-m_{12})\\\theta_2 = \arccos(m_{22})
1785
+ * \\\theta_3 =\arctan2(m_{23},m_{21}) \f$| \f$
1786
+ * \theta_1=\arctan2(m_{13},m_{11})\\ \theta_2=0\\ \theta_3=0 \f$| \f$
1787
+ * \theta_1=\arctan2(m_{13},-m_{11})\\ \theta_2=\pi\\ \theta_3=0 \f$ INT_ZXZ|
1788
+ * \f$ \theta_1 = \arctan2(-m_{13},m_{23})\\\theta_2 = \arccos(m_{33})
1789
+ * \\\theta_3 =\arctan2(m_{31},m_{32}) \f$| \f$
1790
+ * \theta_1=\arctan2(m_{21},m_{22})\\ \theta_2=0\\ \theta_3=0 \f$| \f$
1791
+ * \theta_1=\arctan2(m_{21},m_{11})\\ \theta_2=\pi\\ \theta_3=0 \f$ INT_ZYZ|
1792
+ * \f$ \theta_1 = \arctan2(m_{23},m_{13})\\\theta_2 = \arccos(m_{33})
1793
+ * \\\theta_3 = \arctan2(m_{32},-m_{31}) \f$| \f$
1794
+ * \theta_1=\arctan2(m_{21},m_{11})\\ \theta_2=0\\ \theta_3=0 \f$| \f$
1795
+ * \theta_1=\arctan2(m_{21},m_{11})\\ \theta_2=\pi\\ \theta_3=0 \f$ EXT_XYX|
1796
+ * \f$ \theta_1 = \arctan2(m_{12},m_{13}) \\\theta_2 = \arccos(m_{11})
1797
+ * \\\theta_3 = \arctan2(m_{21},-m_{31})\f$| \f$
1798
+ * \theta_1=0\\ \theta_2=0\\ \theta_3=\arctan2(m_{32},m_{33}) \f$| \f$
1799
+ * \theta_1= 0\\ \theta_2=\pi\\ \theta_3= \arctan2(m_{23},m_{22}) \f$ EXT_XZX|
1800
+ * \f$ \theta_1 = \arctan2(m_{13},-m_{12})\\\theta_2 = \arccos(m_{11})
1801
+ * \\\theta_3 = \arctan2(m_{31},m_{21})\f$| \f$ \theta_1=
1802
+ * 0\\ \theta_2=0\\ \theta_3=\arctan2(m_{32},m_{33}) \f$| \f$ \theta_1=
1803
+ * 0\\ \theta_2=\pi\\ \theta_3=\arctan2(-m_{32},m_{33}) \f$ EXT_YXY| \f$
1804
+ * \theta_1 = \arctan2(m_{21},-m_{23})\\\theta_2 = \arccos(m_{22}) \\\theta_3
1805
+ * = \arctan2(m_{12},m_{32}) \f$| \f$ \theta_1=
1806
+ * 0\\ \theta_2=0\\ \theta_3=\arctan2(m_{13},m_{11}) \f$| \f$ \theta_1=
1807
+ * 0\\ \theta_2=\pi\\ \theta_3=\arctan2(-m_{31},m_{11}) \f$ EXT_YZY| \f$
1808
+ * \theta_1 = \arctan2(m_{23},m_{21}) \\\theta_2 = \arccos(m_{22}) \\\theta_3
1809
+ * = \arctan2(m_{32},-m_{12}) \f$| \f$ \theta_1=
1810
+ * 0\\ \theta_2=0\\ \theta_3=\arctan2(m_{13},m_{11}) \f$| \f$
1811
+ * \theta_1=0\\ \theta_2=\pi\\ \theta_3=\arctan2(m_{13},-m_{11}) \f$ EXT_ZXZ|
1812
+ * \f$ \theta_1 = \arctan2(m_{31},m_{32}) \\\theta_2 = \arccos(m_{33})
1813
+ * \\\theta_3 = \arctan2(-m_{13},m_{23})\f$| \f$
1814
+ * \theta_1=0\\ \theta_2=0\\ \theta_3=\arctan2(m_{21},m_{22}) \f$| \f$
1815
+ * \theta_1= 0\\ \theta_2=\pi\\ \theta_3=\arctan2(m_{21},m_{11}) \f$ EXT_ZYZ|
1816
+ * \f$ \theta_1 = \arctan2(m_{32},-m_{31})\\\theta_2 = \arccos(m_{33})
1817
+ * \\\theta_3 = \arctan2(m_{23},m_{13}) \f$| \f$
1818
+ * \theta_1=0\\ \theta_2=0\\ \theta_3=\arctan2(m_{21},m_{11}) \f$| \f$
1819
+ * \theta_1= 0\\ \theta_2=\pi\\ \theta_3=\arctan2(m_{21},m_{11}) \f$
1820
+ *
1821
+ * @param eulerAnglesType the convertion Euler angles type
1822
+ */
1823
+
1824
+ Vec<_Tp, 3> toEulerAngles(QuatEnum::EulerAnglesType eulerAnglesType);
1825
+
1826
+ _Tp w, x, y, z;
1827
+ };
1828
+
1829
+ template <typename T>
1830
+ Quat<T> inv(const Quat<T> &q, QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1831
+
1832
+ template <typename T> Quat<T> sinh(const Quat<T> &q);
1833
+
1834
+ template <typename T> Quat<T> cosh(const Quat<T> &q);
1835
+
1836
+ template <typename T> Quat<T> tanh(const Quat<T> &q);
1837
+
1838
+ template <typename T> Quat<T> sin(const Quat<T> &q);
1839
+
1840
+ template <typename T> Quat<T> cos(const Quat<T> &q);
1841
+
1842
+ template <typename T> Quat<T> tan(const Quat<T> &q);
1843
+
1844
+ template <typename T> Quat<T> asinh(const Quat<T> &q);
1845
+
1846
+ template <typename T> Quat<T> acosh(const Quat<T> &q);
1847
+
1848
+ template <typename T> Quat<T> atanh(const Quat<T> &q);
1849
+
1850
+ template <typename T> Quat<T> asin(const Quat<T> &q);
1851
+
1852
+ template <typename T> Quat<T> acos(const Quat<T> &q);
1853
+
1854
+ template <typename T> Quat<T> atan(const Quat<T> &q);
1855
+
1856
+ template <typename T>
1857
+ Quat<T> power(const Quat<T> &q, const Quat<T> &p,
1858
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1859
+
1860
+ template <typename T> Quat<T> exp(const Quat<T> &q);
1861
+
1862
+ template <typename T>
1863
+ Quat<T> log(const Quat<T> &q, QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1864
+
1865
+ template <typename T>
1866
+ Quat<T> power(const Quat<T> &q, const T x,
1867
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1868
+
1869
+ template <typename T> Quat<T> crossProduct(const Quat<T> &p, const Quat<T> &q);
1870
+
1871
+ template <typename S>
1872
+ Quat<S> sqrt(const Quat<S> &q,
1873
+ QuatAssumeType assumeUnit = QUAT_ASSUME_NOT_UNIT);
1874
+
1875
+ template <typename T> Quat<T> operator*(const T, const Quat<T> &);
1876
+
1877
+ template <typename T> Quat<T> operator*(const Quat<T> &, const T);
1878
+
1879
+ template <typename S> std::ostream &operator<<(std::ostream &, const Quat<S> &);
1880
+
1881
+ using Quatd = Quat<double>;
1882
+ using Quatf = Quat<float>;
1883
+
1884
+ //! @} core
1885
+ } // namespace cv
1886
+
1887
+ #include "opencv2/core/quaternion.inl.hpp"
1888
+
1889
+ #endif /* OPENCV_CORE_QUATERNION_HPP */