You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
2.6 KiB

7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /** @file array.h
  2. ** @brief Array - Definition
  3. ** @author Andrea Vedaldi
  4. **/
  5. /*
  6. Copyright (C) 2007-12 Andrea Vedaldi and Brian Fulkerson.
  7. All rights reserved.
  8. This file is part of the VLFeat library and is made available under
  9. the terms of the BSD license (see the COPYING file).
  10. */
  11. #ifndef VL_ARRAY_H
  12. #define VL_ARRAY_H
  13. #include "generic.h"
  14. /** @brief Maximum number of array dimensions */
  15. #define VL_ARRAY_MAX_NUM_DIMENSIONS 16
  16. /** @brief Numeric array */
  17. typedef struct _VlArray
  18. {
  19. vl_type type ;
  20. vl_bool isEnvelope ;
  21. vl_bool isSparse ;
  22. vl_size numDimensions ;
  23. vl_size dimensions [VL_ARRAY_MAX_NUM_DIMENSIONS] ;
  24. void * data ;
  25. void * rowPointers ;
  26. void * columnPointers ;
  27. } VlArray ;
  28. /** @name Get data and parameters
  29. ** @{ */
  30. /** @brief Get number of dimensions
  31. ** @param self array.
  32. ** @return number of dimensions.
  33. **/
  34. VL_INLINE vl_size
  35. vl_array_get_num_dimensions (VlArray const * self)
  36. {
  37. return self->numDimensions ;
  38. }
  39. /** @brief Get dimensions
  40. ** @param self array.
  41. ** @return dimensions.
  42. **/
  43. VL_INLINE vl_size const *
  44. vl_array_get_dimensions (VlArray const * self)
  45. {
  46. return self->dimensions ;
  47. }
  48. /** @brief Get data
  49. ** @param self array.
  50. ** @return data.
  51. **/
  52. VL_INLINE void *
  53. vl_array_get_data (VlArray const * self)
  54. {
  55. return self->data;
  56. }
  57. /** @brief Get type
  58. ** @param self array.
  59. ** @return type.
  60. **/
  61. VL_INLINE vl_type
  62. vl_array_get_data_type (VlArray const * self)
  63. {
  64. return self->type ;
  65. }
  66. VL_EXPORT vl_size vl_array_get_num_elements (VlArray const * self) ;
  67. /** @{ */
  68. /** @name Constructing and destroying
  69. ** @{ */
  70. VL_EXPORT VlArray * vl_array_init (VlArray * self, vl_type type, vl_size numDimension, vl_size const * dimensions) ;
  71. VL_EXPORT VlArray * vl_array_init_envelope (VlArray *self, void * data, vl_type type, vl_size numDimension, vl_size const * dimensions) ;
  72. VL_EXPORT VlArray * vl_array_init_matrix (VlArray * self, vl_type type, vl_size numRows, vl_size numColumns) ;
  73. VL_EXPORT VlArray * vl_array_init_matrix_envelope (VlArray * self, void * data, vl_type type, vl_size numRows, vl_size numColumns) ;
  74. VL_EXPORT VlArray * vl_array_new (vl_type type, vl_size numDimension, vl_size const * dimensions) ;
  75. VL_EXPORT VlArray * vl_array_new_envelope (void * data, vl_type type, vl_size numDimension, vl_size const * dimensions) ;
  76. VL_EXPORT VlArray * vl_array_new_matrix (vl_type type, vl_size numRows, vl_size numColumns) ;
  77. VL_EXPORT VlArray * vl_array_new_matrix_envelope (void * data, vl_type type, vl_size numRows, vl_size numColumns) ;
  78. VL_EXPORT void vl_array_dealloc (VlArray * self) ;
  79. VL_EXPORT void vl_array_delete (VlArray * self) ;
  80. /** @} */
  81. /* VL_ARRAY_H */
  82. #endif