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

Collapse All | Expand All

(-)octave-forge-2006.03.17.old/main/comm/ov-galois.cc (-17 / +2 lines)
Lines 322-341 Link Here
322
{
322
{
323
  double retval = lo_ieee_nan_value ();
323
  double retval = lo_ieee_nan_value ();
324
324
325
  // XXX FIXME XXX -- maybe this should be a function, valid_as_scalar()
326
#if defined(HAVE_DO_FORTRAN_INDEXING)
327
  if ((rows () == 1 && columns () == 1)
328
      || (Vdo_fortran_indexing && rows () > 0 && columns () > 0))
329
    retval = (double) gval (0, 0);
330
#else
331
  if (rows () > 0 && columns () > 0)
325
  if (rows () > 0 && columns () > 0)
332
    {
326
    {
333
      if (Vwarn_fortran_indexing)
327
      gripe_implicit_conversion ("real matrix", "real scalar");
334
        gripe_implicit_conversion ("real matrix", "real scalar");
335
328
336
      retval = (double) gval (0, 0);
329
      retval = (double) gval (0, 0);
337
    }
330
    }
338
#endif
339
  else
331
  else
340
    gripe_invalid_conversion ("galois", "real scalar");
332
    gripe_invalid_conversion ("galois", "real scalar");
341
333
Lines 349-367 Link Here
349
341
350
  Complex retval (tmp, tmp);
342
  Complex retval (tmp, tmp);
351
343
352
#if defined(HAVE_DO_FORTRAN_INDEXING)
353
  if ((rows () == 1 && columns () == 1)
354
      || (Vdo_fortran_indexing && rows () > 0 && columns () > 0))
355
    retval = (double) gval (0, 0);
356
#else
357
  if (rows () > 0 && columns () > 0)
344
  if (rows () > 0 && columns () > 0)
358
    {
345
    {
359
      if (Vwarn_fortran_indexing)
346
      gripe_implicit_conversion ("real matrix", "real scalar");
360
        gripe_implicit_conversion ("real matrix", "real scalar");
361
347
362
      retval = (double) gval (0, 0);
348
      retval = (double) gval (0, 0);
363
    }
349
    }
364
#endif
365
  else
350
  else
366
    gripe_invalid_conversion ("galois", "complex scalar");
351
    gripe_invalid_conversion ("galois", "complex scalar");
367
352
(-)octave-forge-2006.03.17.old/main/fixed/ov-fixed-complex.cc (-41 / +9 lines)
Lines 73-93 Link Here
73
octave_fixed_complex::array_value (bool force_conversion) const
73
octave_fixed_complex::array_value (bool force_conversion) const
74
{
74
{
75
  NDArray retval;
75
  NDArray retval;
76
  int flag = force_conversion;
77
76
78
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
77
  if (! force_conversion)
79
  if (! flag)
80
    flag = Vok_to_lose_imaginary_part;
81
#else
82
  if (! flag)
83
    flag = (Vwarn_imag_to_real ? -1 : 1);
84
#endif
85
86
  if (flag > 0)
87
    retval = NDArray (dim_vector (1, 1), real (scalar.fixedpoint ()));
88
  else
89
    gripe_implicit_conversion ("fixed complex", "matrix");
78
    gripe_implicit_conversion ("fixed complex", "matrix");
90
79
80
  retval = NDArray (dim_vector (1, 1), real (scalar.fixedpoint ()));
81
91
  return retval;
82
  return retval;
92
}
83
}
93
84
Lines 247-269 Link Here
247
{
238
{
248
  FixedPoint retval;
239
  FixedPoint retval;
249
240
250
  int flag = force_conversion;
241
  if (! force_conversion)
251
252
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
253
  if (! flag)
254
    flag = Vok_to_lose_imaginary_part;
255
#else
256
  if (! flag)
257
    flag = (Vwarn_imag_to_real ? -1 : 1);
258
#endif
259
260
  if (flag < 0)
261
    gripe_implicit_conversion ("fixed complex", "fixed scalar");
242
    gripe_implicit_conversion ("fixed complex", "fixed scalar");
262
243
263
  if (flag)
244
  retval = FixedPoint(real (scalar));
264
    retval = FixedPoint(real (scalar));
265
  else
266
    gripe_invalid_conversion ("fixed complex", "fixed scalar");
267
245
268
  return retval;
246
  return retval;
269
}
247
}
Lines 273-292 Link Here
273
{
251
{
274
  FixedMatrix retval;
252
  FixedMatrix retval;
275
253
276
  int flag = force_conversion;
254
  if (! force_conversion)
277
255
    gripe_implicit_conversion ("fixed complex", "fixed matrix");
278
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
256
    
279
  if (! flag)
257
  retval = FixedMatrix(1,1,real (scalar));
280
    flag = Vok_to_lose_imaginary_part;
281
#else
282
  if (! flag)
283
    flag = (Vwarn_imag_to_real ? -1 : 1);
284
#endif
285
286
  if (flag > 0)
287
    retval = FixedMatrix(1,1,real (scalar));
288
  else
289
    gripe_invalid_conversion ("fixed complex", "fixed matrix");
290
258
291
  return retval;
259
  return retval;
292
}
260
}
(-)octave-forge-2006.03.17.old/main/fixed/ov-fixed-cx-mat.cc (-117 / +29 lines)
Lines 94-123 Link Here
94
octave_fixed_complex_matrix::array_value (bool force_conversion) const
94
octave_fixed_complex_matrix::array_value (bool force_conversion) const
95
{
95
{
96
  NDArray retval;
96
  NDArray retval;
97
  int flag = force_conversion;
98
97
99
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
98
  if (! force_conversion)
100
  if (! flag)
101
    flag = Vok_to_lose_imaginary_part;
102
#else
103
  if (! flag)
104
    flag = (Vwarn_imag_to_real ? -1 : 1);
105
#endif
106
107
  if (flag > 0)
108
    {
109
      int nr = rows ();
110
      int nc = columns ();
111
      dim_vector dv(nr,nc);
112
      retval.resize (dv);
113
114
      for (int i=0; i<nr; i++)
115
	for (int j=0; j<nc; j++)
116
	  retval(i + j*nr) = real (matrix(i,j).fixedpoint());
117
    }
118
  else
119
    gripe_implicit_conversion ("fixed complex", "matrix");
99
    gripe_implicit_conversion ("fixed complex", "matrix");
120
100
101
  int nr = rows ();
102
  int nc = columns ();
103
  dim_vector dv(nr,nc);
104
  retval.resize (dv);
105
106
  for (int i=0; i<nr; i++)
107
    for (int j=0; j<nc; j++)
108
      retval(i + j*nr) = real (matrix(i,j).fixedpoint());
109
121
  return retval;
110
  return retval;
122
}
111
}
123
112
Lines 349-385 Link Here
349
{
338
{
350
  double retval = lo_ieee_nan_value ();
339
  double retval = lo_ieee_nan_value ();
351
340
352
  int flag = force_conversion;
341
  if (! force_conversion)
353
354
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
355
  if (! flag)
356
    flag = Vok_to_lose_imaginary_part;
357
#else
358
  if (! flag)
359
    flag = (Vwarn_imag_to_real ? -1 : 1);
360
#endif
361
362
  if (flag < 0)
363
    gripe_implicit_conversion ("fixed complex matrix", "real scalar");
342
    gripe_implicit_conversion ("fixed complex matrix", "real scalar");
364
343
365
  if (flag)
344
  if (rows () > 0 && columns () > 0)
366
    {
345
    {
367
346
      gripe_implicit_conversion ("real matrix", "real scalar");
368
#if defined(HAVE_DO_FORTRAN_INDEXING)
369
      if ((rows () == 1 && columns () == 1)
370
	  || (Vdo_fortran_indexing && rows () > 0 && columns () > 0))
371
	retval = std::real (matrix (0, 0) .fixedpoint());
372
#else
373
      if (rows () > 0 && columns () > 0)
374
	{
375
	  if (Vwarn_fortran_indexing)
376
	    gripe_implicit_conversion ("real matrix", "real scalar");
377
	  
347
	  
378
	  retval = std::real (matrix (0, 0) .fixedpoint());
348
      retval = std::real (matrix (0, 0) .fixedpoint());
379
	}
380
#endif
381
      else
382
	gripe_invalid_conversion ("fixed complex matrix", "real scalar");
383
    }
349
    }
384
  else
350
  else
385
    gripe_invalid_conversion ("fixed complex matrix", "real scalar");
351
    gripe_invalid_conversion ("fixed complex matrix", "real scalar");
Lines 392-427 Link Here
392
{
358
{
393
  FixedPoint retval;
359
  FixedPoint retval;
394
360
395
  int flag = force_conversion;
361
  if (! force_conversion)
396
397
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
398
  if (! flag)
399
    flag = Vok_to_lose_imaginary_part;
400
#else
401
  if (! flag)
402
    flag = (Vwarn_imag_to_real ? -1 : 1);
403
#endif
404
405
  if (flag < 0)
406
    gripe_implicit_conversion ("fixed complex matrix", "fixed scalar");
362
    gripe_implicit_conversion ("fixed complex matrix", "fixed scalar");
407
363
408
  if (flag)
364
  if (rows () > 0 && columns () > 0)
409
    {
365
    {
410
#if defined(HAVE_DO_FORTRAN_INDEXING)
366
      gripe_implicit_conversion ("real matrix", "real scalar");
411
      if ((rows () == 1 && columns () == 1)
367
412
	  || (Vdo_fortran_indexing && rows () > 0 && columns () > 0))
368
      retval = real( matrix (0, 0));
413
	retval = real( matrix (0, 0));
414
#else
415
      if (rows () > 0 && columns () > 0)
416
	{
417
	  if (Vwarn_fortran_indexing)
418
	    gripe_implicit_conversion ("real matrix", "real scalar");
419
	  
420
	  retval = real( matrix (0, 0));
421
	}
422
#endif
423
      else
424
	gripe_invalid_conversion ("fixed complex matrix", "fixed scalar");
425
    }
369
    }
426
  else
370
  else
427
    gripe_invalid_conversion ("fixed complex matrix", "fixed scalar");
371
    gripe_invalid_conversion ("fixed complex matrix", "fixed scalar");
Lines 434-456 Link Here
434
{
378
{
435
  Matrix retval;
379
  Matrix retval;
436
380
437
  int flag = force_conversion;
381
  if (! force_conversion)
438
439
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
440
  if (! flag)
441
    flag = Vok_to_lose_imaginary_part;
442
#else
443
  if (! flag)
444
    flag = (Vwarn_imag_to_real ? -1 : 1);
445
#endif
446
447
  if (flag < 0)
448
    gripe_implicit_conversion ("fixed complex matrix", "real matrix");
382
    gripe_implicit_conversion ("fixed complex matrix", "real matrix");
449
383
450
  if (flag)
384
451
    retval = ::real (matrix.fixedpoint());
385
  retval = ::real (matrix.fixedpoint());
452
  else
453
    gripe_invalid_conversion ("fixed complex matrix", "real matrix");
454
386
455
  return retval;
387
  return retval;
456
}
388
}
Lines 460-482 Link Here
460
{
392
{
461
  FixedMatrix retval;
393
  FixedMatrix retval;
462
394
463
  int flag = force_conversion;
395
  if (! force_conversion)
464
465
#if defined(HAVE_OK_TO_LOSE_IMAGINARY_PART)
466
  if (! flag)
467
    flag = Vok_to_lose_imaginary_part;
468
#else
469
  if (! flag)
470
    flag = (Vwarn_imag_to_real ? -1 : 1);
471
#endif
472
473
  if (flag < 0)
474
    gripe_implicit_conversion ("fixed complex matrix", "fixed matrix");
396
    gripe_implicit_conversion ("fixed complex matrix", "fixed matrix");
475
397
476
  if (flag)
398
  retval = real (matrix);
477
    retval = real (matrix);
478
  else
479
    gripe_invalid_conversion ("fixed complex matrix", "fixed matrix");
480
399
481
  return retval;
400
  return retval;
482
}
401
}
Lines 488-506 Link Here
488
407
489
  Complex retval (tmp, tmp);
408
  Complex retval (tmp, tmp);
490
409
491
#if defined(HAVE_DO_FORTRAN_INDEXING)
410
  if (rows () > 0 && columns () > 0)
492
      if ((rows () == 1 && columns () == 1)
411
    {
493
	  || (Vdo_fortran_indexing && rows () > 0 && columns () > 0))
412
      gripe_implicit_conversion ("real matrix", "real scalar");
494
	retval = matrix (0, 0) .fixedpoint();
495
#else
496
      if (rows () > 0 && columns () > 0)
497
	{
498
	  if (Vwarn_fortran_indexing)
499
	    gripe_implicit_conversion ("real matrix", "real scalar");
500
	  
413
	  
501
	  retval = matrix (0, 0) .fixedpoint();
414
      retval = matrix (0, 0) .fixedpoint();
502
	}
415
    }
503
#endif
504
  else
416
  else
505
    gripe_invalid_conversion ("fixed matrix", "complex scalar");
417
    gripe_invalid_conversion ("fixed matrix", "complex scalar");
506
418
(-)octave-forge-2006.03.17.old/main/fixed/ov-fixed-mat.cc (-17 / +2 lines)
Lines 309-328 Link Here
309
{
309
{
310
  double retval = lo_ieee_nan_value ();
310
  double retval = lo_ieee_nan_value ();
311
311
312
  // XXX FIXME XXX -- maybe this should be a function, valid_as_scalar()
313
#if defined(HAVE_DO_FORTRAN_INDEXING)
314
  if ((rows () == 1 && columns () == 1)
315
      || (Vdo_fortran_indexing && rows () > 0 && columns () > 0))
316
    retval = matrix (0, 0) .fixedpoint();
317
#else
318
  if (rows () > 0 && columns () > 0)
312
  if (rows () > 0 && columns () > 0)
319
    {
313
    {
320
      if (Vwarn_fortran_indexing)
314
      gripe_implicit_conversion ("real matrix", "real scalar");
321
        gripe_implicit_conversion ("real matrix", "real scalar");
322
315
323
      retval = matrix (0, 0) .fixedpoint();
316
      retval = matrix (0, 0) .fixedpoint();
324
    }
317
    }
325
#endif
326
  else
318
  else
327
    gripe_invalid_conversion ("fixed matrix", "real scalar");
319
    gripe_invalid_conversion ("fixed matrix", "real scalar");
328
320
Lines 349-367 Link Here
349
341
350
  Complex retval (tmp, tmp);
342
  Complex retval (tmp, tmp);
351
343
352
#if defined(HAVE_DO_FORTRAN_INDEXING)
353
  if ((rows () == 1 && columns () == 1)
354
      || (Vdo_fortran_indexing && rows () > 0 && columns () > 0))
355
    retval = matrix (0, 0) .fixedpoint();
356
#else
357
  if (rows () > 0 && columns () > 0)
344
  if (rows () > 0 && columns () > 0)
358
    {
345
    {
359
      if (Vwarn_fortran_indexing)
346
      gripe_implicit_conversion ("real matrix", "real scalar");
360
        gripe_implicit_conversion ("real matrix", "real scalar");
361
347
362
      retval = matrix (0, 0) .fixedpoint();
348
      retval = matrix (0, 0) .fixedpoint();
363
    }
349
    }
364
#endif
365
  else
350
  else
366
    gripe_invalid_conversion ("fixed matrix", "complex scalar");
351
    gripe_invalid_conversion ("fixed matrix", "complex scalar");
367
352

Return to bug 173274