|
|
@ -8,10 +8,6 @@ Define the associated function `dot`, that calculates the dot product between tw |
|
|
|
|
|
|
|
|
|
|
|
Note: `Vector` must implement `Debug`, `Clone`, `Eq` and `PartialEq`. |
|
|
|
Note: `Vector` must implement `Debug`, `Clone`, `Eq` and `PartialEq`. |
|
|
|
|
|
|
|
|
|
|
|
#### Important |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Note that in the addition of vector of the example the `Rhs` is not `Self` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Expected Functions and Structure |
|
|
|
### Expected Functions and Structure |
|
|
|
|
|
|
|
|
|
|
|
```rust |
|
|
|
```rust |
|
|
@ -42,7 +38,7 @@ fn main() { |
|
|
|
let vector_1: Vector<i64> = Vector(vec![1, 3, -5]); |
|
|
|
let vector_1: Vector<i64> = Vector(vec![1, 3, -5]); |
|
|
|
let vector_2: Vector<i64> = Vector(vec![4, -2, -1]); |
|
|
|
let vector_2: Vector<i64> = Vector(vec![4, -2, -1]); |
|
|
|
println!("{:?}", vector_1.dot(&vector_2)); |
|
|
|
println!("{:?}", vector_1.dot(&vector_2)); |
|
|
|
println!("{:?}", vector_1 + &vector_2); |
|
|
|
println!("{:?}", vector_1 + vector_2); |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|