code: public double magnitude() {
          // Check whether the current magnitude is valid and if not, recompute it
          if (magnitude < 0) {
              double m = 0;
              for (int nz : getNonZeroIndices()) {
                  int i = intArray.get(nz);
                  m += i * i;
              }
              magnitude = Math.sqrt(m);
          }
          return magnitude;
      }
docs: {@inheritDoc}