Revision for “NM Dev Setup Guide” created on June 28, 2021 @ 05:47:42

TitleContentExcerptRevision Note
NM Dev Setup Guide
<h1 id="SetupGuide">Setup Guide</h1>
This tutorial is on how to set up the development environment for programming with the NM Dev library (the Java version). In order to use the NM Dev library, you need to know some Java programming. Sun (or Oracle) provides excellent online tutorials on learning Java. You can find a lot of easy-to-read-and-follow lessons in <a class="ext-link" href="http://java.sun.com/docs/books/tutorial/"><span class="icon">​</span>Sun’s Java Tutorials</a>.
<h2 id="IDE">IDE</h2>
You will need an Integrated Development Environment (IDE) to program NM Dev. Although you may choose any IDE you like, we recommend Netbeans. You can download it from <span class="icon">​</span><a href="https://netbeans.apache.org/download/nb124/nb124.html">here</a>.

<img class="aligncenter size-full wp-image-18554" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.02.51-PM.png" alt="" width="2622" height="1226" />

&nbsp;

To learn about how to use <a href="http://numericalmethod.com/up/netbeans/" target="_blank" rel="noopener noreferrer">NetBeans</a>, you will find a quick start tutorial <a class="ext-link" href="http://netbeans.org/kb/docs/java/quickstart.html"><span class="icon">​</span>here</a>. The most important skill for you to learn is debugging. This is especially true for those who are converting from Matlab and R and are used to printing out values. <a href="http://numericalmethod.com/up/netbeans/" target="_blank" rel="noopener noreferrer">NetBeans</a> debugger allows you to easily inspect values, place conditional breakpoints, pause and resume your program and much more. A quick Google search gives these articles.
<ul>
<li><a class="ext-link" href="http://www.cs.uga.edu/%7Eshoulami/sp2009/cs1301/tutorial/NetBeansDebuggerTutorial/NetBeansDebuggerTutorial.htm"><span class="icon">​</span>NetBeans Debugger- Short Tutorial</a></li>
<li><a class="ext-link" href="http://www.youtube.com/watch?v=joWldbcp1So"><span class="icon">​</span>YouTube – Using the NetBeans Debugger</a></li>
</ul>
<em>We cannot emphasize enough that it is imperative that you must master using a debugger to make your programming experience productive and enjoyable.</em>

Hotkey is another tool that will increase your programming productivity. My favorite hotkey is <tt>Ctrl+Shift+F</tt> (or <span style="font-family: ‘andale mono’, monospace">Alt+Shift+f</span> if you are using windows). It makes my code look pretty and neat. A list of hotkeys is found <a class="ext-link" href="http://netbeanside61.blogspot.com/2008/04/top-10-netbeans-ide-keyboard-shortcuts.html"><span class="icon">​</span>here</a>. You can customize them to your own taste by going to Netbeans -&gt; Preferences -&gt; Keymap (or Tools -&gt; Options -&gt; Keymap for Windows/Linux).

<img class="aligncenter size-full wp-image-18556" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.18.33-PM.png" alt="" width="1560" height="1334" />
<h2 id="suanshu.jar">nmdev.jar</h2>
To program the NM Dev library, you will need a licensed copy of <strong>nmdev.jar</strong> (the actual file name depends on the version that you have). It is a compressed file that contains the NM Dev Java classes for numerical computing. <strong>To get a copy of the trial license, please email <a href="mailto:sales@nm.dev">sales@nm.dev</a>.</strong>

This section walks you through how to set up a NM Dev project. You may skip this section if you want to start programming NM Dev right away using the <a href="https://nm.dev/s2/">S2 IDE</a> which comes in-built with NM Dev. Please read our <a href="http://numericalmethod.com/up/suanshu/tutorial/" target="_blank" rel="noopener noreferrer">Basic Trails</a> to get started. If in the future you would like to update the NM Dev library for a newer version, you will need to come back to this section.
<h2 id="CreateaSuanShuproject">Create a NM Dev project</h2>
To create a NM Dev project in <a href="http://numericalmethod.com/up/netbeans/" target="_blank" rel="noopener noreferrer">NetBeans</a>, open the <a href="http://numericalmethod.com/up/netbeans/" target="_blank" rel="noopener noreferrer">NetBeans</a> IDE, click File -&gt; New Project… (<tt>Ctrl+Shift+N</tt>). In ‘categories’, choose ‘Java with Ant’; in projects, choose ‘Java Application’. Click ‘Next’.

<img class="aligncenter size-full wp-image-18557" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.28.14-PM.png" alt="" width="1428" height="1020" />

In ‘Project Name’, type whatever you like, e.g., HelloNMDev. In ‘Project Location’, type where you would like to save your project. Make sure the box ‘Use dedicated Folder for Storing Libraries’ is checked.Then click ‘Finish’.

<img class="aligncenter size-full wp-image-18558" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.30.51-PM.png" alt="" width="1428" height="1020" />

We need to tell this Java project that we will be calling the NM Dev library. To do so, right click on the ‘Libraries’ Folder in the project tab and click ‘Add JAR/Folder’

<img class="aligncenter size-full wp-image-18560" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.41.59-PM.png" alt="" width="980" height="570" />

Browse to where you saved nmdev.jar. Select nmdev.jar and then hit ‘Open’.

<img class="aligncenter size-full wp-image-18561" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.46.21-PM.png" alt="" width="1324" height="938" />

&nbsp;

To install the NM Dev javadoc in <a href="http://numericalmethod.com/up/netbeans/" target="_blank" rel="noopener noreferrer">NetBeans</a>, we need to associate the nmdev.jar with its javadoc. Right click the nmdev.jar file you just added and select ‘Edit’.

<img class="aligncenter size-full wp-image-18562" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.48.42-PM.png" alt="" width="962" height="560" />

In the popup window, under the ‘javadoc’ section, click ‘Browse’ and select the nmdev-javadoc.jar file. Then click ‘Open’.

<img class="aligncenter size-full wp-image-18563" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.52.43-PM.png" alt="" width="1038" height="390" />

Now, you have created an empty NM Dev project. Copy and paste these lines under "<tt>// TODO code application logic here</tt>".

&nbsp;

[box type="shadow"]

System.out.println("Hello NM Dev");

&nbsp;

Matrix A1 = new DenseMatrix(new double[][]{//create a matrix

{1, 2, 1},

{4, 5, 2},

{7, 8, 1}

});

System.out.println(A1);

&nbsp;

Matrix B = new Inverse(A1);//compute the inverse of A1

Matrix I = A1.multiply(B);//this should be the identity matrix

System.out.println(String.format("%s * %s = %s (the identity matrix)",

A1,

B,

I));

[/box]

<img class="aligncenter size-full wp-image-18564" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-2.58.07-PM.png" alt="" width="1734" height="1488" />

Hit <tt>Command+Shift+I </tt>(or <tt>Ctrl+Shift+I</tt> on Windows/Linux) to fix the necessary imports. Make sure these statements appear at the top of your program. Else you can input them manually.

[box type="shadow"]

<span style="font-family: -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, Oxygen-Sans, Ubuntu, Cantarell, ‘Helvetica Neue’, sans-serif">import dev.nm.algebra.linear.matrix.doubles.Matrix;
import dev.nm.algebra.linear.matrix.doubles.matrixtype.dense.DenseMatrix;
import dev.nm.algebra.linear.matrix.doubles.operation.Inverse;</span>

<span style="font-family: -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, Oxygen-Sans, Ubuntu, Cantarell, ‘Helvetica Neue’, sans-serif">[/box]</span>

Hit <tt>Alt+Shift+F</tt> to beautify your code. Your code should look something like this.

<img class="aligncenter size-full wp-image-18566" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-3.05.50-PM.png" alt="" width="1734" height="1510" />

&nbsp;

Before you can run your code you will have to place your license file by doing

[box type="shadow"]

<span style="font-family: -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, Oxygen-Sans, Ubuntu, Cantarell, ‘Helvetica Neue’, sans-serif">import dev.nm.misc.license.License;</span>

License.setLicenseFile(new java.io.File("your license path"));

<span style="font-family: -apple-system, BlinkMacSystemFont, ‘Segoe UI’, Roboto, Oxygen-Sans, Ubuntu, Cantarell, ‘Helvetica Neue’, sans-serif">[/box]</span>

<img class="aligncenter size-full wp-image-18567" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-3.13.15-PM.png" alt="" width="1734" height="1568" />

Right click on the project name, e.g., HelloNMDev, and click ‘Run’ (or simply press <tt>F6</tt> if you make this project your main project). Voila! You should see this in your output window (<tt>Ctrl+4</tt>).

<img class="aligncenter size-full wp-image-18568" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-3.15.51-PM.png" alt="" width="1504" height="872" />

Congratulations!
<h2 id="Javadoc">Javadoc</h2>
NM Dev’s <a href="https://nm.dev/html/javadoc/nmdev/">javadoc</a> is the complete reference to the NM Dev library. You can read it in a browser, e.g., Internet Explorer. You can bring them up dynamically during programming. Each time you press <tt>Ctrl+SPACE</tt> after the ‘.’ of any object you create, you will see a list of available methods for this object, and the javadoc for the method selected.

<img class="aligncenter size-full wp-image-18569" src="https://nm.dev/wp-content/uploads/2015/04/Screenshot-2021-06-17-at-3.19.22-PM.png" alt="" width="1572" height="1396" />

To get more information about programming NM Dev, please consult our <a href="https://nm.dev/wiki/tutorials/">tutorials</a>.

&nbsp;

&nbsp;



OldNewDate CreatedAuthorActions
June 28, 2021 @ 05:47:42gareth.koh
June 24, 2021 @ 03:19:29gareth.koh
June 24, 2021 @ 03:18:57 [Autosave]gareth.koh
June 17, 2021 @ 07:48:05gareth.koh
June 17, 2021 @ 07:35:05gareth.koh
June 17, 2021 @ 07:24:18gareth.koh
June 17, 2021 @ 07:20:34gareth.koh
June 10, 2021 @ 03:57:52gareth.koh