Scala (Breeze) + Intellij: “Cannot resolve symbol *”

房东的猫 提交于 2019-12-24 17:28:26

问题


I'm using Breeze to to do sum simple linear algebra operations on dense matrices. I'm using the Intellij IDEA. Here is an snippet of my code:

import breeze.linalg._    
val X1:DenseMatrix[Double] = DenseMatrix.zeros[Double](10, 5) + 1.0
val n1 : Double = X1.rows.toDouble
val one_tall_t1  = DenseMatrix.zeros[Double](1, n1.toInt) + 1.0
val mu1=one_tall_t1*X1/n1

In the last line, the symbols * and / are shown with red color in the IDE. The error message is "Cannot resolve the symbol *".

But Intellij builds the program without any errors, and it runs fine.

I've been trying to find out the reason: since I'm new to Scala, I'm not sure if it is because of Intellij, Breeze, or just my code. In some posts, people have suggested to invalidate cache and restart Intellij, but this does not solve my issue.

I appreciate your comments or solutions!


回答1:


IntelliJ gets confused by complex implicit searches like those used in Breeze. I file bugs when I can minimize them and get around to it, but it's a slog. (Eclipse, for what it's worth, isn't much better.)

It typically works better if you're just depending on Breeze, not developing inside of it. I assume you're doing that already though.



来源:https://stackoverflow.com/questions/31391420/scala-breeze-intellij-cannot-resolve-symbol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!