使用 Mahout 数学课创建矩阵时出现问题
我正在使用 Math MAhout 类 DoubleMatrix2d 创建一个 3x4 矩阵,我写了这样的内容来开始:
package org.apache.mahout.math.matrix.impl;
import org.apache.mahout.math.function.BinaryFunction;
public class creaMatrice extends DenseDoubleMatrix2D {
public static void main(String args[]){
double array[][]= { {1,2}, {4,8}, {5,0}, {4,5}, {2,9}, {1,5}, {9,0}, {2,6} };
//creo una nuova matrice vuota
DoubleMatrix2D matrice;
matrice = new DenseDoubleMatrix2D(3,4);//creo una 3x4
matrice = matrice.assign(double array[][]);
int prova = matrice.getQuick(2,3);
System.out.println(prova);
}
}
我收到有关编译的错误,但我需要知道的第一件事是是否是正确的方法:) 谢谢!
i'm creating a matrix 3x4 with Math MAhout class DoubleMatrix2d, i wrote something like this to begin:
package org.apache.mahout.math.matrix.impl;
import org.apache.mahout.math.function.BinaryFunction;
public class creaMatrice extends DenseDoubleMatrix2D {
public static void main(String args[]){
double array[][]= { {1,2}, {4,8}, {5,0}, {4,5}, {2,9}, {1,5}, {9,0}, {2,6} };
//creo una nuova matrice vuota
DoubleMatrix2D matrice;
matrice = new DenseDoubleMatrix2D(3,4);//creo una 3x4
matrice = matrice.assign(double array[][]);
int prova = matrice.getQuick(2,3);
System.out.println(prova);
}
}
im getting errors about compile, but the first thing i need to know is if is the right way to do that :) thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最好在 mahout 用户邮件列表上询问这些问题。否则,您将面临没有人知道 Mahout 会看到您的问题的风险。
一般来说,DoubleMatrix2D 在 Mahout 中已被弃用,您应该使用 Matrix。有些代码仍然使用旧的东西,但是当我们测试旧的 Colt 代码时,我们正在转换它
到新的形式并使用新的数据类型。
It is better to ask these questions on the mahout user mailing list. Otherwise, you take the risk of nobody who knows about Mahout ever seeing your question.
In general, the DoubleMatrix2D is deprecated in Mahout and you should use Matrix instead. Some code still uses the old stuff, but as we test the old Colt code, we are converting it
to the new form and using the new data types.
您能否说明您的目标是什么?
这个小例子实际上并没有做任何基本数组上的嵌套循环无法完成的事情。
至于编译错误,查看控制台输出会很有帮助。
Could you please state what your goal is here?
This little example doesn't really do anything which couldn't be done with a nested loop on the base array.
As for the compiling errors, it would be helpful to see the console output.