[bug #67862] rewrite "repmat()" in C++ for performance and classdef

"Dmitri A. Sergatskov" <[email protected]>
Newsgroups gmane.comp.gnu.octave.bugs
Message-ID <[email protected]>
Please use the bug tracker to post updates to a bug report.  The mailing list is intended as a read-only notification stream.  Info posted to this mailing list address won't appear in the tracker database where it is most useful.

Follow-up Comment #7, bug #67862 (group octave):

Based on popular demand
https://octave.discourse.group/t/implementation-of-classdef-arrays/7057/18?u=dasergatskov
re-write from a stand-alone function into virtual-method.
(file bug67862_repmat_vmethod_20260402_100.cset)

Perhaps it does make more sense from OO point of view. 
But it does touch 20+ files...
Performance is about the same (it is limited by memory I/O in any case). 

From CSET summary:


  Re-implement repmat as a compiled DEFUN that delegates to a new virtual
  method octave_base_value::repmat().  Each type in the octave_value
  hierarchy overrides the method with an implementation tuned to its
  internal representation. In particular:
    - Dense arrays (octave_base_matrix<MT>): dimension-by-dimension block
      copying with a doubling scheme for contiguous memory access.
    - Scalars (octave_base_scalar<ST>): Array fill constructor.
    - Sparse matrices (octave_base_sparse<T>): direct CSC column construction
      without conversion to dense; errors on non-trivial 3D replication.
    - Structs, old-style @classes, classdef objects: field-by-field or
      object-array replication; classdef checks for an overloaded repmat
      method before falling back to the built-in.
    - Diagonal, permutation, lazy-index, and range types: delegate to
      to_dense() / make_value() and call repmat() on the result.



Dmitri.
-- 


(file #58435)

    _______________________________________________________

Additional Item Attachment:

Name: bug67862_repmat_vmethod_20260402_100.cset Size: 44KiB

<https://file.savannah.gnu.org/file/bug67862_repmat_vmethod_20260402_100.cset?file_id=58435>


    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-f290f6b25beb8cb99bbe243a6cd2c5fef79ffcde.tar.gz


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67862>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCac6HTgAKCRCqLAuaBUf3
TpJOAQDpoukiz9A5DHPr4vVfs/Jo2Q8UZZnmUPWFuc2QA3dRYAD9HAGlTmzhddui
lVH9SzZDxJCZslbyy6nL/xVR5/pczwY=
=EXTp
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.