Wikis > NM Dev > FAQs

Maven

  • How do I exclude NM Dev’s dependencies in my own Java project?
    • NM Dev depends on some third-party modules:
      • akka-2.1.4
      • joda-time-2.8.2
      • kryo-2.22
      • heaps-2.0 (from teneighty.org)

      By default, Maven includes these transitive dependencies in the classpath. If you do not want them to be included in the classpath of your project, you may exclude them explicitly by adding an “exclusion” in the dependency section:

      <dependencies>
        <dependency>
          <groupId>com.numericalmethod</groupId>
          <artifactId>suanshu</artifactId>
          <version>${suanshu.version}</version>
          <exclusions>
            <exclusion>
              <groupId>com.esotericsoftware.kryo</groupId> <!-- exclude kryo -->
              <artifactId>kryo</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>

      See this guide for more information.

Licensing

  • Is there a way to have *one* license file shared by multiple machines?
    • Yes, one license file can contain multiple MAC addresses so you can deploy/copy the same file to multiple machines.
  • Is it possible to have a license that runs on cloud machines?

Coding

  • Why did you choose to have indexes for matrices starting from 1 and not zero as for most structures in java (and c, …)? This complicates the adaptation of code to use NM Dev matrix models and prone to a lot of “+-1” errors in the indexes (for instance when simply iterating over an array *and* a matrix at the same time…)
    • Only the computer scientists count from 0. Everyone else on the planet earth, including the mathematicians, counts from 1. One reason for the computer scientists to count from 0 is indexing to an array element by adding an offset to a starting address. Back in the old C generation, suppose we do, double[] arr = new double[10]; , arr is also a reference to an address of a double or an array of doubles. The address of the 2nd element in the array is computed by adding 8 bytes to arr, i.e., arr + (2 – 1)* 8. In other words, the 2nd object is 1 unit (8 bytes) offset from the starting address. Therefore, an array index in C, C++, Java, C# is the number of offsets from a starting address. It is not the index of the object. NM Dev philosophy is to match symbolically the math equations as much as possible. Most math equations count from 1. All matrices and vectors count from 1. We think that this matching is important for code readability and verification against publications. When we compare our code to the papers, we need not mentally compute this +/-1. Otherwise, the code is very prone to errors, especially when there is a lot of indexing in a complex equation. To avoid doing the +/-1 in coding to some extend, I suggest that the users skip using [0], and count from 1. For example,
      double[] v1 = new double[]{Double.NaN, 1., 2., 3., 4., 5.};
      Vector v2 = new DenseVector(1., 2., 3., 4., 5.);
      Vector v3 = new DenseVector(3);
      for (int i = 1; i 
      

Misc