TrainingAlgorithm::TrainingAlgorithm(LossIndex* new_loss_index_pointer)
 : loss_index_pointer(new_loss_index_pointer)
{
   set_default();
}
TimeSeriesPredictionTesting::TimeSeriesPredictionTesting(void) 
 : neural_network_pointer(NULL),
   data_set_pointer(NULL)
{
   set_default();
}
Exemplo n.º 3
0
BoundingLayer::BoundingLayer(const unsigned int& bounding_neurons_number)
{
   set(bounding_neurons_number);

   set_default();
}
Exemplo n.º 4
0
MathematicalModel::MathematicalModel(void)
{                                            
   set_default();
}
Exemplo n.º 5
0
MathematicalModel::MathematicalModel(const std::string& filename)
{                
   set_default();

   load(filename);   
}
Exemplo n.º 6
0
TrainingAlgorithm::TrainingAlgorithm(void)
 : performance_functional_pointer(NULL)
{ 
   set_default();
}
Exemplo n.º 7
0
int
main(int argc, char *argv[]) {
	int fa, nfa, mfa;		/* argument we're looking at */
	int n, ng = 0;			/* Current allocation, number of input gamuts */
	gamdisp *gds;			/* Definition of each gamut */
	int doaxes = 1;
	int docusps = 0;
	int isect = 0;
	FILE *wrl;
	char out_name[MAXNAMEL+1];
	char iout_name[MAXNAMEL+1] = "\000";;
	if (argc < 3)
		usage("Too few arguments, got %d expect at least 2",argc-1);

	mfa = 1;		/* Minimum final arguments */

	if ((gds = (gamdisp *)malloc((ng+1) * sizeof(gamdisp))) == NULL)
		error("Malloc failed on gamdisp");
	set_default(gds, 0);

	/* Process the arguments */
	for(fa = 1;fa < argc;fa++) {
		nfa = fa;					/* skip to nfa if next argument is used */
		if (argv[fa][0] == '-')	{	/* Look for any flags */
			char *na = NULL;		/* next argument after flag, null if none */

			if (argv[fa][2] != '\000')
				na = &argv[fa][2];		/* next is directly after flag */
			else {
				if ((fa+1+mfa) < argc) {
					if (argv[fa+1][0] != '-') {
						nfa = fa + 1;
						na = argv[nfa];		/* next is seperate non-flag argument */
					}
				}
			}

			if (argv[fa][1] == '?')
				usage("Usage requested");

			/* Color */
			else if (argv[fa][1] == 'c' || argv[fa][1] == 'C') {
				fa = nfa;
				if (na == NULL) usage("Expect argument after flag -c");
    			switch (na[0]) {
					case 'r':
					case 'R':
						gds[ng].in_colors = gam_red;
						break;
					case 'g':
					case 'G':
						gds[ng].in_colors = gam_green;
						break;
					case 'b':
					case 'B':
						gds[ng].in_colors = gam_blue;
						break;
					case 'c':
					case 'C':
						gds[ng].in_colors = gam_cyan;
						break;
					case 'm':
					case 'M':
						gds[ng].in_colors = gam_magenta;
						break;
					case 'y':
					case 'Y':
						gds[ng].in_colors = gam_yellow;
						break;
					case 'e':
					case 'E':
						gds[ng].in_colors = gam_grey;
						break;
					case 'w':
					case 'W':
						gds[ng].in_colors = gam_white;
						break;
					case 'n':
					case 'N':
						gds[ng].in_colors = gam_natural;
						break;
					default:
						usage("Unknown argument after flag -c '%c'",na[0]);
				}
			}

			/* Transparency */
			else if (argv[fa][1] == 't' || argv[fa][1] == 'T') {
				double v;
				fa = nfa;
				if (na == NULL) usage("Expect argument after flag -t");
				v = atof(na);
				if (v < 0.0)
					v = 0.0;
				else if (v > 1.0)
					v = 1.0;
				gds[ng].in_trans = v;
			}

			/* Solid output */
			else if (argv[fa][1] == 's' || argv[fa][1] == 'S') {
				gds[ng].in_rep = gam_solid;
			}

			/* Wireframe output */
			else if (argv[fa][1] == 'w' || argv[fa][1] == 'W') {
				gds[ng].in_rep = gam_wire;
			}

			/* No axis output */
			else if (argv[fa][1] == 'n' || argv[fa][1] == 'N') {
				doaxes = 0;
			}

			/* Add cusp markers */
			else if (argv[fa][1] == 'k' || argv[fa][1] == 'K') {
				docusps = 1;
			}

			/* Print intersecting volume */
			else if (argv[fa][1] == 'i' || argv[fa][1] == 'I') {
				isect = 1;

				/* There is an intersection output gamut file */
				if (argv[fa][1] == 'I' && na != NULL) {
					fa = nfa;
					strncpy(iout_name, na, MAXNAMEL); iout_name[MAXNAMEL] = '\000';
				}
			}

			else 
				usage("Unknown flag '%c'",argv[fa][1]);

		} else if (argv[fa][0] != '\000') { /* Got a non-flag */
			strncpy(gds[ng].in_name,argv[fa],MAXNAMEL); gds[ng].in_name[MAXNAMEL] = '\000';

			ng++;
			if ((gds = (gamdisp *)realloc(gds, (ng+1) * sizeof(gamdisp))) == NULL)
				error("Realloc failed on gamdisp");
			set_default(gds, ng);
		} else {
			break;
		}
	}

	/* The last "gamut" is actually the output VRML filename, */
	/* so unwind it. */

	if (ng < 2)
		usage("Not enough arguments to specify output VRML files");

	strncpy(out_name,gds[--ng].in_name,MAXNAMEL); out_name[MAXNAMEL] = '\000';

#ifdef DEBUG
	for (n = 0; n < ng; n++) {
		printf("Input file %d is '%s'\n",n,gds[n].in_name);
		printf("Input file %d has color %d\n",n,gds[n].in_colors);
		printf("Input file %d has rep %d\n",n,gds[n].in_rep);
		printf("Input file %d has trans %f\n",n,gds[n].in_trans);
		
	}
	printf("Output file is '%s'\n",out_name);
#endif	/* DEBUG */

	/* Open up the output file */
	if ((wrl = fopen(out_name,"w")) == NULL)
		error("Error opening output file '%s'\n",out_name);
	
	/* Write the header info */

	fprintf(wrl,"#VRML V2.0 utf8\n");
	fprintf(wrl,"\n");
	fprintf(wrl,"# Created by the Argyll CMS\n");
	fprintf(wrl,"Transform {\n");
  	fprintf(wrl,"  children [\n");
    fprintf(wrl,"    NavigationInfo {\n");
	fprintf(wrl,"      type \"EXAMINE\"        # It's an object we examine\n");
	fprintf(wrl,"    } # We'll add our own light\n");
	fprintf(wrl,"\n");
#ifdef NEVER
	fprintf(wrl,"    DirectionalLight {\n");
	fprintf(wrl,"      direction 0 0 -1      # Light illuminating the scene\n");
	fprintf(wrl,"      direction 0 -1 0      # Light illuminating the scene\n");
	fprintf(wrl,"    }\n");
#else
	fprintf(wrl,"    DirectionalLight {\n");
	fprintf(wrl,"        intensity 0.2\n");
	fprintf(wrl,"        ambientIntensity 0.1\n");
	fprintf(wrl,"        direction -1 -1 -1\n");
	fprintf(wrl,"    }\n");
	fprintf(wrl,"    DirectionalLight {\n");
	fprintf(wrl,"        intensity 0.6\n");
	fprintf(wrl,"        ambientIntensity 0.2\n");
	fprintf(wrl,"        direction 1 1 1\n");
	fprintf(wrl,"    }\n");
#endif
	fprintf(wrl,"\n");
	fprintf(wrl,"    Viewpoint {\n");
	fprintf(wrl,"      position 0 0 340      # Position we view from\n");
	fprintf(wrl,"    }\n");
	fprintf(wrl,"\n");
	if (doaxes) {
		/* Define the axis boxes */
		struct {
			double x, y, z;			/* Box center */
			double wx, wy, wz;		/* Box size */
			double r, g, b;			/* Box color */
		} axes[5] = {
			{ 0, 0,   50-GCENT, 2, 2, 100, .7, .7, .7 },	/* L axis */
			{ 50, 0,  0-GCENT,  100, 2, 2,  1,  0,  0 },	/* +a (red) axis */
			{ 0, -50, 0-GCENT,  2, 100, 2,  0,  0,  1 },	/* -b (blue) axis */
			{ -50, 0, 0-GCENT,  100, 2, 2,  0,  1,  0 },	/* -a (green) axis */
			{ 0,  50, 0-GCENT,  2, 100, 2,  1,  1,  0 },	/* +b (yellow) axis */
		};

		/* Define the labels */
		struct {
			double x, y, z;
			double size;
			char *string;
			double r, g, b;
		} labels[6] = {
			{ -2, 2, -GCENT + 100 + 10, 10, "+L*",  .7, .7, .7 },	/* Top of L axis */
			{ -2, 2, -GCENT - 10,      10, "0",    .7, .7, .7 },	/* Bottom of L axis */
			{ 100 + 5, -3,  0-GCENT,  10, "+a*",  1,  0,  0 },	/* +a (red) axis */
			{ -5, -100 - 10, 0-GCENT,  10, "-b*",  0,  0,  1 },	/* -b (blue) axis */
			{ -100 - 15, -3, 0-GCENT,  10, "-a*",  0,  0,  1 },	/* -a (green) axis */
			{ -5,  100 + 5, 0-GCENT,  10, "+b*",  1,  1,  0 },	/* +b (yellow) axis */
		};

		fprintf(wrl,"    # Lab axes as boxes:\n");
		for (n = 0; n < 5; n++) {
			fprintf(wrl,"    Transform { translation %f %f %f\n", axes[n].x, axes[n].y, axes[n].z);
			fprintf(wrl,"      children [\n");
			fprintf(wrl,"        Shape{\n");
			fprintf(wrl,"          geometry Box { size %f %f %f }\n",
			                       axes[n].wx, axes[n].wy, axes[n].wz);
			fprintf(wrl,"          appearance Appearance { material Material ");
			fprintf(wrl,"{ diffuseColor %f %f %f} }\n", axes[n].r, axes[n].g, axes[n].b);
			fprintf(wrl,"        }\n");
			fprintf(wrl,"      ]\n");
			fprintf(wrl,"    }\n");
		}
		fprintf(wrl,"    # Axes identification:\n");
		for (n = 0; n < 6; n++) {
			fprintf(wrl,"    Transform { translation %f %f %f\n", labels[n].x, labels[n].y, labels[n].z);
			fprintf(wrl,"      children [\n");
			fprintf(wrl,"        Shape{\n");
			fprintf(wrl,"          geometry Text { string [\"%s\"]\n",labels[n].string);
			fprintf(wrl,"            fontStyle FontStyle { family \"SANS\" style \"BOLD\" size %f }\n",
			                                  labels[n].size);
			fprintf(wrl,"                        }\n");
			fprintf(wrl,"          appearance Appearance { material Material ");
			fprintf(wrl,"{ diffuseColor %f %f %f} }\n", labels[n].r, labels[n].g, labels[n].b);
			fprintf(wrl,"        }\n");
			fprintf(wrl,"      ]\n");
			fprintf(wrl,"    }\n");
		}
	}

	/* Read each input in turn */
	for (n = 0; n < ng; n++) {
		int i;
		cgats *pp;
		int nverts;
		int ntris;
		int Lf, af, bf;			/* Fields holding L, a & b data */
		int v0f, v1f, v2f;		/* Fields holding verticies 0, 1 & 2 */

		pp = new_cgats();	/* Create a CGATS structure */
	
		/* Setup to cope with a gamut file */
		pp->add_other(pp, "GAMUT");
	
		if (pp->read_name(pp, gds[n].in_name))
			error("Input file '%s' error : %s",gds[n].in_name, pp->err);
	
		if (pp->t[0].tt != tt_other || pp->t[0].oi != 0)
			error("Input file isn't a GAMUT format file");
		if (pp->ntables != 2)
			error("Input file doesn't contain exactly two tables");

		if ((nverts = pp->t[0].nsets) <= 0)
			error("No verticies");
		if ((ntris = pp->t[1].nsets) <= 0)
			error("No triangles");

		if ((Lf = pp->find_field(pp, 0, "LAB_L")) < 0)
			error("Input file doesn't contain field LAB_L");
		if (pp->t[0].ftype[Lf] != r_t)
			error("Field LAB_L is wrong type");
		if ((af = pp->find_field(pp, 0, "LAB_A")) < 0)
			error("Input file doesn't contain field LAB_A");
		if (pp->t[0].ftype[af] != r_t)
			error("Field LAB_A is wrong type");
		if ((bf = pp->find_field(pp, 0, "LAB_B")) < 0)
			error("Input file doesn't contain field LAB_B");
		if (pp->t[0].ftype[bf] != r_t)
			error("Field LAB_B is wrong type");

		/* Write the vertexes out */
		fprintf(wrl,"\n");
		fprintf(wrl,"    Transform {\n");
		fprintf(wrl,"      translation 0 0 0\n");
		fprintf(wrl,"      children [\n");
		fprintf(wrl,"        Shape { \n");
		if (gds[n].in_rep == gam_wire) {
			fprintf(wrl,"          geometry IndexedLineSet {\n");
		} else {
			fprintf(wrl,"          geometry IndexedFaceSet {\n");
			fprintf(wrl,"            ccw FALSE\n");
			fprintf(wrl,"            convex TRUE\n");
		}
		fprintf(wrl,"\n");
		fprintf(wrl,"            coord Coordinate { \n");
		fprintf(wrl,"              point [			# Verticy coordinates\n");

		/* Spit out the point values, in order. */
		/* Note that a->x, b->y, L->z */
		for (i = 0; i < nverts; i++) {
			double L, a, b;
			L = *((double *)pp->t[0].fdata[i][Lf]);
			a = *((double *)pp->t[0].fdata[i][af]);
			b = *((double *)pp->t[0].fdata[i][bf]);
			fprintf(wrl,"                %f %f %f,\n",a, b, L - GCENT);
		}
		fprintf(wrl,"              ]\n");
		fprintf(wrl,"            }\n");
		fprintf(wrl,"\n");

		/* Write the triangles/wires out */
		if ((v0f = pp->find_field(pp, 1, "VERTEX_0")) < 0)
			error("Input file doesn't contain field VERTEX_0");
		if (pp->t[1].ftype[v0f] != i_t)
			error("Field VERTEX_0 is wrong type");
		if ((v1f = pp->find_field(pp, 1, "VERTEX_1")) < 0)
			error("Input file doesn't contain field VERTEX_1");
		if (pp->t[1].ftype[v1f] != i_t)
			error("Field VERTEX_1 is wrong type");
		if ((v2f = pp->find_field(pp, 1, "VERTEX_2")) < 0)
			error("Input file doesn't contain field VERTEX_2");
		if (pp->t[1].ftype[v2f] != i_t)
			error("Field VERTEX_2 is wrong type");

		fprintf(wrl,"            coordIndex [ 		# Indexes of poligon Verticies \n");

		for (i = 0; i < ntris; i++) {
			int v0, v1, v2;
			v0 = *((int *)pp->t[1].fdata[i][v0f]);
			v1 = *((int *)pp->t[1].fdata[i][v1f]);
			v2 = *((int *)pp->t[1].fdata[i][v2f]);

#ifdef HALF_HACK 
			if (*((double *)pp->t[0].fdata[v0][Lf]) < HALF_HACK
			 || *((double *)pp->t[0].fdata[v1][Lf]) < HALF_HACK
			 || *((double *)pp->t[0].fdata[v2][Lf]) < HALF_HACK)
				continue;
#endif /* HALF_HACK */

			if (gds[n].in_rep == gam_wire) {
				if (v0 < v1)				/* Only output 1 wire of two on an edge */
					fprintf(wrl,"              %d, %d, -1\n", v0, v1);
				if (v1 < v2)
					fprintf(wrl,"              %d, %d, -1\n", v1, v2);
				if (v2 < v0)
					fprintf(wrl,"              %d, %d, -1\n", v2, v0);
			} else {
				fprintf(wrl,"              %d, %d, %d, -1\n", v0, v1, v2);
			}
		}
		fprintf(wrl,"            ]\n");
		fprintf(wrl,"\n");

		/* Write the colors out */
		if (gds[n].in_colors == gam_natural) {
			fprintf(wrl,"            colorPerVertex TRUE\n");
			fprintf(wrl,"            color Color {\n");
			fprintf(wrl,"              color [			# RGB colors of each vertex\n");

			for (i = 0; i < nverts; i++) {
				double rgb[3], Lab[3];
				Lab[0] = *((double *)pp->t[0].fdata[i][Lf]);
				Lab[1] = *((double *)pp->t[0].fdata[i][af]);
				Lab[2] = *((double *)pp->t[0].fdata[i][bf]);
				gamut_Lab2RGB(rgb, Lab);
				fprintf(wrl,"                %f %f %f,\n", rgb[0], rgb[1], rgb[2]);
			}
			fprintf(wrl,"              ] \n");
			fprintf(wrl,"            }\n");
		}
		fprintf(wrl,"          }\n");
		fprintf(wrl,"          appearance Appearance { \n");
		fprintf(wrl,"            material Material {\n");
		if (gds[n].in_trans > 0.0) {
			fprintf(wrl,"              transparency %f\n", gds[n].in_trans);
		}
		fprintf(wrl,"              ambientIntensity 0.3\n");
		fprintf(wrl,"              shininess 0.5\n");
		if (gds[n].in_colors != gam_natural) {
			fprintf(wrl,"              emissiveColor %f %f %f\n",
			   color_rgb[gds[n].in_colors].r, color_rgb[gds[n].in_colors].g, color_rgb[gds[n].in_colors].b);
		}
		fprintf(wrl,"            }\n");
		fprintf(wrl,"          }\n");
		fprintf(wrl,"        }	# end Shape\n");
		fprintf(wrl,"      ] # end children\n");
		fprintf(wrl,"    } # end Transform\n");
		fprintf(wrl,"\n");

		/* See if there are cusp values */
		if (docusps) {
			int kk;
			double rgb[3], Lab[3];
			char buf1[50];
			char *cnames[6] = { "RED", "YELLOW", "GREEN", "CYAN", "BLUE", "MAGENTA" };
	
			for (i = 0; i < 6; i++) {
				sprintf(buf1,"CUSP_%s", cnames[i]);
				if ((kk = pp->find_kword(pp, 0, buf1)) < 0)
					break;
	
				if (sscanf(pp->t[0].kdata[kk], "%lf %lf %lf",
			           &Lab[0], &Lab[1], &Lab[2]) != 3) {
					break;
				}

				gamut_Lab2RGB(rgb, Lab);

				fprintf(wrl,"\n");
				fprintf(wrl,"    Transform {\n");
				fprintf(wrl,"      translation %f %f %f\n",Lab[1], Lab[2], Lab[0]-GCENT);
				fprintf(wrl,"      children [\n");
				fprintf(wrl,"		Shape { \n");
				fprintf(wrl,"		 geometry Sphere { radius 2.0 }\n");
				fprintf(wrl,"         appearance Appearance { material Material {\n");
				if (gds[n].in_trans > 0.0)
				fprintf(wrl,"         transparency %f\n", gds[n].in_trans);
				if (gds[n].in_colors != gam_natural)
				fprintf(wrl,"          diffuseColor %f %f %f\n", color_rgb[gds[n].in_colors].r, color_rgb[gds[n].in_colors].g, color_rgb[gds[n].in_colors].b);
				else
				fprintf(wrl,"          diffuseColor  %f %f %f\n", rgb[0], rgb[1], rgb[2]);
				fprintf(wrl,"		  }\n");
				fprintf(wrl,"		}\n");
				fprintf(wrl,"      }\n");
				fprintf(wrl,"     ]\n");
				fprintf(wrl,"    }\n");
			}
			fprintf(wrl,"\n");
		}

		pp->del(pp);		/* Clean up */
	}

	/* Write the trailer */
	fprintf(wrl,"  ] # end of children for world\n");
	fprintf(wrl,"}\n");

	/* Close the file */
	fclose(wrl);

	if (isect && ng >= 2) {
		gamut *s, *s1, *s2;
		double v1, v2, vi;

		if ((s = new_gamut(0.0, 0, 0)) == NULL)
			error("Creating gamut object failed");
		
		if ((s1 = new_gamut(0.0, 0, 0)) == NULL)
			error("Creating gamut object failed");
		
		if ((s2 = new_gamut(0.0, 0, 0)) == NULL)
			error("Creating gamut object failed");
		
		if (s1->read_gam(s1, gds[0].in_name))
			error("Input file '%s' read failed",gds[n].in_name[0]);

		if (s2->read_gam(s2, gds[1].in_name))
			error("Input file '%s' read failed",gds[n].in_name[1]);

		v1 = s1->volume(s1);
		v2 = s2->volume(s2);

		if (s->intersect(s, s1, s2))
			error("Gamuts are not compatible! (Colorspace, gamut center ?)");
		vi = s->volume(s);

		if (iout_name[0] != '\000') {
			if (s->write_gam(s, iout_name))
				error("Writing intersection gamut to '%s' failed",iout_name);
		}

		printf("Intersecting volume = %.1f cubic units\n",vi);
		printf("'%s' volume = %.1f cubic units, intersect = %.2f%%\n",gds[0].in_name,v1,100.0 * vi/v1);
		printf("'%s' volume = %.1f cubic units, intersect = %.2f%%\n",gds[1].in_name,v2,100.0 * vi/v2);

		s1->del(s1);
		s2->del(s2);
	}

	if (ng > 0)
		free(gds);

	return 0;
}
Exemplo n.º 8
0
MinkowskiError::MinkowskiError(NeuralNetwork* new_neural_network_pointer, DataSet* new_data_set_pointer)
 : ErrorTerm(new_neural_network_pointer, new_data_set_pointer)
{
   set_default();
}
MissingValues::MissingValues(const size_t& new_instances_number,const size_t& new_variables_number)
{
    set(new_instances_number, new_variables_number);

    set_default();
}
Exemplo n.º 10
0
MinkowskiError::MinkowskiError(void) : ErrorTerm()
{
   set_default();
}
Exemplo n.º 11
0
MinkowskiError::MinkowskiError(DataSet* new_data_set_pointer)
: ErrorTerm(new_data_set_pointer)
{
   set_default();
}
Exemplo n.º 12
0
MinkowskiError::MinkowskiError(DataSet* new_data_set_pointer)
: PerformanceTerm(new_data_set_pointer)
{
   set_default();
}
Exemplo n.º 13
0
MinkowskiError::MinkowskiError(NeuralNetwork* new_neural_network_pointer)
: PerformanceTerm(new_neural_network_pointer)
{
   set_default();
}
Exemplo n.º 14
0
MinkowskiError::MinkowskiError(void) : PerformanceTerm()
{
   set_default();
}
Exemplo n.º 15
0
void TrainingAlgorithm::set(void)
{
   performance_functional_pointer = NULL;

   set_default();
}
Exemplo n.º 16
0
IncrementalOrder::IncrementalOrder(void)
    : OrderSelectionAlgorithm()
{
    set_default();
}
Exemplo n.º 17
0
void TrainingAlgorithm::set(PerformanceFunctional* new_performance_functional_pointer)
{
   performance_functional_pointer = new_performance_functional_pointer;

   set_default();
}
Exemplo n.º 18
0
IncrementalOrder::IncrementalOrder(TrainingStrategy* new_training_strategy_pointer)
    : OrderSelectionAlgorithm(new_training_strategy_pointer)
{
    set_default();
}
Exemplo n.º 19
0
TrainingAlgorithm::TrainingAlgorithm(PerformanceFunctional* new_performance_functional_pointer)
 : performance_functional_pointer(new_performance_functional_pointer)
{
   set_default();
}
Exemplo n.º 20
0
SimulatedAnnealingOrder::SimulatedAnnealingOrder(void)
    : OrderSelectionAlgorithm()
{
    set_default();
}
Exemplo n.º 21
0
void edit_side(int source,int smer)
  {
  TSTENA *p;
  CTL3D b1,b2,b3;
  char s[200];

  p=&mapa.sidedef[source][smer];
  memcpy(&b1,def_border(1,0),sizeof(CTL3D));
  memcpy(&b2,def_border(5,WINCOLOR),sizeof(CTL3D));
  memcpy(&b3,def_border(6,WINCOLOR),sizeof(CTL3D));
  default_font=vga_font;
  memcpy(f_default,flat_color(0x0000),sizeof(charcolors));
  sprintf(s,"Vlastnosti stˆn, sektor %d stˆna %d",source,smer);
  def_window(400,324,s);
  waktual->x=125;
  waktual->y=60;
  waktual->modal=1;
  define(CANCEL_BUTT,10,5,80,20,2,button,"Zru¨it");property(&b1,NULL,NULL,WINCOLOR);
    on_change(close_current);
  define(OK_BUTT,190,5,80,20,2,button,"Ok");property(&b1,NULL,NULL,WINCOLOR);
    on_change(edit_side_ok);
  define(3400,100,5,80,20,2,button,"P©edvolba");property(&b1,NULL,NULL,WINCOLOR);
    on_change(edit_side_predvolba_1);on_exit(edit_side_predvolba_2);
  define(10,5,20,300,35,0,label,"Prim rn¡:       Sekundarn¡:       Oblouk:");property(&b3,NULL,NULL,WINCOLOR);
  define(20,10,35,90,12,0,str_line,side_names);property(&b2,NULL,NULL,WINCOLOR);c_default(p->prim);
    on_enter(string_list_sup);
  define(30,110,35,90,12,0,str_line,side_names);property(&b2,NULL,NULL,WINCOLOR);c_default(p->sec);
    on_enter(string_list_sup);
  define(40,210,35,90,12,0,str_line,oblouky);property(&b2,NULL,NULL,WINCOLOR);c_default(p->oblouk & 0x0f);
    on_enter(string_list_sup);
  define(-1,5,60,250,12,0,label,"Animace primarn¡:");
  define(-1,5,75,250,12,0,label,"Animace sekundarn¡:");
  define(-1,5,90,250,12,0,label,"X pozice sek. stˆny:");
  define(-1,5,105,250,12,0,label,"Y pozice sek. stˆny:");
  define(-1,5,120,250,12,0,label,"C¡lov˜ sektor ud losti:");
  define(-1,5,135,250,12,0,label,"C¡lov  stˆna ud losti:");
  define(-1,5,150,250,12,0,label,"Popis akce:");
  define(-1,260,60,100,12,0,label,"Aplikuj na stˆnu:");
  define(50,200,60,50,10,0,input_line,10,1,16,"%6d");property(&b2,NULL,NULL,WINCOLOR);
   set_default(strs((p->prim_anim & 0xf)+1));on_exit(test_int);
  define(60,200,75,50,10,0,input_line,10,1,16,"%6d");property(&b2,NULL,NULL,WINCOLOR);
   set_default(strs((p->sec_anim & 0xf)+1));on_exit(test_int);
  define(70,200,90,50,10,0,input_line,10,0,499,"%6d");property(&b2,NULL,NULL,WINCOLOR);
   set_default(strs(p->xsec<<1));on_exit(test_int);
  define(80,200,105,50,10,0,input_line,10,0,511,"%6d");property(&b2,NULL,NULL,WINCOLOR);
   set_default(strs(p->ysec<<1));on_exit(test_int);
  define(90,200,120,50,10,0,input_line,10,0,65535,"%6d");property(&b2,NULL,NULL,WINCOLOR);
   set_default(strs(p->sector_tag));on_exit(test_int);
  define(100,200,135,50,10,0,str_line,steny2);property(&b2,NULL,NULL,WINCOLOR);
   c_default(p->side_tag & 0x3);on_enter(string_list_sup);
  define(110,100,150,150,10,0,str_line,actions);property(&b2,NULL,NULL,WINCOLOR);
   on_enter(string_list_sup); c_default(p->action);
  define(120,10,175,150,10,0,check_box,side_flgs[0]);
  define(130,10,187,150,10,0,check_box,side_flgs[1]);
  define(140,10,199,150,10,0,check_box,side_flgs[2]);
  define(150,10,211,150,10,0,check_box,side_flgs[3]);
  define(160,10,223,150,10,0,check_box,side_flgs[4]);
  define(170,10,235,150,10,0,check_box,side_flgs[5]);
  define(180,10,247,150,10,0,check_box,side_flgs[6]);
  define(190,10,259,150,10,0,check_box,side_flgs[7]);
  define(200,190,175,100,10,0,check_box,side_flgs[8]);
  define(210,190,187,100,10,0,check_box,side_flgs[9]);
  define(220,190,199,100,10,0,check_box,side_flgs[10]);
  define(230,190,211,150,10,0,check_box,side_flgs[11]);
  define(240,190,223,150,10,0,check_box,side_flgs[12]);
  define(250,190,235,150,10,0,check_box,side_flgs[13]);
  define(260,190,247,150,10,0,check_box,side_flgs[14]);
  define(270,190,259,150,10,0,check_box,side_flgs[15]);
  define(280,10,271,75,10,0,check_box,side_flgs[16]);
  define(290,10,283,75,10,0,check_box,side_flgs[17]);
  define(300,190,271,150,10,0,check_box,side_flgs[18]);
  define(310,10,295,75,11,0,check_box,side_flgs[19]);
  define(400,290,80,100,10,0,check_box,"Severn¡");
  define(410,290,95,100,10,0,check_box,"V˜chodn¡");
  define(420,290,110,100,10,0,check_box,"Ji‘n¡");
  define(430,290,125,100,10,0,check_box,"Z padn¡");
  define(340,290,150,100,15,0,button2,"V¡ce >>");on_change(action_flags);
  define(350,290,150,100,15,0,value_store,4);c_default(p->flags & 0xfff00000);
  define(360,290,150,100,15,0,value_store,4);c_default(source);
  define(370,290,150,100,15,0,value_store,4);c_default(smer);
  define(-1,5,20,60,10,1,label,"Lclip:");
  define(440,30,35,30,12,1,input_line,3,0,255,"%3d");
   property(&b2,NULL,NULL,WINCOLOR);
  set_default(strs(p->lclip));on_exit(test_int);
  define(450,10,220,30,30,1,radio_butts,3,"-","\x4","\x6");c_default((p->oblouk>>5) & 0x3);
   property(NULL,icones,NULL,WINCOLOR);
  define(460,10,175,80,12,1,button,"V˜klenek");on_change(edit_vyklenek_start);
  define(470,190,283,150,10,0,check_box,"Lze polo‘it za");c_default(p->oblouk>>7);
  define(480,10,307,75,10,0,check_box,"P©edsunout s.");c_default(p->side_tag>>7);
  fill_bit_fields(0,120,p->flags,20); if (source)
  fill_bit_fields(0,400,1<<smer,4); else fill_bit_fields(0,400,0xf,4);
  set_enable(0,3400,source!=0);
  set_enable(0,460,source!=0);
  redraw_window();
  }
Exemplo n.º 22
0
SimulatedAnnealingOrder::SimulatedAnnealingOrder(TrainingStrategy* new_training_strategy_pointer)
    : OrderSelectionAlgorithm(new_training_strategy_pointer)
{
    set_default();
}
Exemplo n.º 23
0
MathematicalModel::MathematicalModel(TiXmlElement* mathematical_model_element)
{                
   set_default();

   from_XML(mathematical_model_element);   
}
Exemplo n.º 24
0
PlugIn::PlugIn(void) : MathematicalModel()
{                                            
   set_default();
}
Exemplo n.º 25
0
/*
 * Open a locale file.  First, check the value of "locale"; if it's a null
 * string, first check the environment variable with the same name as the
 * category, and then check the environment variable "LANG".  If neither of
 * them are set to non-null strings, use the LC_default env.var and if this
 * has no meaning then assume we are running in the C locale. It is expected
 * That LC_default is set across the whole system. If the resulting locale is
 * longer than MAXLOCALENAME characters, reject it.  Then, try looking in the
 * per-machine locale directory for the file in question; if it's not found
 * there, try looking in the shared locale directory.
 * If there is no work to do, that is, the last setting of locales is equal
 * to the current request, then we don't do anything, and exit with value 0.
 * Copy the name of the locale used into "newlocale".
 * Exit with positive value if we opened a file
 * Exit with -1 if an error occured (invalid locale).
 * Exit with 0 if there is no need to look at the disk file.
 * (Assumption - there is always at least one fd open before setlocale
 *  is called)
 */
int
openlocale(char *category, int cat_id, char *locale, char *newlocale)
{
	char pathname[MAXPATHLEN], *defp;
	int fd, fd2;
	struct _code_header code_header;
	char *my_info;

	if (*locale == '\0') {
		locale = getenv(category);
		if (locale == NULL || *locale == '\0') {
			locale = getenv("LANG");
			if (locale == NULL || *locale == '\0') {
				if (*Default == '\0') {
					defp = getenv("LC_default");
					if (defp == NULL || *defp == '\0')
						strcpy(Default,"C");
					else
						strcpy(Default, defp);
				}
				locale = Default;
			}
		}
	}
	if (strcmp(locale,_locales[cat_id-1]) == 0) {
		(void) strcpy(newlocale, locale);
		return (0);
	}
	if (strlen(locale) > MAXLOCALENAME)
		return (-1);

	(void) strcpy(pathname, PRIVATE_LOCALE_DIR);
	(void) strcat(pathname, category);
	(void) strcat(pathname, "/");
	(void) strcat(pathname, locale);
	if ((fd = open(pathname, O_RDONLY)) < 0 && errno == ENOENT) {
		(void) strcpy(pathname, LOCALE_DIR);
		(void) strcat(pathname, category);
		(void) strcat(pathname, "/");
		(void) strcat(pathname, locale);
		fd = open(pathname, O_RDONLY);
	}
	if (fd >= 0)
		(void) strcpy(newlocale, locale);
	/*
	 * bug id 1072740; if by some chance the actual fd we're going to
	 * return is 0, change it to be some non-zero descriptor, because
	 * returning 0 means something different.  If '0' is the only 
	 * descriptor left, return an error.
	 */
	if (fd == 0) {
		int dupfd;
	
		if ((dupfd = dup(fd)) < 1) {
			(void) close(fd);
			fd = -1;
		} else {
			(void) close(fd);
			fd = dupfd;
		}
	}

	if (cat_id == LC_CTYPE) {

		/* Go and get the trailer file */

		(void) strcat(pathname, TRAILER);
		fd2 = open(pathname, O_RDONLY);
                if ( fd2 == 0 ) {
                        fd2 = dup(fd2);
                        close(0);
                }
       
		if (fd2 == -1)  {
			set_default();
			return (fd);
		}

		/*
		 * ctype trailer file  exists - read it
		 */

		if (read (fd2, (char *)&code_header, sizeof (code_header)) !=
						    sizeof (code_header)) {
			/*
			 * File format not correct
			 */
			 set_default();
			 close(fd2);
			 return (-1);
		}
		/*
		 * set up trailer file
		 */
		 strcpy(_code_set_info.code_name, code_header.code_name);
		 _code_set_info.code_id = code_header.code_id;
		 if (_code_set_info.code_info != NULL)
			free (_code_set_info.code_info);
		 if (code_header.code_info_size > 0)  {
			my_info = malloc(code_header.code_info_size);
			if (read (fd2, (char *)my_info, 
			 code_header.code_info_size) != 
		 	 code_header.code_info_size) { 
					close(fd2);
					set_default();
					return (-1);
				}
			_code_set_info.code_info = my_info;
		 }
		 else {
		 /* 
		  * We have a corrupted file too 
		  */
			_code_set_info.code_info = NULL;
			close(fd2);
			set_default();
			return (-1);
		 }
		 close (fd2);
	}
	return (fd);
}
Exemplo n.º 26
0
int             main(int argc, char **argv, char **env)
{
    char   buffer[200], *errp;
    size_t          sbuf;
    size_t          retcnt;
    var_store       value;
    var_store_ptr   value_list;
    numeric_ptr     nval;
    unsigned        compute,
           jj,
           yrE,
           monthE,
           dayE,
           yrI,
           monthI,
           dayI;
    struct tm      *times_E,
            *times_I;
    void           *parse_env;
    amort_sched     amortsched;
    financial_info  fininfo;

    /* check dynamic storage allocation
     */
    /*  	mtrace();	*/
    set_default(&fininfo);
    set_fin_vars();
    parse_env = init_parser(predefined_fin_vars,
                            '.',
                            ',',
                            trans_numeric,
                            numeric_ops,
                            negate_numeric,
                            free_numeric);

    npp  = fininfo.npp;
    ir   = fininfo.ir;
    pv   = fininfo.pv;
    pmt  = fininfo.pmt;
    fv   = fininfo.fv;
    CF   = fininfo.CF;
    PF   = fininfo.PF;
    disc = fininfo.disc;
    bep  = fininfo.bep;

    fininfo.prec = prec;

    printf("Single Letter Commands:\na -- amortization schedule\nc -- compute financial variable\nd -- delete variable\ns -- output financial variable status\nq -- quit\nv -- list defined variables\n");
    for (;;)
{
        printf("<>");
        retcnt = strlen(fgets(buffer, 190, stdin));
        if ( (retcnt == 2) && (strchr(sl_commands, buffer[0]) != NULL) )
        {
            if ( buffer[0] == 'q' ) break;
            amortsched.prec = fininfo.prec;
            switch ( buffer[0] )
            {
            case 'a':
                if ( amortsched.Eff_Date_jdn && amortsched.Init_Date_jdn )
                {
                    printf("Current Effective  year: %u\nCurrent Effective month: %u\nCurrent Effective   day: %u\nCurrent Initial    year: %u\nCurrent Initial   month: %u\nCurrent Initial     day %u\n",
                           amortsched.year_E,
                           amortsched.month_E,
                           amortsched.day_E,
                           amortsched.year_I,
                           amortsched.month_I,
                           amortsched.day_I);
                    printf("Change dates ? (y/n) ");
                    fgets(buffer, 190, stdin);
                }
                else
                {
                    buffer[0] = 'y';
                } /* endif */
                if ( buffer[0] == 'y' )
                {
                    printf("Enter Effective Date - year: ");
                    fgets(buffer, 190, stdin);
                    if ( (errp = parse_string(&value, buffer, parse_env)) == NULL )
                    {
                        nval = (numeric_ptr)(value.value);
                        switch ( nval->type )
                        {
                        case INT_TYPE:
                            amortsched.year_E = nval->value.int_value;
                            break;
                        case DBL_TYPE:
                            amortsched.year_E = (unsigned)(nval->value.dbl_value);
                            break;
                        } /* endswitch */
                        if ( !value.variable_name ) free_numeric(value.value);
                    }
                    else
                    {
                        parse_error(get_parse_error(parse_env), buffer, errp);
                    } /* endif */
                    printf("Enter Effective Date - month: ");
                    fgets(buffer, 190, stdin);
                    if ( (errp = parse_string(&value, buffer, parse_env)) == NULL )
                    {
                        nval = (numeric_ptr)(value.value);
                        switch ( nval->type )
                        {
                        case INT_TYPE:
                            amortsched.month_E = nval->value.int_value;
                            break;
                        case DBL_TYPE:
                            amortsched.month_E = (unsigned)(nval->value.dbl_value);
                            break;
                        } /* endswitch */
                        if ( !value.variable_name ) free_numeric(value.value);
                    }
                    else
                    {
                        parse_error(get_parse_error(parse_env), buffer, errp);
                    } /* endif */
                    printf("Enter Effective Date - day: ");
                    fgets(buffer, 190, stdin);
                    if ( (errp = parse_string(&value, buffer, parse_env)) == NULL )
                    {
                        nval = (numeric_ptr)(value.value);
                        switch ( nval->type )
                        {
                        case INT_TYPE:
                            amortsched.day_E = nval->value.int_value;
                            break;
                        case DBL_TYPE:
                            amortsched.day_E = (unsigned)(nval->value.dbl_value);
                            break;
                        } /* endswitch */
                        if ( !value.variable_name ) free_numeric(value.value);
                    }
                    else
                    {
                        parse_error(get_parse_error(parse_env), buffer, errp);
                    } /* endif */
                    printf("Enter Initial Payment Date - year: ");
                    fgets(buffer, 190, stdin);
                    if ( (errp = parse_string(&value, buffer, parse_env)) == NULL )
                    {
                        nval = (numeric_ptr)(value.value);
                        switch ( nval->type )
                        {
                        case INT_TYPE:
                            amortsched.year_I = nval->value.int_value;
                            break;
                        case DBL_TYPE:
                            amortsched.year_I = (unsigned)(nval->value.dbl_value);
                            break;
                        } /* endswitch */
                        if ( !value.variable_name ) free_numeric(value.value);
                    }
                    else
                    {
                        parse_error(get_parse_error(parse_env), buffer, errp);
                    } /* endif */
                    printf("Enter Initial Payment Date - month: ");
                    fgets(buffer, 190, stdin);
                    if ( (errp = parse_string(&value, buffer, parse_env)) == NULL )
                    {
                        nval = (numeric_ptr)(value.value);
                        switch ( nval->type )
                        {
                        case INT_TYPE:
                            amortsched.month_I = nval->value.int_value;
                            break;
                        case DBL_TYPE:
                            amortsched.month_I = (unsigned)(nval->value.dbl_value);
                            break;
                        } /* endswitch */
                        if ( !value.variable_name ) free_numeric(value.value);
                    }
                    else
                    {
                        parse_error(get_parse_error(parse_env), buffer, errp);
                    } /* endif */
                    printf("Enter Initial Payment Date - day: ");
                    fgets(buffer, 190, stdin);
                    if ( (errp = parse_string(&value, buffer, parse_env)) == NULL )
                    {
                        nval = (numeric_ptr)(value.value);
                        switch ( nval->type )
                        {
                        case INT_TYPE:
                            amortsched.day_I = nval->value.int_value;
                            break;
                        case DBL_TYPE:
                            amortsched.day_I = (unsigned)(nval->value.dbl_value);
                            break;
                        } /* endswitch */
                        if ( !value.variable_name ) free_numeric(value.value);
                    }
                    else
                    {
                        parse_error(get_parse_error(parse_env), buffer, errp);
                    } /* endif */
                } /* endif */

                amortsched.n     = npp;
                amortsched.nint  = ir;
                amortsched.pv    = pv;
                amortsched.pmt   = pmt;
                amortsched.fv    = fv;
                amortsched.CF    = CF;
                amortsched.PF    = PF;
                amortsched.disc  = disc;
                amortsched.bep   = bep;

                Amortization_init(&amortsched);
                amort_opt(&amortsched, parse_env);

                (void)Amortization_Schedule(&amortsched);
                prt_amortization_schedule(&amortsched, stdout);
                Amortization_free(&amortsched);
                break;
            case 'c':

                printf("Compute:\nn   - 1\ni   - 2\npv  - 3\npmt - 4\nfv  - 5\n1, 2, 3, 4 or 5: ");
                retcnt = strlen(fgets(buffer, 190, stdin));
                compute = buffer[0] - '0';

                switch ( compute-- )
                {
                case 0: /* all values specified nothing to compute */
                    break;
                case 1: /* compute number of periods, npp */
                    printf("Computing numbor of periods\n");
                    npp = fi_calc_num_payments(&fininfo);
                    printf("Number of Periods: %u\n", npp);
                    nval = (numeric_ptr)(predefined_fin_vars[compute].value);
                    nval->value.int_value = npp;
                    break;
                case 2: /* compute interest, ir */
                    printf("Computing interest rate\n");
                    ir = fi_calc_interest(&fininfo);
                    printf("Nominal Interest Rate: %.*f\n", prec, ir);
                    nval = (numeric_ptr)(predefined_fin_vars[compute].value);
                    nval->value.dbl_value = ir;
                    break;
                case 3: /* compute present value, pv */
                    printf("Computing Present Value\n");
                    pv = fi_calc_present_value(&fininfo);
                    printf("Present Value: %.*f\n", prec, pv);
                    nval = (numeric_ptr)(predefined_fin_vars[compute].value);
                    nval->value.dbl_value = pv;
                    break;
                case 4: /* compute periodic payment, pmt */
                    printf("Computing periodic payment\n");
                    pmt = fi_calc_payment(&fininfo);
                    printf("Periodic Payment: %.*f\n", prec, pmt);
                    nval = (numeric_ptr)(predefined_fin_vars[compute].value);
                    nval->value.dbl_value = pmt;
                    break;
                case 5: /* compute future value, fv */
                    printf("Computing Future Value\n");
                    fv = fi_calc_future_value(&fininfo);
                    printf("Future Value: %.*f\n", prec, fv);
                    nval = (numeric_ptr)(predefined_fin_vars[compute].value);
                    nval->value.dbl_value = fv;
                    break;
                default:    /* whoops */
                    break;
                } /* endswitch */
                break;
            case 'd':
                printf("Enter name of variable to delete: ");
                retcnt = strlen(fgets(buffer, 190, stdin));
                buffer[retcnt - 1] = EOS;
                if ( !delete_var(buffer, parse_env) )
                {
                    printf("Unable to delete specified variable\n");
                } /* endif */
                break;
            case 's':
                prt_status(&fininfo,
                           stdout);
                break;
            case 'v':
                for ( value_list = parser_get_vars(parse_env) ; value_list ; value_list = value_list->next_var )
                {
                    printf("%s: ", value_list->variable_name);
                    nval = (numeric_ptr)(value_list->value);
                    switch ( nval->type )
                    {
                    case INT_TYPE:
                        printf("%i\n", nval->value.int_value);
                        break;
                    case DBL_TYPE:
                        printf("%.*f\n", prec, nval->value.dbl_value);
                        break;
                    } /* endswitch */
                } /* endfor */
                break;
            } /* endswitch */
        }
        else if ( retcnt > 1 )
        {
            buffer[retcnt - 1] = EOS;

            if ( (errp = parse_string(&value, buffer, parse_env)) == NULL )
            {
                if ( value.variable_name ) printf("Variable: %s\n", value.variable_name);
                nval = (numeric_ptr)(value.value);
                switch ( nval->type )
                {
                case INT_TYPE:
                    printf("Evaluated Value: %i\n", nval->value.int_value);
                    break;
                case DBL_TYPE:
                    printf("Evaluated Value: %.*f\n", prec, nval->value.dbl_value);
                    break;
                } /* endswitch */
                if ( !value.variable_name ) free_numeric(value.value);
                chk_vars(predefined_fin_vars, fin_vars, fin_type, PREDEFINED_FIN_VARS);
                fininfo.npp = npp;
                fininfo.ir = ir;
                fininfo.pv = pv;
                fininfo.pmt = pmt;
                fininfo.fv = fv;
                fininfo.CF = CF;
                fininfo.PF = PF;
                fininfo.disc = disc;
                fininfo.bep = bep;
            }
            else
            {
                parse_error(get_parse_error(parse_env), buffer, errp);
            } /* endif */
        } /* endif */
    } /* endfor */
    exit_parser(parse_env);
    unset_fin_vars();
} /* main */
TimeSeriesPredictionTesting::TimeSeriesPredictionTesting(NeuralNetwork* new_neural_network_pointer, DataSet* new_data_set_pointer)
 : neural_network_pointer(new_neural_network_pointer),
   data_set_pointer(new_data_set_pointer)
{  
   set_default();
}
Exemplo n.º 28
0
int
load_config (char * file)
{
	if (!conf)
		conf = alloc_config();

	if (!conf)
		return 1;

	/*
	 * internal defaults
	 */
	if (!conf->verbosity)
		conf->verbosity = DEFAULT_VERBOSITY;

	conf->udev = udev_new();
	dm_drv_version(conf->version, TGT_MPATH);
	conf->dev_type = DEV_NONE;
	conf->minio = DEFAULT_MINIO;
	conf->minio_rq = DEFAULT_MINIO_RQ;
	get_sys_max_fds(&conf->max_fds);
	conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE);
	conf->wwids_file = set_default(DEFAULT_WWIDS_FILE);
	conf->bindings_read_only = 0;
	conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);
	conf->features = set_default(DEFAULT_FEATURES);
	conf->flush_on_last_del = 0;
	conf->attribute_flags = 0;
	conf->reassign_maps = DEFAULT_REASSIGN_MAPS;
	conf->checkint = DEFAULT_CHECKINT;
	conf->max_checkint = MAX_CHECKINT(conf->checkint);
	conf->fast_io_fail = DEFAULT_FAST_IO_FAIL;
	conf->retain_hwhandler = DEFAULT_RETAIN_HWHANDLER;
	conf->detect_prio = DEFAULT_DETECT_PRIO;

	/*
	 * preload default hwtable
	 */
	if (conf->hwtable == NULL) {
		conf->hwtable = vector_alloc();

		if (!conf->hwtable)
			goto out;
	}
	if (setup_default_hwtable(conf->hwtable))
		goto out;

	/*
	 * read the config file
	 */
	set_current_keywords(&conf->keywords);
	alloc_keywords();
	if (filepresent(file)) {
		int builtin_hwtable_size;

		builtin_hwtable_size = VECTOR_SIZE(conf->hwtable);
		if (init_data(file, init_keywords)) {
			condlog(0, "error parsing config file");
			goto out;
		}
		if (VECTOR_SIZE(conf->hwtable) > builtin_hwtable_size) {
			/*
			 * remove duplica in hwtable. config file
			 * takes precedence over build-in hwtable
			 */
			factorize_hwtable(conf->hwtable, builtin_hwtable_size);
		}

	} else {
		init_keywords();
	}

	/*
	 * fill the voids left in the config file
	 */
	if (conf->blist_devnode == NULL) {
		conf->blist_devnode = vector_alloc();

		if (!conf->blist_devnode)
			goto out;
	}
	if (conf->blist_wwid == NULL) {
		conf->blist_wwid = vector_alloc();

		if (!conf->blist_wwid)
			goto out;
	}
	if (conf->blist_device == NULL) {
		conf->blist_device = vector_alloc();

		if (!conf->blist_device)
			goto out;
	}
	if (setup_default_blist(conf))
		goto out;

	if (conf->elist_devnode == NULL) {
		conf->elist_devnode = vector_alloc();

		if (!conf->elist_devnode)
			goto out;
	}
	if (conf->elist_wwid == NULL) {
		conf->elist_wwid = vector_alloc();

		if (!conf->elist_wwid)
			goto out;
	}

	if (conf->elist_device == NULL) {
		conf->elist_device = vector_alloc();

		if (!conf->elist_device)
			goto out;
	}

	if (conf->mptable == NULL) {
		conf->mptable = vector_alloc();
		if (!conf->mptable)
			goto out;
	}
	if (conf->bindings_file == NULL)
		conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE);

	if (!conf->multipath_dir || !conf->bindings_file ||
	    !conf->wwids_file)
		goto out;

	return 0;
out:
	free_config(conf);
	return 1;
}
Exemplo n.º 29
0
MissingValues::MissingValues(void)
{
    set();

    set_default();
}
TrainingAlgorithm::TrainingAlgorithm(void)
 : loss_index_pointer(NULL)
{ 
   set_default();
}