arm_svm_polynomial_init_f32.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* ----------------------------------------------------------------------
  2. * Project: CMSIS DSP Library
  3. * Title: arm_svm_polynomial_init_f32.c
  4. * Description: SVM Polynomial 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. * @addtogroup groupSVM
  31. * @{
  32. */
  33. /**
  34. * @brief SVM polynomial instance init function
  35. *
  36. * Classes are integer used as output of the function (instead of having -1,1
  37. * as class values).
  38. *
  39. * @param[in] S points to an instance of the polynomial SVM structure.
  40. * @param[in] nbOfSupportVectors Number of support vectors
  41. * @param[in] vectorDimension Dimension of vector space
  42. * @param[in] intercept Intercept
  43. * @param[in] dualCoefficients Array of dual coefficients
  44. * @param[in] supportVectors Array of support vectors
  45. * @param[in] classes Array of 2 classes ID
  46. * @param[in] degree Polynomial degree
  47. * @param[in] coef0 coeff0 (scikit-learn terminology)
  48. * @param[in] gamma gamma (scikit-learn terminology)
  49. * @return none.
  50. *
  51. */
  52. void arm_svm_polynomial_init_f32(arm_svm_polynomial_instance_f32 *S,
  53. uint32_t nbOfSupportVectors,
  54. uint32_t vectorDimension,
  55. float32_t intercept,
  56. const float32_t *dualCoefficients,
  57. const float32_t *supportVectors,
  58. const int32_t *classes,
  59. int32_t degree,
  60. float32_t coef0,
  61. float32_t gamma
  62. )
  63. {
  64. S->nbOfSupportVectors = nbOfSupportVectors;
  65. S->vectorDimension = vectorDimension;
  66. S->intercept = intercept;
  67. S->dualCoefficients = dualCoefficients;
  68. S->supportVectors = supportVectors;
  69. S->classes = classes;
  70. S->degree = degree;
  71. S->coef0 = coef0;
  72. S->gamma = gamma;
  73. }
  74. /**
  75. * @} end of groupSVM group
  76. */