Next: Applying a linear operator Up: AN IGF90 TUTORIAL Previous: Constructing IGF90 objects

## Using basic member functions of the IGF90 class

Once an IGF90 object has being instantiated, we are next interested in knowing how to manipulate it, and what its interface to the user is. The IGF90 class provides a set of linear algebra utilities that can be used on any IGF90 object, such as adding, multiplying, and scaling IGF90's, as well as I/O and on-screen inspection tools. These set of member functions are inherited from the abstract parent class HCL_Vector, but are implemented by the IGF90 class. They are written in Fortran 90.

```  #include "IGF90.h"
...

IGF90 data1("name");

// outputs some diagnostics about data1 to stderr
data1.Inspect(cerr);

IGF90 data2(data1), data3(data1);

data1.ScaleAdd(2., data2);        // data1 = 2. * data1 + data2

data1.Neg();                      // data1 = -data1

data1.Mul(2.);                    // data1 = 2. * data1
data1.Mul(2., data2);             // data1 = 2. * data2

data1.Write("result");            // writes to file with tag "result"

data1.Add(data3, data2);          // data1 = data3 + data2

data1.Sub(data2);                 // data1 -= data2
data1.Sub(data3, data2);          // data1 = data3 - data2

data1.AddScale(2., data2);        // data1 += 2. * data2
data1.AddScale(2., data2, data3); // data1 = data2 + 2. * data3

data1.Fill(777.7);                // data1 = 777.7
data1.Zero();                     // data1 = 0.
data1.Random();                   // data1 = random numbers [0,1]

cerr << data1.Inner(data2) << endl;   // inner product of data1 by data2

cerr << data1.Norm()       << endl;   // norm of data1
cerr << data1.Norm2()      << endl;   // squared norm of data1
```

Next: Applying a linear operator Up: AN IGF90 TUTORIAL Previous: Constructing IGF90 objects
Stanford Exploration Project
11/11/1997