constructor ====================== .. js:function:: ArrayView.constructor() ソース ^^^^^^ .. code-block:: js constructor() { var args; if (arguments.length == 1 && Array.isArray(arguments[0])) { args = arguments[0]; } else { // 引数のリストをArrayに変換します。 args = Array.prototype.slice.call(arguments); } // 引数の最後 var last_arg = args[args.length - 1]; if (typeof last_arg != 'number') { // 引数の最後が数値でない場合 if (typeof last_arg == 'ArrayView') { this.dt = new Float32Array(last_arg.dt); } else { Assert(last_arg instanceof Float32Array, "is Float32Array"); this.dt = last_arg; } args.pop(); } this.shape = args; this.ncol = this.shape[this.shape.length - 1]; if (this.shape.length == 1) { this.nrow = 1; } else { this.nrow = this.shape[this.shape.length - 2]; } if (!this.dt) { this.dt = new Float32Array(this.shape.reduce((x, y) => x * y)); } }