示例#1
0
 gmp_CC toBigComplex(const ElementType& a) const
 {
   gmp_CC result = getmemstructtype(gmp_CC);
   result->re = getmemstructtype(gmp_RR);
   result->im = getmemstructtype(gmp_RR);
   mpfr_init2(result->re,get_precision());
   mpfr_init2(result->im,get_precision());
   mpfr_set_d(result->re, a.re, GMP_RNDN);
   mpfr_set_d(result->im, a.im, GMP_RNDN);
   return result;
 }
 string  chain_interface::to_pretty_asset( const asset& a )const
 {
    auto oasset = get_asset_record( a.asset_id );
    if( oasset )
    {
       string decimal = fc::to_string(oasset->get_precision() + a.amount%oasset->get_precision());
       decimal[0] = '.';
       return fc::to_pretty_string( a.amount / oasset->get_precision()) +  decimal + " " + oasset->symbol;
    }
    else
       return fc::to_pretty_string( a.amount ) + " ???";
 }
示例#3
0
   string chain_interface::to_pretty_price( const price& price_to_pretty_print )const
   { try {
      auto obase_asset = get_asset_record( price_to_pretty_print.base_asset_id );
      if( !obase_asset ) FC_CAPTURE_AND_THROW( unknown_asset_id, (price_to_pretty_print.base_asset_id) );

      auto oquote_asset = get_asset_record( price_to_pretty_print.quote_asset_id );
      if( !oquote_asset ) FC_CAPTURE_AND_THROW( unknown_asset_id, (price_to_pretty_print.quote_asset_id) );

      auto tmp = price_to_pretty_print;
      tmp.ratio *= obase_asset->get_precision();
      tmp.ratio /= oquote_asset->get_precision();

      return tmp.ratio_string() + " " + oquote_asset->symbol + " / " + obase_asset->symbol;

   } FC_CAPTURE_AND_RETHROW( (price_to_pretty_print) ) }
示例#4
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_hyperseq )
{
	Dimension_Set ds1, *dsp=(&ds1);
	const char *obj_name;
	long ns, nf, nr, nc, ncomps;
	Precision *prec_p;

	obj_name=NAMEOF("object name");

	ns = (long) how_many("number of sequences");
	nf = (long) how_many("number of frames");
	nr = (long) how_many("number of rows");
	nc = (long) how_many("number of columns");
	ncomps = (long) how_many("number of components");
	prec_p = get_precision(SINGLE_QSP_ARG);

	if( prec_p == NULL ) return;

	INSIST_POSITIVE_DIM(ns,"sequence","new_hyperseq");

	SET_DIMENSION(dsp,4,ns);
	SET_DIMENSION(dsp,3,nf);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,ncomps);

	finish_obj(obj_name,dsp,prec_p,DT_HYPER_SEQ);
}
示例#5
0
std::string oskar_settings_utility_double_to_string_2(double d, char format,
                                                      int precision)
{
    if (precision < 0) {
        switch (format) {
            case 'f':
                precision = get_precision(d);
                break;
            case 'e':
                precision = 15;
                break;
            case 'g':
            default:
                precision = 16;
        }
    }
    std::ostringstream ss;
    std::string s;
    DoubleForm f;
    switch (format) {
        case 'f':
            f = DFDecimal;
            break;
        case 'e':
            f = DFExponent;
            break;
        case 'g':
        default:
            f = DFSignificantDigits;
    }
    unsigned int flags = 0;
    s = doubleToString(d, precision, f, -1, flags);
    return s;
}
示例#6
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_frame )
{
	Dimension_Set ds1;
	Dimension_Set *dsp=(&ds1);
	const char *obj_name;
	long nr, nc, ncomps;
	Precision *prec_p;

	obj_name=NAMEOF("object name");

	nr = (long) how_many("number of rows");
	nc = (long) how_many("number of columns");
	ncomps = (long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( prec_p == NULL ) return;
	INSIST_POSITIVE_DIM(nr,"row","new_frame");
	INSIST_POSITIVE_DIM(nc,"column","new_frame");
	INSIST_POSITIVE_DIM(ncomps,"component","new_frame");

	SET_DIMENSION(dsp,4,1);
	SET_DIMENSION(dsp,3,1);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,ncomps);

	finish_obj(obj_name,dsp,prec_p,DT_IMAGE);
}
示例#7
0
void RGFlow<Two_scale>::run_up()
{
   VERBOSE_MSG("> running tower up (iteration " << iteration << ") ...");
   const size_t number_of_models = models.size();
   for (size_t m = 0; m < number_of_models; ++m) {
      TModel* model = models[m];
      model->model->set_precision(get_precision());
      VERBOSE_MSG("> \tselecting model " << model->model->name());
      // apply all constraints
      const size_t n_upwards_constraints = model->upwards_constraints.size();
      for (size_t c = 0; c < n_upwards_constraints; ++c) {
         Constraint<Two_scale>* constraint = model->upwards_constraints[c];
         const double scale = constraint->get_scale();
         VERBOSE_MSG("> \t\tselecting constraint " << c << " at scale " << scale);
         VERBOSE_MSG("> \t\t\trunning model to scale " << scale);
         if (model->model->run_to(scale))
            throw NonPerturbativeRunningError(scale);
         VERBOSE_MSG("> \t\t\tapplying constraint");
         constraint->apply();
      }
      // apply matching condition if this is not the last model
      if (m != number_of_models - 1) {
         VERBOSE_MSG("> \tmatching to model " << models[m + 1]->model->name());
         Matching<Two_scale>* mc = model->matching_condition;
         mc->match_low_to_high_scale_model();
      }
   }
   VERBOSE_MSG("> running up finished");
}
示例#8
0
文件: ft_printf.c 项目: Selk/Dev
int		ft_printf(const char *format, ...)
{
	va_list		args;
	t_env		*env;

	va_start(args, format);
	env = init_env();
	while (format[env->i])
	{
		if (format[env->i] == '%' && env->flag == 0)
			init_flags(env);
		if (env->flag == 1 && check_flag(format[env->i]) != 0)
			add_flag(env, format[env->i], env->i);
		else if (ft_isdigit(format[env->i]) == 1 && env->flag == 1)
			env->i = get_width(format, env->i, env);
		else if (format[env->i] == '.'
			&& env->flag == 1 && ft_isdigit(format[++(env->i)]) == 1)
			env->i = get_precision(format, env->i, env);
		else if (env->flag == 1 && check_length(format[env->i]) != 0)
			add_length(env, format, &(env->i));
		else if (env->flag == 1 && check_specifier(format[env->i]) != 0)
			process(args, env, format[env->i]);
		else
			env->size += ft_putchar(format[env->i]);
		env->i++;
	}
	return (env->size);
}
示例#9
0
int		my_printf(const char *format, ...)
{
  va_list	list;
  int		i;
  int		chars_written;

  va_start(list, format);
  i = 0;
  chars_written = 0;
  while (format[i] != 0)
    {
      if (format[i] == '%')
	{
	  get_opt_flag((char*)format, &i, &chars_written);
	  get_width((char*)format, &i, &chars_written);
	  get_precision((char*)format, &i, &chars_written);
	  get_flag((char*)format, &i, &chars_written, &list);
	}
      else
	chars_written += my_putchar(format[i]);
      i++;
    }
  va_end(list);
  return (chars_written);
}
示例#10
0
文件: fio_menu.c 项目: E-LLP/QuIP
static COMMAND_FUNC( do_set_raw_prec )
{
	Precision * prec_p;

	prec_p = get_precision(SINGLE_QSP_ARG);
	set_raw_prec( prec_p );
}
示例#11
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_col )
{
	Dimension_Set ds1, *dsp=(&ds1);
	const char *obj_name;
	long nr, ncomps;
	Precision *prec_p;

	obj_name=NAMEOF("object name");

	nr = (long) how_many("number of elements");
	ncomps = (long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( prec_p == NULL ) return;
	INSIST_POSITIVE_DIM(nr,"element","new_col")
	INSIST_POSITIVE_DIM(ncomps,"component","new_col")

	SET_DIMENSION(dsp,4,1);
	SET_DIMENSION(dsp,3,1);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,1);
	SET_DIMENSION(dsp,0,ncomps);

	finish_obj(obj_name,dsp,prec_p,DT_COLVEC);
}
示例#12
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( equivalence )
{
	const char *obj_name;
	Data_Obj *dp;
	Precision * prec_p;
	Dimension_Set ds1, *dsp=(&ds1);
	long ns,nf,nr,nc,nd;

	obj_name=NAMEOF("name for equivalent image");

	dp=pick_obj(PARENT_PROMPT);

	ns=(long) how_many("number of sequences");
	nf=(long) how_many("number of frames");
	nr=(long) how_many("number of rows");
	nc=(long) how_many("number of columns");
	nd=(long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( dp==NULL ) return;
	if( prec_p == NULL ) return;

	INSIST_POSITIVE_DIM(ns,"sequence","equivalence")
	INSIST_POSITIVE_DIM(nf,"frame","equivalence")
	INSIST_POSITIVE_DIM(nr,"row","equivalence")
	INSIST_POSITIVE_DIM(nc,"column","equivalence")
	INSIST_POSITIVE_DIM(nd,"component","equivalence")

	SET_DIMENSION(dsp,4,ns);
	SET_DIMENSION(dsp,3,nf);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,nd);

	if( COMPLEX_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 complex component");
			return;
		}
		//SET_DIMENSION(dsp,0,2);
	} else if( QUAT_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 quaternion component");
			return;
		}
		//SET_DIMENSION(dsp,0,2);
	} else if( COLOR_PRECISION(PREC_CODE(prec_p)) ){
		if( DIMENSION(dsp,0) != 1 ){
			warn("Sorry, can only have 1 color triple per pixel");
			return;
		}
advise("component dim 3 for color");
		//SET_DIMENSION(dsp,0,3);
	}

	if( make_equivalence(obj_name,dp,dsp,prec_p) == NULL )
		warn("error making equivalence");
}
示例#13
0
   double chain_interface::to_pretty_price_double( const price& price_to_pretty_print )const
   {
      auto obase_asset = get_asset_record( price_to_pretty_print.base_asset_id );
      if( !obase_asset ) FC_CAPTURE_AND_THROW( unknown_asset_id, (price_to_pretty_print.base_asset_id) );

      auto oquote_asset = get_asset_record( price_to_pretty_print.quote_asset_id );
      if( !oquote_asset ) FC_CAPTURE_AND_THROW( unknown_asset_id, (price_to_pretty_print.quote_asset_id) );

      return fc::variant(string(price_to_pretty_print.ratio * obase_asset->get_precision() / oquote_asset->get_precision())).as_double() / (BTS_BLOCKCHAIN_MAX_SHARES*1000);
   }
示例#14
0
 string chain_interface::to_pretty_asset( const asset& a )const
 {
    const auto oasset = get_asset_record( a.asset_id );
    const auto amount = ( a.amount >= 0 ) ? a.amount : -a.amount;
    if( oasset.valid() )
    {
       const auto precision = oasset->get_precision();
       string decimal = fc::to_string( precision + ( amount % precision ) );
       decimal[0] = '.';
       const auto str = fc::to_pretty_string( amount / precision ) + decimal + " " + oasset->symbol;
       if( a.amount < 0 ) return "-" + str;
       return str;
    }
    else
    {
       return fc::to_pretty_string( a.amount ) + " ???";
    }
 }
示例#15
0
void			ft_nbrs(char **s, va_list va, t_format *opt)
{
	int		val;

	val = -1;
	if (**s == '.')
		get_precision(s, va, opt);
	else
	{
		if (ft_isdigit(**s) || **s == '*')
		{
			if (**s == '*')
			{
				val = va_arg(va, int);
				++(*s);
			}
			else
				val = ft_get_nbrs(s);
		}
示例#16
0
/*
**Treat arg
*/
t_list		*treat_arg(t_list *list, char *str)
{
  t_format	*format;
  t_list	*elt;

  format = malloc_format();
  format->attribut = get_attribut(str);
  format->field_width = get_field_width(str);
  format->precision = get_precision(str);
  format->len_modif = get_len_modif(str);
  format->convertion = str[0];
  format->disp_func = get_convertion(str);
  if (format->len_modif & mod_ll_v && 
      (pf_char_is_in_base(format->convertion, "diouxXb") != -1))
    format->size_on_stack = sizeof(long long);
  else
    format->size_on_stack = sizeof(int);
  elt = pf_xmalloc(sizeof(*elt));
  elt->data = format;
  return (pf_insert_queue(list, elt));
}
示例#17
0
文件: dobj_menu.c 项目: nasa/QuIP
static COMMAND_FUNC( new_gen_obj )
{
	Dimension_Set ds1, *dsp=(&ds1);
	const char *obj_name;
	long ns, nf, nr, nc, ncomps;
	Precision *prec_p;

	obj_name=NAMEOF("object name");

	ns = (long) how_many("number of sequences");
	nf = (long) how_many("number of frames");
	nr = (long) how_many("number of rows");
	nc = (long) how_many("number of columns");
	ncomps = (long) how_many("number of components");

	prec_p = get_precision(SINGLE_QSP_ARG);

	if( prec_p == NULL ) return;
	INSIST_POSITIVE_DIM(ns,"sequence","new_gen_obj");
	INSIST_POSITIVE_DIM(nf,"frame","new_gen_obj");
	INSIST_POSITIVE_DIM(nr,"row","new_gen_obj");
	INSIST_POSITIVE_DIM(nc,"column","new_gen_obj");
	INSIST_POSITIVE_DIM(ncomps,"component","new_gen_obj");

	SET_DIMENSION(dsp,4,ns);
	SET_DIMENSION(dsp,3,nf);
	SET_DIMENSION(dsp,2,nr);
	SET_DIMENSION(dsp,1,nc);
	SET_DIMENSION(dsp,0,ncomps);

	if( *obj_name == 0 ){
		warn("new_gen_obj:  Null object name!?");
		return;	// shouldn't happen, but can - HOW???
		// If it can, then should move this check to finish_obj???
	}

	finish_obj(obj_name,dsp,prec_p,AUTO_SHAPE);
}
示例#18
0
static int	parse_tag(char **format, va_list *args)
{
	int		ret;
	t_tag	*tag_info;
	void (*handler)(t_tag *, va_list *);

	tag_info = init_tag_struct();

	get_flags(format, tag_info);
	get_width(format, tag_info);
	get_precision(format, tag_info);
	get_length(format, tag_info);
	get_specifier(format, tag_info);

//	print_struct(tag_info);

	handler = return_handler(tag_info->specifier);
	(*handler)(tag_info, args);
	
	free(tag_info);
	ret = 0;
	return (ret);
}
SEXP rph_phyloFit(SEXP msaP, 
		  SEXP treeStrP, 
		  SEXP substModP,
		  SEXP scaleOnlyP,
		  SEXP scaleSubtreeP,
		  SEXP nratesP,
		  SEXP alphaP,
		  SEXP rateConstantsP,
		  SEXP initModP,
		  SEXP initBackgdFromDataP,
		  SEXP initRandomP,
		  SEXP initParsimonyP,
		  SEXP clockP,
		  SEXP emP,
		  SEXP maxEmItsP,
		  SEXP precisionP,
		  SEXP gffP,
		  SEXP ninfSitesP,
		  SEXP quietP,
		  SEXP noOptP,
		  SEXP boundP,
		  SEXP logFileP,
		  SEXP selectionP) {
  struct phyloFit_struct *pf;
  int numProtect=0, i;
  double *doubleP;
  char *die_message=NULL;
  SEXP rv=R_NilValue;
  List *new_rate_consts = NULL;
  List *new_rate_weights = NULL;

  GetRNGstate(); //seed R's random number generator
  pf = phyloFit_struct_new(1);  //sets appropriate defaults for RPHAST mode

  pf->msa = (MSA*)EXTPTR_PTR(msaP);

  if (treeStrP != R_NilValue) 
    pf->tree = rph_tree_new(treeStrP);

  pf->use_em = LOGICAL_VALUE(emP);

  if (rateConstantsP != R_NilValue) {
    PROTECT(rateConstantsP = AS_NUMERIC(rateConstantsP));
    numProtect++;
    doubleP = NUMERIC_POINTER(rateConstantsP);
    new_rate_consts = lst_new_dbl(LENGTH(rateConstantsP));
    for (i=0; i < LENGTH(rateConstantsP); i++)
      lst_push_dbl(new_rate_consts, doubleP[i]);
//    pf->use_em = 1;
  }

  if (initModP != R_NilValue) {
    pf->input_mod = (TreeModel*)EXTPTR_PTR(initModP);
    pf->subst_mod = pf->input_mod->subst_mod;
    tm_register_protect(pf->input_mod);
    
    if (new_rate_consts == NULL && pf->input_mod->rK != NULL && pf->input_mod->nratecats > 1) {
      new_rate_consts = lst_new_dbl(pf->input_mod->nratecats);
      for (i=0; i < pf->input_mod->nratecats; i++) 
	lst_push_dbl(new_rate_consts, pf->input_mod->rK[i]);
//      pf-> = 1;
    }

    if (pf->input_mod->empirical_rates && pf->input_mod->freqK != NULL && pf->input_mod->nratecats > 1) {
      new_rate_weights = lst_new_dbl(pf->input_mod->nratecats);
      for (i=0; i < pf->input_mod->nratecats; i++)
	lst_push_dbl(new_rate_weights, pf->input_mod->freqK[i]);
    }

    tm_reinit(pf->input_mod, 
	      rph_get_subst_mod(substModP),
	      nratesP == R_NilValue ? pf->input_mod->nratecats : INTEGER_VALUE(nratesP),
	      NUMERIC_VALUE(alphaP),
	      new_rate_consts,
	      new_rate_weights);
  } else {
    if (nratesP != R_NilValue)
      pf->nratecats = INTEGER_VALUE(nratesP);
    if (alphaP != R_NilValue)
      pf->alpha = NUMERIC_VALUE(alphaP);
    if (rateConstantsP != R_NilValue) {
      pf->rate_consts = new_rate_consts;
      if (nratesP == R_NilValue)
	pf->nratecats = lst_size(new_rate_consts);
      else if (lst_size(new_rate_consts) != pf->nratecats) 
	die("length of new_rate_consts does not match nratecats\n");
    }
  }
  pf->subst_mod = rph_get_subst_mod(substModP);
  
  pf->estimate_scale_only = LOGICAL_VALUE(scaleOnlyP);
  
  if (scaleSubtreeP != R_NilValue) {
    pf->subtree_name = smalloc((1+strlen(CHARACTER_VALUE(scaleSubtreeP)))*sizeof(char));
    strcpy(pf->subtree_name, CHARACTER_VALUE(scaleSubtreeP));
  }
  
  pf->random_init = LOGICAL_VALUE(initRandomP);

  pf->init_backgd_from_data = LOGICAL_VALUE(initBackgdFromDataP);
  
  pf->init_parsimony = LOGICAL_VALUE(initParsimonyP);
  
  pf->assume_clock = LOGICAL_VALUE(clockP);

  if (maxEmItsP != R_NilValue)
    pf->max_em_its = INTEGER_VALUE(maxEmItsP);

  pf->precision = get_precision(CHARACTER_VALUE(precisionP));
  if (pf->precision == OPT_UNKNOWN_PREC) {
    die_message = "invalid precision";
    goto rph_phyloFit_end;
  }

  if (gffP != R_NilValue) {
    pf->gff = (GFF_Set*)EXTPTR_PTR(gffP);
    gff_register_protect(pf->gff);
  }

  if (ninfSitesP != R_NilValue)
    pf->nsites_threshold = INTEGER_VALUE(ninfSitesP);
  
  pf->quiet = LOGICAL_VALUE(quietP);

  if (noOptP != R_NilValue) {
    int len=LENGTH(noOptP), pos=0;
    char *temp;
    for (i=0; i < LENGTH(noOptP); i++) 
      len += strlen(CHARACTER_VALUE(STRING_ELT(noOptP, i)));
    temp = smalloc(len*sizeof(char));
    for (i=0; i < LENGTH(noOptP); i++) {
      if (i != 0) temp[pos++] = ',';
      sprintf(&temp[pos], "%s", CHARACTER_VALUE(STRING_ELT(noOptP, i)));
      pos += strlen(CHARACTER_VALUE(STRING_ELT(noOptP, i)));
    }
    if (pos != len-1) die("ERROR parsing noOpt len=%i pos=%i\n", len, pos);
    temp[pos] = '\0';
    pf->nooptstr = str_new_charstr(temp);
  }

  if (boundP != R_NilValue) {
    pf->bound_arg = lst_new_ptr(LENGTH(boundP));
    for (i=0; i < LENGTH(boundP); i++) {
      String *temp = str_new_charstr(CHARACTER_VALUE(STRING_ELT(boundP, i)));
      lst_push_ptr(pf->bound_arg, temp);
    }
  }

  if (logFileP != R_NilValue) {
    if (IS_CHARACTER(logFileP)) 
      pf->logf = phast_fopen(CHARACTER_VALUE(logFileP), "w+");
    else if (IS_LOGICAL(logFileP) &&
	     LOGICAL_VALUE(logFileP)) {
      pf->logf = stdout;
    }
  }

  if (selectionP != R_NilValue) {
    pf->use_selection = TRUE;
    pf->selection = NUMERIC_VALUE(selectionP);
  }

  msa_register_protect(pf->msa);

  run_phyloFit(pf);
  rv = PROTECT(rph_listOfLists_to_SEXP(pf->results));
  numProtect++;

 rph_phyloFit_end:
  if (pf->logf != NULL && pf->logf != stdout && pf->logf != stderr)
    phast_fclose(pf->logf);
  PutRNGstate();
  if (die_message != NULL) die(die_message);
  if (numProtect > 0) 
    UNPROTECT(numProtect);
  return rv;
}
示例#20
0
void digest_input(string filename)
{
	// Print basic information and advance read cursor past author line.
	// (Author line must always exist and must be the first line.)
	cout << "Processing started..." << endl << endl;
	cout << "Input: " << filename << endl << endl;
	string filename_input = "Texts/" + filename;
	ifstream file_text(filename_input);
	print_data_size(file_text);
	string author_name;
	getline(file_text, author_name);
	string filename_author = "Authors/" + author_name + ".csv";
	string filename_summary = create_file_and_name("Digests/", filename, "-SUM.txt");
	string filename_words = create_file_and_name("Digests/", filename, "-WORD.csv");
	string filename_sentences = create_file_and_name("Digests/", filename, "-SENT.csv");
	cout << "Author: " << author_name << endl << endl;
	cout << "Output: " << filename + "-SUM.txt" << endl <<
		"        " << filename + "-WORD.csv" << endl <<
		"        " << filename + "-SENT.csv" << endl << endl;

	Memory RAM;
	string raw_input;
	cout << "Parsing text: |";
	const int bar_width = 50;
	for (int i = 0; i<bar_width; ++i) { cout << " "; }
	cout << "|  0.00%";
	for (int i = 0; getline(file_text, raw_input); ++i) {
		add_data_from_line(RAM, raw_input);
		// TODO: Make constants settable via command-line options (i.e. 10000, 3000)
		if (RAM.word_list.size() > 10000) {
			cout << endl << endl << "Flushing buffer..." << endl << endl;
			combine_list_file(	RAM.word_list,
								filename_words,
								RAM.word_list.begin() + 3000,
								RAM.word_list.end()	);
			cout << "Parsing text: |";
			for (int i = 0; i<bar_width; ++i) { cout << " "; }
			cout << "|  0.00%";
		}
		// Progress bar stuff:
		if (i % 120 == 0) {
			cout << "\b\b\b\b\b\b\b\b"; // "| ##.##%"
			for (int i = 0; i < bar_width; ++i) { cout << "\b"; }
			ifstream file_sizer(filename_input);
			file_sizer.seekg(0, ios::end);
			float size = static_cast<float>(file_sizer.tellg());
			file_sizer.close();
			float current = static_cast<float>(file_text.tellg());
			float percentage = current / size * 100;
			int chars_filled = static_cast<int>(floor(percentage/100.0*bar_width));
			for (int i = 0; i < bar_width; ++i) {
				if (i < chars_filled) {
					cout << "#";
				} else {
					cout << " ";
				}
			}
			std::streamsize precision_init = cout.precision();
			int correct_precision = get_precision(5, percentage);
			cout.precision(correct_precision);
			std::streamsize width_init = cout.width();
			cout << "| " << std::setw(5) << percentage << "%";
			cout.precision(precision_init);
			cout << std::setw(width_init);
		}
	}
	cout << "\b\b\b\b\b\b\b\b"; // "| ##.##%"
	for (int i = 0; i < bar_width; ++i) { cout << "\b"; }
	for (int i = 0; i < bar_width; ++i) { cout << "#"; }
	cout << "| -DONE-" << endl << endl;

	// Final write:
	cout << "Writing frequency files..." << endl << endl;
	std::sort(RAM.word_list.begin(), RAM.word_list.end(), word_compare());
	combine_list_file(RAM.word_list, filename_words);
	get_list_from_file(RAM.word_list, filename_words);
	ofstream file_sentences(filename_sentences);
	file_sentences << "WORDS" << endl;
	for (unsigned int i = 0; i < RAM.sentence_len.size(); ++i) {
		file_sentences << RAM.sentence_len[i] << endl;
	}
	file_sentences.close();
	cout << "Writing summary file..." << endl << endl;
	write_summary(filename_summary, &RAM, author_name);

	cout << endl << "Done!" << endl;
}