Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 22053 | Differences between
and this patch

Collapse All | Expand All

(-)speech_tools/base_class/vec_mat_aux.cc (-3 / +3 lines)
Lines 453-467 Link Here
453
	return (a.a_no_check(0,0) * a.a_no_check(1,1)) - 
453
	return (a.a_no_check(0,0) * a.a_no_check(1,1)) - 
454
	    (a.a_no_check(0,1) * a.a_no_check(1,0));
454
	    (a.a_no_check(0,1) * a.a_no_check(1,0));
455
    
455
    
456
    float p;
456
    double p;
457
    
457
    
458
    // create cofactor matrix
458
    // create cofactor matrix
459
    j = 1;
459
    j = 1;
460
    for (i = 0; i < n; ++i)
460
    for (i = 0; i < n; ++i)
461
    {
461
    {
462
	p = (float)(i + j + 2);	// because i & j should start at 1
462
	p = (double)(i + j + 2);	// because i & j should start at 1
463
	//	cout << "power " <<p << endl;
463
	//	cout << "power " <<p << endl;
464
	A[i] = pow(-1.0, p) * determinant(sub(a, i, j));
464
	A[i] = pow((double)-1.0, p) * determinant(sub(a, i, j));
465
    }
465
    }
466
    //    cout << "cofactor " << A;
466
    //    cout << "cofactor " << A;
467
    
467
    
(-)speech_tools/grammar/ngram/EST_Ngrammar.cc (-2 / +2 lines)
Lines 579-585 Link Here
579
	return false;
579
	return false;
580
    }
580
    }
581
    
581
    
582
    p_num_states = (int)pow(vocab->length(),p_order-1);
582
    p_num_states = (int)pow((double)vocab->length(),(double)p_order-1);
583
    p_states = new EST_NgrammarState[p_num_states];
583
    p_states = new EST_NgrammarState[p_num_states];
584
    for (i=0; i < p_num_states; i++)
584
    for (i=0; i < p_num_states; i++)
585
	p_states[i].init(i,pred_vocab);
585
	p_states[i].init(i,pred_vocab);
Lines 597-603 Link Here
597
	return false;
597
	return false;
598
    }
598
    }
599
    
599
    
600
    p_num_states = (int)pow(vocab->length(),p_order-1);
600
    p_num_states = (int)pow((double)vocab->length(),(double)p_order-1);
601
    p_states = new EST_NgrammarState[p_num_states];
601
    p_states = new EST_NgrammarState[p_num_states];
602
    
602
    
603
    return (bool)(p_states != NULL);
603
    return (bool)(p_states != NULL);
(-)speech_tools/grammar/ngram/ngrammar_aux.cc (-3 / +3 lines)
Lines 110-116 Link Here
110
    }
110
    }
111
  
111
  
112
  for(int r=first;r<=last;r++)
112
  for(int r=first;r<=last;r++)
113
    N[r] = exp(a)* pow((float)r, b);
113
    N[r] = exp(a)* pow((double)r, (double)b);
114
  
114
  
115
  return true;
115
  return true;
116
}
116
}
Lines 252-258 Link Here
252
		  for (i=1;i<ff.n();i++)
252
		  for (i=1;i<ff.n();i++)
253
		    total += ff(i);
253
		    total += ff(i);
254
		  
254
		  
255
		  ff[0] = pow(n.get_vocab_length(),n.order()) - total;
255
		  ff[0] = pow((double)n.get_vocab_length(),(double)n.order()) - total;
256
	      }
256
	      }
257
	}
257
	}
258
	break;
258
	break;
Lines 285-291 Link Here
285
		  double total=0;
285
		  double total=0;
286
		  for (i=1;i<ff.n();i++)
286
		  for (i=1;i<ff.n();i++)
287
		    total += ff(i);
287
		    total += ff(i);
288
		  ff[0] = pow(n.get_vocab_length(),this_order) - total;
288
		  ff[0] = pow((double)n.get_vocab_length(),(double)this_order) - total;
289
289
290
290
291
291
(-)speech_tools/grammar/ngram/ngrammar_io.cc (-2 / +2 lines)
Lines 756-762 Link Here
756
	n.print_freqs(*ost,floor);
756
	n.print_freqs(*ost,floor);
757
    else if (n.representation() == EST_Ngrammar::backoff)
757
    else if (n.representation() == EST_Ngrammar::backoff)
758
    {
758
    {
759
	int total_ngrams = (int)pow(n.get_vocab_length(),n.order()-1);
759
	int total_ngrams = (int)pow((double)n.get_vocab_length(),(double)n.order()-1);
760
	
760
	
761
	for(i=0;i<total_ngrams;i++)
761
	for(i=0;i<total_ngrams;i++)
762
	{
762
	{
Lines 903-909 Link Here
903
	// word in the ngram is the least significant 'bit'
903
	// word in the ngram is the least significant 'bit'
904
	
904
	
905
	// number of ngrams, excluding last word, is
905
	// number of ngrams, excluding last word, is
906
	int total_ngrams = (int)pow(n.get_vocab_length(),n.order()-1);
906
	int total_ngrams = (int)pow((double)n.get_vocab_length(),(double)n.order()-1);
907
	
907
	
908
	for(i=0;i<total_ngrams;i++)
908
	for(i=0;i<total_ngrams;i++)
909
	{
909
	{
(-)speech_tools/intonation/tilt/tilt_utils.cc (-4 / +4 lines)
Lines 378-386 Link Here
378
378
379
    x = (t / (dur)) * 2.0;
379
    x = (t / (dur)) * 2.0;
380
    if (x < 1.0)
380
    if (x < 1.0)
381
	val = pow(x, 2.0);
381
	val = pow((double)x, 2.0);
382
    else
382
    else
383
	val = 2 - pow((2 - x), 2.0);
383
	val = 2 - pow((double)(2.0 - x), 2.0);
384
	
384
	
385
    val = (val / 2.0);
385
    val = (val / 2.0);
386
	
386
	
Lines 398-406 Link Here
398
    x = (t / length) * 2.0;
398
    x = (t / length) * 2.0;
399
    
399
    
400
    if (x < 1.0)
400
    if (x < 1.0)
401
	val = pow(x, curve);
401
	val = pow((double)x, (double)curve);
402
    else
402
    else
403
	val = 2 - pow((2 - x), curve);
403
	val = 2 - pow((double)(2.0 - x), (double)curve);
404
    
404
    
405
    val = val / 2.0;
405
    val = val / 2.0;
406
    
406
    
(-)speech_tools/main/wfst_run_main.cc (-1 / +1 lines)
Lines 213-219 Link Here
213
	   (int)R.samples(),R.mean()*100,(1-R.mean())*100);
213
	   (int)R.samples(),R.mean()*100,(1-R.mean())*100);
214
    if (al.present("-perplexity"))
214
    if (al.present("-perplexity"))
215
    {
215
    {
216
	printf("perplexity is %f\n", pow(2.0,(-1 * (sumlogp/count))));
216
	printf("perplexity is %f\n", pow(2.0,(double)(-1 * (sumlogp/count))));
217
    }
217
    }
218
218
219
    if (ofd != stdout)
219
    if (ofd != stdout)
(-)speech_tools/sigpr/filter.cc (-3 / +3 lines)
Lines 419-425 Link Here
419
	
419
	
420
    // check frequency_response has dimension 2^N
420
    // check frequency_response has dimension 2^N
421
    int N = fastlog2(frequency_response.n());
421
    int N = fastlog2(frequency_response.n());
422
    if(frequency_response.n() !=  (int)pow(2,(float)N)){
422
    if(frequency_response.n() !=  (int)pow(2,(double)N)){
423
	cerr << "Desired frequency response must have dimension 2^N" << endl;
423
	cerr << "Desired frequency response must have dimension 2^N" << endl;
424
	return EST_FVector(0);
424
	return EST_FVector(0);
425
    }
425
    }
Lines 470-479 Link Here
470
    int i;
470
    int i;
471
    int N=10;			// good minimum size
471
    int N=10;			// good minimum size
472
    
472
    
473
    int fft_size = (int)pow(2, N);
473
    int fft_size = (int)pow(2.0, (double)N);
474
    while(fft_size < order*4){	// rule of thumb !?
474
    while(fft_size < order*4){	// rule of thumb !?
475
	N++;
475
	N++;
476
	fft_size = (int)pow(2, N);
476
	fft_size = (int)pow(2.0, (double)N);
477
    }
477
    }
478
    
478
    
479
    // freq response is from 0 to sampling freq and therefore
479
    // freq response is from 0 to sampling freq and therefore
(-)speech_tools/sigpr/sigpr_frame.cc (-1 / +1 lines)
Lines 499-505 Link Here
499
{
499
{
500
    power = 0.0;
500
    power = 0.0;
501
    for (int i = 0; i < frame.length(); i++)
501
    for (int i = 0; i < frame.length(); i++)
502
	power += pow(frame(i), 2.0);
502
	power += pow((double)frame(i), 2.0);
503
503
504
    power /= frame.length();
504
    power /= frame.length();
505
}
505
}
(-)speech_tools/siod/slib_math.cc (-4 / +3 lines)
Lines 14-27 Link Here
14
14
15
LISP numberp(LISP x)
15
LISP numberp(LISP x)
16
{if FLONUMP(x) return(truth); else return(NIL);}
16
{if FLONUMP(x) return(truth); else return(NIL);}
17
17
static LISP lplus(LISP args)
18
static LISP plus(LISP args)
19
{
18
{
20
    LISP l;
19
    LISP l;
21
    double sum;
20
    double sum;
22
    for (sum=0.0,l=args; l != NIL; l=cdr(l))
21
    for (sum=0.0,l=args; l != NIL; l=cdr(l))
23
    {
22
    {
24
	if (NFLONUMP(car(l))) err("wrong type of argument to plus",car(l));
23
	if (NFLONUMP(car(l))) err("wrong type of argument to lplus",car(l));
25
	sum += FLONM(car(l));
24
	sum += FLONM(car(l));
26
    }
25
    }
27
    return flocons(sum);
26
    return flocons(sum);
Lines 138-144 Link Here
138
 init_subr_1("number?",numberp,
137
 init_subr_1("number?",numberp,
139
 "(number? DATA)\n\
138
 "(number? DATA)\n\
140
  Returns t if DATA is a number, nil otherwise.");
139
  Returns t if DATA is a number, nil otherwise.");
141
 init_lsubr("+",plus,
140
 init_lsubr("+",lplus,
142
 "(+ NUM1 NUM2 ...)\n\
141
 "(+ NUM1 NUM2 ...)\n\
143
  Returns the sum of NUM1 and NUM2 ...  An error is given is any argument\n\
142
  Returns the sum of NUM1 and NUM2 ...  An error is given is any argument\n\
144
  is not a number.");
143
  is not a number.");
(-)speech_tools/speech_class/EST_track_aux.cc (-3 / +3 lines)
Lines 351-357 Link Here
351
    mean /= n;
351
    mean /= n;
352
    
352
    
353
    for (i = 0, var = 0.0; i < tr.num_frames(); ++i)
353
    for (i = 0, var = 0.0; i < tr.num_frames(); ++i)
354
	var += tr.track_break(i) ? 0.0 : pow(tr.a(i, channel) - mean, 2.0);
354
	var += tr.track_break(i) ? 0.0 : pow((double)(tr.a(i, channel) - mean), 2.0);
355
    
355
    
356
    var /= n;
356
    var /= n;
357
    sd = sqrt(var);
357
    sd = sqrt(var);
Lines 369-375 Link Here
369
    
369
    
370
    for (i = 0; i < size; ++i)
370
    for (i = 0; i < size; ++i)
371
	if (a.val(i) && b.val(i))
371
	if (a.val(i) && b.val(i))
372
	    sum += pow((a.a(i, channel) - b.a(i, channel)), 2.0);
372
	    sum += pow((double)(a.a(i, channel) - b.a(i, channel)), 2.0);
373
    
373
    
374
    sum = sqrt(sum / size);
374
    sum = sqrt(sum / size);
375
    return sum;
375
    return sum;
Lines 461-467 Link Here
461
    for (p = tl.head(); p; p = next(p))
461
    for (p = tl.head(); p; p = next(p))
462
	for (i = 0; i < tl(p).num_frames(); ++i)
462
	for (i = 0; i < tl(p).num_frames(); ++i)
463
	    if (!tl(p).track_break(i))
463
	    if (!tl(p).track_break(i))
464
		var +=  pow(tl(p).a(i, channel) - mean, 2.0);
464
		var +=  pow((double)(tl(p).a(i, channel) - mean), 2.0);
465
465
466
    var /= n;
466
    var /= n;
467
    sd = sqrt(var);
467
    sd = sqrt(var);
(-)speech_tools/speech_class/EST_wave_temp.cc (-3 / +3 lines)
Lines 83-89 Link Here
83
    mean /= n;
83
    mean /= n;
84
    
84
    
85
    for (i = 0, mean = 0.0; i < tr.num_samples(); ++i)
85
    for (i = 0, mean = 0.0; i < tr.num_samples(); ++i)
86
	var += pow(tr.a(i, channel) - mean, 2.0);
86
	var += pow((double)(tr.a(i, channel) - mean), 2.0);
87
    
87
    
88
    var /= n;
88
    var /= n;
89
    sd = sqrt(var);
89
    sd = sqrt(var);
Lines 96-102 Link Here
96
    float sum = 0;
96
    float sum = 0;
97
    
97
    
98
    for (i = 0; i < size; ++i)
98
    for (i = 0; i < size; ++i)
99
      sum += pow((a.a(i, channel) - b.a(i, channel)), 2.0);
99
      sum += pow((double)(a.a(i, channel) - b.a(i, channel)), 2.0);
100
    
100
    
101
    sum = sqrt(sum / size);
101
    sum = sqrt(sum / size);
102
    return sum;
102
    return sum;
Lines 110-116 Link Here
110
    for (i = 0; i < size; ++i)
110
    for (i = 0; i < size; ++i)
111
    {
111
    {
112
      // cout << i << " " << a.a(i, channel) << " " << b.a(i, channel) << endl;
112
      // cout << i << " " << a.a(i, channel) << " " << b.a(i, channel) << endl;
113
	sum += fabs(a.a(i, channel) - b.a(i, channel));
113
	sum += fabs((double)(a.a(i, channel) - b.a(i, channel)));
114
    }
114
    }
115
    return sum / size;
115
    return sum / size;
116
}
116
}
(-)speech_tools/stats/EST_multistats.cc (-3 / +3 lines)
Lines 89-95 Link Here
89
    {
89
    {
90
	v[j] = 0.0;
90
	v[j] = 0.0;
91
	for (i = 0; i < m.num_rows(); ++i)
91
	for (i = 0; i < m.num_rows(); ++i)
92
	    v[j] += pow(m(i, j) - u(j), 2.0);
92
	    v[j] += pow((double)(m(i, j) - u(j)), 2.0);
93
	v[j] /= m.num_rows() - 1; // sample variance
93
	v[j] /= m.num_rows() - 1; // sample variance
94
    }
94
    }
95
    
95
    
Lines 183-189 Link Here
183
	{
183
	{
184
	    P(i, j) = 0.0;
184
	    P(i, j) = 0.0;
185
	    for (k = 0; k < p; ++k)
185
	    for (k = 0; k < p; ++k)
186
		P(i, j) += pow(gu(i, k) - gu(j, k), 2.0) / gv(k);
186
		P(i, j) += pow((double)(gu(i, k) - gu(j, k)), 2.0) / gv(k);
187
	    P(i, j) /= p;
187
	    P(i, j) /= p;
188
	}
188
	}
189
    return P;
189
    return P;
Lines 228-234 Link Here
228
    float P = 0.0;
228
    float P = 0.0;
229
    
229
    
230
    for (k = 0; k < n; ++k)
230
    for (k = 0; k < n; ++k)
231
	P += pow(ui(k) - uj(k), 2.0) / v(k);
231
	P += pow((double)(ui(k) - uj(k)), 2.0) / v(k);
232
    P /= n;
232
    P /= n;
233
    
233
    
234
    return P;
234
    return P;
(-)speech_tools/testsuite/hash_example.cc (-2 / +2 lines)
Lines 71-78 Link Here
71
71
72
EST_THash<int,float> logs(100);
72
EST_THash<int,float> logs(100);
73
73
74
logs.add_item(12, log(12));
74
logs.add_item(12, log(12.0));
75
logs.add_item(34, log(34));
75
logs.add_item(34, log(34.0));
76
76
77
cout << "length of `fred' = " << lengths.val("fred") << "\n";
77
cout << "length of `fred' = " << lengths.val("fred") << "\n";
78
cout << "log of 34' = " << logs.val(34) << "\n";
78
cout << "log of 34' = " << logs.val(34) << "\n";

Return to bug 22053