1

I have a Vector<Real> vec in jscience. I could not find the function to normalize it. Could you please help me to normalize vec?

padawan
  • 1,295
  • 1
  • 17
  • 45

1 Answers1

1

The class org.jscience.mathematics.vector.Float64Vector, a Vector<Float64>, includes both norm() and normValue() methods. Although a Vector<Real>, a collection of arbitrary precision real numbers, lacks either method, you can take the Real#sqrt() of the sum of the components' squares, as outlined here.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045