diff liboctave/fCNDArray.cc @ 8956:d91fa4b20bbb

ensure nonnegative char -> real conversion
author Jaroslav Hajek <highegg@gmail.com>
date Wed, 11 Mar 2009 10:31:08 +0100
parents eb63fbe60fab
children ed5055b0a476
line wrap: on
line diff
--- a/liboctave/fCNDArray.cc	Tue Mar 10 21:54:39 2009 -0400
+++ b/liboctave/fCNDArray.cc	Wed Mar 11 10:31:08 2009 +0100
@@ -56,6 +56,14 @@
 }
 #endif
 
+FloatComplexNDArray::FloatComplexNDArray (const charNDArray& a)
+  : MArrayN<FloatComplex> (a.dims ())
+{
+  octave_idx_type n = a.numel ();
+  for (octave_idx_type i = 0; i < n; i++)
+    xelem (i) = static_cast<unsigned char> (a(i));
+}
+
 #if defined (HAVE_FFTW3)
 FloatComplexNDArray
 FloatComplexNDArray::fourier (int dim) const