1 /***************************************************************************** 2 FILE : $Source: /projects/higgs1/SNNS/CVS/SNNS/kernel/sources/krui_typ.h,v $ 3 SHORTNAME : 4 SNNS VERSION : 4.2 5 6 PURPOSE : SNNS-Kernel User Interface Function Prototypes 7 NOTES : ANSI-C only 8 9 AUTHOR : Niels Mache 10 DATE : 27.02.90 11 12 CHANGED BY : Sven Doering 13 RCS VERSION : $Revision: 2.9 $ 14 LAST CHANGE : $Date: 1998/02/25 15:27:20 $ 15 16 Copyright (c) 1990-1995 SNNS Group, IPVR, Univ. Stuttgart, FRG 17 Copyright (c) 1996-1998 SNNS Group, WSI, Univ. Tuebingen, FRG 18 19 ******************************************************************************/ 20 21 22 /* ----------------------- THAT'S NEW: ------------------------------- 23 24 25 Development History of the SNNS Kernel (reverse order): 26 27 ****************************************************************************** 28 29 22.07.92: 30 NEW FUNCTIONS: 31 A set of new activation/initialization/learning functions for make use of 32 Radial Basis Functions. Changes in: 33 trans_f.c 34 init_f.c 35 learn_f.c 36 func_tbl.c 37 NEW MODULES: 38 matrix.c 39 matrix.h 40 - general purpose matrix operations 41 42 ******************************************************************************* 43 44 45 ******************************************************************************* 46 47 22.05.92: 48 NEW FUNCTIONS: 49 krui_saveResult( ... ) 50 - saves a result file. Depends on the current loaded net and patterns 51 52 ******************************************************************************* 53 54 ******************************************************************************* 55 56 SNNS Kernel Version 2.1 with parallel kernel capability: 57 58 1.01.92: 59 CHANGES: 60 krui_deleteLink(), 61 krui_deleteAllInputLinks(), 62 krui_deleteAllOutputLinks() 63 now returns and error code. 64 65 krui_getCurrentSuccUnit( ... ) 66 has been removed from the interface. 67 68 NEW FUNCTIONS: 69 krui_setSpecialNetworkType( ... ) 70 - sets the topologic type of the current network. 71 72 krui_getSpecialNetworkType() 73 - returns the special topologic type of the current network, if set. 74 75 krui_MasPar( ... ) 76 - connects and disconnects the MasPar. 77 78 krui_getMasParStatus() 79 - returns the status of the MasPar. 80 81 krui_newVectorPatternPair( ... ) 82 - creates a new pattern vector. 83 84 krui_getPatternArrays( ... ) 85 - determines the addresses of the internal pattern arrays. 86 87 krui_allocatePatterns( ... ) 88 - allocate pattern pairs. 89 90 krui_setNoOfPatterns( ... ) 91 - set the number of available pattern pairs. 92 93 94 ******************************************************************************* 95 96 SNNS Kernel Version 2.0: 97 98 21.08.91: 99 NEW FUNCTIONS: 100 krui_searchUnitName( ... ) 101 - searches for a unit with the given name 102 krui_searchNextUnitName() 103 - searches for the next unit with the given name 104 krui_testNet( ... ) 105 - calculates the network error whith a given pattern 106 krui_getNoOfTTypeUnits( ... ) 107 - returns the no. of units of the specified topologic type 108 (should now be used instead of "krui_getNoOfInputUnits" and 109 "krui_getNoOfOutputUnits") 110 111 krui_getFuncParamInfo( ... ) 112 - returns the no. of input and output parameters of the given function 113 114 115 NEW FUNCTIONS for the 3D-Kernel: 116 krui_getXYTransTable( ... ) 117 - returns the pointer of the XY-Translation Table 118 119 krui_getUnitCenters( ... ) 120 - returns the 3D transform center of the specified unit and center number 121 122 krui_setUnitCenters( ... ) 123 - sets the 3D transform center of the specified unit and center number 124 125 126 ******************************************************************************* 127 128 SNNS Kernel Version 1.3: 129 130 26.04.91: 131 CHANGES: 132 krui_showPattern( mode ) 133 - has now only one parameter <mode> (the parameter <pattern_no> has left) 134 krui_showPattern(...) shows now the CURRENT pattern. 135 136 - The pattern file format has been changed but the scanner is downward kompatible. 137 The new file format has now a SNNS-header with time stamp and is better readable. 138 Comments (beginning with a #) are also possible. 139 140 NEW FUNCTIONS: 141 krui_setPatternNo( ... ) 142 - sets the current pattern for access 143 krui_deletePattern() 144 - deletes the current pattern 145 krui_modifyPattern() 146 - modifies the current pattern 147 148 149 150 ******************************************************************************* 151 152 SNNS Kernel Version 1.2: 153 154 18.03.91: 155 CHANGES: 156 krui_randomizeWeights( ... ) 157 - has been removed from the user interface 158 krui_updateNet( ... ) 159 - parameters of krui_updateNet has changed 160 161 NEW FUNCTIONS: 162 krui_setInitialisationFunc( ... ) 163 - sets the initialisation function (i.e. randomize weights) 164 krui_getInitialisationFunc() 165 - returns the current initialisation function 166 krui_initializeNet( ... ) 167 - initializes the net with the current initialisation function 168 krui_setUpdateFunc( ... ) 169 - sets the update function (i.e. serial propagation) 170 krui_getUpdateFunc() 171 - returns the current update function 172 krui_updateNet( ... ) 173 - updates the network 174 175 ******************************************************************************* 176 177 178 179 ******************************************************************************* 180 181 SNNS Kernel Version 1.1: 182 183 19.12.90: 184 CHANGES: 185 krui_learnAllPatterns( ... ) and krui_learnSinglePattern( ... ) 186 have parameter arrays now. The return type has changed to krui_err. 187 188 NEW FUNCTIONS: 189 krui_getLearnFunc( ... ) 190 - Returns the name of the current learning function 191 krui_setLearnFunc( ... ) 192 - Changes the learning function 193 194 195 ******************************************************************************* 196 197 ############################################################################### 198 199 18.10.90 SNNS Kernel Version 1.0 200 201 ############################################################################### 202 203 204 18.10.90: 205 NEW FUNCTIONS: 206 krui_getUnitNoNearPosition( ... ) 207 - Returns the unit no. near the given position 208 209 210 04.10.90: 211 CHANGES: 212 krui_getUnitNoAtPosition( ... ) needs now another parameter <subnet_no>. 213 214 215 25.09.90: 216 NEW FUNCTIONS: 217 krui_randomizeWeights( ... ) 218 - Initializes connection weights with uniform distributed random values. 219 220 krui_jogWeights( ... ) 221 - Add uniform distributed random values to connection weights. 222 223 krui_areConnected( ... ) 224 - Determines a connection AND the attached site between two units 225 and returns the connection weight. 226 227 228 05.06.90: 229 NEW FUNCTIONS: 230 krui_setSite( char *site_name ) 231 - initializes the given site at the current unit. 232 233 234 04.06.90: 235 All Symbols (Unit, Site, FType) will be spelling checked now. 236 Symbols must match ([A-Za-z]^[|, ]*). 237 238 krui_loadNet( ... ) 239 - now admit user friendly free style format 240 - loads default presettings 241 242 krui_saveNet( ... ) now saves default presettings. 243 244 NEW FUNCTIONS: krui_getUnitDefaults( ... ) and 245 krui_setUnitDefaults( ... ) 246 247 - Determines and changes the default presettings. 248 NOTE: Presettings may now be changed dynamically, i.e 249 during creation of units. 250 251 252 29.05.90: 253 NEW FUNCTIONS: 254 krui_getMemoryManagerInfo( ... ) 255 - returns the number of ALLOCATED (not the number of USED) bytes 256 for the units, sites, name-table and site-table. 257 258 krui_getNetInfo( ... ) 259 - returns miscellanous information about the current network. 260 261 krui_getVersion() 262 - returns the current version of the SNNS-Kernel. 263 264 265 ******************************************************************************* 266 267 268 For additional type definitions and constants see include file "glob_typ.h" ! 269 For kernel user interface function prototypes use this file ! 270 */ 271 272 273 274 /*################################################# 275 276 GROUP: Unit Functions 277 278 #################################################*/ 279 280 281 int krui_getNoOfUnits( void ); 282 /* Returns the number of units used by the network. 283 */ 284 285 int krui_getFirstUnit( void ); 286 /* Initializes the first available unit for access. If the unit has sites, the 287 first site will be set to the current site. 288 Returns the unit no. of the first unit or 0 if no units available. 289 */ 290 291 int krui_getNextUnit( void ); 292 /* Initializes the next available unit for access. If the unit has sites, the 293 first site will be set to the current site. 294 Returns the unit no. of the next unit or 0 if no more units available. 295 */ 296 297 int krui_getCurrentUnit( void ); 298 /* Returns the no. of the current unit or 0 if no units available. 299 */ 300 301 krui_err krui_setCurrentUnit( int UnitNo ); 302 /* Initializes a unit for access. If the unit has sites, the first site 303 will be set to the current site. 304 Returns error code if the given unit doesn't exist, 0 otherwise. 305 */ 306 307 308 char *krui_getUnitName( int UnitNo ); 309 /* Returns the name of the unit. (NULL if not available). 310 */ 311 312 krui_err krui_setUnitName( int UnitNo, char * unit_name ); 313 /* Sets the name of the unit <UnitNo>. 314 If the unit_name pointer is NULL, the unit's symbol will be deleted. 315 Function has no effect on the current unit. 316 Returns error code if memory allocation fails, 0 otherwise. 317 */ 318 319 int krui_searchUnitName( char *unit_name ); 320 /* Searches for a unit with the given name. 321 Returns the first unit no. if a unit with the given name was found, 322 0 otherwise. 323 324 Returns error code if no units defined. 325 */ 326 327 int krui_searchNextUnitName( void ); 328 /* Searches for the next unit with the given name. 329 Returns the next unit no. if a unit with the given name was found, 330 0 otherwise. 331 332 NOTE: Call krui_searchUnitName( unit_name ) before calling krui_searchNextUnitName(). 333 334 Returns error code if no units defined. 335 */ 336 337 338 339 char *krui_getUnitOutFuncName( int UnitNo ); 340 /* Returns the output function name of the unit. 341 Do not use invalid unit numbers! 342 */ 343 344 krui_err krui_setUnitOutFunc( int UnitNo, char * unitOutFuncName ); 345 /* The unit's FType will be set to 0, i.e. the 346 unit's functionality type will be deleted. 347 Function has no effect on the current unit. 348 Do not use invalid unit numbers! 349 NOTE: Returns 0, if the function is a valid output function, 350 error code otherwise. 351 */ 352 353 char *krui_getUnitActFuncName( int UnitNo ); 354 /* Returns the activation function name of the unit. 355 Do not use invalid unit numbers! 356 */ 357 358 krui_err krui_setUnitActFunc( int UnitNo, char * unitActFuncName ); 359 /* The unit's FType will be set to 0, i.e. the 360 unit's functionality type will be deleted. 361 Function has no effect on the current unit. 362 Do not use invalid unit numbers! 363 NOTE: Returns 0, if the function is a valid activation function, 364 error code otherwise. 365 */ 366 367 368 char *krui_getUnitFTypeName( int UnitNo ); 369 /* Returns the functionality type name of the unit. 370 Function has no effect on the current unit. 371 Returns NULL if unit has no FType. 372 Do not use invalid unit numbers! 373 */ 374 375 376 FlintType krui_getUnitActivation( int UnitNo ); 377 /* Returns the activation value of the unit. 378 Function has no effect on the current unit. 379 Do not use invalid unit numbers! 380 */ 381 382 krui_err krui_setUnitActivation(int UnitNo, FlintTypeParam unit_activation); 383 /* Sets the activation value of the unit. 384 Function has no effect on the current unit. 385 Do not use invalid unit numbers! 386 */ 387 388 FlintType krui_getUnitInitialActivation( int UnitNo ); 389 /* Returns the initial activation value of the unit. 390 Function has no effect on the current unit. 391 Do not use invalid unit numbers! 392 */ 393 394 void krui_setUnitInitialActivation( int UnitNo, FlintTypeParam unit_i_activation ); 395 /* Sets the initial activation value of the unit. 396 Function has no effect on the current unit. 397 Do not use invalid unit numbers! 398 */ 399 400 FlintType krui_getUnitOutput( int UnitNo ); 401 /* Returns the output value of the unit. 402 Function has no effect on the current unit. 403 Do not use invalid unit numbers! 404 */ 405 406 krui_err krui_setUnitOutput( int UnitNo, FlintTypeParam unit_output ); 407 /* Sets the output value of the unit. 408 Function has no effect on the current unit. 409 Do not use invalid unit numbers! 410 */ 411 412 413 FlintType krui_getUnitBias( int UnitNo ); 414 /* Returns the bias value of the unit. 415 Function has no effect on the current unit. 416 Do not use invalid unit numbers! 417 */ 418 419 void krui_setUnitBias( int UnitNo, FlintTypeParam unit_bias ); 420 /* Sets the bias value of the unit. 421 Function has no effect on the current unit. 422 Do not use invalid unit numbers! 423 */ 424 425 426 int krui_getUnitSubnetNo( int UnitNo ); 427 /* Returns the subnet number of the unit. 428 Function has no effect on the current unit. 429 NOTE: The range of the subnet no. is -32736...+32735 430 Do not use invalid unit numbers! 431 */ 432 433 void krui_setUnitSubnetNo( int UnitNo, int subnet_no); 434 /* Sets the subnet number of the unit. 435 Function has no effect on the current unit. 436 NOTE: The range of the subnet no. is -32736...+32735 437 Do not use invalid unit numbers! 438 */ 439 440 unsigned short krui_getUnitLayerNo( int UnitNo ); 441 /* Returns the layer number of the unit. 442 Function has no effect on the current unit. 443 NOTE: Bit fields are 16 bit integers 444 Do not use invalid unit numbers! 445 */ 446 447 void krui_setUnitLayerNo( int UnitNo, int layer_bitField ); 448 /* Sets the layer number of the unit. 449 Function has no effect on the current unit. 450 NOTE: Bit fields are 16 bit integers 451 Do not use invalid unit numbers! 452 */ 453 454 void krui_getUnitPosition( int UnitNo, struct PosType *position ); 455 /* Returns the position of the unit. 456 Function has no effect on the current unit. 457 Do not use invalid unit numbers! 458 459 NOTE: See include file glob_typ.h for PosType definition ! 460 */ 461 462 void krui_setUnitPosition( int UnitNo, struct PosType *position ); 463 /* Sets the position of the unit. 464 Function has no effect on the current unit. 465 Do not use invalid unit numbers! 466 467 NOTE: See include file glob_typ.h for PosType definition ! 468 */ 469 470 471 int krui_getUnitNoAtPosition( struct PosType *position, int subnet_no ); 472 /* Returns the unit no. at the given position and the specified 473 subnet no or 0, if no unit exists at this position. 474 Function has no effect on the current unit. 475 476 NOTE: This function is slow because it uses linear search to 477 find the unit with the given position. 478 479 REMARK: getUnitNoAtPosition is for downward compatibility only. 480 Do not use this function in future applications. 481 */ 482 483 int krui_getUnitNoNearPosition( struct PosType *position, int subnet_no , 484 int range, int gridWidth ); 485 /* Returns the unit no. near the given position and the specified 486 subnet no or 0, if no unit exists at this position. 487 Function has no effect on the current unit. 488 489 NOTE: This function is slow because it uses linear search to 490 find the unit with the given position. 491 */ 492 493 494 /* Functions for the 3D-Kernel */ 495 krui_err krui_getUnitCenters( int unit_no, int center_no, struct PositionVector * *unit_center ); 496 /* Returns the 3D transform center of the specified unit and center number. 497 Function has no effect on the current unit. 498 Returns error number if unit or center no. is invalid 499 */ 500 501 krui_err krui_setUnitCenters( int unit_no, int center_no, struct PositionVector *unit_center ); 502 /* sets the 3D transform center of the specified unit and center number 503 Function has no effect on the current unit. 504 Returns error number if unit or center no. is invalid 505 */ 506 507 krui_err krui_xyTransTable(int op, int *x, int *y, int z); 508 /* Returns the x y coordinate of the given z-value. 509 Returns error code if the SNNS-Kernel isn't a 3D-Kernel. 510 */ 511 512 513 514 515 516 int krui_getUnitTType( int UnitNo ); 517 /* Returns the topologic type, i.e. input, output, hidden 518 Function has no effect on the current unit. 519 520 NOTE: See include file glob_typ.h for TType constants ! 521 522 Do not use invalid unit numbers! 523 */ 524 525 krui_err krui_setUnitTType( int UnitNo, int UnitTType ); 526 /* Sets the topologic type of the unit. 527 Function has no effect on the current unit. 528 529 NOTE: See include file glob_typ.h for TType constants ! 530 531 Returns error code if topologic type or unit number is invalid. 532 */ 533 534 krui_err krui_freezeUnit( int UnitNo ); 535 /* Freezes the output of a unit, i.e. the unit is disabled. 536 Function has no effect on the current unit. 537 Do not use invalid unit numbers! 538 */ 539 540 krui_err krui_unfreezeUnit( int UnitNo ); 541 /* Disabels a previosly freezed unit. 542 Function has no effect on the current unit. 543 Do not use invalid unit numbers! 544 */ 545 546 bool krui_isUnitFrozen( int UnitNo ); 547 /* Returns true, if unit is frozen 548 Do not use invalid unit numbers! 549 */ 550 551 552 int krui_getUnitInputType( int UnitNo ); 553 /* Returns the input type of the unit: 554 NO_INPUTS : if the unit has not inputs (at least not now) 555 SITES : if the unit has one or more sites (and no direct input links !) 556 DIRECT_LINKS : if the unit has direct input links (and no sites !) 557 558 Function has no effect on the current unit. 559 560 NOTE: See include file glob_typ.h for input type constants ! 561 */ 562 563 /* ************************************* */ 564 565 int krui_createDefaultUnit( void ); 566 /* Creates a unit with default properties: 567 1. default activation and output functions 568 2. default activation and bias 569 3. default position, subnet and layer number 570 4. no functionality type 571 5. no sites 572 6. no inputs and outputs 573 7. no unit_name 574 575 Returns an (negative) error code, if memory allocation fails or 576 invalid functions occured. Returns (positive) unit number otherwise. 577 Function has no effect on the current unit. 578 579 NOTE: See file "kr_def.h" for more details about default presettings. 580 */ 581 582 int krui_createUnit( char *unit_name, char *out_func_name, char *act_func_name, 583 FlintTypeParam i_act, FlintTypeParam bias); 584 /* Creates a user defined unit. 585 Returns an (negative) error code, if memory allocation fails or 586 invalid functions occured. Returns (positive) unit number otherwise. 587 Function has no effect on the current unit. 588 589 Unit has additional default settings: 590 1. default position, subnet and layer number 591 2. no functionality type 592 3. no sites 593 4. no inputs and outputs 594 595 */ 596 597 598 krui_err krui_deleteUnit( int UnitNo ); 599 /* Deletes a unit from network. Removes all links to other 600 units. Returns error code if unit doesn't exist. 601 */ 602 603 int krui_createFTypeUnit( char * FType_name); 604 /* creates a unit with FType properties, but: 605 1. no inputs and outputs 606 2. default position, subnet and layer 607 608 Returns the unit number or (negative) error code if memory allocation 609 fails or functionality type isn't defined. 610 Function has no effect on the current unit. 611 */ 612 613 614 krui_err krui_setUnitFType( int UnitNo, char * FTypeName ); 615 /* Changes the properties of unit <UnitNo> to FType properties. 616 617 Returns an error code if 618 - FType name doesn't exist or 619 - unit doesn't exist or 620 - memory allocation fails 621 otherwise 0. 622 623 Function has no effect on the current unit. 624 */ 625 626 627 int krui_copyUnit( int UnitNo, int copy_mode); 628 /* Copy a given unit, according to the copy mode 629 1. copy unit (with it sites, if available) and input/output links 630 2. copy unit (with it sites, if available) and input links 631 3. copy unit (with it sites, if available) and output links 632 4. copy unit (with it sites, if available) but no input/output links 633 634 Returns the unit number of the new unit or error message < 0 , if errors occured. 635 Function has no effect on the current unit. 636 637 NOTE: Copying of output links is slow. 638 If return code < 0, an error occured. 639 640 See include file glob_typ.h for copy mode constants ! 641 642 */ 643 644 645 /*################################################# 646 647 GROUP: Functions for manipulation of the Unit-Functionality-List 648 REMEMBER: The Unit-Functionality-List stores: 649 1. unit activation and output functions 650 2. if sites: 3. all site functions 651 4. all site names 652 653 654 #################################################*/ 655 656 bool krui_setFirstFTypeEntry( void ); 657 /* Initializes the first FType entry. 658 Returns true, if an entry is available 659 */ 660 bool krui_setNextFTypeEntry( void ); 661 /* Initializes the next FType entry. 662 Returns true, if an entry is available 663 */ 664 665 bool krui_setFTypeEntry( char *Ftype_symbol ); 666 /* Initializes the FType entry with the given name. 667 Returns true, if an entry with this name is available. 668 */ 669 670 char *krui_getFTypeName( void ); 671 /* Returns the name of the current FType entry. 672 NOTE: The FType name is definite and will never be 673 a NULL pointer. 674 */ 675 676 krui_err krui_setFTypeName( char *unitFType_name ); 677 /* Sets the name of the current FType entry. 678 Returns error code if memory allocation fails or Ftype name 679 isn't definite, 0 otherwise. 680 NOTE: The new FType name have to be definite and must not be 681 a NULL pointer. 682 */ 683 684 char *krui_getFTypeActFuncName( void ); 685 /* Returns the name of the activation function in the current 686 FType entry. 687 */ 688 689 krui_err krui_setFTypeActFunc( char * act_func_name ); 690 /* Sets the activation function in the current FType entry 691 returns 0, if the function is a valid activation function, 692 error code otherwise. 693 All units (in the existing network) of the current Ftype changes 694 their activation function. 695 */ 696 697 char *krui_getFTypeOutFuncName( void ); 698 /* Returns the name of the output function in the current 699 FType entry. 700 */ 701 702 krui_err krui_setFTypeOutFunc( char * out_func_name ); 703 /* Sets the output function in the current FType entry 704 Returns 0, if the function is a valid output function, 705 error code otherwise. 706 All units (in the existing network) of the current Ftype changes 707 their output function. 708 */ 709 710 /* FType sites 711 */ 712 bool krui_setFirstFTypeSite( void ); 713 /* Initializes the first site of the current FType. 714 Returns FALSE, if no sites are available in the current 715 FType entry. 716 */ 717 718 bool krui_setNextFTypeSite( void ); 719 /* Initializes the next FType site. 720 Returns FALSE, if no more sites are available in the current 721 FType entry. 722 */ 723 724 char *krui_getFTypeSiteName( void ); 725 /* Returns the name of the current FType site (in the current 726 Ftype entry). 727 */ 728 729 krui_err krui_setFTypeSiteName( char * FType_site_name ); 730 /* Sets the name and function of the current FType site (in the 731 current FType entry). 732 All sites (in the existing network) of the current Ftype and the 733 same (old) name changes their names and site functions. 734 735 Returns an error code if 736 - current Ftype site isn't defined 737 - site name does not exist in the site name table 738 0 otherwise. 739 */ 740 741 krui_err krui_createFTypeEntry( char * FType_symbol, 742 char * act_func, char * out_func, 743 int no_of_sites, char * *array_of_site_names ); 744 745 /* Create a new functionality type, needs a definite FType symbol, 746 the unit output and activation function 747 and the number of sites provided for this unit FType. 748 An additional array with N elements of pointers to site names 749 is required for the definition of the sites. 750 751 Returns error code if: 752 - memory allocation fails 753 - FType name isn't definite (symbol is used for another FType 754 or symbol is a NULL pointer) 755 - one or more site names are undefined 756 757 0 otherwise. 758 759 NOTE: The number of Ftype entries and the number of sites per Ftype is 760 only limited by the size of system memory. 761 */ 762 763 krui_err krui_deleteFTypeEntry( char *FType_symbol ); 764 /* Deletes the specified FType entry. If there exists units in the 765 network with this FType, all these units will lost their FType 766 but the functionality of the units will not be changed. 767 Returns error code if FType symbol dosn't exist, 0 otherwise. 768 */ 769 770 771 /*################################################# 772 773 GROUP: Functions for reading of the function table 774 The function table holds the names, types and no. of parameters 775 of all functions (transfer, propagate, learning and initialisation 776 functions) 777 778 #################################################*/ 779 780 int krui_getNoOfFunctions( void ); 781 /* Returns the number of available functions 782 */ 783 784 void krui_getFuncInfo( int func_no, char * *func_name, int *func_type ); 785 /* Returns the name of the function and the function type (Output, 786 Activation, Site). 787 788 NOTE: See include file glob_typ.h for function type constants ! 789 */ 790 791 bool krui_isFunction( char *func_name, int func_type ); 792 /* Returns true if the given function name and type exists. 793 794 NOTE: See include file glob_typ.h for function type constants ! 795 */ 796 797 bool krui_getFuncParamInfo( char *func_name, int func_type, 798 int *no_of_input_params, 799 int *no_of_output_params ); 800 801 /* Returns the no. of input and output parameters of the given 802 function (only relevant for learning, update and initialisation 803 functions). 804 805 Returns TRUE if the given function exists, FALSE otherwise. 806 */ 807 808 /*################################################# 809 810 GROUP: Site Table Functions 811 812 #################################################*/ 813 814 bool krui_getFirstSiteTableEntry( char * *site_name, char * *site_func ); 815 /* Returns the first site name/function pair in the site table. 816 Returns FALSE and NULL, if not available. 817 */ 818 819 bool krui_getNextSiteTableEntry( char * *site_name, char * *site_func ); 820 /* Returns the next site name/function pair in the site table. 821 Returns FALSE and NULL, if not available. 822 */ 823 824 char *krui_getSiteTableFuncName( char *site_name ); 825 /* Returns the name of the site function that is associated with 826 the site name. 827 If the site name do not exist, function returns NULL. 828 */ 829 830 krui_err krui_createSiteTableEntry( char *site_name, char *site_func ); 831 /* Creates a new site name and associate this name with a site 832 function. 833 Returns error code if: 834 - site name already exists or 835 - site function is invalid or 836 - memory allocation has failed 837 0 otherwise. 838 */ 839 840 krui_err krui_changeSiteTableEntry( char *old_site_name, char *new_site_name, char *new_site_func ); 841 /* Changes the site function of a previously defined site name. 842 Returns error code if <old_site_name> or <new_site_func> 843 are not defined, 0 otherwise. 844 845 NOTE: All sites in the network with the name <old_site_name> 846 changes their names and functions. 847 */ 848 849 krui_err krui_deleteSiteTableEntry( char *site_name ); 850 /* Removes the current site name entry from the site table. 851 852 Returns an error code if there exists sites in the network 853 with the given name, 0 otherwise. 854 */ 855 856 /*################################################# 857 858 GROUP: Site Functions 859 860 #################################################*/ 861 862 bool krui_setFirstSite( void ); 863 /* Initializes the first site at the current unit. 864 Returns false if no site available or if no sites permitted 865 at this unit. 866 */ 867 868 bool krui_setNextSite( void ); 869 /* Initializes the next site at the current unit. 870 Returns false if no more sites available. 871 */ 872 873 krui_err krui_setSite( char *site_name ); 874 /* Initializes the given site at the current unit. 875 Returns error code if 876 - unit dosn't exist 877 - site name doesn't exist 878 - unit don't has sites 879 - unit don't has a site with this name 880 0 otherwise. 881 */ 882 883 884 FlintType krui_getSiteValue( void ); 885 /* Returns the actual value of the current site. 886 */ 887 888 char *krui_getSiteName( void ); 889 /* Returns the name of the current unit/site, 890 NULL if not available. 891 */ 892 893 krui_err krui_setSiteName( char *site_name ); 894 /* Sets the name/function of the current unit/site. 895 Current Unit will loose the functionality type. 896 Returns error code if site name isn't defined. 897 */ 898 899 char *krui_getSiteFuncName( void ); 900 /* Returns the name of the current unit/site function. 901 */ 902 903 krui_err krui_addSite( char * site_name ); 904 /* Adds a site at the current unit. If the unit has already sites, this new 905 site will be inserted above all other sites, i.e. the new created site will 906 be the first site at this unit. 907 If the unit has direct input links, i.e the unit has input links 908 but no sites, the creation of sites is not permitted (krui_addSite will 909 return an error code). 910 If there exists already a site with the given name, the creation of the 911 new site is prohibited and krui_addSite returns an error code. 912 913 krui_addSite has no effect on the current site. To change the current site 914 to this new site, call krui_setFirstSite(). 915 The unit's FType will be deleted. 916 917 Returns error code if 918 - memory allocation fails or 919 - unit has direct input links or 920 - site name isn't defined or 921 - site with the given name exists already at this unit 922 0 otherwise. 923 924 NOTE: The number of sites per unit is nearly unlimited (2^32). 925 */ 926 927 928 bool krui_deleteSite( void ); 929 /* Removes the current site at the current unit and removes all 930 links from predecessor units to this site. 931 krui_setFirstSite (krui_setNextSite) must be called at least once 932 before using this function. 933 The current site will be set to the next available site, if no more 934 sites available, krui_deleteSite returns 0 otherwise 1. 935 Returns an error code if ther was a problem. 936 The unit's FType will be set to 0, i.e. the unit's functionality 937 type will be deleted. 938 939 NOTE: To delete all sites at a unit: 940 if ( krui_setFirstSite() ) 941 while ( krui_deleteSite() > 0) { } 942 */ 943 944 945 /*################################################# 946 947 GROUP: Link Functions 948 949 #################################################*/ 950 951 int krui_getFirstPredUnit( FlintType *strength ); 952 /* Returns the no. of first predecessor unit of the current unit/site 953 and the connection strenght. 954 Returns 0 if no predecessor unit available, i.e. if the current 955 unit and/or site has no inputs. 956 957 NOTE: If a predecessor unit exists, the current link is set to the link 958 between the two units. 959 */ 960 961 int krui_getNextPredUnit( FlintType *strength ); 962 /* Returns the no. of the next predecessor unit of the current 963 unit/site and the connection strenght. 964 Returns 0 if no more predecessor units exists. 965 NOTE: If another predecessor unit exists, the current link is set to the link 966 between the two units. 967 */ 968 969 int krui_getCurrentPredUnit( FlintType *strength ); 970 /* Returns the no. of the current predecessor unit (of the current 971 unit/site) and the connection strenght. 972 Returns 0 if no predecessor unit available, i.e. if the current unit 973 and/or site has no inputs. 974 */ 975 976 int krui_getFirstSuccUnit( int UnitNo, FlintType *strength ); 977 /* Returns the no. of the first successor unit of the unit <source_unit_no> 978 and the connection strenght. 979 Returns (negative) error code if unit doesn't exist. 980 Returns 0 if no successor unit available, i.e. if the given unit 981 has no output connection. 982 983 IMPORTANT: If a successor unit exists, the current unit and site will be 984 set to this successor unit and the attached site. 985 986 NOTE: This function is slow (Units are backward chained only). 987 988 REMARK: getFirstSuccUnit is for downward compatibility only. 989 Do not use this function in future applications. 990 */ 991 992 993 int krui_getNextSuccUnit( FlintType *strength ); 994 /* Returns the no. of the next successor unit and the connection strenght. 995 996 IMPORTANT: If a successor unit exists, the current unit and site will be 997 set to this successor unit and the attached site. 998 999 NOTE: This function is slow (Units are backward chained only) 1000 1001 REMARK: getNextSuccUnit is for downward compatibility only. 1002 Do not use this function in future applications. 1003 */ 1004 1005 1006 extern bool krui_areConnected(int source_unit_no, int target_unit_no); 1007 extern bool krui_areConnectedWeight(int source_unit_no, int target_unit_no, FlintType *weight); 1008 /* Returns true if there exists a connection between source unit <source_unit_no> 1009 and target unit <target_unit_no>, otherwise false. If there exist a 1010 connection between these units, krui_areConnected returns the connection 1011 strength also. 1012 Returns FALSE if unit doesn't exist. 1013 1014 IMPORTANT: If there exist a connection, the current unit and site will be 1015 set to the target unit and the attached site. 1016 1017 NOTE: This function is slow (Units are backward chained only). 1018 */ 1019 1020 bool krui_isConnected( int source_unit_no ); 1021 /* True if there exists a connection between source unit <source_unit_no> 1022 and the current unit/site, otherwise false. 1023 1024 NOTE: If there exists a connection between the two units, the current link is set 1025 to the link between the two units. (alter the link weight with krui_setLinkWeight) 1026 */ 1027 1028 FlintType krui_getLinkWeight( void ); 1029 /* Returns the link weight of the current link. 1030 */ 1031 1032 void krui_setLinkWeight( FlintTypeParam strength ); 1033 /* Sets the link weight of the current link. 1034 */ 1035 1036 krui_err krui_createLink( int source_unit_no, FlintTypeParam strength ); 1037 /* Creates a link between source unit and the current unit/site. 1038 Returns an error code: 1039 - if memory allocation fails 1040 - if source unit doesn't exist or 1041 - if there exists already a connection between current unit/site and 1042 the source unit 1043 0 otherwise. 1044 krui_createLink DO NOT set the current link. 1045 1046 NOTE: If you want to create a link and its unknown if there exists already a 1047 connection between the two units, use krui_createLink and test the return 1048 code, instead of the sequence krui_isConnected and krui_createLink. 1049 */ 1050 1051 krui_err krui_deleteLink( void ); 1052 /* Deletes the current link. 1053 1054 NOTE: To delete a link between the current unit/site and the source unit 1055 <source_unit_no>, call krui_isConnected( source_unit_no ) and 1056 krui_deleteLink(). 1057 */ 1058 1059 krui_err krui_deleteAllInputLinks( void ); 1060 /* Deletes all input links at current unit/site. 1061 */ 1062 1063 krui_err krui_deleteAllOutputLinks( void ); 1064 /* Deletes all output links at current unit. 1065 NOTE: This function is slow. 1066 */ 1067 1068 void krui_jogWeights( FlintTypeParam minus, FlintTypeParam plus); 1069 /* Add uniform distributed random values to connection weights. 1070 <minus> must be less then <plus>. 1071 */ 1072 1073 1074 1075 /*################################################# 1076 1077 GROUP: Functions for network updating 1078 1079 #################################################*/ 1080 1081 krui_err krui_updateSingleUnit( int UnitNo ); 1082 /* Updates a single unit. Returns error code if unit doesn't exist, 1083 0 otherwise. 1084 1085 NOTE: Updates also frozen Units. 1086 */ 1087 1088 char *krui_getUpdateFunc( void ); 1089 /* Returns the current update function. The default update function is 1090 SerialOrder() (see also kr_def.h). 1091 */ 1092 1093 krui_err krui_setUpdateFunc( char *update_func ); 1094 /* Changes the current update function. Returns error code if update 1095 function is invalid. 1096 */ 1097 1098 krui_err krui_updateNet( float *parameterArray, int NoOfParams ); 1099 /* Updates the network according to update function: 1100 1101 To propagate a pattern thru the network the use of following 1102 function calls is recommended: 1103 1104 krui_setPatternNo( pat_no ); 1105 krui_showPattern( OUTPUT_NOTHING ); 1106 krui_updateNet( parameterArray, NoOfParams ); 1107 1108 See also krui_setSeedNo for initializing the pseudo 1109 random generator. 1110 1111 Returns error code if an error occured, 0 othrwise. 1112 1113 NOTE: The network should be feedforward in topological mode, 1114 otherwise function will return a warning message. 1115 */ 1116 1117 krui_err krui_testNet( int pattern_no, 1118 float *updateParameterArray, int NoOfUpdateParams, 1119 float *parameterInArray, int NoOfInParams, 1120 float * *parameterOutArray, int *NoOfOutParams ); 1121 /* Calculates the network error whith the given pattern. 1122 Uses the current update function to propagate the network. 1123 1124 UpdateParameterArray contains the parameters of the update function. 1125 NoOfUpdateParams contains the number of input parameters of the update function. 1126 1127 parameterInArray[0] contains the max. devitation. 1128 Set NoOfInParams to 1. 1129 1130 parameterOutArray[0] contains the error of the network/pattern, 1131 parameterOutArray[1] contains the number of output units with a 1132 higher error value than the given max. devitation. 1133 NoOfOutParams will be set to 2. 1134 1135 NOTE: Patterns must be loaded before calling this function. 1136 1137 Returns error code if an error occured, 0 otherwise. 1138 */ 1139 1140 1141 /*################################################# 1142 1143 GROUP: Functions for network initialisation 1144 1145 #################################################*/ 1146 1147 char *krui_getInitialisationFunc( void ); 1148 /* Returns the current initialisation function. The default initialisation function is 1149 Randomize_Weights (see also kr_def.h). 1150 */ 1151 1152 krui_err krui_setInitialisationFunc( char *init_func ); 1153 /* Changes the current initialisation function. Returns error code if initialisation 1154 function is invalid. 1155 */ 1156 1157 krui_err krui_initializeNet( float *parameterArray, int NoOfParams ); 1158 /* Initializes the network 1159 */ 1160 1161 1162 /*################################################# 1163 1164 GROUP: Learning Functions 1165 1166 #################################################*/ 1167 1168 char *krui_getLearnFunc( void ); 1169 /* Returns the name of the current learning function. 1170 */ 1171 1172 krui_err krui_setLearnFunc( char *learning_func ); 1173 /* Changes the learning function. Returns a error code if the 1174 given learning function is invalid. 1175 */ 1176 1177 krui_err krui_learnAllPatterns( float *parameterInArray, int NoOfInParams, 1178 float * *parameterOutArray, int *NoOfOutParams ); 1179 /* Learn all pattern pairs using current learning method. 1180 parameterInArray contains the learning 1181 parameter(s). NoOfInParams stores the number of learning parameters. 1182 parameterOutArray returns the results from the learning function. 1183 this array is a static array defined in the learning function. 1184 *NoOfOutParams points to a integer value that contains the number 1185 of output parameters from the current learning function. 1186 Returns an error code if memory allocation has failed or if 1187 the parameters are invalid. 1188 1189 Returns error code of the learning function. 1190 REMEMBER: The backpropagation learning function takes the learning 1191 parameter from parameterInArray[ 0 ]. parameterOutArray[ 0 ] 1192 returns the current net error. 1193 1194 NOTE: Patterns must be loaded before calling this function. 1195 */ 1196 1197 krui_err krui_learnSinglePattern( int pattern_no, float *parameterInArray, 1198 int NoOfInParams, 1199 float * *parameterOutArray, int *NoOfOutParams ); 1200 /* Same as krui_learnAllPatterns( ... ) but learns only the current 1201 pattern pair. 1202 1203 NOTE: Patterns must be loaded before calling this function. 1204 */ 1205 1206 krui_err krui_setPatternNo( int patter_no ); 1207 /* Sets the current pattern. 1208 Returns a error code if pattern number is invalid. 1209 1210 NOTE: Patterns must be loaded before calling this function. 1211 */ 1212 1213 krui_err krui_deletePattern( void ); 1214 /* Deletes the current pattern. 1215 */ 1216 1217 krui_err krui_modifyPattern( void ); 1218 /* Modifies the current pattern. 1219 */ 1220 1221 krui_err krui_showPattern( int mode ); 1222 /* According to the mode krui_showPattern stores the current 1223 Pattern into the units activation (and/or output) values. 1224 The modes are: 1225 - OUTPUT_NOTHING 1226 store input pattern into input units activations 1227 - OUTPUT_ACT 1228 store input pattern into input units activations and 1229 store output pattern into output units activations 1230 - OUTPUT_OUT 1231 store input pattern into input units activations, 1232 store output pattern into output units activations and 1233 update output units output 1234 1235 NOTE: See include file glob_typ.h for mode constants. 1236 */ 1237 1238 krui_err krui_newPattern( void ); 1239 /* Creates a new pattern pair. 1240 A pattern pair can be created by modifying the activation 1241 value of the input/output units. 1242 Returns error code if memory is insufficent or no. of 1243 input/output units is incompatible, 0 otherwise. 1244 1245 NOTE: krui_newPattern switches pattern shuffeling off. 1246 For shuffeling the new pattern pairs call 1247 krui_newPattern(...) 1248 krui_shufflePattern( TRUE ) 1249 */ 1250 1251 1252 int krui_getNoOfPatterns( void ); 1253 /* Returns the no. of available pattern pairs. 1254 */ 1255 1256 1257 void krui_deleteAllPatterns( void ); 1258 /* Release previously defined patterns from memory. 1259 Call krui_releasePatterns() if you want to create totally 1260 new patterns with krui_newPattern(). 1261 */ 1262 1263 krui_err krui_shufflePatterns( bool on_or_off ); 1264 /* Shuffle pattern pairs by using pseudo random generator. 1265 Returns error code if memory allocation fails. 1266 Shuffeling of patterns is used by krui_learnAllPatterns(...). 1267 krui_shufflePatterns( TRUE ) switches shuffeling of patterns 1268 on, krui_shufflePatterns( FALSE ) switches shuffeling of 1269 patterns off. 1270 The default presetting is krui_shufflePatterns( FALSE ). 1271 1272 NOTE: See also krui_setSeedNo( seed ) 1273 */ 1274 1275 1276 /*################################################# 1277 1278 GROUP: I/O Functions 1279 1280 #################################################*/ 1281 1282 krui_err krui_loadNet( char *filename, char * *netname ); 1283 /* Load a network file and create a network. 1284 Returns the name of the net or "UNTITLED" if unknown. 1285 Returns error code if an error occured during 1286 loading/memory allocation, or 0 otherwise. 1287 */ 1288 1289 krui_err krui_saveNet( char *filename, char *netname); 1290 /* Save a network. 1291 If netname is a NULL pointer, the net will get the name "UNTITLED" 1292 Returns error code if an error occured, or 0 otherwise. 1293 */ 1294 1295 /*################################################# 1296 1297 GROUP: Functions for reading/searching the symbol table 1298 The symbol table holds the names and types of all symbols 1299 (unit and site symbols). 1300 1301 #################################################*/ 1302 1303 bool krui_getFirstSymbolTableEntry( char * *symbol_name, int *symbol_type ); 1304 /* Returns the first symbol/symbol type entry in the 1305 symbol table. Returns true if this entry is available, 1306 false otherwise. 1307 */ 1308 1309 bool krui_getNextSymbolTableEntry( char * *symbol_name, int *symbol_type ); 1310 /* Returns the next symbol/symbol type entry in the 1311 symbol table. Returns true if another entry is available, 1312 false otherwise. 1313 1314 Example: To get all symbols in the symbol table 1315 if (krui_getFirstSymbolTableEntry( &symbol, &symtype)) 1316 do 1317 { 1318 . 1319 . 1320 . 1321 } 1322 while (krui_getNextSymbolTableEntry( &symbol, &symtype)); 1323 */ 1324 1325 1326 bool krui_symbolSearch( char * symbol, int symbol_type); 1327 /* Searches the symbol table for a given symbol and 1328 symbol type (unit name symbol, site name symbol, 1329 functionality unit name symbol) 1330 Returns true, if the symbol exists. 1331 */ 1332 1333 /*################################################# 1334 1335 GROUP: Miscellanous 1336 1337 #################################################*/ 1338 1339 1340 char *krui_getVersion( void ); 1341 /* Returns the current Version of the SNNS-Kernel. 1342 */ 1343 1344 void krui_getNetInfo( int *no_of_sites, int *no_of_links, 1345 int *no_of_STable_entries, int *no_of_FTable_entries ); 1346 /* Returns miscellanous information about the current network. 1347 */ 1348 1349 void krui_getUnitDefaults( FlintType *act, FlintType *bias, int *st, 1350 int *subnet_no, int *layer_no, 1351 char * *act_func, char * *out_func ); 1352 /* Returns Information about the unit default settings. 1353 For more information about default settings see krui_createDefaultUnit() and 1354 krui_createFTypeUnit( .. ). 1355 */ 1356 1357 krui_err krui_setUnitDefaults( FlintTypeParam act, FlintTypeParam bias, int st, 1358 int subnet_no, int layer_no, 1359 char *act_func, char *out_func ); 1360 /* Changes the unit default settings. 1361 For more information about default settings see krui_createDefaultUnit() and 1362 krui_createFTypeUnit( .. ). 1363 1364 Returns error code if 1365 - activation/output function is invalid 1366 - Topologic type is invalid 1367 0 otherwise. 1368 */ 1369 1370 1371 1372 void krui_setSeedNo( long seed ); 1373 /* Initialize the pseudo random generator. 1374 0 as argument reinitializes the random generator. 1375 */ 1376 1377 1378 int krui_getNoOfInputUnits( void ); 1379 /* Returns no. of input units 1380 */ 1381 1382 int krui_getNoOfOutputUnits( void ); 1383 /* returns no. of output units 1384 */ 1385 1386 int krui_getNoOfTTypeUnits( int UnitTType ); 1387 /* returns the no. of units of the specified topologic type 1388 (i.e. Input, Hidden, Output, Dual or Special units) 1389 */ 1390 1391 void krui_resetNet( void ); 1392 /* Reset the network by changeing the unit activation 1393 to the initial activation value. 1394 */ 1395 char *krui_error( int error_code ); 1396 /* Returns an error message, depending on the error code. 1397 If a function returns an error code use krui_error to 1398 get the message. 1399 1400 Available error messages are: 1401 1402 "Invalid error code", 1403 "Insufficient memory", 1404 "Invalid unit number", 1405 "Invalid unit output function", 1406 "Invalid unit activation function", 1407 "Invalid site function", 1408 "Creation of sites isn't permitted because unit has direct input links", 1409 "Creation of a link isn't permitted because there exists already a link between these units", 1410 "Memory allocation failed during critical operation. Have lost some pointers, but consistency of the network is guaranteed", 1411 "Ftype name isn't definite", 1412 "Current Ftype entry isn't defined", 1413 "Invalid copy mode", 1414 "Current unit doesn't have sites", 1415 "Can't update unit because unit is frozen", 1416 "Redefinition of site name isn't permitted (site name already exists)", 1417 "Site name isn't defined", 1418 "This is not a 3D-Kernel", 1419 "This unit has already a site with this name", 1420 "Can't delete site table entry because site is in use", 1421 "Current Ftype site isn't defined", 1422 "Ftype symbol isn't defined", 1423 "Physical I/O error", 1424 "Creation of output file failed (line length limit exceeded)", 1425 "The network has not enough layers: ", 1426 "No Units defined", 1427 "Unexpected EOF", 1428 "Line length exceeded", 1429 "Incompatible file format", 1430 "Can't open file", 1431 "Syntax error at line", 1432 "Memory allocation error 1", 1433 "Topologic type invalid", 1434 "Symbol pattern invalid (must start with a letter)", 1435 "Current unit doesn't have a site with this name", 1436 "No hidden units defined", 1437 "Network contains cycle(s): ", 1438 "Network contains dead unit(s): ", 1439 "Pattern file contains not the same no. of input units as the network", 1440 "Pattern file contains not the same no. of output units as the network", 1441 "No. of input units have changed", 1442 "No. of output units have changed", 1443 "No input units defined", 1444 "No output units defined", 1445 "No patterns defined", 1446 "In-Core patterns incompatible with current network (remove In-Core patterns before loading a new network)", 1447 "Invalid pattern number", 1448 "Invalid learning function", 1449 "Invalid parameters", 1450 "Invalid update function", 1451 "Invalid initialisation function", 1452 "Derivation function of the activation function doesn't exist", 1453 "Input unit(s) with input connection(s) to other units: ", 1454 "Output unit(s) with output connection(s) to other units: ", 1455 "Invalid topological sorting mode", 1456 "Learning function doesn't support sites", 1457 "Sites are not supported", 1458 "This isn't a MasPar Kernel", 1459 "Connection(s) between unit(s) in non-neighbour layers are not supported: ", 1460 "The network has too much layers: ", 1461 "The network layers aren't fully connected", 1462 "This operation isn't allowed in the superscalar kernel mode", 1463 "Change of network type isn't possible in superscalar kernel mode", 1464 "No current link defined", 1465 "No current unit defined", 1466 "Current unit doesn't have any inputs", 1467 "Invalid parameter in topologic definition section", 1468 "Creation of link between these units isn't permitted", 1469 "MasPar don't respond", 1470 "This function isn't implemented yet", 1471 "Kernel isn't in parallel mode", 1472 "MasPar ran out of memory", 1473 "MasPar communication error", 1474 "MasPar ran out of processors", 1475 "Missing default function (check function table)", 1476 "MasPar kernel doesn't support multiple unit output functions", 1477 "MasPar kernel doesn't support multiple unit activation functions", 1478 "The depth of the network doesn't fit to the learning function" 1479 1480 1481 */ 1482 1483 1484 /*################################################# 1485 1486 GROUP: Functions for memory management 1487 1488 #################################################*/ 1489 1490 krui_err krui_allocateUnits( int number ); 1491 /* Allocates a given number of units, additional units 1492 may allocated by calling this function again. 1493 This function is called automatically if the user 1494 construct more units than have been allocated before, but 1495 it is recommended to use this function if a large amount 1496 of units is needed (the UNIX System can manage system resources 1497 much better, if the amount of memory used for the network is 1498 approximately known before the network is created). 1499 1500 Returns error code if memory allocation fails, 0 otherwise. 1501 1502 NOTE: If krui_create_unit has been called before using this 1503 function, at least <UNIT_BLOCK> numbers of units have been 1504 allocated. 1505 See "kr_def.h" for more information about memory allocation 1506 block sizes. 1507 */ 1508 1509 void krui_getMemoryManagerInfo( int *unit_bytes, int *site_bytes, int *link_bytes, 1510 int *NTable_bytes, int *STable_bytes, int *FTable_bytes ); 1511 /* Returns the number of ALLOCATED (not the number of USED) bytes 1512 for the units, sites, name-table and site-table. 1513 */ 1514 1515 void krui_deleteNet( void ); 1516 /* Delete network, names and unit types. 1517 Frees all memory used for the network. 1518 1519 NOTE: If krui_loadNet is called more then once, krui_deleteNet will 1520 be called by krui_loadNet, because the kernel have to free the 1521 memory used for the old network. 1522 It is recommended (but not neccessary) to call krui_deleteNet 1523 before terminating program. 1524 */ 1525 1526 1527 /* ############################################################# 1528 1529 Functions for the extern kernels 1530 1531 ############################################################# */ 1532 1533 krui_err krui_setSpecialNetworkType( int net_type ); 1534 /* Sets the topologic type of the current network. 1535 Returns an error if the topologic type of the current network 1536 doesn't fit to this type. 1537 Topologic types are: 1538 - NET_TYPE_GENERAL 1539 general purpose network type with no limitations 1540 - NET_TYPE_FF1 1541 feedforward network with fully connected units in 1542 neighbour layers 1543 */ 1544 1545 int krui_getSpecialNetworkType( void ); 1546 /* Returns the special topologic type of the current network, if set. 1547 */ 1548 1549 int krui_initInversion(void); 1550 void krui_inv_forwardPass(struct UnitList *inputs); 1551 double krui_inv_backwardPass(float learn, float delta_max, int *err_units, 1552 float ratio, struct UnitList *inputs, 1553 struct UnitList *outputs); 1554 1555 #ifdef MASPAR_KERNEL 1556 1557 /* ############################################################# 1558 1559 Functions for the parallel kernel 1560 1561 ############################################################# */ 1562 1563 krui_err krui_MasPar( int mode ); 1564 /* Connects and Disconnects the MasPar. 1565 The mode switches are: MASPAR_CONNECT, MASPAR_DISCONNECT and 1566 MASPAR_NOT_AVAILABLE. 1567 */ 1568 1569 1570 krui_err krui_getMasParStatus( void ); 1571 /* Returns the status of the MasPar. 1572 */ 1573 1574 krui_err krui_MasParBenchmark( int func_type, int cycles, float *result ); 1575 /* Perform benchmark tests 1576 */ 1577 1578 #endif 1579 1580