Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def linearInterpolation(weights: Seq[Double], points: Seq[Seq[Double]]) : Seq[T] = {
- weights.zip(points).map(
- weight_point => weight_point._2.map(coordinate => weight_point._1 * coordinate)
- ).reduce((point_a : Seq[Double], point_b : Seq[Double]) => point_a.zip(point_b).map(coordinate_points => (coordinate_points._1 + coordinate_points._2).asInstanceOf[T]))
- }
- def linearInterpolation(weights: Seq[Double], points: Seq[Seq[Double]])(fromDouble: Double => T) : Seq[T] = {
- weights.zip(points).map(
- weight_point => weight_point._2.map(coordinate => weight_point._1 * coordinate)
- ).reduce((point_a : Seq[Double], point_b : Seq[Double]) => point_a.zip(point_b).map(coordinate_points => coordinate_points._1 + coordinate_points._2)).map(fromDouble)
- }
Add Comment
Please, Sign In to add comment