2

I have four vectors have same dimension (1 dimensional) and same size. 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

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

and vector subtraction also for example 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"?

JoshuaJeanThree
  • 1,382
  • 2
  • 22
  • 41

2 Answers2

1

You may use vecmath for vector operations. It is very precise. No rounding errors!

padawan
  • 1,295
  • 1
  • 17
  • 45
0

I think there is no API methods provided for this.

It looks like the definiton might change from one to one , we have implement mannually for this.

NPKR
  • 5,368
  • 4
  • 31
  • 48