code: public double magnitude() {
          if (magnitude < 0) {
              magnitude = 0;
              TDoubleIterator iter = vector.valueCollection().iterator();
              while (iter.hasNext()) {
                  double d = iter.next();
                  magnitude += d*d;
              }
              magnitude = Math.sqrt(magnitude);
          }
          return magnitude;
      }
docs: {@inheritDoc}