Lens supports a number of sparse projection patterns between groups. It is likely, however, that you will want to create your own connectivity patterns at some point.
Begin by defining a new projection type. This should be added to type.h (in the section on PROJECTION TYPES). For example:
/* DOUG... */
#define FUNKY_PROJ ((mask) 1 << 10)
/* ...DOUG */
Now write the connection procedure. It should be similar to this:
static flag funkyConnectGroups(Group preGroup, Group postGroup, mask linkType,
real strength, real range, real mean) {
Unit V;
FOR_EVERY_UNIT(preGroup, {
V = U;
FOR_EVERY_UNIT(postGroup, {
if (randProb() < strength)
if (connectUnits(V, U, linkType, range, mean)) return TCL_ERROR;
});
});
return TCL_OK;
}
Be sure to use FOR_EVERY_UNIT rather than FOR_EACH_UNIT unless you want it to skip lesioned units.
Finally, you need to register the projection type by putting a line
like this in userInit() in extension.c:
registerProjectionType("FUNKY_PROJ", FUNKY_PROJ, funkyConnectGroups);
Now you should be able to create projections of your type by calling connectGroups with the "-p FUNKY_PROJ" option.