Mercurial > octave
comparison libinterp/corefcn/sparse.cc @ 29961:7d6709900da7
eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more
Files affected: __betainc__.cc, __contourc__.cc, __eigs__.cc,
__expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc,
__magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, balance.cc,
besselj.cc, bsxfun.cc, call-stack.cc, ccolamd.cc, cellfun.cc, chol.cc,
colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
defaults.cc, dirfns.cc, display.cc, dlmread.cc, dmperm.cc, dot.cc,
eig.cc, ellipj.cc, environment.cc, error.cc, event-manager.cc, fft.cc,
fft2.cc, fftn.cc, file-io.cc, find.cc, gcd.cc, getgrent.cc,
getpwent.cc, getrusage.cc, gsvd.cc, hash.cc, help.cc, hess.cc,
hex2num.cc, input.cc, inv.cc, jsondecode.cc, jsonencode.cc,
load-path.cc, load-save.cc, lookup.cc, lsode.cc, lu.cc, max.cc,
mgorth.cc, oct-hist.cc, ordqz.cc, ordschur.cc, pager.cc, pr-output.cc,
psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, regexp.cc,
schur.cc, settings.cc, sighandlers.cc, sparse.cc, spparms.cc,
sqrtm.cc, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc,
symbfact.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc, toplev.cc,
tril.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc,
__delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc,
__init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc,
audioread.cc, convhulln.cc, fftw.cc, gzip.cc, ov-cell.cc, ov-class.cc,
ov-classdef.cc, ov-fcn-handle.cc, ov-struct.cc, ov-typeinfo.cc,
ov-usr-fcn.cc, octave.cc, lex.ll, oct-parse.yy, profiler.cc,
andpt-eval.cc.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Aug 2021 22:48:52 -0400 |
parents | 32c3a5805893 |
children | 81d26e8481a6 |
comparison
equal
deleted
inserted
replaced
29960:939bef0b66e0 | 29961:7d6709900da7 |
---|---|
153 print_usage (); | 153 print_usage (); |
154 | 154 |
155 octave_value retval; | 155 octave_value retval; |
156 | 156 |
157 // Temporarily disable sparse_auto_mutate if set (it's obsolete anyway). | 157 // Temporarily disable sparse_auto_mutate if set (it's obsolete anyway). |
158 octave::unwind_protect_var<bool> restore_var (Vsparse_auto_mutate, false); | 158 unwind_protect_var<bool> restore_var (Vsparse_auto_mutate, false); |
159 | 159 |
160 if (nargin == 1) | 160 if (nargin == 1) |
161 { | 161 { |
162 octave_value arg = args(0); | 162 octave_value arg = args(0); |
163 if (arg.islogical ()) | 163 if (arg.islogical ()) |
172 else if (nargin == 2) | 172 else if (nargin == 2) |
173 { | 173 { |
174 octave_idx_type m = 0; | 174 octave_idx_type m = 0; |
175 octave_idx_type n = 0; | 175 octave_idx_type n = 0; |
176 | 176 |
177 octave::get_dimensions (args(0), args(1), "sparse", m, n); | 177 get_dimensions (args(0), args(1), "sparse", m, n); |
178 | 178 |
179 if (m < 0 || n < 0) | 179 if (m < 0 || n < 0) |
180 error ("sparse: dimensions must be non-negative"); | 180 error ("sparse: dimensions must be non-negative"); |
181 | 181 |
182 retval = SparseMatrix (m, n); | 182 retval = SparseMatrix (m, n); |
205 nargin--; | 205 nargin--; |
206 } | 206 } |
207 | 207 |
208 if (nargin == 5) | 208 if (nargin == 5) |
209 { | 209 { |
210 octave::get_dimensions (args(3), args(4), "sparse", m, n); | 210 get_dimensions (args(3), args(4), "sparse", m, n); |
211 | 211 |
212 if (m < 0 || n < 0) | 212 if (m < 0 || n < 0) |
213 error ("sparse: dimensions must be non-negative"); | 213 error ("sparse: dimensions must be non-negative"); |
214 } | 214 } |
215 | 215 |
216 int k = 0; // index we're checking when index_vector throws | 216 int k = 0; // index we're checking when index_vector throws |
217 try | 217 try |
218 { | 218 { |
219 octave::idx_vector i = args(0).index_vector (); | 219 idx_vector i = args(0).index_vector (); |
220 k = 1; | 220 k = 1; |
221 octave::idx_vector j = args(1).index_vector (); | 221 idx_vector j = args(1).index_vector (); |
222 | 222 |
223 if (args(2).islogical ()) | 223 if (args(2).islogical ()) |
224 retval = SparseBoolMatrix (args(2).bool_array_value (), i,j, | 224 retval = SparseBoolMatrix (args(2).bool_array_value (), i,j, |
225 m, n, summation, nzmax); | 225 m, n, summation, nzmax); |
226 else if (args(2).iscomplex ()) | 226 else if (args(2).iscomplex ()) |
230 retval = SparseMatrix (args(2).array_value (), i, j, | 230 retval = SparseMatrix (args(2).array_value (), i, j, |
231 m, n, summation, nzmax); | 231 m, n, summation, nzmax); |
232 else | 232 else |
233 err_wrong_type_arg ("sparse", args(2)); | 233 err_wrong_type_arg ("sparse", args(2)); |
234 } | 234 } |
235 catch (octave::index_exception& ie) | 235 catch (index_exception& ie) |
236 { | 236 { |
237 // Rethrow to allow more info to be reported later. | 237 // Rethrow to allow more info to be reported later. |
238 ie.set_pos_if_unset (2, k+1); | 238 ie.set_pos_if_unset (2, k+1); |
239 throw; | 239 throw; |
240 } | 240 } |