Initialising Data in TABLO-generated Programs and GEMSIM

When I display the values of a matrix produced by a TABLO-generated program or GEMSIM, why are there values I did not put there? I expected zeros.

If you assign all values to a matrix or array, the values shown (via Display or Write statements) should be exactly as you assigned.

However, if you assign only some values to a matrix or array, what happens depends on the Release of GEMPACK you are running.

Release 8.0 or later

If you are running Release 8.0 or later of GEMPACK, by default all values of all Coefficients are initialized equal to zero. So any positions you do not assign values to should have the value zero. [You can change this default. For more details, see section 6.7 of the Release 8.0 version of GPD-3.]

Release 7.0 or earlier

If you are running Release 7.0 or earlier of GEMPACK, you cannot tell what values will be put in the parts of the matrix or array for which you did not specify values. [TABLO-generated programs and GEMSIM do not fill all matrices and arrays with zeros before you assign values. You must do that yourself if that is what you want. For more details, see section 6.7 of the Release 7.0 version of GPD-3.]

Example

Suppose that sets COM and IND have been defined and that IND has the three elements ind1, ind2 and ind3. Consider the following statements

Coefficient (all,c,COM)(All,i,IND) COEF1(c,i) ; 
Formula (all,c,COM) COEF1(c,"ind1") = 20.0 ; 
Formula (all,c,COM) COEF1(c,"ind3") = 10.0 ; 
Display COEF1 ;

No values have been assigned to the (COM,"ind2") part of the matrix. When you look at the DISPLAY, you may see nonzero values in this part.

Usually you will want to make sure that zeros (or some other suitable values) are put into the parts you do not set via formulas. For example, if you want zeros, you should add the statement

Formula (all,c,COM)(all,i,IND) COEF1(c,i) = 0 ;

immediately after the declaration of the Coefficient [and before the formulas for the (COM,"ind1") and (COM,"ind3") parts.] [As indicated above, this is not necessary if you are using Release 8.0 or later of GEMPACK.]

Note that if you only had a formula for the (COM,"ind1") part of COEF1, TABLO would warn you (at the DISPLAY statement) that only some values have been assigned to COEF1.

But, after two partial assignments [the formulas for the (COM,"ind1") and (COM,"ind3") parts above], TABLO hands over responsibility to you for initialising all of the array. [TABLO makes no further attempt to see if you have initialised the whole array and so does not give warnings that some values may not be initialised.] See section 4.7.4 of GEMPACK document GPD-2 for more details.

Go back to
GEMPACK FAQ Page