Skip to content

Commit

Permalink
v5.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DrTimothyAldenDavis committed Jul 1, 2020
1 parent e095e79 commit 5d3337d
Show file tree
Hide file tree
Showing 4,309 changed files with 367,581 additions and 148,620 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions CHOLMOD/Demo/lperf.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

clear
rng ('default')
index = UFget ;
index = ssget ;
f = find (index.posdef & (index.amd_lnz > 0)) ;
f = setdiff (f, [1425 228 353 354]) ; % not really posdef
[ignore i] = sort (index.amd_lnz (f)) ;
Expand All @@ -15,7 +15,7 @@

for k = 1:nmat
id = f (k) ;
Prob = UFget (id, index)
Prob = ssget (id, index)
A = Prob.A ;
n = size (A,1) ;

Expand Down
6 changes: 6 additions & 0 deletions CHOLMOD/Doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
June 30, 2020: no change to version number

* minor update to MATLAB tests: no change to compiled library,
so version number remains 3.0.14.
* replaced UFget with ssget in MATLAB tests

Feb 20, 2020: version 3.0.14

* minor update to cholmod_check to print a matrix
Expand Down
6 changes: 3 additions & 3 deletions CHOLMOD/MATLAB/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ the MATLAB command line, while in the CHOLMOD/MATLAB directory.
cholmod_demo is a short demo program for CHOLMOD. Type "cholmod_demo" in
your MATLAB command window to test your newly compiling CHOLMOD functions.
Test/cholmod_test.m runs the test suite for the MATLAB interface to CHOLMOD.
It requires the "UFget" interface to the UF sparse matrix collection, but
provides a more extensive test for CHOLMOD. To obtain a copy of UFget, see
http://www.suitesparse.com .
It requires the "ssget" interface to the SuiteSparse matrix collection, but
provides a more extensive test for CHOLMOD. To obtain a copy of ssget, see
http://sparse.tamu.edu.

----------------------------------------
Using AMD, CCOLAMD, and COLAMD in MATLAB
Expand Down
57 changes: 57 additions & 0 deletions CHOLMOD/MATLAB/Test/GB_spones_mex.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
//------------------------------------------------------------------------------
// GB_spones_mex: like spones(A) in MATLAB but do not drop zeros on input
//------------------------------------------------------------------------------

// The MATLAB built-in function spones(A) has changed, of MATLAB R2019b.
// It now drops zeros on input. Prior versions converted them to 1 on output.
// The tests here use the old behavior, so this function replaces spones(A)
// with GB_spones_mex (A), which has the old behavior of spones.

#include "mex.h"
#include <string.h>

void mexFunction
(
int nargout,
mxArray *pargout [ ],
int nargin,
const mxArray *pargin [ ]
)
{

//--------------------------------------------------------------------------
// check inputs
//--------------------------------------------------------------------------

if (nargin != 1 || nargout > 1 || !mxIsSparse (pargin [0]))
{
mexErrMsgTxt ("usage: C = GB_spones_mex (A), A must be sparse") ;
}

//--------------------------------------------------------------------------
// get the input matrix
//--------------------------------------------------------------------------

mwSize m = mxGetM (pargin [0]) ;
mwSize n = mxGetN (pargin [0]) ;
mwIndex *Ap = mxGetJc (pargin [0]) ;
mwIndex *Ai = mxGetIr (pargin [0]) ;
mwSize nz = Ap [n] ;

//--------------------------------------------------------------------------
// create the output matrix
//--------------------------------------------------------------------------

pargout [0] = mxCreateSparse (m, n, nz+1, mxREAL) ;
mwIndex *Cp = mxGetJc (pargout [0]) ;
mwIndex *Ci = mxGetIr (pargout [0]) ;
double *Cx = mxGetDoubles (pargout [0]) ;

memcpy (Cp, Ap, (n+1) * sizeof (mwIndex)) ;
memcpy (Ci, Ai, nz * sizeof (mwIndex)) ;
for (mwSize p = 0 ; p < nz ; p++)
{
Cx [p] = 1 ;
}
}

6 changes: 4 additions & 2 deletions CHOLMOD/MATLAB/Test/cholmod_test.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ function cholmod_test (nmat, do_diary)
% Example:
% cholmod_test(nmat,do_diary)
%
% The UFget interface to the UF sparse matrix collection is required.
% The ssget interface to the SuiteSparse matrix collection is required.
% See sparse.tamu.edu.
%
% nmat is optional. If present, it is the # of matrices used in
% tests 0, 8, 10, 11, 12, and 12. tests 14 and 15 use 2*nmat matrices.
Expand Down Expand Up @@ -50,7 +51,7 @@ function cholmod_test (nmat, do_diary)
% This extensive test is not included:
% test28: test nesdis

% Copyright 2006-2007, Timothy A. Davis, http://www.suitesparse.com
% Copyright 2006-2020, Timothy A. Davis, http://www.suitesparse.com

if (nargin < 2)
do_diary = 0 ;
Expand All @@ -66,6 +67,7 @@ function cholmod_test (nmat, do_diary)

fprintf ('Running CHOLMOD tests.\n') ;
help cholmod_test
mex -O -R2018a GB_spones_mex.c

test_path = pwd ;
% addpath (test_path) ;
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/MATLAB/Test/dg.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function dg(A)

% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com

A = spones (A) ;
A = GB_spones_mex (A) ;
[p cp cm] = nesdis (A, 'row') ;

% get the corresponding column ordering. Order the columns
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/ltest.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
% Copyright 2013, Timothy A. Davis, http://www.suitesparse.com

rng ('default')
index = UFget ;
index = ssget ;

%{
f = find (index.nrows == index.ncols & index.amd_lnz > 0) ;
Expand All @@ -23,7 +23,7 @@

for k = 1:nmat
id = f (k) ;
Prob = UFget (id, index)
Prob = ssget (id, index)
A = spones (Prob.A) ;
n = size (A,1) ;
A = A+A' ;
Expand Down
10 changes: 5 additions & 5 deletions CHOLMOD/MATLAB/Test/lxtest.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
% Copyright 2013, Timothy A. Davis, http://www.suitesparse.com

rng ('default')
index = UFget ;
index = ssget ;

%{
f = find (index.posdef & index.amd_lnz > 0) ;
Expand All @@ -23,13 +23,13 @@

for k = 1:nmat
id = f (k) ;
Prob = UFget (id, index)
Prob = ssget (id, index)
A = Prob.A ;
n = size (A,1) ;
[LD gunk p] = ldlchol (A) ;
C = A (p,p) ;
[count h parent post Lpattern] = symbfact (C, 'sym', 'lower') ;
if (~isequal (Lpattern, spones (LD)))
if (~isequal (Lpattern, GB_spones_mex (LD)))
error ('!') ;
end

Expand All @@ -44,8 +44,8 @@
end

D2 = chol (D) ;
L2 = L*D2 + 1e-50 * spones (L) ;
if (~isequal (spones (L), spones (L2)))
L2 = L*D2 + 1e-50 * GB_spones_mex (L) ;
if (~isequal (GB_spones_mex (L), GB_spones_mex (L2)))
error ('oops') ;
end
err = norm (L2*L2' - C, 1) / norm (C, 1) ;
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/n2.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com

index = UFget ;
index = ssget ;
f = find ((index.amd_lnz > 0) & (index.nrows > 200)) ;
[ignore i] = sort (index.amd_lnz (f)) ;
f = f (i) ;
nmat = length (f) ;

for i = f

Prob = UFget (i, index) ;
Prob = ssget (i, index) ;
disp (Prob) ;
A = spones (Prob.A) ;
[m n] = size (A) ;
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/nn.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com

index = UFget ;
index = ssget ;
f = find (index.amd_lnz > 0) ;
[ignore i] = sort (index.amd_lnz (f)) ;
f = f (i) ;
Expand All @@ -25,7 +25,7 @@
for k = 1:nmat

i = f (k) ;
Prob = UFget (i,index) ;
Prob = ssget (i,index) ;
A = Prob.A ;
[m n] = size (A) ;

Expand Down
34 changes: 23 additions & 11 deletions CHOLMOD/MATLAB/Test/test0.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function test0 (nmat)
function test0 (nmat,f)
%TEST0 test most CHOLMOD functions
% Example:
% test0(nmat)
Expand All @@ -9,18 +9,20 @@ function test0 (nmat)
fprintf ('=================================================================\n');
fprintf ('test0: test most CHOLMOD functions\n') ;

% This test requires UFget, the MATLAB interface to the UF sparse matrix
% collection. You can obtain UFget from http://www.suitesparse.com.
% This test requires ssget, the MATLAB interface to the UF sparse matrix
% collection. You can obtain ssget from http://www.suitesparse.com.

try
index = UFget ;
index = ssget ;
catch
error ('Test aborted. UF sparse matrix collection not available.\n') ;
end

f = find (index.posdef) ;
[ignore i] = sort (index.nrows (f)) ;
f = f (i) ;
if (nargin < 2)
f = find (index.posdef) ;
[ignore i] = sort (index.nrows (f)) ;
f = f (i) ;
end

rand ('state', 0) ;
randn ('state', 0) ;
Expand Down Expand Up @@ -60,7 +62,7 @@ function test0 (nmat)

% try

Problem = UFget (i) ;
Problem = ssget (i) ;
A = Problem.A ;
fprintf ('\n================== Problem: %d: %s n: %d nnz: %d\n', ...
i, Problem.name, size (A,1), nnz (A)) ;
Expand Down Expand Up @@ -250,9 +252,19 @@ function test0 (nmat)
if (nnz (LD5) ~= nnz (LD4))
error ('!') ;
end
if (nnz (spones (LD5) - spones (LD4)) ~= 0)
error ('!') ;
end

% revised June 30, 2020
if (nnz (GB_spones_mex (LD5) - GB_spones_mex (LD4)) ~= 0)
error ('!') ;
end

% if (nnz (spones (LD5) - spones (LD4)) ~= 0)
% % TODO: fails on ssget (878) because MATLAB changed spones(...).
% LD5 (262,246)
% LD4 (262,246)
% spones (LD5) - spones (LD4)
% error ('!') ;
% end

b = rand (n,2) ;
x = ldlsolve (LD4, b) ;
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/test10.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function test10 (nmat)
rand ('state',0) ;
randn ('state',0) ;

index = UFget ;
index = ssget ;
f = find (index.posdef) ;
[ignore i] = sort (index.nrows (f)) ;
f = f (i) ;
Expand Down Expand Up @@ -71,7 +71,7 @@ function test10 (nmat)

if (~complexity)
nn %#ok
Prob = UFget (nn) %#ok
Prob = ssget (nn) %#ok
end
A = Prob.A ;
if (complexity)
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/test11.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function test11 (nmat)
rand ('state',0) ;
randn ('state',0) ;

index = UFget ;
index = ssget ;
f = find (index.posdef) ;
[ignore i] = sort (index.nrows (f)) ;
f = f (i) ;
Expand Down Expand Up @@ -59,7 +59,7 @@ function test11 (nmat)
% try

fprintf ('\n%3d: %s/%s\n', nn, index.Group {nn}, index.Name {nn}) ;
Prob = UFget (nn) ;
Prob = ssget (nn) ;
A = Prob.A ;
clear Prob
n = size (A,1) ;
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/MATLAB/Test/test11results.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com

load Results
index = UFget ;
index = ssget ;

c = E1(1:kkk) < 1 & T1(1:kkk) > 0 ;
m = E2(1:kkk) < 1 & T2(1:kkk) > 0 ;
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/test12.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function test12 (nmat)
fprintf ('=================================================================\n');
fprintf ('test12: test etree2 and compare with etree\n') ;

index = UFget ;
index = ssget ;

% only test matrices with nrows = 109000 or less. large ones nearly always
% cause a MATLAB segfault.
Expand Down Expand Up @@ -60,7 +60,7 @@ function test12 (nmat)

% try

Problem = UFget (i) ;
Problem = ssget (i) ;
A = spones (Problem.A) ;
[m n] = size (A) ;
fprintf ('\n%4d: %-20s nrow: %6d ncol: %6d nnz: %10d\n', ...
Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/test14.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function test14 (nmat)
fprintf ('=================================================================\n');
fprintf ('test14: test metis, symbfact2, and etree2\n') ;

index = UFget ;
index = ssget ;

[ignore f] = sort (max (index.nrows, index.ncols)) ;

Expand Down Expand Up @@ -39,7 +39,7 @@ function test14 (nmat)

% try

Prob = UFget (i) %#ok
Prob = ssget (i) %#ok
A = Prob.A ;
[m n] = size (A) ;

Expand Down
4 changes: 2 additions & 2 deletions CHOLMOD/MATLAB/Test/test15.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function test15 (nmat)

fprintf ('=================================================================\n');

index = UFget ;
index = ssget ;

% only test matrices with nrows = 109000 or less. large ones nearly always
% cause a MATLAB segfault.
Expand All @@ -31,7 +31,7 @@ function test15 (nmat)

% try

Problem = UFget (i) ;
Problem = ssget (i) ;
A = spones (Problem.A) ;
[m n] = size (A) ;
fprintf ('\n%4d: %-20s nrow: %6d ncol: %6d nnz: %10d\n', ...
Expand Down
2 changes: 1 addition & 1 deletion CHOLMOD/MATLAB/Test/test16.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
rand ('state',1) ;
randn ('state',1) ;

Prob = UFget (936) %#ok
Prob = ssget (936) %#ok
A = Prob.A ;
% tic
% [L,s,p] = lchol (A) ;
Expand Down
Loading

0 comments on commit 5d3337d

Please sign in to comment.