I saw code in spark codebase written in this way. 

    var regVal = updater.compute(
      weights,
      new DoubleMatrix(initialWeights.length, 1), 0, 1, regParam)._2

What do you think?