package com.hadwinling.woa
import breeze.linalg.clip
import org.apache.log4j.{Level, Logger}
import org.apache.spark.{SparkConf, SparkContext}
object ClipDemo {
def main(args: Array[String]): Unit = {
Logger.getLogger("org").setLevel(Level.ERROR)
val conf = new SparkConf().setAppName("SparkWOA").setMaster("local[*]")
val sc: SparkContext = new SparkContext(conf)
val ints = Array(1, 2, 3, 4)
val ints1 = clip(ints, -10, 10)
ints1.foreach(println)
println("=======================")
val int2 = Array(1, 2, 3, 40)
val ints2 = clip(int2, -10, 10)
ints2.foreach(println)
sc.stop()
}
}
结果:
|