diff options
Diffstat (limited to 'examples')
4 files changed, 6 insertions, 6 deletions
diff --git a/examples/src/main/scala/spark/examples/LocalALS.scala b/examples/src/main/scala/spark/examples/LocalALS.scala index 10360dab3d..10e03359c9 100644 --- a/examples/src/main/scala/spark/examples/LocalALS.scala +++ b/examples/src/main/scala/spark/examples/LocalALS.scala @@ -106,8 +106,8 @@ object LocalALS { val R = generateR() // Initialize m and u randomly - var ms = Array.fromFunction(_ => factory1D.random(F))(M) - var us = Array.fromFunction(_ => factory1D.random(F))(U) + var ms = Array.fill(M)(factory1D.random(F)) + var us = Array.fill(U)(factory1D.random(F)) // Iteratively update movies then users for (iter <- 1 to ITERATIONS) { diff --git a/examples/src/main/scala/spark/examples/LocalLR.scala b/examples/src/main/scala/spark/examples/LocalLR.scala index 96cda80277..72c5009109 100644 --- a/examples/src/main/scala/spark/examples/LocalLR.scala +++ b/examples/src/main/scala/spark/examples/LocalLR.scala @@ -18,7 +18,7 @@ object LocalLR { val x = Vector(D, _ => rand.nextGaussian + y * R) DataPoint(x, y) } - Array.fromFunction(generatePoint _)(N) + Array.tabulate(N)(generatePoint) } def main(args: Array[String]) { diff --git a/examples/src/main/scala/spark/examples/SparkALS.scala b/examples/src/main/scala/spark/examples/SparkALS.scala index 08e0420371..8ee1418067 100644 --- a/examples/src/main/scala/spark/examples/SparkALS.scala +++ b/examples/src/main/scala/spark/examples/SparkALS.scala @@ -117,8 +117,8 @@ object SparkALS { val R = generateR() // Initialize m and u randomly - var ms = Array.fromFunction(_ => factory1D.random(F))(M) - var us = Array.fromFunction(_ => factory1D.random(F))(U) + var ms = Array.fill(M)(factory1D.random(F)) + var us = Array.fill(U)(factory1D.random(F)) // Iteratively update movies then users val Rc = spark.broadcast(R) diff --git a/examples/src/main/scala/spark/examples/SparkLR.scala b/examples/src/main/scala/spark/examples/SparkLR.scala index d08f5d3f01..faa8471824 100644 --- a/examples/src/main/scala/spark/examples/SparkLR.scala +++ b/examples/src/main/scala/spark/examples/SparkLR.scala @@ -20,7 +20,7 @@ object SparkLR { val x = Vector(D, _ => rand.nextGaussian + y * R) DataPoint(x, y) } - Array.fromFunction(generatePoint _)(N) + Array.tabulate(N)(generatePoint) } def main(args: Array[String]) { |