Skip to content
Snippets Groups Projects
Commit 44cc9cbc authored by loick.pipolo's avatar loick.pipolo
Browse files

transposed fini pas teste

parent cdf8ebc5
Branches
Tags
No related merge requests found
......@@ -2,6 +2,10 @@ package ch.hepia.numeric;
public class Transposed{
private List<Double> vecT;
private Transposed(){
vecT = new ArrayList<>();
};
private Transposed(Vector That){
vecT = new ArrayList<>();
for (double elem : That){vecT.add(elem);}
......@@ -16,8 +20,15 @@ public class Transposed{
return res;
//throw new UnsupportedOperationException("This feature isn't implemented yet");
};
public Vector sub(Vector That){
throw new UnsupportedOperationException("This feature isn't implemented yet");
public Transposed sub(Vector That){
Transposed resT = new Transposed();
Integer count = 0;
for (double coo : This.vecT) {
resT.add(coo - That.values.get(count));
count = count + 1;
}
return resT;
//throw new UnsupportedOperationException("This feature isn't implemented yet");
};
......
......@@ -55,7 +55,7 @@ class VectorTest {
Vector v3 = Vector.of(1.0, 2.0, 3.0);
Vector v4 = Vector.of(1.0, 2.0, 3.0);
assertEquals( v3.t().dot(v4), 14.0 );
//assertEquals( v3.t().sub(v4.t()), Vector.of(0.0, 0.0, 0.0).t() );
assertEquals( v3.t().sub(v4.t()), Vector.of(0.0, 0.0, 0.0).t() );
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment