comparison liboctave/array/dSparse.cc @ 17812:fffd0c0ca2dc

maint: A few Octave coding convention tweaks * libinterp/corefcn/rand.cc: Use space before parentheses in %!test function call. * liboctave/array/CSparse.cc: Change "found [...]" to "found[...]". * liboctave/array/dSparse.cc: Change "found [...]" to "found[...]". Use space before parentheses in %!test function call.
author Rik <rik@octave.org>
date Wed, 30 Oct 2013 21:55:14 -0700
parents 49a5a4be04a1
children 35464baa7d99
comparison
equal deleted inserted replaced
17811:ef4fc092c86b 17812:fffd0c0ca2dc
355 return SparseMatrix (nr, nc == 0 ? 0 : 1); 355 return SparseMatrix (nr, nc == 0 ? 0 : 1);
356 356
357 OCTAVE_LOCAL_BUFFER (octave_idx_type, found, nr); 357 OCTAVE_LOCAL_BUFFER (octave_idx_type, found, nr);
358 358
359 for (octave_idx_type i = 0; i < nr; i++) 359 for (octave_idx_type i = 0; i < nr; i++)
360 found [i] = 0; 360 found[i] = 0;
361 361
362 for (octave_idx_type j = 0; j < nc; j++) 362 for (octave_idx_type j = 0; j < nc; j++)
363 for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) 363 for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
364 if (found [ridx (i)] == -j) 364 if (found[ridx (i)] == -j)
365 found [ridx (i)] = -j - 1; 365 found[ridx (i)] = -j - 1;
366 366
367 for (octave_idx_type i = 0; i < nr; i++) 367 for (octave_idx_type i = 0; i < nr; i++)
368 if (found [i] > -nc && found [i] < 0) 368 if (found[i] > -nc && found[i] < 0)
369 idx_arg.elem (i) = -found [i]; 369 idx_arg.elem (i) = -found[i];
370 370
371 for (octave_idx_type j = 0; j < nc; j++) 371 for (octave_idx_type j = 0; j < nc; j++)
372 { 372 {
373 for (octave_idx_type i = cidx (j); i < cidx (j+1); i++) 373 for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
374 { 374 {
506 return SparseMatrix (nr, nc == 0 ? 0 : 1); 506 return SparseMatrix (nr, nc == 0 ? 0 : 1);
507 507
508 OCTAVE_LOCAL_BUFFER (octave_idx_type, found, nr); 508 OCTAVE_LOCAL_BUFFER (octave_idx_type, found, nr);
509 509
510 for (octave_idx_type i = 0; i < nr; i++) 510 for (octave_idx_type i = 0; i < nr; i++)
511 found [i] = 0; 511 found[i] = 0;
512 512
513 for (octave_idx_type j = 0; j < nc; j++) 513 for (octave_idx_type j = 0; j < nc; j++)
514 for (octave_idx_type i = cidx(j); i < cidx(j+1); i++) 514 for (octave_idx_type i = cidx(j); i < cidx(j+1); i++)
515 if (found [ridx (i)] == -j) 515 if (found[ridx (i)] == -j)
516 found [ridx (i)] = -j - 1; 516 found[ridx (i)] = -j - 1;
517 517
518 for (octave_idx_type i = 0; i < nr; i++) 518 for (octave_idx_type i = 0; i < nr; i++)
519 if (found [i] > -nc && found [i] < 0) 519 if (found[i] > -nc && found[i] < 0)
520 idx_arg.elem (i) = -found [i]; 520 idx_arg.elem (i) = -found[i];
521 521
522 for (octave_idx_type j = 0; j < nc; j++) 522 for (octave_idx_type j = 0; j < nc; j++)
523 { 523 {
524 for (octave_idx_type i = cidx (j); i < cidx (j+1); i++) 524 for (octave_idx_type i = cidx (j); i < cidx (j+1); i++)
525 { 525 {
675 return r; 675 return r;
676 } 676 }
677 677
678 /* 678 /*
679 679
680 %!assert(nnz(real(sparse([1i,1]))),1) 680 %!assert (nnz (real (sparse ([1i,1]))), 1)
681 %!assert(nnz(real(sparse([1i,1]))),1) 681 %!assert (nnz (real (sparse ([1i,1]))), 1)
682 682
683 */ 683 */
684 684
685 SparseMatrix 685 SparseMatrix
686 atan2 (const double& x, const SparseMatrix& y) 686 atan2 (const double& x, const SparseMatrix& y)