Skip to content

Instantly share code, notes, and snippets.

@josep2
Created December 6, 2016 03:24
Show Gist options
  • Save josep2/a87ba0597713f382f01033d99ccb476e to your computer and use it in GitHub Desktop.
Save josep2/a87ba0597713f382f01033d99ccb476e to your computer and use it in GitHub Desktop.
def fillMax(values: Vector): DenseVector = {
val result: Array = values.copy.toArray
val max: Double = result.filter(!_.isNaN).max
finalresult = result.map(x => isNan(x))
def isNan(a: Double): Double = a.isNaN match {
case true => max
case _ => a
}
new DenseVector(finalResult)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment