LinTool and other Programming Issues


Important: The instructions below are "high level", not step-by-step, instructions. This means you may have to struggle a bit to get some things installed and working, but that's not a bad experience because it's a really useful skill to be able to install software. Step-by-step instructions can of course be found on youtube or other sites.
 


Overview

The general process is this:

There's a minor "headache" that needs to be overcome:

First, start with these two steps:

Step 1: Practice working at the command-line

Step 2: Understand what environment variables are

Step 3: Make a folder for the course called linAlg off of your Desktop:

For the remainder, we will assume:


Step 3: Download and test LinTool

LinTool is both a library and an interface for students in this course. The interface is what you will use for your own implementations of linear algebra, whereas the library has both default versions and code that will test your implementation.


Step 4: Go a bit further with LinTool

Let's start down the road to implementation by understanding how to use LinTool:

  • The main idea is this: LinTool is an abstract class that defines a number of methods that you will implement. Each of these methods is a linear algebra computation.

  • For example, examine the method that adds two real numbers in LinTool. It takes in two real numbers (as double's) and should return the sum. Easy to implement, right?

  • Let's implement just that method alone and subject the implementation to testing.

  • We will call our implementation AliceLinTool.java for our example user called Alice. You will of course use your username instead. Meanwhile, let's examine the code:
    import edu.gwu.lintool.*;
    
    public class AliceLinTool extends LinToolEmpty {
    
        // We'll now override the method that adds two real numbers.
        public double add (double a, double b)
        {
    	double c = a + b;
    	return c;
        }
    
    }
        
    Note the following:
    • We need to import the lintool package, at the top.
    • The method signature (first line) is exactly the same as described in the documenation of LinTool.
    • Only that one method was implemented inspite of the fact that LinTool has many, many methods. How is this possible? It is made possible because LinTool provides a default so-called "empty" implementation that implements all the methods. The default implementation does nothing at all. Each time you implement a method, your implementation overrides the default implementation.

  • Now download and save both AliceLinTool.java and a special test file called TestLinTool.java in the testdir you created a while back.

  • Let's examine TestLinTool.java:
    import edu.gwu.lintool.*;
    
    public class TestLinTool {
    
        public static void main (String[] argv)
        {
    	AliceLinTool alice = new AliceLinTool ();
    	LinTest.testRealNumberAdd (alice);
        }
    
    }
        
    Observe the following:
    • This is a simple test file that creates an instance of Alice's implementation and subjects it to a test.
    • Again, the import statement is needed at the top.
    • There is a mysterious method called testRealNumberAdd() that takes Alice's implementation and subjects it to a test.

  • Compile and run TestLinTool.java, and you'll see that it passes the test.

  • This is essentially the manner in which you will implement and test your code. First you will implement a couple of methods from LinTool, then you will test your implementation.

  • To see a complete list of tests, examine the code in AllLinToolTests.java.

  • By the end of the semester, you will have written a linear algebra toolkit.


Step 5: Draw3D

Draw3D is a 3D-drawing tool created by GW alum Bill Edison for this course. (We will be eternally grateful.) The tool will help us draw 3D vectors and visualize 3D examples more easily.

See this page on Draw3D for more information on Draw3D, including instructions on how to install.

NOTE: All the notes above are about implementing code, but not about submission. See this page for submission instructions.