GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
typecast.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2007-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if defined (HAVE_CONFIG_H)
27# include "config.h"
28#endif
29
30#include <algorithm>
31#include <limits>
32
33#include "mx-base.h"
34
35#include "defun.h"
36#include "error.h"
37#include "errwarn.h"
38#include "ovl.h"
39#include "unwind-prot.h"
40
41OCTAVE_NAMESPACE_BEGIN
42
43static dim_vector
45{
46 if (old_dims.ndims () == 2 && old_dims(0) == 1)
47 return dim_vector (1, n);
48 else if (old_dims.ndims () == 2 && old_dims(0) == 0 && old_dims(1) == 0)
49 return dim_vector ();
50 else
51 return dim_vector (n, 1);
52}
53
54template <typename ArrayType>
55static void
56get_data_and_bytesize (const ArrayType& array,
57 const void *& data,
58 octave_idx_type& byte_size,
59 dim_vector& old_dims,
60 unwind_protect& frame)
61{
62 // The array given may be a temporary, constructed from a scalar or sparse
63 // array. This will ensure the data will be deallocated after we exit.
64 frame.add_delete (new ArrayType (array));
65
66 data = reinterpret_cast<const void *> (array.data ());
67 byte_size = array.byte_size ();
68
69 old_dims = array.dims ();
70}
71
72template <typename ArrayType>
73static ArrayType
74reinterpret_copy (const void *data, octave_idx_type byte_size,
75 const dim_vector& old_dims)
76{
77 typedef typename ArrayType::element_type T;
78 octave_idx_type n = byte_size / sizeof (T);
79
80 if (n * static_cast<int> (sizeof (T)) != byte_size)
81 error ("typecast: incorrect number of input values to make output value");
82
83 ArrayType retval (get_vec_dims (old_dims, n));
84 T *dest = retval.fortran_vec ();
85 std::memcpy (dest, data, n * sizeof (T));
86
87 return retval;
88}
89
90template <typename ArrayType>
91static ArrayType
92reinterpret_int_copy (const void *data, octave_idx_type byte_size,
93 const dim_vector& old_dims)
94{
95 typedef typename ArrayType::element_type T;
96 typedef typename T::val_type VT;
97 octave_idx_type n = byte_size / sizeof (T);
98
99 if (n * static_cast<int> (sizeof (T)) != byte_size)
100 error ("typecast: incorrect number of input values to make output value");
101
102 ArrayType retval (get_vec_dims (old_dims, n));
103 VT *dest = reinterpret_cast<VT *> (retval.fortran_vec ());
104 std::memcpy (dest, data, n * sizeof (VT));
105
106 return retval;
107}
108
109DEFUN (typecast, args, ,
110 doc: /* -*- texinfo -*-
111@deftypefn {} {@var{y} =} typecast (@var{x}, "@var{class}")
112Return a new array @var{y} resulting from interpreting the data of @var{x}
113in memory as data of the numeric class @var{class}.
114
115Both the class of @var{x} and @var{class} must be one of the built-in
116numeric classes:
117
118@example
119@group
120"logical"
121"char"
122"int8"
123"int16"
124"int32"
125"int64"
126"uint8"
127"uint16"
128"uint32"
129"uint64"
130"double"
131"single"
132"double complex"
133"single complex"
134@end group
135@end example
136
137@noindent
138the last two are only used with @var{class}; they indicate that a
139complex-valued result is requested. Complex arrays are stored in memory as
140consecutive pairs of real numbers. The sizes of integer types are given by
141their bit counts. Both logical and char are typically one byte wide;
142however, this is not guaranteed by C++. If your system is IEEE conformant,
143single and double will be 4 bytes and 8 bytes wide, respectively.
144@qcode{"logical"} is not allowed for @var{class}.
145
146If the input is a row vector, the return value is a row vector, otherwise it
147is a column vector.
148
149If the bit length of @var{x} is not divisible by that of @var{class}, an
150error occurs.
151
152An example of the use of typecast on a little-endian machine is
153
154@example
155@group
156@var{x} = uint16 ([1, 65535]);
157typecast (@var{x}, "uint8")
158@result{} [ 1, 0, 255, 255]
159@end group
160@end example
161@seealso{cast, bitpack, bitunpack, swapbytes}
162@end deftypefn */)
163{
164 if (args.length () != 2)
165 print_usage ();
166
167 octave_value retval;
168
169 unwind_protect frame;
170
171 const void *data = nullptr;
172 octave_idx_type byte_size = 0;
173 dim_vector old_dims;
174
175 octave_value array = args(0);
176
177 if (array.islogical ())
178 get_data_and_bytesize (array.bool_array_value (), data, byte_size,
179 old_dims, frame);
180 else if (array.is_string ())
181 get_data_and_bytesize (array.char_array_value (), data, byte_size,
182 old_dims, frame);
183 else if (array.isinteger ())
184 {
185 if (array.is_int8_type ())
186 get_data_and_bytesize (array.int8_array_value (), data, byte_size,
187 old_dims, frame);
188 else if (array.is_int16_type ())
189 get_data_and_bytesize (array.int16_array_value (), data, byte_size,
190 old_dims, frame);
191 else if (array.is_int32_type ())
192 get_data_and_bytesize (array.int32_array_value (), data, byte_size,
193 old_dims, frame);
194 else if (array.is_int64_type ())
195 get_data_and_bytesize (array.int64_array_value (), data, byte_size,
196 old_dims, frame);
197 else if (array.is_uint8_type ())
198 get_data_and_bytesize (array.uint8_array_value (), data, byte_size,
199 old_dims, frame);
200 else if (array.is_uint16_type ())
201 get_data_and_bytesize (array.uint16_array_value (), data, byte_size,
202 old_dims, frame);
203 else if (array.is_uint32_type ())
204 get_data_and_bytesize (array.uint32_array_value (), data, byte_size,
205 old_dims, frame);
206 else if (array.is_uint64_type ())
207 get_data_and_bytesize (array.uint64_array_value (), data, byte_size,
208 old_dims, frame);
209 else
210 assert (0);
211 }
212 else if (array.iscomplex ())
213 {
214 if (array.is_single_type ())
216 byte_size, old_dims, frame);
217 else
219 byte_size, old_dims, frame);
220 }
221 else if (array.isreal ())
222 {
223 if (array.is_single_type ())
224 get_data_and_bytesize (array.float_array_value (), data, byte_size,
225 old_dims, frame);
226 else
227 get_data_and_bytesize (array.array_value (), data, byte_size,
228 old_dims, frame);
229 }
230 else
231 error ("typecast: invalid input CLASS: %s",
232 array.class_name ().c_str ());
233
234 std::string numclass = args(1).string_value ();
235 std::transform (numclass.begin (), numclass.end (), numclass.begin (),
236 tolower);
237
238 if (numclass.size () == 0)
239 ;
240 else if (numclass == "char")
241 retval = octave_value (reinterpret_copy<charNDArray>
242 (data, byte_size, old_dims), array.is_dq_string () ? '"'
243 : '\'');
244 else if (numclass[0] == 'i')
245 {
246 if (numclass == "int8")
247 retval = reinterpret_int_copy<int8NDArray> (data, byte_size, old_dims);
248 else if (numclass == "int16")
249 retval = reinterpret_int_copy<int16NDArray> (data, byte_size, old_dims);
250 else if (numclass == "int32")
251 retval = reinterpret_int_copy<int32NDArray> (data, byte_size, old_dims);
252 else if (numclass == "int64")
253 retval = reinterpret_int_copy<int64NDArray> (data, byte_size, old_dims);
254 }
255 else if (numclass[0] == 'u')
256 {
257 if (numclass == "uint8")
258 retval = reinterpret_int_copy<uint8NDArray> (data, byte_size, old_dims);
259 else if (numclass == "uint16")
260 retval = reinterpret_int_copy<uint16NDArray> (data, byte_size,
261 old_dims);
262 else if (numclass == "uint32")
263 retval = reinterpret_int_copy<uint32NDArray> (data, byte_size,
264 old_dims);
265 else if (numclass == "uint64")
266 retval = reinterpret_int_copy<uint64NDArray> (data, byte_size,
267 old_dims);
268 }
269 else if (numclass == "single")
270 retval = reinterpret_copy<FloatNDArray> (data, byte_size, old_dims);
271 else if (numclass == "double")
272 retval = reinterpret_copy<NDArray> (data, byte_size, old_dims);
273 else if (numclass == "single complex")
274 retval = reinterpret_copy<FloatComplexNDArray> (data, byte_size,
275 old_dims);
276 else if (numclass == "double complex")
277 retval = reinterpret_copy<ComplexNDArray> (data, byte_size, old_dims);
278
279 if (retval.is_undefined ())
280 error ("typecast: cannot convert to %s class", numclass.c_str ());
281
282 return retval;
283}
284
285/*
286%!assert (typecast (int64 (0), "char"), char (zeros (1, 8)))
287%!assert (typecast (int64 (0), "int8"), zeros (1, 8, "int8"))
288%!assert (typecast (int64 (0), "uint8"), zeros (1, 8, "uint8"))
289%!assert (typecast (int64 (0), "int16"), zeros (1, 4, "int16"))
290%!assert (typecast (int64 (0), "uint16"), zeros (1, 4, "uint16"))
291%!assert (typecast (int64 (0), "int32"), zeros (1, 2, "int32"))
292%!assert (typecast (int64 (0), "uint32"), zeros (1, 2, "uint32"))
293%!assert (typecast (int64 (0), "int64"), zeros (1, 1, "int64"))
294%!assert (typecast (int64 (0), "uint64"), zeros (1, 1, "uint64"))
295%!assert (typecast (int64 (0), "single"), zeros (1, 2, "single"))
296%!assert (typecast (int64 (0), "double"), 0)
297%!assert (typecast (int64 (0), "single complex"), single (0))
298%!assert (typecast (int64 ([0 0]), "double complex"), 0)
299
300%!assert (typecast ([], "double"), [])
301%!assert (typecast (0, "double"), 0)
302%!assert (typecast (inf, "double"), inf)
303%!assert (typecast (-inf, "double"), -inf)
304%!assert (typecast (nan, "double"), nan)
305
306%!error typecast ()
307%!error typecast (1)
308%!error typecast (1, 2, 3)
309%!error typecast (1, "invalid")
310%!error typecast (int8 (0), "double")
311*/
312
313template <typename ArrayType>
314ArrayType
316{
317 typedef typename ArrayType::element_type T;
319 = bitp.numel () / (sizeof (T) * std::numeric_limits<unsigned char>::digits);
320
321 if (n * static_cast<int> (sizeof (T)) *
322 std::numeric_limits<unsigned char>::digits != bitp.numel ())
323 error ("bitpack: incorrect number of bits to make up output value");
324
325 ArrayType retval (get_vec_dims (bitp.dims (), n));
326
327 const bool *bits = bitp.data ();
328 char *packed = reinterpret_cast<char *> (retval.fortran_vec ());
329
330 octave_idx_type m = n * sizeof (T);
331
332 for (octave_idx_type i = 0; i < m; i++)
333 {
334 char c = bits[0];
335 for (int j = 1; j < std::numeric_limits<unsigned char>::digits; j++)
336 c |= bits[j] << j;
337
338 packed[i] = c;
339 bits += std::numeric_limits<unsigned char>::digits;
340 }
341
342 return retval;
343}
344
345DEFUN (bitpack, args, ,
346 doc: /* -*- texinfo -*-
347@deftypefn {} {@var{y} =} bitpack (@var{x}, @var{class})
348Return a new array @var{y} resulting from interpreting the logical array
349@var{x} as raw bit patterns for data of the numeric class @var{class}.
350
351@var{class} must be one of the built-in numeric classes:
352
353@example
354@group
355"double"
356"single"
357"double complex"
358"single complex"
359"char"
360"int8"
361"int16"
362"int32"
363"int64"
364"uint8"
365"uint16"
366"uint32"
367"uint64"
368@end group
369@end example
370
371The number of elements of @var{x} should be divisible by the bit length of
372@var{class}. If it is not, excess bits are discarded. Bits come in
373increasing order of significance, i.e., @code{x(1)} is bit 0, @code{x(2)} is
374bit 1, etc.
375
376The result is a row vector if @var{x} is a row vector, otherwise it is a
377column vector.
378@seealso{bitunpack, typecast}
379@end deftypefn */)
380{
381 if (args.length () != 2)
382 print_usage ();
383
384 if (! args(0).islogical ())
385 error ("bitpack: X must be a logical array");
386
387 octave_value retval;
388
389 boolNDArray bitp = args(0).bool_array_value ();
390
391 std::string numclass = args(1).string_value ();
392
393 if (numclass.size () == 0)
394 ;
395 else if (numclass == "char")
396 retval = octave_value (do_bitpack<charNDArray> (bitp), '\'');
397 else if (numclass[0] == 'i')
398 {
399 if (numclass == "int8")
400 retval = do_bitpack<int8NDArray> (bitp);
401 else if (numclass == "int16")
402 retval = do_bitpack<int16NDArray> (bitp);
403 else if (numclass == "int32")
404 retval = do_bitpack<int32NDArray> (bitp);
405 else if (numclass == "int64")
406 retval = do_bitpack<int64NDArray> (bitp);
407 }
408 else if (numclass[0] == 'u')
409 {
410 if (numclass == "uint8")
411 retval = do_bitpack<uint8NDArray> (bitp);
412 else if (numclass == "uint16")
413 retval = do_bitpack<uint16NDArray> (bitp);
414 else if (numclass == "uint32")
415 retval = do_bitpack<uint32NDArray> (bitp);
416 else if (numclass == "uint64")
417 retval = do_bitpack<uint64NDArray> (bitp);
418 }
419 else if (numclass == "single")
420 retval = do_bitpack<FloatNDArray> (bitp);
421 else if (numclass == "double")
422 retval = do_bitpack<NDArray> (bitp);
423 else if (numclass == "single complex")
424 retval = do_bitpack<FloatComplexNDArray> (bitp);
425 else if (numclass == "double complex")
426 retval = do_bitpack<ComplexNDArray> (bitp);
427
428 if (retval.is_undefined ())
429 error ("bitpack: cannot pack to %s class", numclass.c_str ());
430
431 return retval;
432}
433
434/*
435%!assert (bitpack (zeros (1, 8, "logical"), "char"), "\0")
436%!assert (bitpack (zeros (1, 8, "logical"), "int8"), int8 (0))
437%!assert (bitpack (zeros (1, 8, "logical"), "uint8"), uint8 (0))
438%!assert (bitpack (zeros (1, 16, "logical"), "int16"), int16 (0))
439%!assert (bitpack (zeros (1, 16, "logical"), "uint16"), uint16 (0))
440%!assert (bitpack (zeros (1, 32, "logical"), "int32"), int32 (0))
441%!assert (bitpack (zeros (1, 32, "logical"), "uint32"), uint32 (0))
442%!assert (bitpack (zeros (1, 64, "logical"), "int64"), int64 (0))
443%!assert (bitpack (zeros (1, 64, "logical"), "uint64"), uint64 (0))
444%!assert (bitpack (zeros (1, 32, "logical"), "single"), single (0))
445%!assert (bitpack (zeros (1, 64, "logical"), "double"), double (0))
446%!assert (bitpack (zeros (1, 64, "logical"), "single complex"), single (0))
447%!assert (bitpack (zeros (1, 128, "logical"), "double complex"), double (0))
448
449%!test <54931>
450%! x = false (1, 32);
451%! x(1) = true;
452%! assert (bitpack (x, "uint32"), uint32 (1));
453%! x([1, 9]) = true;
454%! assert (bitpack (x, "uint32"), uint32 (257));
455
456%!error bitpack ()
457%!error bitpack (1)
458%!error bitpack (1, 2, 3)
459%!error bitpack (1, "invalid")
460%!error bitpack (1, "double")
461%!error bitpack (false, "invalid")
462%!error bitpack (false, "double")
463*/
464
465template <typename ArrayType>
467do_bitunpack (const ArrayType& array)
468{
469 typedef typename ArrayType::element_type T;
470 octave_idx_type n = array.numel () * sizeof (T)
471 * std::numeric_limits<unsigned char>::digits;
472
473 boolNDArray retval (get_vec_dims (array.dims (), n));
474
475 const char *packed = reinterpret_cast<const char *> (array.data ());
476 bool *bits = retval.fortran_vec ();
477
478 octave_idx_type m = n / std::numeric_limits<unsigned char>::digits;
479
480 for (octave_idx_type i = 0; i < m; i++)
481 {
482 char c = packed[i];
483 bits[0] = c & 1;
484 for (int j = 1; j < std::numeric_limits<unsigned char>::digits; j++)
485 bits[j] = (c >>= 1) & 1;
486 bits += std::numeric_limits<unsigned char>::digits;
487 }
488
489 return retval;
490}
491
492DEFUN (bitunpack, args, ,
493 doc: /* -*- texinfo -*-
494@deftypefn {} {@var{y} =} bitunpack (@var{x})
495Return a logical array @var{y} corresponding to the raw bit patterns of
496@var{x}.
497
498@var{x} must belong to one of the built-in numeric classes:
499
500@example
501@group
502"double"
503"single"
504"char"
505"int8"
506"int16"
507"int32"
508"int64"
509"uint8"
510"uint16"
511"uint32"
512"uint64"
513@end group
514@end example
515
516The result is a row vector if @var{x} is a row vector; otherwise, it is a
517column vector.
518@seealso{bitpack, typecast}
519@end deftypefn */)
520{
521 if (args.length () != 1)
522 print_usage ();
523
524 if (! (args(0).isnumeric () || args(0).is_string ()))
525 error ("bitunpack: argument must be a number or a string");
526
527 octave_value retval;
528
529 octave_value array = args(0);
530
531 if (array.is_string ())
532 retval = do_bitunpack (array.char_array_value ());
533 else if (array.isinteger ())
534 {
535 if (array.is_int8_type ())
536 retval = do_bitunpack (array.int8_array_value ());
537 else if (array.is_int16_type ())
538 retval = do_bitunpack (array.int16_array_value ());
539 else if (array.is_int32_type ())
540 retval = do_bitunpack (array.int32_array_value ());
541 else if (array.is_int64_type ())
542 retval = do_bitunpack (array.int64_array_value ());
543 else if (array.is_uint8_type ())
544 retval = do_bitunpack (array.uint8_array_value ());
545 else if (array.is_uint16_type ())
546 retval = do_bitunpack (array.uint16_array_value ());
547 else if (array.is_uint32_type ())
548 retval = do_bitunpack (array.uint32_array_value ());
549 else if (array.is_uint64_type ())
550 retval = do_bitunpack (array.uint64_array_value ());
551 else
552 assert (0);
553 }
554 else if (array.iscomplex ())
555 {
556 if (array.is_single_type ())
557 retval = do_bitunpack (array.float_complex_array_value ());
558 else
559 retval = do_bitunpack (array.complex_array_value ());
560 }
561 else if (array.isreal ())
562 {
563 if (array.is_single_type ())
564 retval = do_bitunpack (array.float_array_value ());
565 else
566 retval = do_bitunpack (array.array_value ());
567 }
568 else
569 error ("bitunpack: invalid input class: %s",
570 array.class_name ().c_str ());
571
572 return retval;
573}
574
575/*
576%!assert (bitunpack ("\0"), zeros (1, 8, "logical"))
577%!assert (bitunpack (int8 (0)), zeros (1, 8, "logical"))
578%!assert (bitunpack (uint8 (0)), zeros (1, 8, "logical"))
579%!assert (bitunpack (int16 (0)), zeros (1, 16, "logical"))
580%!assert (bitunpack (uint16 (0)), zeros (1, 16, "logical"))
581%!assert (bitunpack (int32 (0)), zeros (1, 32, "logical"))
582%!assert (bitunpack (uint32 (0)), zeros (1, 32, "logical"))
583%!assert (bitunpack (int64 (0)), zeros (1, 64, "logical"))
584%!assert (bitunpack (uint64 (0)), zeros (1, 64, "logical"))
585%!assert (bitunpack (single (0)), zeros (1, 32, "logical"))
586%!assert (bitunpack (double (0)), zeros (1, 64, "logical"))
587%!assert (bitunpack (complex (single (0))), zeros (1, 64, "logical"))
588%!assert (bitunpack (complex (double (0))), zeros (1, 128, "logical"))
589
590%!error bitunpack ()
591%!error bitunpack (1, 2)
592%!error bitunpack ({})
593*/
594
595OCTAVE_NAMESPACE_END
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:411
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Definition: Array.h:487
const T * data(void) const
Size of the specified dimension.
Definition: Array.h:616
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
Definition: Array.cc:1744
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:257
int32NDArray int32_array_value(void) const
Definition: ov.h:1001
boolNDArray bool_array_value(bool warn=false) const
Definition: ov.h:936
uint16NDArray uint16_array_value(void) const
Definition: ov.h:1010
bool isreal(void) const
Definition: ov.h:783
bool is_uint16_type(void) const
Definition: ov.h:766
bool is_int8_type(void) const
Definition: ov.h:751
bool is_dq_string(void) const
Definition: ov.h:688
bool is_string(void) const
Definition: ov.h:682
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
Definition: ov.h:923
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov.h:942
bool isinteger(void) const
Definition: ov.h:775
std::string class_name(void) const
Definition: ov.h:1451
bool is_uint32_type(void) const
Definition: ov.h:769
int8NDArray int8_array_value(void) const
Definition: ov.h:995
bool is_int64_type(void) const
Definition: ov.h:760
int64NDArray int64_array_value(void) const
Definition: ov.h:1004
uint8NDArray uint8_array_value(void) const
Definition: ov.h:1007
bool is_int32_type(void) const
Definition: ov.h:757
bool is_uint64_type(void) const
Definition: ov.h:772
bool is_int16_type(void) const
Definition: ov.h:754
uint64NDArray uint64_array_value(void) const
Definition: ov.h:1016
NDArray array_value(bool frc_str_conv=false) const
Definition: ov.h:904
bool is_single_type(void) const
Definition: ov.h:743
uint32NDArray uint32_array_value(void) const
Definition: ov.h:1013
bool is_undefined(void) const
Definition: ov.h:640
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
Definition: ov.h:927
FloatNDArray float_array_value(bool frc_str_conv=false) const
Definition: ov.h:907
bool is_uint8_type(void) const
Definition: ov.h:763
int16NDArray int16_array_value(void) const
Definition: ov.h:998
bool iscomplex(void) const
Definition: ov.h:786
bool islogical(void) const
Definition: ov.h:780
OCTINTERP_API void print_usage(void)
Definition: defun-int.h:72
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
Definition: defun.h:56
void error(const char *fmt,...)
Definition: error.cc:980
ColumnVector transform(const Matrix &m, double x, double y, double z)
Definition: graphics.cc:5861
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
ArrayType do_bitpack(const boolNDArray &bitp)
Definition: typecast.cc:315
static OCTAVE_NAMESPACE_BEGIN dim_vector get_vec_dims(const dim_vector &old_dims, octave_idx_type n)
Definition: typecast.cc:44
static ArrayType reinterpret_int_copy(const void *data, octave_idx_type byte_size, const dim_vector &old_dims)
Definition: typecast.cc:92
static ArrayType reinterpret_copy(const void *data, octave_idx_type byte_size, const dim_vector &old_dims)
Definition: typecast.cc:74
static void get_data_and_bytesize(const ArrayType &array, const void *&data, octave_idx_type &byte_size, dim_vector &old_dims, unwind_protect &frame)
Definition: typecast.cc:56
boolNDArray do_bitunpack(const ArrayType &array)
Definition: typecast.cc:467