Source: eclairjs/mllib/linalg/SparseVector.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. //var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper');
  18. //var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger');
  19. //var Vector = require(EclairJS_Globals.NAMESPACE + '/mllib/linalg/Vector');
  20. /**
  21. * A sparse vector represented by an index array and an value array.
  22. *
  23. * @param size size of the vector.
  24. * @param indices index array, assume to be strictly increasing.
  25. * @param values value array, must have the same length as the index array.
  26. * @classdesc
  27. */
  28. /**
  29. * @param {integer} size
  30. * @param {integer[]} indices
  31. * @param {float[]} values
  32. * @class SparseVector
  33. * @memberof module:eclairjs/mllib/linalg
  34. * @extends module:eclairjs/mllib/linalg.Vector
  35. */
  36. var SparseVector = Java.type('org.eclairjs.nashorn.wrap.mllib.linalg.SparseVector');
  37. //var SparseVector = function () {
  38. //
  39. // this.logger = Logger.getLogger("SparseVector_js");
  40. // var jvmObj;
  41. // if (arguments[0] instanceof org.apache.spark.mllib.linalg.SparseVector) {
  42. // jvmObj = arguments[0];
  43. // } else {
  44. // jvmObj = new org.apache.spark.mllib.linalg.SparseVector(arguments[0], arguments[1], arguments[2]);
  45. //
  46. // }
  47. // Vector.call(this, jvmObj);
  48. //
  49. //};
  50. //
  51. //SparseVector.prototype = Object.create(Vector.prototype);
  52. //
  53. //SparseVector.prototype.constructor = SparseVector;
  54. /**
  55. * @function
  56. * @name module:eclairjs/mllib/linalg.SparseVector#indices
  57. * @returns {integer[]}
  58. */
  59. //SparseVector.prototype.indices = function() {
  60. // return this.getJavaObject().indices();
  61. //};
  62. /**
  63. * @function
  64. * @name module:eclairjs/mllib/linalg.SparseVector#values
  65. * @returns {module:eclairjs.Tuple2}
  66. */
  67. //SparseVector.unapply = function (sv) {
  68. // var sv_uw = Utils.unwrapObject(sv);
  69. // var javaObject = org.apache.spark.mllib.linalg.SparseVector.unapply(sv_uw);
  70. // return new Tuple3(javaObject);
  71. //};
  72. module.exports = SparseVector;
  73. })();