可能链接到Cannot call particular java method from Clojure
使用smile包,我已经升级到了3.0.0,但是无法调用一些方法。
现在在REPL中:
(import smile.math.MathEx)
(MathEx/log2 5.)
=> 2.321928094887362
(MathEx/pow2 5.)
Syntax error (IllegalArgumentException) compiling . at (C:\Users\AAlmosni\AppData\Local\Temp\1\form-init13649993705313983821.clj:1:1).
No matching method pow2 found taking 1 args for class smile.math.MathEx
(MathEx/sigmoid 5.)
Syntax error (IllegalArgumentException) compiling . at (C:\Users\AAlmosni\AppData\Local\Temp\1\form-init13649993705313983821.clj:1:1).
No matching method sigmoid found taking 1 args for class smile.math.MathEx
(MathEx/isPower2 32)
=> true
这让我很困惑--有些方法可以正常工作,有些则不行。下面是MathEx.class的摘录:
public static double log2(double x) {
return Math.log(x) / LOG2;
}
public static double log(double x) {
double y = -690.7755D;
if (x > 1.0E-300D) {
y = Math.log(x);
}
return y;
}
public static double log1pe(double x) {
double y = x;
if (x <= 15.0D) {
y = Math.log1p(Math.exp(x));
}
return y;
}
public static boolean isInt(float x) {
return x == (float)Math.floor((double)x) && !Float.isInfinite(x);
}
public static boolean isInt(double x) {
return x == Math.floor(x) && !Double.isInfinite(x);
}
public static boolean equals(double a, double b) {
if (a == b) {
return true;
} else {
double absa = Math.abs(a);
double absb = Math.abs(b);
return Math.abs(a - b) <= Math.min(absa, absb) * 2.220446049250313E-16D;
}
}
public static double sigmoid(double x) {
x = Math.max(-36.0D, Math.min(x, 36.0D));
return 1.0D / (1.0D + Math.exp(-x));
}
public static double pow2(double x) {
return x * x;
}
public static boolean isPower2(int x) {
return x > 0 && (x & x - 1) == 0;
}
你知道是什么导致导入失败吗?
谢谢你,
1条答案
按热度按时间hmtdttj41#
正如Juraj暗示的那样,这是一个依赖性冲突-我在我的项目中也使用
tech.ml.dataset
,版本6使用的是smile
的旧版本。将tech.ml.dataset
移动到版本7,默认情况下不包括smile
,解决了这个问题。谢谢!