Dot implements InnerProduct<Double> { @Override public Scalar<Double> norm(final Vect<Double> vect) { return Dot.wrap(Math.sqrt(Dot.val(this.product(vect, vect)))); }  @Override Scalar<Double> product(final Vect<Double> foperand, final Vect<Double> soperand); @Override Scalar<Double> norm(final Vect<Double> vect); @Override Degrees<Double> angle(final Vect<Double> first, final Vect<Double> second); @Override Vect<Double> rot(final Vect<Double> vect, final Degrees<Double> ang);  }
@Test public void calculatesNorm() { final Decimal field = new Decimal(); final Dot dot = new Dot(); MatcherAssert.assertThat( field.actual(dot.norm(new DblVect(1., 0.))), Matchers.equalTo(1.) ); MatcherAssert.assertThat( field.actual(dot.norm(new DblVect(0., 0.))), Matchers.equalTo(0.) ); MatcherAssert.assertThat( field.actual(dot.norm(new DblVect(1., 1.))), Matchers.equalTo(Math.sqrt(2.)) ); final double expected = Math.sqrt(8); final double mintwo = -2.; MatcherAssert.assertThat( field.actual(dot.norm(new DblVect(mintwo, mintwo))), Matchers.equalTo(expected) ); }