Skip to content

Commit

Permalink
symbfact: return row vectors for Matlab compatibility (bug #66521)
Browse files Browse the repository at this point in the history
* NEWS.10.md: Announce change in Matlab Compatibility section.

* symbfact.cc: Use "#include dRowVector.h".
* symbfact.cc (Fsymbfact): Declare "tmp" variable to be of type RowVector
rather than ColumnVector.  Update BIST tests for new behavior.
  • Loading branch information
Rik committed Dec 4, 2024
1 parent 5d78448 commit fd456d9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions etc/NEWS.10.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ Summary of important user-visible changes for version 10 (yyyy-mm-dd):
"median" to allow the user to select which option to use. This property
should not be expected to function in code used outside of Octave.

- `symbfact`: outputs `count`, `parent`, and `post` are now row vectors rather
than column vectors.

### Alphabetical list of new functions added in Octave 10

* `clim`
Expand Down
11 changes: 5 additions & 6 deletions libinterp/corefcn/symbfact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "CSparse.h"
#include "boolSparse.h"
#include "dColVector.h"
#include "dRowVector.h"
#include "dSparse.h"
#include "oct-locbuf.h"
#include "oct-sparse.h"
Expand Down Expand Up @@ -249,7 +249,7 @@ Cholesky@tie{}factorization as determined by @var{typ}.

CHOLMOD_NAME(etree) (Aup, Parent, cm);

ColumnVector tmp (n); // Declaration must precede any goto cleanup.
RowVector tmp (n); // Declaration must precede any goto cleanup.
std::string err_msg;

if (cm->status < CHOLMOD_OK)
Expand Down Expand Up @@ -403,9 +403,9 @@ Cholesky@tie{}factorization as determined by @var{typ}.
%!testif HAVE_CHOLMOD
%! A = sparse (magic (3));
%! [count, h, parent, post, r] = symbfact (A);
%! assert (count, [3; 2; 1]);
%! assert (count, [3, 2, 1]);
%! assert (h, 3);
%! assert (parent, [2; 3; 0]);
%! assert (parent, [2, 3, 0]);
%! assert (r, sparse (triu (true (3))));
%!testif HAVE_CHOLMOD
Expand All @@ -427,8 +427,7 @@ Cholesky@tie{}factorization as determined by @var{typ}.
%! fail ("symbfact (sparse (1), {1})", "TYP must be a string");
%! fail ("symbfact (sparse (1), 'foobar')", 'unrecognized TYP "foobar"');
%! fail ("symbfact (sparse (1), 'sym', {'L'})", "MODE must be a string");
%! fail ('symbfact (sparse (1), "sym", "foobar")',
%! 'unrecognized MODE "foobar"');
%! fail ('symbfact (sparse (1), "sym", "foobar")','unrecognized MODE "foobar"');
%! fail ("symbfact (sparse ([1, 2; 3, 4; 5, 6]))", "S must be a square matrix");
*/
Expand Down

0 comments on commit fd456d9

Please sign in to comment.