Mercurial > octave
annotate scripts/sparse/colperm.m @ 29358:0a5b15007766 stable
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2021.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 10 Feb 2021 09:52:15 -0500 |
parents | 54b9fcbefd73 |
children | 7854d5752dd2 |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 ######################################################################## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 ## |
29358
0a5b15007766
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
28863
diff
changeset
|
3 ## Copyright (C) 2004-2021 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
4 ## |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 ## See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 ## distribution or <https://octave.org/copyright/>. |
5164 | 7 ## |
7016 | 8 ## This file is part of Octave. |
5164 | 9 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
10 ## Octave is free software: you can redistribute it and/or modify it |
7016 | 11 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
12 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
13 ## (at your option) any later version. |
7016 | 14 ## |
15 ## Octave is distributed in the hope that it will be useful, but | |
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
18 ## GNU General Public License for more details. |
5164 | 19 ## |
20 ## You should have received a copy of the GNU General Public License | |
7016 | 21 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
22 ## <https://www.gnu.org/licenses/>. |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 ## |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 ######################################################################## |
5164 | 25 |
26 ## -*- texinfo -*- | |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20164
diff
changeset
|
27 ## @deftypefn {} {@var{p} =} colperm (@var{s}) |
12575
d0b799dafede
Grammarcheck files for 3.4.1 release.
Rik <octave@nomad.inbox5.com>
parents:
11523
diff
changeset
|
28 ## Return the column permutations such that the columns of |
28863
54b9fcbefd73
colperm.m: Cuddle parenthesis in documentation when indicating indexing.
Rik <rik@octave.org>
parents:
28862
diff
changeset
|
29 ## @code{@var{s}(:, @var{p})} are ordered in terms of increasing number of |
20164
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
30 ## nonzero elements. |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
31 ## |
df437a52bcaf
doc: Update more docstrings to have one sentence summary as first line.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
32 ## If @var{s} is symmetric, then @var{p} is chosen such that |
28863
54b9fcbefd73
colperm.m: Cuddle parenthesis in documentation when indicating indexing.
Rik <rik@octave.org>
parents:
28862
diff
changeset
|
33 ## @code{@var{s}(@var{p}, @var{p})} orders the rows and columns with |
54b9fcbefd73
colperm.m: Cuddle parenthesis in documentation when indicating indexing.
Rik <rik@octave.org>
parents:
28862
diff
changeset
|
34 ## increasing number of nonzero elements. |
5164 | 35 ## @end deftypefn |
36 | |
37 function p = colperm (s) | |
7125 | 38 |
39 if (nargin != 1) | |
40 print_usage (); | |
41 endif | |
42 | |
28862
c153b1446e36
colperm.m: Fix for matrices with empty columns (bug #59226).
Marcel Jacobse <mjacobse@uni-bremen.de>
parents:
27923
diff
changeset
|
43 [~, p] = sort (sum (s != 0, 1)); |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
20852
diff
changeset
|
44 |
5164 | 45 endfunction |
28862
c153b1446e36
colperm.m: Fix for matrices with empty columns (bug #59226).
Marcel Jacobse <mjacobse@uni-bremen.de>
parents:
27923
diff
changeset
|
46 |
c153b1446e36
colperm.m: Fix for matrices with empty columns (bug #59226).
Marcel Jacobse <mjacobse@uni-bremen.de>
parents:
27923
diff
changeset
|
47 |
c153b1446e36
colperm.m: Fix for matrices with empty columns (bug #59226).
Marcel Jacobse <mjacobse@uni-bremen.de>
parents:
27923
diff
changeset
|
48 %!assert <*59226> (colperm ([1,0;0,0]), [2, 1]) |