Source: eclairjs/ml/linalg/Vector.js

  1. /*
  2. * Copyright 2016 IBM Corp.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. (function () {
  17. /**
  18. * Represents a numeric vector, whose index type is Int and value type is Double.
  19. *
  20. * Note: Users should not implement this interface.
  21. * @classdesc
  22. * @constructor Vector
  23. * @abstract
  24. * @memberof module:eclairjs/ml/linalg
  25. */
  26. var Vector = Java.type('org.eclairjs.nashorn.wrap.ml.linalg.DenseVector');
  27. /**
  28. * Size of the vector.
  29. * @function
  30. * @name module:eclairjs/ml/linalg.Vector#size
  31. * @returns {integer}
  32. */
  33. /**
  34. * Converts the instance to a double array.
  35. * @function
  36. * @name module:eclairjs/ml/linalg.Vector#toArray
  37. * @returns {float[]}
  38. */
  39. /**
  40. * @function
  41. * @name module:eclairjs/ml/linalg.Vector#equals
  42. * @param {object} other
  43. * @returns {boolean}
  44. */
  45. /**
  46. *
  47. * Returns a hash code value for the vector. The hash code is based on its size and its first 128
  48. * nonzero entries, using a hash algorithm similar to {@link hashCode}.
  49. * @function
  50. * @name module:eclairjs/ml/linalg.Vector#hashCode
  51. * @returns {number}
  52. */
  53. /**
  54. * Gets the value of the ith element.
  55. * @function
  56. * @name module:eclairjs/ml/linalg.Vector#apply
  57. * @param {number} i index
  58. * @returns {number}
  59. */
  60. /**
  61. * Makes a deep copy of this vector.
  62. * @function
  63. * @name module:eclairjs/ml/linalg.Vector#copy
  64. * @returns {module:eclairjs/ml/linalg.Vector}
  65. */
  66. /**
  67. * Number of active entries. An "active entry" is an element which is explicitly stored,
  68. * regardless of its value. Note that inactive entries have value 0.
  69. * @function
  70. * @name module:eclairjs/ml/linalg.Vector#numActives
  71. * @returns {integer}
  72. */
  73. /**
  74. * Number of nonzero elements. This scans all active values and count nonzeros.
  75. * @function
  76. * @name module:eclairjs/ml/linalg.Vector#numNonzeros
  77. * @returns {integer}
  78. */
  79. /**
  80. * Converts this vector to a sparse vector with all explicit zeros removed.
  81. * @function
  82. * @name module:eclairjs/ml/linalg.Vector#toSparse
  83. * @returns {module:eclairjs/ml/linalg.SparseVector}
  84. */
  85. /**
  86. * Converts this vector to a dense vector.
  87. * @function
  88. * @name module:eclairjs/ml/linalg.Vector#toDense
  89. * @returns {module:eclairjs/ml/linalg.DenseVector}
  90. */
  91. /**
  92. * Returns a vector in either dense or sparse format, whichever uses less storage.
  93. * @function
  94. * @name module:eclairjs/ml/linalg.Vector#compressed
  95. * @returns {module:eclairjs/ml/linalg.Vector}
  96. */
  97. /**
  98. * Find the index of a maximal element. Returns the first maximal element in case of a tie.
  99. * Returns -1 if vector has length 0.
  100. * @function
  101. * @name module:eclairjs/ml/linalg.Vector#argmax
  102. * @returns {integer}
  103. */
  104. module.exports = Vector;
  105. })();