| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (2 out of 28)

Matrixes and Arrays in G2

G2 provides two kinds of system procedures for matrix operations:

Representing Matrixes

A matrix is an item-array whose elements are quantity-arrays. Each quantity-array represents one row of the matrix.

G2 does not support a matrix class. However, you can assemble data structures that serve as matrixes in your KB by creating item arrays and quantity arrays.

Representing Arrays

A dense array is a quantity array that can include elements whose value is 0.

A sparse array is an alternate way of expressing a dense array. A sparse array consists of two separate arrays:

For example, a dense array can contain the following elements:

The sparse array that corresponds to this dense array consists of a value array containing the non-zero elements of the dense array:

and an index array containing the index of each non-zero element:

Creating Objects Referenced by Procedures

All arguments of system procedures described in this chapter must refer to existing objects. The procedures do not create the objects referenced by their arguments.

For information about how to create arrays and matrixes, see the G2 Reference Manual.

Performing Operations on Matrixes and Arrays

You can use system procedures to perform:

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (2 out of 28)

Copyright © 1997 Gensym Corporation, Inc.