arm_svm_linear_init_f32.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_svm_linear_init_f32.c
  4. * Description: SVM Linear Instance Initialization
  5. *
  6. *
  7. * Target Processor: Cortex-M and Cortex-A cores
  8. * -------------------------------------------------------------------- */
  9. /*
  10. * Copyright (C) 2010-2019 ARM Limited or its affiliates. All rights reserved.
  11. *
  12. * SPDX-License-Identifier: Apache-2.0
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the License); you may
  15. * not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at
  17. *
  18. * www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  22. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. */
  26. #include "arm_math.h"
  27. #include <limits.h>
  28. #include <math.h>
  29. /**
  30. * @defgroup groupSVM SVM Functions
  31. *
  32. */
  33. /**
  34. * @addtogroup groupSVM
  35. * @{
  36. */
  37. /**
  38. * @brief SVM linear instance init function
  39. *
  40. * Classes are integer used as output of the function (instead of having -1,1
  41. * as class values).
  42. *
  43. * @param[in] S Parameters for the SVM function
  44. * @param[in] nbOfSupportVectors Number of support vectors
  45. * @param[in] vectorDimension Dimension of vector space
  46. * @param[in] intercept Intercept
  47. * @param[in] dualCoefficients Array of dual coefficients
  48. * @param[in] supportVectors Array of support vectors
  49. * @param[in] classes Array of 2 classes ID
  50. * @return none.
  51. *
  52. */
  53. void arm_svm_linear_init_f32(arm_svm_linear_instance_f32 *S,
  54. uint32_t nbOfSupportVectors,
  55. uint32_t vectorDimension,
  56. float32_t intercept,
  57. const float32_t *dualCoefficients,
  58. const float32_t *supportVectors,
  59. const int32_t *classes)
  60. {
  61. S->nbOfSupportVectors = nbOfSupportVectors;
  62. S->vectorDimension = vectorDimension;
  63. S->intercept = intercept;
  64. S->dualCoefficients = dualCoefficients;
  65. S->supportVectors = supportVectors;
  66. S->classes = classes;
  67. }
  68. /**
  69. * @} end of groupSVM group
  70. */