亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? exemplar.c

?? 各種神經網絡C源代碼。包括: CPN、BPN、ART1、ART2
?? C
字號:
/**************************************************************************
 **************************************************************************
 ***									***
 ***				EXEMPLAR.C				***
 ***									***
 *** Notice:                                                            ***
 ***    This code is copyright (C) 1995 by David M. Skapura.  It may    ***
 ***    be used as is, or modified to suit the requirements of a  	***
 ***    specific application without permission of the author.		***
 ***    There are no royalty fees for use of this code, as long         ***
 ***    as the original author is credited as part of the final		***
 ***    work.  In exchange for this royalty free use, the user    	***
 ***    agrees that no guarantee or warantee is given or implied.	***
 ***									***
 ***									***
 **************************************************************************
 **************************************************************************

   The code in this file provides a standard interface to an exemplar
   source file.  The file is expected to have the following format:

	1. Data is text only.

	2. Only text contained inside curly braces is interpreted by
	   the program.  Anything outside of curly braces is comment.

	3. At the beginning of the file, you may optionally define
	   translation characters for the exemplars.  This is helpful
	   when visualizing the data patterns is necessary.

        4. Every non-blank symbol inside parenthesis is interpreted.
	   Symbols must be assigned at the beginning of the file, or
	   they must be convertable to floating point numbers.

	5. Although you can intermix symbols and floating point
	   values for pattern components, be aware that the characters 
	   "0123456789.+-eE" are reserved for floating point number
	   conversion. If you define one of these characters as a 
	   symbol for another value, do not use floating point number 
	   values as pattern components.

   The following example shows the beginning of a typical exemplar file.


   { X =  0.9 }  Assigns the character 'X' to be numerically  0.9 (active)
   { . =  0.0 }  Assigns the character '.' to be numerically  0.1 (inactive)
   { 1 =  1.0 }  Assigns the character '1' to be numerically  1.0 (active)
   { 0 = -1.0 }  Assigns the character '0' to be numerically -1.0 (inactive}

   What follows is the first exemplar of the training set. The input
   pattern is enclosed by parentheses inside the curly braces, as is
   the output pattern.  Text inside the curly braces, not contained
   inside parentheses is ignored.  For applications that do not require
   an output pattern, use () to denote the target output.

   { (..X..
	  .X.X.
      XX.XX
      X...X
      XXXXX
      X...X
      X...X)

      ABCDEFGHIJKLMNOPQRSTUVWXYZ
     (X.........................)
   }

   Other exemplars would be defined similarly.  The code in this file
   interprets data patterns until the end-of-file is encountered. The
   number of exemplars defined is indefinate, but each must have the
   same number of input and output components as every other exemplar.


*************************************************************************/


#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>


#define MAX_ALIASES 10



typedef struct
 {
  int dimX;
  int dimY;
  float **invecs;
  float **outvecs;
 } iop;



typedef struct
 {
  char c;
  float v;
 } aka;


aka **alias;				/* array of pointers to aliases */
int akacnt;                             /* global holds aka count */



int position (char c, char *s)		/* locate first c in s */
 {
  int i;

  for (i=0; i<strlen(s); i++)
   if (s[i] == c) return (i);

  return (-1);
 }


int is_float (char *s)
 {
  int i=0;

  while (s[i] <= ' ') i++;

  for (; position (s[i], "0123456789.+-eE") >= 0; i++) {}

  if ((i >= strlen(s)) || (position (s[i], " )\0") >= 0))
   {
    s[i] = '\0';
    return (1);
   }

  return (0);
 }



int is_assignment (char *s)
 {
  return (position ('=', s) > -1);
 }



int is_pattern (char *s)
 {
  int rp, lp;

  rp = position ('(', s);
  lp = position (')', s);

  return ((rp < lp) && (rp > -1));
 }



int is_alias (char c)
 {
  int i;

  for (i=0; i<akacnt; i++)
   if (alias[i]->c == c) return (1);

  return (0);
 }



char *substr (char *s, int pos, int bytes)
 {
  char *result;

  result = (char *) calloc (bytes, sizeof(char));
  strncpy (result, (char *)s[pos], bytes);
  return (result);
 }



float getalias (char c)
 {
  int i;

  for (i=0; i<akacnt; i++)
   if (alias[i]->c == c) return (alias[i]->v);

  return (0);
 }



int translate (char *s, float *f)
 {
  int index=0;

  while (s[index] <= ' ') index++;

  if (is_alias (s[index]))
   {
    *f = getalias (s[index]);
    return (index+1);
   }

  if (is_float (s))
   {
    index = strlen(s);
    *f = (float) strtod (s, NULL);
    return (index+1);
   }

  printf ("\nERROR: Could not convert value %s", s);
  exit (0);
  return (0);  /* dummy instruction to avoid compiler warning */
 }


int dimension (char *s)
 {
  float f;
  int i, len, valid, count=0;

  len = strlen (s) - 1;

  for (i=1, valid=0; i<len;)
   {
    valid = translate ((char *)&s[i], &f);

    if (valid)
     {
      count += 1;
      i += valid;
     }
    else i++;
   }

  return (count);
 }


aka *interpret_assignment (char *s)
 {
  aka *result;
  int i, eqflag=0;

  result = (aka *) calloc (1, sizeof(aka));

  for (i=1; (i<strlen(s)-1) && !eqflag; i++)
   {
    if (s[i] == '=') eqflag = i;
    if ((s[i] > ' ') && !eqflag) result->c = s[i];
   }

  if (is_float ((char *)&s[eqflag+1]))
   result->v = (float) atof ((char *)&s[eqflag+1]);
  else result->v = 0;

  return (result);
 }



float *interpret_pattern (char *s, int *dim)
 {
  int i, index;
  float *result;

  if (*dim < 0) *dim = dimension (s);
  else
   if (*dim != dimension (s))
    {
     printf ("\nERROR: Pattern \"%s\" dimension different than previous examples.", s);
     exit (0);
    }

  result = (float *) calloc (*dim, sizeof(float));

  for (i=0, index=1; i<*dim; i++)
   index += translate ((char *)&s[index], &result[i]);

  return (result);
 }



int read_statement (FILE *fp, char *result)
 {
  char c=' ';
  int i, sflag=1;

  while (!(feof(fp)) && (c != '{')) c = fgetc (fp);

  for (i=0; (c != '}') && (!feof(fp));)
   {
    if (position (c, " \n\t") < 0)
     {
      result[i++] = toupper(c);
      sflag = 1;
     }
    else
     if ((c == ' ') && sflag)
      {
       result[i++] = c;
       sflag = 0;
      }

    c = fgetc(fp);
   }

  result[i++] = c;
  result[i] = '\0';
  return (c == '}');
 }



int extract (char *s, char *invec, char *outvec)
 {
  int i, j, len;
  char c=' ';

  len = strlen(s);

  for (i=0; (c != '(') && (i < len); i++) c = s[i];
  for (j=0; (c != ')') && (i < len); i++, j++)
   {
    invec[j] = c;
    c = s[i];
   }

  invec[j++] = c;
  invec[j] = '\0';

  for (; (c != '(') && (i < len); i++) c = s[i];
  for (j=0; (c != ')') && (i < len); i++, j++)
   {
    outvec[j] = c;
    c = s[i];
   }

  outvec[j++] = c;
  outvec[j] = '\0';

  return (i<=len);
 }



int interpret (char *s, float **inval, float **outval, int *dX, int *dY)
 {
  char invec[2048], outvec[2048];

  if (is_assignment (s))
   {
    alias[akacnt++] = interpret_assignment (s);
    return (0);
   }

  if (extract (s, (char *)&invec, (char *)&outvec))
   {
    *inval = interpret_pattern (invec, dX);
    *outval = interpret_pattern (outvec, dY);
    return (1);
   }

  return (0);
 }



int init_patterns (FILE *fp)
 {
  int i=0;
  char buffer[4096], *s=(char *)&buffer[0];

  alias = (aka **) calloc (MAX_ALIASES, sizeof(aka *));
  akacnt = 0;

  while (!(feof(fp)) && (read_statement (fp, s)))
   if (!(is_assignment (s)) && (position ('(', s) >= 0)) i++;

  rewind (fp);
  return (i);
 }


int load_exemplars (char *filename, iop *pattern)
 {
  FILE *fp;
  char buffer[4096], *s=(char *)&buffer[0];
  int iopairs=0, how_many;
  float **invecs, **outvecs;

  if (!(fp = fopen (filename, "r")))
   {
    printf ("\nERROR: Could not open exemplar file \"%s\"", filename);
    exit (0);
   }

  how_many = init_patterns (fp);
  pattern->invecs = (float **) calloc (how_many, sizeof (float *));
  pattern->outvecs = (float **) calloc (how_many, sizeof (float *));

  while (!(feof (fp)) && (read_statement (fp, s)))
   {
    if (interpret (s, &pattern->invecs[iopairs], &pattern->outvecs[iopairs], &pattern->dimX, &pattern->dimY)) iopairs++;

    if (akacnt >= MAX_ALIASES)
     {
      printf ("\nERROR: Too many assignment statements in exemplar file.");
      fclose (fp);
      exit (0);
     }
   }

  fclose (fp);
  return (iopairs);
 }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99久久久欧美国产| 五月激情丁香一区二区三区| 亚洲777理论| 国产一区二区精品久久| 在线免费观看日本欧美| 国产午夜精品久久| 美日韩一级片在线观看| 欧美色综合久久| 亚洲婷婷综合久久一本伊一区| 精品一区二区三区免费毛片爱| 91黄色激情网站| 综合婷婷亚洲小说| 国产成人免费高清| 欧美不卡123| 免费在线观看精品| 欧美群妇大交群中文字幕| 亚洲视频资源在线| 99精品在线观看视频| 国产精品三级av| 粉嫩高潮美女一区二区三区| 日韩视频123| 麻豆成人久久精品二区三区红| 欧美日韩国产一区二区三区地区| 亚洲精品老司机| 91麻豆高清视频| 亚洲精品久久久久久国产精华液| 99精品欧美一区二区蜜桃免费| 日本一区二区三区四区| 国产剧情一区在线| 久久天天做天天爱综合色| 狠狠狠色丁香婷婷综合激情| 精品日韩99亚洲| 国产在线精品一区二区三区不卡 | 丁香激情综合国产| xnxx国产精品| 国产一二三精品| 久久久久久99久久久精品网站| 国产一区亚洲一区| 国产嫩草影院久久久久| 成人天堂资源www在线| 日韩一区在线播放| 欧美亚洲综合另类| 日韩成人av影视| 欧美成人r级一区二区三区| 精品亚洲aⅴ乱码一区二区三区| 精品国产精品网麻豆系列| 国产精品1区2区| 中文字幕一区在线观看| 在线欧美日韩精品| 免费人成在线不卡| 欧美激情在线一区二区| 成人av电影免费在线播放| 亚洲男人天堂av| 3atv在线一区二区三区| 国内精品久久久久影院薰衣草| 国产精品天美传媒| 欧美性受xxxx| 狠狠色丁香久久婷婷综| 亚洲免费观看高清| 日韩一区二区在线观看视频播放| 国产激情视频一区二区三区欧美| 国产精品国产三级国产a| 欧美日韩成人综合在线一区二区 | 欧美r级电影在线观看| 粉嫩av一区二区三区在线播放 | 久久99精品国产麻豆不卡| 亚洲国产精品t66y| 欧美精品亚洲一区二区在线播放| 国产在线精品不卡| 亚洲香肠在线观看| 久久精品视频网| 欧美三级电影在线看| 国产成人综合网| 石原莉奈在线亚洲二区| 中文无字幕一区二区三区| 欧美日韩精品欧美日韩精品一综合| 狠狠v欧美v日韩v亚洲ⅴ| 一区二区三区不卡视频在线观看 | 亚洲欧美一区二区三区极速播放 | 中文字幕一区在线| 精品国产免费人成电影在线观看四季 | 成人91在线观看| 日本亚洲免费观看| 亚洲精品一二三区| 欧美激情一区二区三区不卡| 欧美精品亚洲一区二区在线播放| av中文字幕在线不卡| 极品少妇xxxx精品少妇| 日韩精品电影一区亚洲| 亚洲黄网站在线观看| 国产精品久久久久婷婷二区次| 日韩西西人体444www| 欧美视频在线观看一区二区| 成人黄色一级视频| 国产精选一区二区三区| 免费美女久久99| 亚洲国产日产av| 一区二区三区在线视频观看| 国产精品视频第一区| 久久久久青草大香线综合精品| 91精品国产综合久久精品图片| 91啦中文在线观看| 91网站最新网址| 成人av动漫网站| av一区二区三区黑人| 国产sm精品调教视频网站| 国产一区二区三区久久悠悠色av| 麻豆一区二区三区| 蜜桃传媒麻豆第一区在线观看| 五月婷婷激情综合| 日韩成人dvd| 久久成人精品无人区| 美女视频网站久久| 精品亚洲免费视频| 经典三级在线一区| 国产精品中文有码| 粉嫩av一区二区三区粉嫩| 成人av片在线观看| 色视频一区二区| 欧美日韩激情一区二区三区| 欧美精品日日鲁夜夜添| 91精品一区二区三区久久久久久 | 日本一区二区视频在线观看| 欧美国产激情一区二区三区蜜月| 日本一区免费视频| 亚洲视频每日更新| 亚洲一区二区美女| 午夜精品福利在线| 美女视频一区二区| 国产成人综合在线观看| 成人一区二区三区视频在线观看 | 蜜臀精品一区二区三区在线观看| 久久精品99国产精品| 国产成人免费av在线| 色中色一区二区| 这里只有精品免费| 久久久美女毛片| 亚洲毛片av在线| 麻豆精品在线播放| youjizz国产精品| 欧美日韩1区2区| 久久久精品影视| 亚洲另类在线制服丝袜| 免费在线观看视频一区| 成人激情校园春色| 欧美久久婷婷综合色| 久久麻豆一区二区| 亚洲一区二区三区视频在线| 久久丁香综合五月国产三级网站| 99久久免费国产| 91精品国产品国语在线不卡| 国产日韩一级二级三级| 亚洲国产中文字幕| 国产九色sp调教91| 欧美日韩国产一级| 国产精品美女久久久久aⅴ国产馆| 亚洲韩国精品一区| 成人亚洲一区二区一| 欧美精品丝袜中出| 中文字幕亚洲综合久久菠萝蜜| 日韩精品成人一区二区在线| 99视频精品在线| 日韩欧美一级精品久久| 亚洲靠逼com| 国产成人在线影院| 日韩免费看的电影| 亚洲精品va在线观看| 国产激情91久久精品导航| 欧美精品 国产精品| 亚洲天堂成人网| 国产寡妇亲子伦一区二区| 911精品产国品一二三产区 | 欧美激情一区二区三区不卡| 日韩av一区二| 欧美在线观看你懂的| 亚洲少妇中出一区| 福利一区二区在线观看| www国产成人免费观看视频 深夜成人网| 亚洲一区二区三区精品在线| 99精品视频在线免费观看| 久久久综合精品| 日韩1区2区日韩1区2区| 欧美日韩一区三区四区| 亚洲欧美乱综合| 99re亚洲国产精品| 国产精品女主播av| 成人午夜视频在线| 久久精品一区八戒影视| 国内久久精品视频| 337p日本欧洲亚洲大胆精品| 日韩黄色小视频| 欧美久久久影院| 全部av―极品视觉盛宴亚洲| 欧美区一区二区三区| 天堂va蜜桃一区二区三区| 欧美吞精做爰啪啪高潮| 亚洲国产中文字幕| 91精品午夜视频| 免费成人你懂的| 久久久久免费观看|