Library Name: lib_numeric.a

Introduction:

The numeric library contains implementations of general mathematical functions and operations that don't fit nicely into the Math class framework. Some well-established functions, such as a Sigmoid, are found here. Linear algebra operations, such as linear equation solving, that involve multiple data types, can also be found here. These functions and operations are implemented in as generic a way as possible to maximize reusability. Most of these are integral parts of the algorithms used in the speech recognition system found at higher levels of the class hierarchy.

There are generally three types of things found in this library. First, there are well-known mathematical or speech-related functions, such as Bark , Sigmoid and different Kernel functions. Second, there are math operations that utilize many of the lower mathematical classes to build complex sequences of operations. LinearAlgebra is a good example of this type of class. Third, there are numerical methods such as optimization. The NonlinearOptimization class is a good example of the latter. It includes standard nonlinear optimization techniques such as parametric curve fitting and nonparametric quadratic optimization.
Example:
Here is a basic example to introduce some of the methods for LinearAlgebra:
```       01  // file: \$isip/doc/examples/class/numeric/numeric_example_00/example.cc
02  // version: \$Id: index.html 10195 2005-08-09 20:40:42Z raghavan \$
03  //
04
05  // isip include files
06  //
07  #include <LinearAlgebra.h>
08  #include <Console.h>
09
10  // main program starts here
11  //
12  int main (int argc, const char **argv) {
13
14    // declare a multiplier float matrix (2x2)
15    //
16    MatrixFloat A_fl(2, 2, L" 2, 4, 7, 5");
17
18    // declare a multiplier double matrix (2x2)
19    //
20    MatrixDouble A_doub(2, 2, L" 2, 4, 7, 5");
21
22    // declare the vector of knowns (2x1)
23    //
24    VectorFloat b_fl(L"16, 29");
25    VectorDouble b_doub(L"16, 29");
26
27    // test vectors
28    //
29    VectorFloat x_fl;
30    VectorDouble x_doub;
31
32    // use linearSolve
33    //
34    LinearAlgebra::linearSolve(x_fl, A_fl, b_fl);
35    LinearAlgebra::linearSolve(x_doub, A_doub, b_doub);
36
37    // print the output
38    //
39    x_fl.debug(L"Result vector for float type");
40    x_fl.debug(L"Result vector for double type");
41
42    // exit gracefully
43    //
44    Integral::exit();
45  }

```
Explanation:
Lines 7 and 8 contain the ISIP class definitions. The main program starts on line 12 with the main function definition.

This example shows how to solve the linear function of type 'A * x = b'. On lines 16 and 20, we create a matrix of Float and Double objects respectively to be used as multiplier matrices (A). On lines 24 and 25, we create vector of Float and Double objects respectively (b). On lines 29 and 30, we declare the result vectors of Float and Double objects (x). On lines 34 and 35, we call the linearSolve method of the LinearAlgebra class to solve the linear function 'A * x = b' for float and double types.

If the executable file name is example.exe, and we execute the following command:

example.exe

The output for this code is generated using the debug method on lines 39 and 40. On our systems, the output is shown below. Due to the random function, your output may vary.

```<VectorFloat::Result vector for float type> length_d = 2
<VectorFloat::Result vector for float type> capacity_d = 2
<VectorFloat::Result vector for float type> v_d = 2, 3
<VectorDouble::Result vector for double type> length_d = 2
<VectorDouble::Result vector for double type> capacity_d = 2
<VectorDouble::Result vector for double type> v_d = 2, 3
```
Example:
Here is a second example to show the nonlinear transformations by Mel and Bark:
```       01  // file: \$isip/doc/examples/class/numeric/numeric_example_01/example.cc
02  // version: \$Id: index.html 10195 2005-08-09 20:40:42Z raghavan \$
03  //
04
05  // isip include files
06  //
07  #include <Mel.h>
08  #include <Bark.h>
09  #include <Console.h>
10
11  // main program starts here
12  //
13  int main (int argc, const char **argv) {
14
15     // declare a Mel and a Bark object
16     //
17     Mel mel_obj;
18     Bark bark_obj;
19
20     // declare the test variables
21     //
22     VectorFloat vec_input;
23     vec_input.assign(L"100, 500, 1000, 1500");
24
25     // the result for Mel
26     //
27     VectorFloat vec_output_mel;
28
29     // call Mel::compute method for mel transformations
30     //
31     mel_obj.compute(vec_output_mel, vec_input);
32
33     // print the output
34     //
35     vec_output_mel.debug(L"Output of Mel Transformation");
36
37     // the result for Bark
38     //
39     VectorFloat vec_output_bark;
40
41     // call Bark::compute method for bark transformations
42     //
43     bark_obj.compute(vec_output_bark, vec_input);
44
45     // print the output
46     //
47     vec_output_bark.debug(L"Output of Bark Transformation");
48
49    // exit gracefully
50    //
51    Integral::exit();
52  }

```
Explanation:
Lines 07 through 09 contain the ISIP class definitions. The main program starts on line 13 with the main function definition.

This example shows how to apply the "mel" and "bark" nonlinear transformations to the input data. On lines 17 and 18, we create a Mel and a Bark object. On lines 22 and 23, we define a test vector. On line 31, we call the Mel::compute method to apply nonlinear mel transformation. Similarly, on line 43, we call the Bark::compute method to apply nonlinear bark transformation.

If the executable file name is example.exe, and we execute the following command:

example.exe

The output for this code is generated using the debug method on lines 35 and 47. On our systems, the output is shown below. Due to the random function, your output may vary.

```<VectorFloat::Output of Mel Transformation> length_d = 4
<VectorFloat::Output of Mel Transformation> capacity_d = 4
<VectorFloat::Output of Mel Transformation> v_d = 150.489, 607.446, 999.986, 1290.56
<VectorFloat::Output of Bark Transformation> length_d = 4
<VectorFloat::Output of Bark Transformation> capacity_d = 4
<VectorFloat::Output of Bark Transformation> v_d = 0.986727, 4.73647, 8.51053, 11.1994
```
The following classes belong to numeric:
 Bark Kernel LinearAlgebra Mel NonlinearOptimization Sigmoid

The next level in the ISIP class hierarchy is data-structure which provides classes that are generic data structure container classes, including commonly used data structures such as a linked list, a stack, a tree, and a graph. The software corresponding to the examples demonstrated in this document can be found in our documentation directory under class/numeric/.