斯卡拉中的多元插值

  • 本文关键字:插值 scala scala-breeze
  • 更新时间 :
  • 英文 :


我需要在Scala中进行多元插值。我正在使用 breeze.interpolation 的线性插值器,但找不到传递矩阵的方法。我想知道是否有人知道这是否可能?

这是我尝试过的:

import breeze.interpolation.LinearInterpolator 
import breeze.linalg.{DenseMatrix, DenseVector} 
val dm = DenseMatrix(
  Array(1.2, 2.4, 6.8), 
  Array(1.5, 2.6, 6.1), 
  Array(1.3, 2.9, 6.8), 
  Array(1.7, 2.2, 6.2), 
  Array(1.1, 2.8, 6.8), 
  Array(1.7, 2.1, 6.9)
) 
val dv = DenseVector(2.2, 3.1, 5.2, 1.8, 4.4, 7, 2)   
LinearInterpolator(dm, dv)

它不运行,因为Linearinterpolator()似乎不允许DenseMatrix。提前非常感谢!

根据文档,可能是不可能的:

breeze.interpolation 模块目前支持一维数据的插值工具(单变量插值(

而看LinearInterpolator类的属性类型,你可以看到你需要传递VectorDenseMatrix不是Vector

最新更新