Skip to content

Commit

Permalink
Use correct attributes for overridable member functions.
Browse files Browse the repository at this point in the history
* ov-base-diag.h: Use correct attributes for overridable member functions with
definition of class template "octave_base_diag". Follow-up for changes in
564e33ab34fe.
  • Loading branch information
mmuetzel committed Jan 6, 2025
1 parent 99a48c5 commit 8abe8cb
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions libinterp/octave-value/ov-base-diag.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,27 @@ class OCTINTERP_TEMPLATE_API octave_base_diag : public octave_base_value

public:

OCTINTERP_API
OCTINTERP_OVERRIDABLE_FUNC_API
octave_base_diag ()
: octave_base_value (), m_matrix (), m_dense_cache () { }

OCTINTERP_API
OCTINTERP_OVERRIDABLE_FUNC_API
octave_base_diag (const DMT& m)
: octave_base_value (), m_matrix (m), m_dense_cache ()
{ }
: octave_base_value (), m_matrix (m), m_dense_cache () { }

OCTINTERP_API
OCTINTERP_OVERRIDABLE_FUNC_API
octave_base_diag (const octave_base_diag& m)
: octave_base_value (), m_matrix (m.m_matrix), m_dense_cache () { }

OCTINTERP_API ~octave_base_diag () = default;
OCTINTERP_OVERRIDABLE_FUNC_API ~octave_base_diag () = default;

OCTINTERP_API std::size_t byte_size () const
OCTINTERP_OVERRIDABLE_FUNC_API std::size_t byte_size () const
{ return m_matrix.byte_size (); }

OCTINTERP_API octave_value squeeze () const
OCTINTERP_OVERRIDABLE_FUNC_API octave_value squeeze () const
{ return m_matrix; }

OCTINTERP_API octave_value full_value () const
OCTINTERP_OVERRIDABLE_FUNC_API octave_value full_value () const
{ return to_dense (); }

// We don't need to override all three forms of subsref. The using
Expand All @@ -80,7 +79,7 @@ class OCTINTERP_TEMPLATE_API octave_base_diag : public octave_base_value
OCTINTERP_API octave_value
subsref (const std::string& type, const std::list<octave_value_list>& idx);

OCTINTERP_API octave_value_list
OCTINTERP_OVERRIDABLE_FUNC_API octave_value_list
subsref (const std::string& type, const std::list<octave_value_list>& idx,
int)
{ return subsref (type, idx); }
Expand All @@ -92,16 +91,16 @@ class OCTINTERP_TEMPLATE_API octave_base_diag : public octave_base_value
subsasgn (const std::string& type, const std::list<octave_value_list>& idx,
const octave_value& rhs);

OCTINTERP_API dim_vector dims () const
OCTINTERP_OVERRIDABLE_FUNC_API dim_vector dims () const
{ return m_matrix.dims (); }

OCTINTERP_API octave_idx_type nnz () const
OCTINTERP_OVERRIDABLE_FUNC_API octave_idx_type nnz () const
{ return diag ().nnz (); }

OCTINTERP_API octave_value reshape (const dim_vector& new_dims) const
OCTINTERP_OVERRIDABLE_FUNC_API octave_value reshape (const dim_vector& new_dims) const
{ return to_dense ().reshape (new_dims); }

OCTINTERP_API octave_value
OCTINTERP_OVERRIDABLE_FUNC_API octave_value
permute (const Array<int>& vec, bool inv = false) const
{
if (vec.numel () == 2
Expand All @@ -115,15 +114,15 @@ class OCTINTERP_TEMPLATE_API octave_base_diag : public octave_base_value
OCTINTERP_API octave_value
resize (const dim_vector& dv, bool fill = false) const;

OCTINTERP_API octave_value all (int dim = 0) const
OCTINTERP_OVERRIDABLE_FUNC_API octave_value all (int dim = 0) const
{ return MT (m_matrix).all (dim); }

OCTINTERP_API octave_value any (int dim = 0) const
OCTINTERP_OVERRIDABLE_FUNC_API octave_value any (int dim = 0) const
{ return MT (m_matrix).any (dim); }

OCTINTERP_API MatrixType matrix_type () const
OCTINTERP_OVERRIDABLE_FUNC_API MatrixType matrix_type () const
{ return MatrixType::Diagonal; }
OCTINTERP_API MatrixType matrix_type (const MatrixType&) const
OCTINTERP_OVERRIDABLE_FUNC_API MatrixType matrix_type (const MatrixType&) const
{ return matrix_type (); }

// We don't need to override both forms of the diag method. The using
Expand All @@ -133,41 +132,44 @@ class OCTINTERP_TEMPLATE_API octave_base_diag : public octave_base_value

OCTINTERP_API octave_value diag (octave_idx_type k = 0) const;

OCTINTERP_API octave_value
OCTINTERP_OVERRIDABLE_FUNC_API octave_value
sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
{ return to_dense ().sort (dim, mode); }
OCTINTERP_API octave_value
OCTINTERP_OVERRIDABLE_FUNC_API octave_value
sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0,
sortmode mode = ASCENDING) const
{ return to_dense ().sort (sidx, dim, mode); }

OCTINTERP_API sortmode issorted (sortmode mode = UNSORTED) const
OCTINTERP_OVERRIDABLE_FUNC_API sortmode
issorted (sortmode mode = UNSORTED) const
{ return to_dense ().issorted (mode); }

OCTINTERP_API Array<octave_idx_type>
OCTINTERP_OVERRIDABLE_FUNC_API Array<octave_idx_type>
sort_rows_idx (sortmode mode = ASCENDING) const
{ return to_dense ().sort_rows_idx (mode); }

OCTINTERP_API sortmode is_sorted_rows (sortmode mode = UNSORTED) const
OCTINTERP_OVERRIDABLE_FUNC_API sortmode
is_sorted_rows (sortmode mode = UNSORTED) const
{ return to_dense ().is_sorted_rows (mode); }

OCTINTERP_API bool is_matrix_type () const { return true; }
OCTINTERP_OVERRIDABLE_FUNC_API bool is_matrix_type () const
{ return true; }

OCTINTERP_API bool isnumeric () const { return true; }
OCTINTERP_OVERRIDABLE_FUNC_API bool isnumeric () const { return true; }

OCTINTERP_API bool is_defined () const { return true; }
OCTINTERP_OVERRIDABLE_FUNC_API bool is_defined () const { return true; }

OCTINTERP_API bool is_constant () const { return true; }
OCTINTERP_OVERRIDABLE_FUNC_API bool is_constant () const { return true; }

OCTINTERP_API bool is_true () const;

OCTINTERP_API bool is_diag_matrix () const { return true; }
OCTINTERP_OVERRIDABLE_FUNC_API bool is_diag_matrix () const { return true; }

OCTINTERP_API double double_value (bool = false) const;

OCTINTERP_API float float_value (bool = false) const;

OCTINTERP_API double
OCTINTERP_OVERRIDABLE_FUNC_API double
scalar_value (bool frc_str_conv = false) const
{ return double_value (frc_str_conv); }

Expand Down Expand Up @@ -205,28 +207,28 @@ class OCTINTERP_TEMPLATE_API octave_base_diag : public octave_base_value
OCTINTERP_API SparseComplexMatrix
sparse_complex_matrix_value (bool = false) const;

OCTINTERP_API int8NDArray int8_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API int8NDArray int8_array_value () const
{ return to_dense ().int8_array_value (); }

OCTINTERP_API int16NDArray int16_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API int16NDArray int16_array_value () const
{ return to_dense ().int16_array_value (); }

OCTINTERP_API int32NDArray int32_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API int32NDArray int32_array_value () const
{ return to_dense ().int32_array_value (); }

OCTINTERP_API int64NDArray int64_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API int64NDArray int64_array_value () const
{ return to_dense ().int64_array_value (); }

OCTINTERP_API uint8NDArray uint8_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API uint8NDArray uint8_array_value () const
{ return to_dense ().uint8_array_value (); }

OCTINTERP_API uint16NDArray uint16_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API uint16NDArray uint16_array_value () const
{ return to_dense ().uint16_array_value (); }

OCTINTERP_API uint32NDArray uint32_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API uint32NDArray uint32_array_value () const
{ return to_dense ().uint32_array_value (); }

OCTINTERP_API uint64NDArray uint64_array_value () const
OCTINTERP_OVERRIDABLE_FUNC_API uint64NDArray uint64_array_value () const
{ return to_dense ().uint64_array_value (); }

OCTINTERP_API octave_value
Expand Down

0 comments on commit 8abe8cb

Please sign in to comment.