Exemplo n.º 1
0
void Latex::overview           ()
{
    int n_strat = da.strategy_names().size();

    os <<   "\\chapter{Overview}\n"
                "\\section{Holding Period Return}\n";

           add_figure(output_folder + "holding_ret.tex", "Holding Period Return");

    os <<   "\\section{Statistics}\n"

            "\\begin{center}\n"
                "\\begin{tabular}{|r|rrrrrrr|}\n";

    os <<       "\\hline \n"
                    "Strategies & Mean & St. Dev. & Sharp & Skew & Kurtosis & Positive & Negative \\\\ \n"
                "\\hline \n";

    for (int i = 0; i < n_strat; i++)
    {
        os  << da.strategy_names()[i]                                   << " & "
            << format_double(da.means()(0, i) * 250.0 * 100.0, 2)       << " & "
            << format_double(da.stdev()(0, i) * sqrt(250.0) * 100.0, 2) << " & "
            << format_double(da.means()(0, i) * 250.0 / (da.stdev()(0, i) * sqrt(250.0)), 4)     << " & "
            << format_double(da.skewness()(0, i), 4)                    << " & "
            << format_double(da.kurtosis()(0, i), 2)                    << " & "
            << da.pos_count()(0, i)                                     << " & "
            << da.neg_count()(0, i)                                     << " \\\\ \n "
        ;
    }

    os <<       "\\hline \n";
    os <<       "\\end{tabular} \n"
            "\\end{center}\n";
}
Exemplo n.º 2
0
int format_parms(double v, int *n, int *dp, int *eformat, int e_option)
{
    char buf[50];
    int orig_length, scient_dp;

    orig_length = *n;
    scient_dp = *dp;
    for (;;) {
	if (!*eformat)
	    format_double(v, buf, *n, *dp);
	else
	    scient_format(v, buf, *n, *dp);

	if (strlen(buf) <= *n)
	    break;

	if (*dp) {
	    *dp -= 1;
	}
	else {
	    if ((e_option) && (!*eformat)) {
		*eformat = 1;
		*dp = scient_dp;
	    }
	    else
		*n = strlen(buf);
	}
    }

    return 0;
}
Exemplo n.º 3
0
int jdfits_write_header_double (JDFits_Type *ft, char *name, double val, char *comment)
{
   char buf[JDFITS_CARD_SIZE + 1];
   char numbuf[64];
   int prec;

   if ((-1 == check_keyword (name))
       || (-1 == check_ascii(comment, 1)))
     return -1;

   /* According to the FITS NOST document, the resulting value should be right
    * justified in columns 11-30.  It must contain a decimal point and E must
    * be used if with in exponential form.
    */
   prec = 16;
   do
     {
	if (-1 == format_double (val, prec, numbuf))
	  {
	     strcpy (numbuf, "Floating point exception");
	     jdfits_warning ("jdfits_write_header_double: unable to convert value\n");
	     prec = 0;
	  }
	prec--;
	sprintf (buf, "%-8s= %20s", name, numbuf);
     }
   while ((prec > 5) && (strlen (buf) > 30));

   jdfits_append_comment (buf, comment);

   return jdfits_write (ft, (unsigned char *) buf, JDFITS_CARD_SIZE);
}
void CQuotesProviderVisitorFormater::FormatDoubleHelper(LPCSTR pszDbSet,
	const tstring sInvalid/* = _T("-")*/)
{
	double d = 0.0;
	if (true == Quotes_DBReadDouble(m_hContact, QUOTES_MODULE_NAME, pszDbSet, d))
		m_sResult = format_double(d, m_nWidth);
	else
		m_sResult = sInvalid;
}
Exemplo n.º 5
0
static int print_double(char *buf, double num)
{
	char stack[DBL_MAX_LEN], b[DBL_MAX_LEN];
	int i, p = 0;

	i = format_double(b, DBL_MAX_LEN, num) - 1;
	while (i >= 0) {
		stack[p++] = b[i];
		i--;
	}
	return stack_print(buf, stack, p);
}
Exemplo n.º 6
0
void JsonPrettify::formatValue (web::json::value &val, utility::ostream_t &stream) {
	if ( val.is_array () )
		formatArray (val.as_array (), stream) ;
	else if ( val.is_object () )
		formatObject (val.as_object (), stream) ;
	else if ( val.is_string () )
		format_string (val.as_string (), stream) ;
	else if ( val.is_boolean () )
		format_boolean (val.as_bool (), stream) ;
	else if ( val.is_integer () )
		format_integer (val.as_integer (), stream) ;
	else if ( val.is_double () )
		format_double (val.as_double (), stream) ;
	else if ( val.is_null () )
		format_null (stream) ;
}
Exemplo n.º 7
0
/*-------------------------------------------------------------------------*/
void
change_base(void)
{
	parse_double(&dnum);

    if (dnum >= 0) {
        switch (numbase) {
        case 8:  numbase = 10;  break;
        case 10: numbase = 16;  break;
        case 16: numbase = 8;   break;
        }

        format_double(dnum);
    } else strlcpy(dispstr, "error", sizeof(dispstr));

    DrawDisplay();
}
Exemplo n.º 8
0
/// Evaluate math expressions.
static int evaluate_expression(const wchar_t *cmd, parser_t &parser, io_streams_t &streams,
                               math_cmd_opts_t &opts, wcstring &expression) {
    UNUSED(parser);

    int retval = STATUS_CMD_OK;
    te_error_t error;
    std::string narrow_str = wcs2string(expression);
    // Switch locale while computing stuff.
    // This means that the "." is always the radix character,
    // so numbers work the same across locales.
    char *saved_locale = strdup(setlocale(LC_NUMERIC, NULL));
    setlocale(LC_NUMERIC, "C");
    double v = te_interp(narrow_str.c_str(), &error);

    if (error.position == 0) {
        // Check some runtime errors after the fact.
        // TODO: Really, this should be done in tinyexpr
        // (e.g. infinite is the result of "x / 0"),
        // but that's much more work.
        const char *error_message = NULL;
        if (std::isinf(v)) {
            error_message = "Result is infinite";
        } else if (std::isnan(v)) {
            error_message = "Result is not a number";
        } else if (std::abs(v) >= kMaximumContiguousInteger) {
            error_message = "Result magnitude is too large";
        }
        if (error_message) {
            streams.err.append_format(L"%ls: Error: %s\n", cmd, error_message);
            streams.err.append_format(L"'%ls'\n", expression.c_str());
            retval = STATUS_CMD_ERROR;
        } else {
            streams.out.append(format_double(v, opts));
            streams.out.push_back(L'\n');
        }
    } else {
        streams.err.append_format(L"%ls: Error: %ls\n", cmd, math_describe_error(error).c_str());
        streams.err.append_format(L"'%ls'\n", expression.c_str());
        streams.err.append_format(L"%*ls%ls\n", error.position - 1, L" ",L"^");
        retval = STATUS_CMD_ERROR;
    }
    setlocale(LC_NUMERIC, saved_locale);
    free(saved_locale);
    return retval;
}
Exemplo n.º 9
0
/* Two operand functions for infix calc */
void
twoop(int keynum)
{
  if (flagINV) {
    flagINV=0;
    DrawDisplay();
  }

  if (!entered) {		/* something like "5+*" */
    if (!isopempty())
      (void) PopOp();			/* replace the prev op */
    PushOp(keynum);		/* with the new one */
    return;
  }

  if (entered==1)
    parse_double(&dnum);

  clrdisp=CLR=1;
  entered=Dpoint=exponent=0;

  if (!isopempty()) {  /* there was a previous op */
    lastop=PopOp();   /* get it */

    if (lastop==kLPAR) {  /* put it back */
      PushOp(kLPAR);
      PushOp(keynum);
      PushNum(dnum);
      return;
    }

    /* now, if the current op (keynum) is of
       higher priority than the lastop, the current
       op and number are just pushed on top
       Priorities:  (Y^X) > *,/ > +,- > >>,<< > & > ^ > ~ */

    if (priority(keynum) > priority(lastop)) {
      PushNum(dnum);
      PushOp(lastop);
      PushOp(keynum);
    } else {  /* execute lastop on lastnum and dnum, push
	       result and current op on stack */
      acc=PopNum();
      switch (lastop) { /* perform the operation */
      case kADD: acc += dnum;  break;
      case kSUB: acc -= dnum;  break;
      case kMUL: acc *= dnum;  break;
      case kDIV: acc /= dnum;  break;
      case kPOW: acc =  pow(acc,dnum);  break;
      case kMOD: acc = (long)acc %  (long)dnum;  break;
      case kAND: acc = (long)acc &  (long)dnum;  break;
      case kOR:  acc = (long)acc |  (long)dnum;  break;
      case kXOR: acc = (long)acc ^  (long)dnum;  break;
      case kSHL: acc = (long)acc << (long)dnum;  break;
      case kSHR: acc = (long)acc >> (long)dnum;  break;
      }

      PushNum(acc);
      PushOp(keynum);
      format_double(acc);
      DrawDisplay();
      dnum=acc;
    }
  }
Exemplo n.º 10
0
/*-------------------------------------------------------------------------*/
void
numeric(int keynum)
{
  char st[2];

  flagINV=0;

  if (rpn && (memop == kSTO || memop == kRCL || memop == kSUM)) {
      int cell = 0;

      switch (keynum) {
	case kONE:	cell = 1; break;
	case kTWO:	cell = 2; break;
	case kTHREE:	cell = 3; break;
	case kFOUR:	cell = 4; break;
	case kFIVE:	cell = 5; break;
	case kSIX:	cell = 6; break;
	case kSEVEN:	cell = 7; break;
	case kEIGHT:	cell = 8; break;
	case kNINE:	cell = 9; break;
	case kZERO:	cell = 0; break;
      }
      switch (memop) {
      case kSTO:
	mem[cell] = dnum;
	lift_enabled = 1;
	entered = 2;
	clrdisp++;
	break;
      case kRCL:
	PushNum(dnum);
	dnum = mem[cell];
	format_double(dnum);
	lift_enabled = 1;
        entered = 1;
	clrdisp++;
	break;
      case kSUM:
	mem[cell] += dnum;
	lift_enabled = 1;
	entered = 2;
	clrdisp++;
	break;
      }
      memop = kCLR;
      DrawDisplay();
      return;
  }

  if (clrdisp) {
    dispstr[0]='\0';
    exponent=Dpoint=0;
/*    if (rpn && entered==2)
      PushNum(dnum);
 */
    if (rpn & lift_enabled)
	PushNum(dnum);
  }
  if ((int) strlen(dispstr) >= MAXDISP)
    return;

  st[0] = '\0';
  switch (keynum){
      case kZERO:	st[0] = '0'; break;
      case kONE:	st[0] = '1'; break;
      case kTWO:	st[0] = '2'; break;
      case kTHREE:	st[0] = '3'; break;
      case kFOUR:	st[0] = '4'; break;
      case kFIVE:	st[0] = '5'; break;
      case kSIX:	st[0] = '6'; break;
      case kSEVEN:	st[0] = '7'; break;
      case kEIGHT:	if (numbase > 8)  st[0] = '8'; break;
      case kNINE:	if (numbase > 8)  st[0] = '9'; break;
      case kxA: 	if (numbase > 10) st[0] = 'A'; break;
      case kxB: 	if (numbase > 10) st[0] = 'B'; break;
      case kxC: 	if (numbase > 10) st[0] = 'C'; break;
      case kxD: 	if (numbase > 10) st[0] = 'D'; break;
      case kxE: 	if (numbase > 10) st[0] = 'E'; break;
      case kxF: 	if (numbase > 10) st[0] = 'F'; break;
    }

    if (st[0] == '\0')
        return;
    st[1] = '\0';
    strcat(dispstr,st);

  DrawDisplay();
  if (clrdisp && keynum != kZERO)
    clrdisp=0; /*no leading 0s*/
  memop = keynum;
  entered=1;
  lift_enabled = 0;
}
Exemplo n.º 11
0
int G_site_put_new(FILE * fptr, Site * s, int has_cat)

/* Writes a site to file open on fptr. */
{
    char ebuf[MAX_SITE_STRING], nbuf[MAX_SITE_STRING];
    char xbuf[MAX_SITE_STRING], buf[MAX_SITE_LEN];
    static int format_double();
    int fmt, i, j, k;
    int G_format_northing(), G_format_easting(), G_projection();

    fmt = G_projection();

    G_format_northing(s->north, nbuf, fmt);
    G_format_easting(s->east, ebuf, fmt);
    sprintf(buf, "%s|%s|", ebuf, nbuf);
    for (i = 0; i < s->dim_alloc; ++i) {
	format_double(s->dim[i], nbuf);
	sprintf(xbuf, "%s|", nbuf);
	strcat(buf, xbuf);
    }

    if (has_cat) {
	switch (s->cattype) {
	case CELL_TYPE:
	    sprintf(xbuf, "#%d ", s->ccat);
	    strcat(buf, xbuf);
	    break;
	case FCELL_TYPE:
	    sprintf(xbuf, "#%g ", s->fcat);
	    strcat(buf, xbuf);
	    break;
	case DCELL_TYPE:
	    sprintf(xbuf, "#%g ", s->dcat);
	    strcat(buf, xbuf);
	    break;
	}
    }
    else {			/* no cat there, so data in plain x,y,z format will be imported   12/99 MN */

	/* we create a #cat entry in site_list from the current site number 11/99 */
	sprintf(xbuf, "#%d ", loop);
	loop++;
	strcat(buf, xbuf);
    }

    /* now import attributes */
    for (i = 0; i < s->dbl_alloc; ++i) {
	format_double(s->dbl_att[i], nbuf);
	sprintf(xbuf, "%%%s ", nbuf);
	strcat(buf, xbuf);
    }

    for (i = 0; i < s->str_alloc; ++i) {
	if (strlen(s->str_att[i]) != 0) {
	    /* escape double quotes */
	    j = k = 0;
	    if (G_index(s->str_att[i], DQUOTE) != (char *)NULL) {
		while (!isnull(s->str_att[i][j])) {
		    if (isquote(s->str_att[i][j])) {
			xbuf[k++] = BSLASH;
			xbuf[k++] = DQUOTE;
		    }
		    else if (isbslash(s->str_att[i][j])) {
			xbuf[k++] = BSLASH;
			xbuf[k++] = BSLASH;
		    }
		    else
			xbuf[k++] = s->str_att[i][j];
		    j++;
		}
		xbuf[k] = (char)NULL;
	    }
	    else
		strcpy(xbuf, s->str_att[i]);

	    strcpy(s->str_att[i], xbuf);

	    if (G_index(s->str_att[i], SPACE) != (char *)NULL)
		sprintf(xbuf, "@\"%s\" ", s->str_att[i]);
	    else
		sprintf(xbuf, "@%s ", s->str_att[i]);

	    strcat(buf, xbuf);
	}
    }
    fprintf(fptr, "%s\n", buf);
    return 0;
}
Exemplo n.º 12
0
void print_info(const struct Map_info *Map)
{
    int i;
    char line[100];
    char tmp1[100], tmp2[100];

    struct bound_box box;
    
    divider('+');
    if (Vect_maptype(Map) & (GV_FORMAT_OGR | GV_FORMAT_OGR_DIRECT)) {
	/* for OGR format print also datasource and layer */
	sprintf(line, "%-17s%s", _("OGR layer:"),
		Vect_get_ogr_layer_name(Map));
	printline(line);
	sprintf(line, "%-17s%s", _("OGR datasource:"),
		Vect_get_ogr_dsn_name(Map));
	printline(line);
    }
    else {
	sprintf(line, "%-17s%s", _("Name:"),
		Vect_get_name(Map));
	printline(line);
	sprintf(line, "%-17s%s", _("Mapset:"),
		Vect_get_mapset(Map));
	printline(line);
    }

    sprintf(line, "%-17s%s", _("Location:"),
	    G_location());
    printline(line);
    sprintf(line, "%-17s%s", _("Database:"),
	    G_gisdbase());
    printline(line);
    sprintf(line, "%-17s%s", _("Title:"),
	    Vect_get_map_name(Map));
    printline(line);
    sprintf(line, "%-17s1:%d", _("Map scale:"),
	    Vect_get_scale(Map));
    printline(line);
    
    if (Vect_maptype(Map) & (GV_FORMAT_OGR | GV_FORMAT_OGR_DIRECT)) {
	sprintf(line, "%-17s%s (%s)", _("Map format:"),
		Vect_maptype_info(Map), Vect_get_ogr_format_info(Map));
    }
    else {
	sprintf(line, "%-17s%s", _("Map format:"),
		Vect_maptype_info(Map));
    }
    
    printline(line);
    sprintf(line, "%-17s%s", _("Name of creator:"),
	    Vect_get_person(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Organization:"),
	    Vect_get_organization(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Source date:"),
	    Vect_get_map_date(Map));
    printline(line);
    
    divider('|');
    
    sprintf(line, "  %s: %s (%s: %i)",
	    _("Type of map"), _("vector"), _("level"), Vect_level(Map));
    
    printline(line);
    
    if (Vect_level(Map) > 0) {
	printline("");
	sprintf(line,
		"  %-24s%-9d       %-22s%-9d",
		_("Number of points:"), 
		Vect_get_num_primitives(Map, GV_POINT),
		_("Number of centroids:"),
		Vect_get_num_primitives(Map, GV_CENTROID));
	printline(line);
	sprintf(line,
		"  %-24s%-9d       %-22s%-9d",
		_("Number of lines:"),
		Vect_get_num_primitives(Map, GV_LINE),
		_("Number of boundaries:"),
		Vect_get_num_primitives(Map, GV_BOUNDARY));
	printline(line);
	sprintf(line,
		"  %-24s%-9d       %-22s%-9d",
		_("Number of areas:"),
		Vect_get_num_areas(Map),
		_("Number of islands:"),
		Vect_get_num_islands(Map));
	printline(line);
	if (Vect_is_3d(Map)) {
	    sprintf(line,
		    "  %-24s%-9d       %-22s%-9d",
		    _("Number of faces:"),
		    Vect_get_num_primitives(Map, GV_FACE),
		    _("Number of kernels:"),
		    Vect_get_num_primitives(Map, GV_KERNEL));
	    printline(line);
	    sprintf(line,
		    "  %-24s%-9d       %-22s%-9d",
		    _("Number of volumes:"),
		    Vect_get_num_volumes(Map),
		    _("Number of holes:"),
		    Vect_get_num_holes(Map));
	    printline(line);
	}
	printline("");
	
	sprintf(line, "  %-24s%s",
		_("Map is 3D:"),
		Vect_is_3d(Map) ? _("Yes") : _("No"));
	printline(line);
	sprintf(line, "  %-24s%-9d",
		_("Number of dblinks:"),
		Vect_get_num_dblinks(Map));
	printline(line);
    }
    
    printline("");
    /* this differs from r.info in that proj info IS taken from the map here, not the location settings */
    /* Vect_get_proj_name() and _zone() are typically unset?! */
    if (G_projection() == PROJECTION_UTM)
	sprintf(line, "  %s: %s (%s %d)",
		_("Projection:"),
		Vect_get_proj_name(Map),
		_("zone"), Vect_get_zone(Map));
    else
	sprintf(line, "  %s: %s",
		_("Projection"),
		Vect_get_proj_name(Map));
    
    printline(line);
    printline("");
    
    Vect_get_map_box(Map, &box);
    
    G_format_northing(box.N, tmp1, G_projection());
    G_format_northing(box.S, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
	    'N', tmp1, 'S', tmp2);
    printline(line);
    
    G_format_easting(box.E, tmp1, G_projection());
    G_format_easting(box.W, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
	    'E', tmp1, 'W', tmp2);
    printline(line);
    
    if (Vect_is_3d(Map)) {
	format_double(box.B, tmp1);
	format_double(box.T, tmp2);
	sprintf(line, "              %c: %17s    %c: %17s",
		'B', tmp1, 'T', tmp2);
	printline(line);
    }
    printline("");

    format_double(Vect_get_thresh(Map), tmp1);
    sprintf(line, "  %s: %s", _("Digitization threshold"), tmp1);
    printline(line);
    sprintf(line, "  %s:", _("Comment"));
    printline(line);
    sprintf(line, "    %s", Vect_get_comment(Map));
    printline(line);
    divider('+');
    fprintf(stdout, "\n");
}
Exemplo n.º 13
0
//// read the directory entries of given dir/archive
static void b_zzip_read_dirent(task *tsk, pntr *argstack)
{
	char *fileName;
	pntr p = argstack[0];
	int badtype;
	
	CHECK_ARG(0, CELL_CONS);
	if((badtype = array_to_string(p, &fileName)) >= 0){
		set_error(tsk, "error1: argument is not a string (contains non-char: %s)", cell_types[badtype]);
		return;
	}

    ZZIP_DIR * dir;
    ZZIP_DIRENT * d;
  
    dir = zzip_opendir(fileName);
    if (! dir){
    	fprintf (stderr, "did not open %s: ", fileName);
    	set_error(tsk, "error1: could not handle file: %s", fileName);
		return;
    }

    char *singleFileName;
    char *compressionType;
    int fSize = 20;
    char fileSize[fSize];
    char compressedSize[fSize];
    pntr pSingleFileName, pCompressionType, pFileSize, pCompressedSize;
    pntr preList, singleList;
    int counter = 0;
    
	/* read each dir entry, a list for each file */
	while ((d = zzip_readdir (dir))){
		counter++;
		/* orignal size / compression-type / compression-ratio / filename */
		singleFileName = d->d_name;
		pSingleFileName = string_to_array(tsk, singleFileName);	//// convert the string to cons list
		
//		sprintf(compressionType, "%s ", zzip_compr_str(d->d_compr)); //// NOTE: executing this func will change the tsk->steamstack, very weird
																	//// NOTE: overflow caused here
		compressionType = (char *)zzip_compr_str(d->d_compr);
		pCompressionType = string_to_array(tsk, compressionType);
		
//		snprintf(fileSize, 5, "%d ", d->st_size);	//// NOTE: executing this func will change the tsk->steamstack, very weird
		format_double(fileSize, fSize, d->st_size);
		pFileSize = string_to_array(tsk, fileSize);

//		sprintf(compressedSize, "%d ", d->d_csize);
		format_double(compressedSize, fSize, d->d_csize);
		pCompressedSize = string_to_array(tsk, compressedSize);
		
//		printf("cell type: %s \t", cell_type(preList));
		//// link the cons lists to form a new list
//		singleList = connect_lists(tsk, &pSingleFileName, &pCompressionType);
//		singleList = connect_lists(tsk, &singleList, &pFileSize);
//		singleList = connect_lists(tsk, &singleList, &pCompressedSize);
		
		//// make cons from the last element to the beginning element
		singleList = make_cons(tsk, pCompressedSize, tsk->globnilpntr);
		singleList = make_cons(tsk, pFileSize, singleList);
		singleList = make_cons(tsk, pCompressionType, singleList);
		singleList = make_cons(tsk, pSingleFileName, singleList);
		
		
		if(counter == 1){
			preList = make_cons(tsk, singleList, tsk->globnilpntr);
//			printf("cell type: %s \t", cell_type(preList));
		}else{
			preList = make_cons(tsk, singleList, preList);
//			printf("cell type: %s \n", cell_type(preList));
		}
	}

	argstack[0] = preList;
//	printf("cell type: %s \n", cell_type(argstack[0]));
}
Exemplo n.º 14
0
static int double_len(double num)
{
	char buf[DBL_MAX_LEN];
	return format_double(buf, DBL_MAX_LEN, num);
}
Exemplo n.º 15
0
void print_info(const struct Map_info *Map)
{
    int i, map_type;
    char line[1024];
    char timebuff[256];
    struct TimeStamp ts;
    int time_ok, first_time_ok, second_time_ok;
    struct bound_box box;
    char tmp1[1024], tmp2[1024];
    
    time_ok = first_time_ok = second_time_ok = FALSE;
    map_type = Vect_maptype(Map);
    
    /* Check the Timestamp */
    time_ok = G_read_vector_timestamp(Vect_get_name(Map), NULL, "", &ts);

    /* Check for valid entries, show none if no timestamp available */
    if (time_ok == TRUE) {
        if (ts.count > 0)
            first_time_ok = TRUE;
        if (ts.count > 1)
            second_time_ok = TRUE;
    }

    divider('+');
    sprintf(line, "%-17s%s", _("Name:"),
            Vect_get_name(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Mapset:"),
            Vect_get_mapset(Map));
    printline(line);
    
    sprintf(line, "%-17s%s", _("Location:"),
            G_location());
    printline(line);
    sprintf(line, "%-17s%s", _("Database:"),
            G_gisdbase());
    printline(line);

    sprintf(line, "%-17s%s", _("Title:"),
            Vect_get_map_name(Map));
    printline(line);
    sprintf(line, "%-17s1:%d", _("Map scale:"),
            Vect_get_scale(Map));
    printline(line);

    sprintf(line, "%-17s%s", _("Name of creator:"),
            Vect_get_person(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Organization:"),
            Vect_get_organization(Map));
    printline(line);
    sprintf(line, "%-17s%s", _("Source date:"),
            Vect_get_map_date(Map));
    printline(line);

    /* This shows the TimeStamp (if present) */
    if (time_ok  == TRUE && (first_time_ok || second_time_ok)) {
        G_format_timestamp(&ts, timebuff);
        sprintf(line, "%-17s%s", _("Timestamp (first layer): "), timebuff);
        printline(line);
    }
    else {
        strcpy(line, _("Timestamp (first layer): none"));
        printline(line);
    }
    
    divider('|');
    
    if (map_type == GV_FORMAT_OGR ||
        map_type == GV_FORMAT_OGR_DIRECT) {
        sprintf(line, "%-17s%s (%s)", _("Map format:"),
                Vect_maptype_info(Map), Vect_get_finfo_format_info(Map));
        printline(line);
        
        /* for OGR format print also datasource and layer */
        sprintf(line, "%-17s%s", _("OGR layer:"),
                Vect_get_finfo_layer_name(Map));
        printline(line);
        sprintf(line, "%-17s%s", _("OGR datasource:"),
                Vect_get_finfo_dsn_name(Map));
        printline(line);
        sprintf(line, "%-17s%s", _("Feature type:"),
                Vect_get_finfo_geometry_type(Map));
        printline(line);
    }
    else if (map_type == GV_FORMAT_POSTGIS) {
        int topo_format;
        char *toposchema_name, *topogeom_column;
        int topo_geo_only;

        const struct Format_info *finfo;

        finfo = Vect_get_finfo(Map);
        
        sprintf(line, "%-17s%s (%s)", _("Map format:"),
                Vect_maptype_info(Map), Vect_get_finfo_format_info(Map));
        printline(line);
        
        /* for PostGIS format print also datasource and layer */
        sprintf(line, "%-17s%s", _("DB table:"),
                Vect_get_finfo_layer_name(Map));
        printline(line);
        sprintf(line, "%-17s%s", _("DB name:"),
                Vect_get_finfo_dsn_name(Map));
        printline(line);

        sprintf(line, "%-17s%s", _("Geometry column:"),
                finfo->pg.geom_column);
        printline(line);

        sprintf(line, "%-17s%s", _("Feature type:"),
                Vect_get_finfo_geometry_type(Map));
        printline(line);


        
        topo_format = Vect_get_finfo_topology_info(Map,
                                                   &toposchema_name, &topogeom_column,
                                                   &topo_geo_only);
        if (topo_format == GV_TOPO_POSTGIS) {
            sprintf(line, "%-17s%s (%s %s%s)", _("Topology:"), "PostGIS",
                    _("schema:"), toposchema_name,
                    topo_geo_only ? ", topo-geo-only: yes" : "");
            printline(line);

            sprintf(line, "%-17s%s", _("Topology column:"),
                    topogeom_column);
        }
        else
            sprintf(line, "%-17s%s", _("Topology:"), "pseudo (simple features)");
        
        printline(line);
    }
    else {
        sprintf(line, "%-17s%s", _("Map format:"),
                Vect_maptype_info(Map));
        printline(line);
    }
    

    divider('|');
    
    sprintf(line, "  %s: %s (%s: %i)",
            _("Type of map"), _("vector"), _("level"), Vect_level(Map));
    printline(line);
    
    if (Vect_level(Map) > 0) {
        printline("");
        sprintf(line,
                "  %-24s%-9d       %-22s%-9d",
                _("Number of points:"), 
                Vect_get_num_primitives(Map, GV_POINT),
                _("Number of centroids:"),
                Vect_get_num_primitives(Map, GV_CENTROID));
        printline(line);
        sprintf(line,
                "  %-24s%-9d       %-22s%-9d",
                _("Number of lines:"),
                Vect_get_num_primitives(Map, GV_LINE),
                _("Number of boundaries:"),
                Vect_get_num_primitives(Map, GV_BOUNDARY));
        printline(line);
        sprintf(line,
                "  %-24s%-9d       %-22s%-9d",
                _("Number of areas:"),
                Vect_get_num_areas(Map),
                _("Number of islands:"),
                Vect_get_num_islands(Map));
        printline(line);
        if (Vect_is_3d(Map)) {
            sprintf(line,
                    "  %-24s%-9d       %-22s%-9d",
                    _("Number of faces:"),
                    Vect_get_num_primitives(Map, GV_FACE),
                    _("Number of kernels:"),
                    Vect_get_num_primitives(Map, GV_KERNEL));
            printline(line);
            sprintf(line,
                    "  %-24s%-9d       %-22s%-9d",
                    _("Number of volumes:"),
                    Vect_get_num_volumes(Map),
                    _("Number of holes:"),
                    Vect_get_num_holes(Map));
            printline(line);
        }
        printline("");

        sprintf(line, "  %-24s%s",
                _("Map is 3D:"),
                Vect_is_3d(Map) ? _("Yes") : _("No"));
        printline(line);
        sprintf(line, "  %-24s%-9d",
                _("Number of dblinks:"),
                Vect_get_num_dblinks(Map));
        printline(line);
    }

    printline("");
    /* this differs from r.info in that proj info IS taken from the map here, not the location settings */
    /* Vect_get_proj_name() and _zone() are typically unset?! */
    if (G_projection() == PROJECTION_UTM) {
        int utm_zone;

        utm_zone = Vect_get_zone(Map);
        if (utm_zone < 0 || utm_zone > 60)
            strcpy(tmp1, _("invalid"));
        else if (utm_zone == 0)
            strcpy(tmp1, _("unspecified"));
        else
            sprintf(tmp1, "%d", utm_zone);

        sprintf(line, "  %s: %s (%s %s)",
                _("Projection"), Vect_get_proj_name(Map),
                _("zone"), tmp1);
    }
    else
        sprintf(line, "  %s: %s",
                _("Projection"), Vect_get_proj_name(Map));

    printline(line);
    printline("");

    Vect_get_map_box(Map, &box);

    G_format_northing(box.N, tmp1, G_projection());
    G_format_northing(box.S, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
            'N', tmp1, 'S', tmp2);
    printline(line);
    
    G_format_easting(box.E, tmp1, G_projection());
    G_format_easting(box.W, tmp2, G_projection());
    sprintf(line, "              %c: %17s    %c: %17s",
            'E', tmp1, 'W', tmp2);
    printline(line);
    
    if (Vect_is_3d(Map)) {
        format_double(box.B, tmp1);
        format_double(box.T, tmp2);
        sprintf(line, "              %c: %17s    %c: %17s",
                'B', tmp1, 'T', tmp2);
        printline(line);
    }
    printline("");

    format_double(Vect_get_thresh(Map), tmp1);
    sprintf(line, "  %s: %s", _("Digitization threshold"), tmp1);
    printline(line);
    sprintf(line, "  %s:", _("Comment"));
    printline(line);
    sprintf(line, "    %s", Vect_get_comment(Map));
    printline(line);
    divider('+');
    fprintf(stdout, "\n");
}
Exemplo n.º 16
0
void process_item (int rectype, int reclen, unsigned char *rec) {
	if (rectype != CONTINUE && prev_rectype == SST) {
		/* we have accumulated  unparsed SST, and now encountered
		 * another record, which indicates that SST is ended */
		/* fprintf(stderr,"parse sst!\n");*/
		parse_sst(sstBuffer,sstBytes);
	}	
	switch (rectype) {
	case FILEPASS: {
		fprintf(stderr,"File is encrypted\n");
		exit(69);
		break;
	}
	case WRITEPROT: 
		/* File is write protected, but we only read it */
		break;
	case 0x42: {
		if (source_charset) break;
		codepage=getshort(rec,0);
		/*fprintf(stderr,"CODEPAGE %d\n",codepage); */
		if (codepage!=1200) {
			const char *cp = charset_from_codepage(codepage); 
			source_charset=read_charset(cp);
		}		 
		break;
	}  
	case FORMAT: {
		int format_code;
		format_code=getshort(rec,0);
		SetFormatIdxUsed(format_code);
		/* this debug code prints format string */
		/*							  
			int i;
			char *ptr;
			fprintf(stderr,"Format %x \"",format_code);
			if (rec[2] == reclen - 3 && rec[3] != 0) {
			for (i=0,ptr=rec+3;i<rec[2];i++,ptr++) {
			fputc(*ptr,stderr);
			}
			} else {
			for (i=0,ptr=rec+5;i<rec[2];i++,ptr+=2) {
			fputc(*ptr,stderr);
			}
			}
			fprintf (stderr,"\"\n");
		*/
		break;
	}			 
	case SST: {
		/* Just copy SST into buffer, and wait until we get
		 * all CONTINUE records
		 */
/* 		fprintf(stderr,"SST\n"); */
		/* If exists first SST entry, then just drop it and start new*/
		if (sstBuffer != NULL) 
			free(sstBuffer);
		if (sst != NULL)
			free(sst);
		
		sstBuffer=(unsigned char*)malloc(reclen);
		sstBytes = reclen;
		if (sstBuffer == NULL ) {
			perror("SSTptr alloc error! ");
			exit(1);
		}	  
		memcpy(sstBuffer,rec,reclen);
		break;
	}	
	case CONTINUE: {
		if (prev_rectype != SST) {
			return; /* to avoid changing of prev_rectype;*/
		}    
		sstBuffer=realloc(sstBuffer,sstBytes+reclen);
		if (sstBuffer == NULL ) {
			perror("SSTptr realloc error! ");
			exit(1);
		}	  
		memcpy(sstBuffer+sstBytes,rec,reclen);
		sstBytes+=reclen;
		return;
	}			   
	case LABEL: {
		int row,col;
		unsigned char **pcell;
		unsigned char *src=(unsigned char *)rec+6;

		saved_reference=NULL;
		row = getshort(rec,0); 
		col = getshort(rec,2);
		/* 		fprintf(stderr,"LABEL!\n"); */
		pcell=allocate(row,col);
		*pcell=copy_unicode_string(&src);
		break;
	}     
	case BLANK: { int row,col;unsigned char **pcell;
			row = getshort(rec,0);
			col = getshort(rec,2);
			pcell=allocate(row,col);
			*pcell=NULL;
			break;
	}
	case MULBLANK: {
		int row, startcol,endcol;
		unsigned char **pcell;
		row = getshort(rec,0);
		startcol = getshort(rec,2);
		endcol=getshort(rec,reclen-2);
		pcell=allocate(row,endcol);
		*pcell=NULL;
		(void)startcol;
		break;
	}	   
	case CONSTANT_STRING: {
		int row = getshort(rec,0); 
		int col = getshort(rec,2);
		unsigned char **pcell;
		int string_no=getshort(rec,6);
		if (!sst) {
			fprintf(stderr,"CONSTANT_STRING before SST parsed\n");
			exit(1);
		}    
		/* 									fprintf(stderr,"col=%d row=%d no=%d\n",col,row,string_no); */
									
		saved_reference=NULL;
		pcell=allocate(row,col);
		if (string_no>=sstsize|| string_no < 0 ) {
			fprintf(stderr,"string index out of boundary\n"); 
			exit(1);	 
		} else if (sst[string_no] !=NULL) {	
			int len;
			unsigned char *outptr;
			len=strlen((char *)sst[string_no]);
			outptr=*pcell=malloc(len+1);
			strcpy((char *)outptr,(char *)sst[string_no]);
		} else {
			*pcell=malloc(1);
			**pcell = 0;
		}	
		break;
	}
	case 0x03:
	case 0x103:
	case 0x303:
	case NUMBER: {
		int row,col;
		unsigned char **pcell;

		saved_reference=NULL;
		row = getshort(rec,0)-startrow; 
		col = getshort(rec,2);
		pcell=allocate(row,col);
		*pcell=(unsigned char *)strdup(format_double(rec,6,getshort(rec,4)));
		break;
	}
	case INTEGER_CELL: {
		int row,col;
		unsigned char **pcell;

		row = getshort(rec,0)-startrow;
		col = getshort(rec,2);
		pcell=allocate(row,col);
		*pcell=(unsigned char *)strdup(format_int(getshort(rec,7),getshort(rec,4)));		  
		break;

	}				  
	case RK: {
		int row,col,format_code;
		unsigned char **pcell;

		saved_reference=NULL;
		row = getshort(rec,0)-startrow; 
		col = getshort(rec,2);
		pcell=allocate(row,col);
		format_code = getshort(rec,4);
		*pcell=(unsigned char *)strdup(format_rk(rec+6,format_code));
		break;
	}
	case MULRK: {
		int row,col,startcol,endcol,offset,format_code;
		unsigned char **pcell;
		row = getshort(rec,0)-startrow; 
		startcol = getshort(rec,2);
		endcol = getshort(rec,reclen-2);
		saved_reference=NULL;

		for (offset=4,col=startcol;col<=endcol;offset+=6,col++) { 
			pcell=allocate(row,col);
			format_code=getshort(rec,offset);
			*pcell=(unsigned char *)strdup(format_rk(rec+offset+2,format_code));

		}		 
		break;
	} 
	case FORMULA: { 
		int row,col;
		unsigned char **pcell;
		saved_reference=NULL;
		row = getshort(rec,0)-startrow; 
		col = getshort(rec,2);
		pcell=allocate(row,col);
		if (((unsigned char)rec[12]==0xFF)&&(unsigned char)rec[13]==0xFF) {
			/* not a floating point value */
			if (rec[6]==1) {
				/*boolean*/
				char buf[2]="0";
				buf[0]+=rec[9];
				*pcell=(unsigned char *)strdup(buf);
			} else if (rec[6]==2) {
				/*error*/
				char buf[6]="ERROR";
				*pcell=(unsigned char *)strdup(buf);
			} else if (rec[6]==0) {
				saved_reference=pcell;
			}   
		} else {
			int format_code=getshort(rec,4);
			*pcell=(unsigned char *)strdup(format_double(rec,6,format_code));
		}		 
		break;
	}
	case STRING: {
		unsigned char *src=(unsigned char *)rec;
		if (!saved_reference) {
			fprintf(stderr,"String record without preceeding string formula\n");
			break;
		}
		*saved_reference=copy_unicode_string(&src);
		break;
	}	    
	case BOF: {
		if (rowptr) {
			fprintf(stderr,"BOF when current sheet is not flushed\n");
			free_sheet();
		}
		break;
	}	  
	case XF:
	case 0x43: /*from perl module Spreadsheet::ParseExecel */		  
		{
			short int formatIndex = getshort(rec,2);
			/* we are interested only in format index here */ 
			if (formatTableIndex >= formatTableSize) {
				formatTable=realloc(formatTable,
														(formatTableSize+=16)*sizeof(short int));
					  	  
				if (!formatTable) {
					fprintf(stderr,"Out of memory for format table");
					exit (1);
				}	  
			}	
			formatTable[formatTableIndex++] = formatIndex;
			break;
		} 
	case MS1904: /* Macintosh 1904 date system */ 
		date_shift=24107.0; 
		break;	 
						 
					 
	case MSEOF: {
		if (!rowptr) break;
		print_sheet();
		free_sheet();
		break;
	}
	case ROW: { 
		/*  		fprintf(stderr,"Row! %d %d %d\n",getshort(rec,0), getshort(rec+2,0),getshort(rec+4,0));  */
		break; 
	} 
	case INDEX: {
		/* 		fprintf(stderr,"INDEX! %d %d\n", getlong(rec+4,0), getlong(rec+8,0));  */
		break;
	}
	default: {
#if	0	
		fprintf(stderr,"Unknown record 0x%x\n length %d\n",rectype,reclen);		
#endif 
	}
	}
	prev_rectype=rectype; 
}  
Exemplo n.º 17
0
char *G_site_format(const Site * s, const char *fs, int id)
/* sprintf analog to G_site_put with the addition of a field separator fs 
   and option of printing site attribute identifiers
 */
{
    char ebuf[MAX_SITE_STRING], nbuf[MAX_SITE_STRING];
    char xbuf[MAX_SITE_STRING];
    const char *nfs;
    char *buf;
    int fmt, i, j, k;

    buf = (char *)G_malloc(MAX_SITE_LEN * sizeof(char));

    fmt = G_projection();

    G_format_northing(s->north, nbuf, fmt);
    G_format_easting(s->east, ebuf, fmt);

    nfs = (char *)((fs == (char *)NULL) ? "|" : fs);

    sprintf(buf, "%s%s%s", ebuf, nfs, nbuf);

    for (i = 0; i < s->dim_alloc; ++i) {
	format_double(s->dim[i], nbuf);
	sprintf(xbuf, "%s%s", nfs, nbuf);
	G_strcat(buf, xbuf);
    }

    nfs = (fs == NULL) ? " " : fs;

    switch (s->cattype) {
    case CELL_TYPE:
	sprintf(xbuf, "%s%s%d ", nfs, ((id == 0) ? "" : "#"), (int)s->ccat);
	G_strcat(buf, xbuf);
	break;
    case FCELL_TYPE:
    case DCELL_TYPE:
	sprintf(xbuf, "%s%s%g ", nfs, ((id == 0) ? "" : "#"), (float)s->fcat);
	G_strcat(buf, xbuf);
	break;
    }

    for (i = 0; i < s->dbl_alloc; ++i) {
	format_double(s->dbl_att[i], nbuf);
	sprintf(xbuf, "%s%s%s", nfs, ((id == 0) ? "" : "%"), nbuf);
	G_strcat(buf, xbuf);
    }

    for (i = 0; i < s->str_alloc; ++i) {
	if (strlen(s->str_att[i]) != 0) {
	    /* escape double quotes */
	    j = k = 0;

	    /* do not uncomment this code because sites file was created
	     * as we want. So it's enough to print them out as it is.
	     *
	     if (G_index (s->str_att[i], DQUOTE) != (char *) NULL)
	     {
	     while (!isnull(s->str_att[i][j]))
	     {
	     if (isquote(s->str_att[i][j]))
	     {
	     xbuf[k++] = BSLASH;
	     xbuf[k++] = DQUOTE;
	     }
	     else
	     xbuf[k++] = s->str_att[i][j];
	     j++;
	     }
	     xbuf[k] = (char) NULL;
	     }
	     else
	     */

	    G_strcpy(xbuf, s->str_att[i]);

	    G_strcpy(s->str_att[i], xbuf);

	    if (G_index(s->str_att[i], SPACE) != (char *)NULL)
		sprintf(xbuf, "%s%s\"%s\"", nfs, ((id == 0) ? "" : "@"),
			s->str_att[i]);
	    else
		sprintf(xbuf, "%s%s%s", nfs, ((id == 0) ? "" : "@"),
			s->str_att[i]);
	    G_strcat(buf, xbuf);
	}
    }
    return buf;
}
Exemplo n.º 18
0
void Latex::risk()
{
    os <<
    "\\chapter{Risk}\n"
        "\\section{Periodict Return}\n";

            add_figure(output_folder + "daily_ret.tex", "Periodic Return") <<

        "\\section{Volatility Evolution}\n";

            add_figure(output_folder + "volatility_ret.tex", "Volatility") <<

        "\n"

        "\\begin{center}\n"
        "\\begin{tabular}{|r|rrr|}\n"

            "\\hline \n"
            "\\  & Mean & St. Dev. & Count \\\\ \n"
            "\\hline \n";

            for(int i = 0; i < da.strategy_names().size(); i++)
                os << da.strategy_names()[i]  << " & " <<
                      format_double(da.vol_mean()(0, i)  * 100.0 * sqrt(250.0), 2)  << " & " <<
                      format_double(da.vol_stdev()(0, i) * 100.0 * sqrt(250.0), 2)  << " & " <<
                      da.count()(0, i)  << " \\\\ \n ";

    os <<   "\\hline \n"
        "\\end{tabular}\n"
        "\\end{center}\n"

    "\\section{Drawdown}\n";
         add_figure(output_folder + "drawdown_ret.tex", "Drawdown") <<

    "\\section{Density}\n";
         add_figure(output_folder + "distri_ret.tex", "Return Distribution") <<

    "\\begin{center}\n"
    "\\begin{tabular}{rr}\n"

//         "\\input{" << output_folder << "loss_distri_ret.tex} & \\input{"
//                    << output_folder << "gain_distri_ret.tex} \\\\ \n"

         "\\begin{tabular}{|r|rrr|}\n"

            "\\hline \n"
            "\\  & Mean & St. Dev. & Count (\\%) \\\\ \n"
            "\\hline \n";

            for(int i = 0; i < da.strategy_names().size(); i++)
                os << da.strategy_names()[i] << " & " <<
                      format_double(da.neg_means()(0, i) * 100.0 * 250.0, 2)  << " & " <<
                      format_double(da.neg_stdev()(0, i) * 100.0 * sqrt(250.0), 2)  << " & " <<
                      format_double(double(da.neg_count()(0, i) * 100.0) / da.count()(0, i), 2)  << " \\\\ \n ";

   os << "\\hline \n"
         "\\end{tabular}\n"

         " & \n"

         "\\begin{tabular}{|r|rrr|}\n"

            "\\hline \n"
            "\\  & Mean & St. Dev. & Count (\\%) \\\\ \n"
            "\\hline \n";

           for(int i = 0; i < da.strategy_names().size(); i++)
               os << da.strategy_names()[i] << " & " <<
                     format_double(da.pos_means()(0, i) * 100.0 * 250.0, 2)  << " & " <<
                     format_double(da.pos_stdev()(0, i) * 100.0 * sqrt(250.0), 2)  << " & " <<
                     format_double(double(da.pos_count()(0, i) * 100.0) / da.count()(0, i), 2)  << " \\\\ \n ";

   os << "\\hline \n"
         "\\end{tabular}\n"

    "\\end{tabular}\n\n"
    "\\end{center}\n";
}
Exemplo n.º 19
0
void Latex::data()
{
    os <<"\\chapter{Data}\n"
            // =================================
            "\\section{Portfolio Values}\n";

        for (int i = 0; i < da.strategy_names().size(); i++)
        {
            os << "\\subsection{"<< da.strategy_names()[i] <<"}\n";

            add_figure(output_folder + da.strategy_names()[i] + "_values.tex",  da.strategy_names()[i] + " Assets");
        }

        // =================================
        os <<"\\section{Holdings}\n";

        for (int i = 0; i < da.strategy_names().size(); i++)
        {
            os << "\\subsection{"<<  da.strategy_names()[i] <<"}\n";

            add_figure(output_folder +  da.strategy_names()[i] + "_holding_var.tex",  da.strategy_names()[i] + " Holdings percentage variation");
        }                                                       // _holding_var.tex
                                                                // _holding_evol.tex

        // =================================
        os <<"\\section{Transaction Order}\n"
              "Statistics about the number of Asset's unit bought/sold. The first observation is skipped";

        for (int k = 0; k <  da.strategy_names().size(); k++)
        {
            os << "\\subsection{"<<  da.strategy_names()[k] <<"}\n"
                  "\\begin{center}\n";

            int j = 0;
            for(int i = 0, n = da.security_names().size(); i < n; i++)
            {
                 if (j == 0)
                 {
                     os << "\\begin{tabular}{|r|rrrrrr|}\n"
                              "\\hline\n"
                              "\\ & Mean & Mean (Bought) & Mean (Sold) & St. Dev. & \\% Buy & \\% Sell \\\\ \n"
                              "\\hline\n";
                 }

                 os <<  da.security_names()[i]                    << " & " <<
                        format_double(da.to_mean(k)    (0, i), 4) << " & " <<
                        format_double(da.to_pos_mean(k)(0, i), 2) << " & " <<
                        format_double(da.to_neg_mean(k)(0, i), 2) << " & " <<
                        format_double(da.to_stdev(k)   (0, i), 2) << " & " <<
                        format_double(da.to_pos_count(k)(0, i) * 100.0/ da.to_count(k)(0, i), 2) << " & " <<
                        format_double(da.to_neg_count(k)(0, i) * 100.0/ da.to_count(k)(0, i), 2) << " \\\\ \n";

                 j++;

                 if (j == 40)
                 {
                     os << "\\hline\n"
                     "\\end{tabular}\n \\newpage";
                     j = 0;
                 }
             }

            os << "\\hline\n"
            "\\end{tabular}\n"
            "\\end{center}\n";
        }

        // =================================
        os <<"\\section{Target Weight}\n";

        for (int i = 0; i < da.strategy_names().size(); i++)
        {
            os << "\\subsection{"<< da.strategy_names()[i] <<"}\n";
                     add_figure(output_folder + da.strategy_names()[i] + "_weight_target.tex", da.strategy_names()[i] + " Target Weight");
        }
}