Mercurial > octave
comparison libinterp/corefcn/pr-output.cc @ 33395:a258493e726a
Backed out changeset c714266d9f0d
author | Arun Giridhar <arungiridhar@gmail.com> |
---|---|
date | Sat, 13 Apr 2024 14:28:48 -0400 |
parents | c714266d9f0d |
children | 3e446791b7ef |
comparison
equal
deleted
inserted
replaced
33394:ee94862503e2 | 33395:a258493e726a |
---|---|
298 template <typename T> | 298 template <typename T> |
299 static inline T | 299 static inline T |
300 pr_max_internal (const MArray<T>& m) | 300 pr_max_internal (const MArray<T>& m) |
301 { | 301 { |
302 // We expect a 2-d array. | 302 // We expect a 2-d array. |
303 if (m.ndims () != 2) | 303 panic_unless (m.ndims () == 2); |
304 error ("pr_max_internal: M must be two-dimensional"); | |
305 | 304 |
306 octave_idx_type nr = m.rows (); | 305 octave_idx_type nr = m.rows (); |
307 octave_idx_type nc = m.columns (); | 306 octave_idx_type nc = m.columns (); |
308 | 307 |
309 T result = std::numeric_limits<T>::lowest (); | 308 T result = std::numeric_limits<T>::lowest (); |
680 template <typename MT> | 679 template <typename MT> |
681 static inline float_display_format | 680 static inline float_display_format |
682 make_matrix_format (const MT& m) | 681 make_matrix_format (const MT& m) |
683 { | 682 { |
684 // We expect a 2-d array. | 683 // We expect a 2-d array. |
685 if (m.ndims () != 2) | 684 panic_unless (m.ndims () == 2); |
686 error ("make_matrix_format: M must be two-dimensional"); | |
687 | 685 |
688 if (free_format) | 686 if (free_format) |
689 return float_display_format (); | 687 return float_display_format (); |
690 | 688 |
691 bool inf_or_nan = m.any_element_is_inf_or_nan (); | 689 bool inf_or_nan = m.any_element_is_inf_or_nan (); |
1570 | 1568 |
1571 static inline void | 1569 static inline void |
1572 print_empty_matrix (std::ostream& os, octave_idx_type nr, octave_idx_type nc, | 1570 print_empty_matrix (std::ostream& os, octave_idx_type nr, octave_idx_type nc, |
1573 bool pr_as_read_syntax) | 1571 bool pr_as_read_syntax) |
1574 { | 1572 { |
1575 if (nr && nc) | 1573 panic_unless (nr == 0 || nc == 0); |
1576 error ("print_empty_matrix: at least one of NR and NC must be zero"); | |
1577 | 1574 |
1578 if (pr_as_read_syntax) | 1575 if (pr_as_read_syntax) |
1579 { | 1576 { |
1580 if (nr == 0 && nc == 0) | 1577 if (nr == 0 && nc == 0) |
1581 os << "[]"; | 1578 os << "[]"; |
1593 | 1590 |
1594 static inline void | 1591 static inline void |
1595 print_empty_nd_array (std::ostream& os, const dim_vector& dims, | 1592 print_empty_nd_array (std::ostream& os, const dim_vector& dims, |
1596 bool pr_as_read_syntax) | 1593 bool pr_as_read_syntax) |
1597 { | 1594 { |
1598 if (! dims.any_zero ()) | 1595 panic_unless (dims.any_zero ()); |
1599 error ("print_empty_nd_array: at least one of DIMS must be zero"); | |
1600 | 1596 |
1601 if (pr_as_read_syntax) | 1597 if (pr_as_read_syntax) |
1602 os << "zeros (" << dims.str (',') << ')'; | 1598 os << "zeros (" << dims.str (',') << ')'; |
1603 else | 1599 else |
1604 { | 1600 { |