[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54183] Cache NaN/Inf status of matrix for per
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #54183] Cache NaN/Inf status of matrix for performance? |
Date: |
Mon, 25 Jun 2018 14:11:34 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0 |
URL:
<http://savannah.gnu.org/bugs/?54183>
Summary: Cache NaN/Inf status of matrix for performance?
Project: GNU Octave
Submitted by: rik5
Submitted on: Mon 25 Jun 2018 11:11:33 AM PDT
Category: Performance
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Feature Request
Status: Confirmed
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: Any
_______________________________________________________
Details:
Low-level Octave code in liboctave often calculates the 1-norm of a matrix
before calling BLAS/LAPACK routines. This was originally done to prevent
segfaults and other unhandled exceptions in the external library code.
However, this is obviously a lot of work, even for the 1-norm. Now that bug
#39000 has been resolved for Windows (XERBLA handler override for external
BLAS libraries) there is no longer a pressing need to inspect the matrix so
thoroughly before handing it over to the library.
Architecturally, it would be useful to consider the locations in liboctave
where we calculate the 1-norm and determine if they could be removed, and
instead catch any error from the external library and modify the return value
as necessary. In pseudocode
[retval, info] = BLAS_fcn (A, ...);
if (info)
if (any (isnan (A(:))))
retval = NaN (size (A));
elseif (any (isinf (A(:))))
retval = Inf (size (A)); # this wouldn't get the sign right, but its
close
endif
endif
This has the advantage of only bothering to inspect the matrix if there is a
problem with the calculation.
Alternatively, there is already a caching system in place for Octave matrices
that records any special properties abouth them (diagonal, banded, symmetric,
etc.). This caching system could be extended so that any NaN or Inf status of
a matrix was calculated only once.
The first solution is preferrable, since most of the time there is no reason
to check a matrix as most will be valid. But at least the second solution
would restrict the calculation to once per matrix.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54183>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54183] Cache NaN/Inf status of matrix for performance?,
Rik <=