octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #60426] patch: huge speed-up of pchip for mixe


From: A.R. Burgers
Subject: [Octave-bug-tracker] [bug #60426] patch: huge speed-up of pchip for mixed precision arguments
Date: Tue, 20 Apr 2021 16:32:49 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.82 Safari/537.36 Edg/89.0.774.48

URL:
  <https://savannah.gnu.org/bugs/?60426>

                 Summary: patch: huge speed-up of pchip for mixed precision
arguments
                 Project: GNU Octave
            Submitted by: arb
            Submitted on: Tue 20 Apr 2021 08:32:48 PM UTC
                Category: Performance
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Performance
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

as explained in bug #60361 pchip is very slow for mixed precision x and y
arguments. The attached changeset fixes this, by replacing the division by a
diagonal matrix with broadcast and scalar division.


   ## This is taken from SLATEC.
-  h = diag (h);
+  hr = 1.0 ./ h;

-  delta = diff (y, 1, 2) / h;
-  del1 = (d1 - delta) / h;
-  del2 = (d2 - delta) / h;
+  delta = diff (y, 1, 2) .* hr;
+  del1 = (d1 - delta) .* hr;
+  del2 = (d2 - delta) .* hr;
   c3 = del1 + del2;
   c2 = -c3 - del1;
-  c3 /= h;
+  c3 .*= hr;
   coeffs = cat (3, c3, c2, d1, f1);




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Tue 20 Apr 2021 08:32:48 PM UTC  Name: p29634_pchip.txt  Size: 996B  
By: arb

<http://savannah.gnu.org/bugs/download.php?file_id=51300>

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]