comparison src/DLD-FUNCTIONS/find.cc @ 10840:89f4d7e294cc

Grammarcheck .cc files
author Rik <octave@nomad.inbox5.com>
date Sat, 31 Jul 2010 11:18:11 -0700
parents 9e6aed3c6704
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
10839:65bc065bec95 10840:89f4d7e294cc
336 return retval; 336 return retval;
337 } 337 }
338 338
339 DEFUN_DLD (find, args, nargout, 339 DEFUN_DLD (find, args, nargout,
340 "-*- texinfo -*-\n\ 340 "-*- texinfo -*-\n\
341 @deftypefn {Loadable Function} {} find (@var{x})\n\ 341 @deftypefn {Loadable Function} {} find (@var{x})\n\
342 @deftypefnx {Loadable Function} {} find (@var{x}, @var{n})\n\ 342 @deftypefnx {Loadable Function} {} find (@var{x}, @var{n})\n\
343 @deftypefnx {Loadable Function} {} find (@var{x}, @var{n}, @var{direction})\n\ 343 @deftypefnx {Loadable Function} {} find (@var{x}, @var{n}, @var{direction})\n\
344 Return a vector of indices of nonzero elements of a matrix, as a row if\n\ 344 Return a vector of indices of nonzero elements of a matrix, as a row if\n\
345 @var{x} is a row or as a column otherwise. To obtain a single index for\n\ 345 @var{x} is a row or as a column otherwise. To obtain a single index for\n\
346 each matrix element, Octave pretends that the columns of a matrix form one\n\ 346 each matrix element, Octave pretends that the columns of a matrix form one\n\
347 long vector (like Fortran arrays are stored). For example,\n\ 347 long vector (like Fortran arrays are stored). For example:\n\
348 \n\ 348 \n\
349 @example\n\ 349 @example\n\
350 @group\n\ 350 @group\n\
351 find (eye (2))\n\ 351 find (eye (2))\n\
352 @result{} [ 1; 4 ]\n\ 352 @result{} [ 1; 4 ]\n\
353 @end group\n\ 353 @end group\n\
354 @end example\n\ 354 @end example\n\
355 \n\ 355 \n\
356 If two outputs are requested, @code{find} returns the row and column\n\ 356 If two outputs are requested, @code{find} returns the row and column\n\
357 indices of nonzero elements of a matrix. For example,\n\ 357 indices of nonzero elements of a matrix. For example:\n\
358 \n\ 358 \n\
359 @example\n\ 359 @example\n\
360 @group\n\ 360 @group\n\
361 [i, j] = find (2 * eye (2))\n\ 361 [i, j] = find (2 * eye (2))\n\
362 @result{} i = [ 1; 2 ]\n\ 362 @result{} i = [ 1; 2 ]\n\
363 @result{} j = [ 1; 2 ]\n\ 363 @result{} j = [ 1; 2 ]\n\
364 @end group\n\ 364 @end group\n\
365 @end example\n\ 365 @end example\n\
366 \n\ 366 \n\
367 If three outputs are requested, @code{find} also returns a vector\n\ 367 If three outputs are requested, @code{find} also returns a vector\n\
368 containing the nonzero values. For example,\n\ 368 containing the nonzero values. For example:\n\
369 \n\ 369 \n\
370 @example\n\ 370 @example\n\
371 @group\n\ 371 @group\n\
372 [i, j, v] = find (3 * eye (2))\n\ 372 [i, j, v] = find (3 * eye (2))\n\
373 @result{} i = [ 1; 2 ]\n\ 373 @result{} i = [ 1; 2 ]\n\
383 \"last\", requesting only the first or last @var{n} indices, respectively.\n\ 383 \"last\", requesting only the first or last @var{n} indices, respectively.\n\
384 However, the indices are always returned in ascending order.\n\ 384 However, the indices are always returned in ascending order.\n\
385 \n\ 385 \n\
386 Note that this function is particularly useful for sparse matrices, as\n\ 386 Note that this function is particularly useful for sparse matrices, as\n\
387 it extracts the non-zero elements as vectors, which can then be used to\n\ 387 it extracts the non-zero elements as vectors, which can then be used to\n\
388 create the original matrix. For example,\n\ 388 create the original matrix. For example:\n\
389 \n\ 389 \n\
390 @example\n\ 390 @example\n\
391 @group\n\ 391 @group\n\
392 sz = size(a);\n\ 392 sz = size(a);\n\
393 [i, j, v] = find (a);\n\ 393 [i, j, v] = find (a);\n\