code: function matmul(A, B) {
      var shapeA = A.shape;
      var shapeB = B.shape;
      if (shapeA.length > 2 || shapeB.length > 2) {
          throw new Error('Array shape is > 2D, not suitable for ' +
              'matrix multiplication');
      }
      // Treat a flat n-item array as 1xn matrix
      if (shapeA.length === 1) {
          shapeA = [1, shapeA[0]];
      }
      if (shapeB.length === 1) {
          shapeB = [1, shapeB[0]];
      }
      if (shapeA[1] !== shapeB[0]) {
          throw new Error('Matrix shapes ' + shapeA.join('x') + ' and ' +
              shapeB.join('x') + ' not compatible for multiplication');
      }
      // If one of the matrices is flat n-item array clone them into 1xn NDArray
      var mA, mB;
      if (A.shape.length === 1) {
          mA = A.clone();
          mA.reshape([1, A.shape[0]]);
      }
      else {
          mA = A;
      }
      if (B.shape.length === 1) {
          mB = B.clone();
          mB.reshape([1, B.shape[0]]);
      }
      else {
          mB = B;
      }
      var result = new common_1.NDArray({ shape: [mA.shape[0], mB.shape[1]] });
      for (var i = 0; i < mA.shape[0]; i++) {
          for (var j = 0; j < mB.shape[1]; j++) {
              var value = 0.0;
              for (var k = 0; k < mA.shape[1]; k++) {
                  value += A.get(i, k) * B.get(k, j); // TODO:Complex
              }
              result.set(i, j, value);
          }
      }
      return result;
  }
docs: Matrix multiplication
  
  At least one of the arguments has to be 2D matrix (i.e. shape mxn).
  The other argument could be a 1D vector. It will be implicitly used
  as 1xn matrix