The Complete SPRLIB & ANNLIB

connect_maps

- connect units in two maps in two successive layers (LOCAL)

SYNOPSIS

int connect_maps (map, prev_map)

ARGUMENTS

MAP *map A pointer to the MAP structure in layer L.
MAP *prev_map A pointer to the MAP structure in layer L-1.

RETURNS

TRUE if an error occured, FALSE if not.

FUNCTION

This function is used by the connect_layers function, after all units in a layer have been constructed, to construct the links and shared weights between two maps, one in a layer L and another in the previous layer L-1. In more detail: each UNIT in map is connected to a square group of units of size map.FilterSizeX by map.FilterSizeY in prev_map. Neighbouring units in map have connections to neighbouring groups of units in prev_map, shifted by map.PixelShiftX and map.PixelShiftY. Furthermore, all units are connected to such a square group using the same set of weights. The coordinates of the top-left of this square of units can be found by considering the coordinates of a unit in map - say (x, y): the unit number of the top-left of the square in prev_map can be found as x * map.PixelShiftX + y * map.PixelShiftY * map.SizeX. If either of map.FilterSizeX or map.FilterSizeY is smaller than 0, this indicates that the maps are to be connected fully, i.e. each unit in map is connected to all units in prev_map. If either of map.PixelShiftX or map.PixelShiftY is smaller than 0, this indicates that the weights should not be shared, i.e. each unit in map is connected to a unique group of units in prev_map using unique weights. If map.SizeX = 1 or map.SizeY = 1, there is only one unit in that direction which is to be connected to a number of unique regions in prev_map using shared weights. The function first creates a set of weights (size map.FilterSizeX times map.FilterSizeY) using malloc_weight. These weights get a SHAREDWEIGHT WeightFlag field (see WEIGHT-flags). Then a set of links is created between a unit in map and a group of units in prev_map, after which each link is connected to a weight in the weight set. This is done for all units in map. If the weights are not shared (map.FilterSizeX < 0 or map.FilterSizeX < 0), a new set of weights is created for each unit in map. The created LINK structures are allocated using malloc_link and given the correct LinkFlag (INLINK or OUTLINK, see LINK-flags).

NOTE

The link_count and weight_count variables are updated (see SHAREDNET-variables).

SEE ALSO

connect_layers, create_map, create_layer, create_sharednet

This document was generated using api2html on Thu Mar 5 09:00:00 MET DST 1998