简体   繁体   English

Java中的算术向量运算

[英]arithmetic vector operations in Java

I have four vectors have same dimension (1 dimensional) and same size. 我有四个矢量具有相同的尺寸(1维)和相同的尺寸。 My vectors are consturcated as: 我的载体被构建为:

Vector<Integer> v1=new Vector<Integer>(5);
Vector<Integer> v2=new Vector<Integer>(5);
Vector<Integer> vp=new Vector<Integer>(5);
Vector<Integer> vs=new Vector<Integer>(5);

for example: vp=v1*v2 例如:vp = v1 * v2

<1 3 4 1 2>
<0 0 2 2 3>
<0 0 8 2 6>

and vector subtraction also for example vs=1-v1 和矢量减法也是例如vs = 1-v1

1-v1= <0 -2 -3 0 -1>

is there any function in java to assign the result of multiplication of vectors to vector "vp" and "vs"? 在java中是否有任何函数将向量乘法的结果赋给向量“vp”和“vs”?

You may use vecmath for vector operations. 您可以使用vecmath进行矢量运算。 It is very precise. 这非常精确。 No rounding errors! 没有舍入错误!

I think there is no API methods provided for this. 我认为没有为此提供API方法。

It looks like the definiton might change from one to one , we have implement mannually for this. 看起来定义可能会从一个变为一个,我们已经为此实现了手动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM