set_print_format_type#

Set the MatX print format type

enum matx::PrintFormatType#

Print formatting type specifier. Default: MATX_PRINT_FORMAT_DEFAULT

Values:

enumerator MATX_PRINT_FORMAT_DEFAULT#

Original MATX print formatting.

enumerator MATX_PRINT_FORMAT_MLAB#

Print formatting allowing cut&paste as MATLAB or Octave multi-dimensional matrix.

enumerator MATX_PRINT_FORMAT_PYTHON#

Print formatting allowing cut&paste as Python list or list of lists.

__MATX_INLINE__ __MATX_HOST__ void matx::set_print_format_type(enum PrintFormatType format_type)#

Set the print() format type.

Parameters:

format_type – print format type (default MATX_PRINT_FORMAT_DEFAULT)

Examples#

using complex = cuda::std::complex<double>;

auto A1 = make_tensor<complex>({16});
A1.SetVals({
  {  1,  -1}, {  2,   2}, {  3,  -3}, {  4,  4},
  { -5,   5}, { -6,  -6}, { -7,   7}, { -8, -8},
  {  9,  -9}, { 10,  10}, { 11, -11}, { 12, 12},
  {-13,  13}, {-14,  14}, {-15,  15}, {-16, 16}
});

A1.set_name("A1 Matrix");
auto A2 = reshape(A1, {4,4});
auto A3 = reshape(A1, {2,2,4});
auto A4 = reshape(A1, {2,2,2,2});

printf("MATX_PRINT_FORMAT_DEFAULT:\n");
print(A1);
print(A2);
print(A3);
print(A4);

set_print_format_type(MATX_PRINT_FORMAT_MLAB);
printf("MATX_PRINT_FORMAT_MLAB:\n");
print(A1);
print(A2);
print(A3);
print(A4);

set_print_format_type(MATX_PRINT_FORMAT_PYTHON);
printf("MATX_PRINT_FORMAT_PYTHON:\n");
print(A1);
print(A2);
print(A3);
print(A4);