comparison liboctave/Sparse.cc @ 7246:f81e80674b9b

[project @ 2007-12-04 15:49:12 by jwe]
author jwe
date Tue, 04 Dec 2007 15:49:12 +0000
parents 22f210ca8cc1
children c5a024013d2d
comparison
equal deleted inserted replaced
7245:d65670971cbc 7246:f81e80674b9b
2160 new_nzmx++; 2160 new_nzmx++;
2161 } 2161 }
2162 2162
2163 if (nr > 1) 2163 if (nr > 1)
2164 { 2164 {
2165 Sparse<LT> tmp (max_idx, 1, new_nzmx); 2165 Sparse<LT> tmp ((max_idx > nr ? max_idx : nr), 1, new_nzmx);
2166 tmp.cidx(0) = 0; 2166 tmp.cidx(0) = 0;
2167 tmp.cidx(1) = new_nzmx; 2167 tmp.cidx(1) = new_nzmx;
2168 2168
2169 octave_idx_type i = 0; 2169 octave_idx_type i = 0;
2170 octave_idx_type ii = 0; 2170 octave_idx_type ii = 0;
2204 2204
2205 lhs = tmp; 2205 lhs = tmp;
2206 } 2206 }
2207 else 2207 else
2208 { 2208 {
2209 Sparse<LT> tmp (1, max_idx, new_nzmx); 2209 Sparse<LT> tmp (1, (max_idx > nc ? max_idx : nc), new_nzmx);
2210 2210
2211 octave_idx_type i = 0; 2211 octave_idx_type i = 0;
2212 octave_idx_type ii = 0; 2212 octave_idx_type ii = 0;
2213 while (ii < nc && c_lhs.cidx(ii+1) <= i) 2213 while (ii < nc && c_lhs.cidx(ii+1) <= i)
2214 ii++; 2214 ii++;
2279 new_nzmx--; 2279 new_nzmx--;
2280 } 2280 }
2281 2281
2282 if (nr > 1) 2282 if (nr > 1)
2283 { 2283 {
2284 Sparse<LT> tmp (max_idx, 1, new_nzmx); 2284 Sparse<LT> tmp ((max_idx > nr ? max_idx : nr), 1, new_nzmx);
2285 tmp.cidx(0) = 0; 2285 tmp.cidx(0) = 0;
2286 tmp.cidx(1) = new_nzmx; 2286 tmp.cidx(1) = new_nzmx;
2287 2287
2288 octave_idx_type i = 0; 2288 octave_idx_type i = 0;
2289 octave_idx_type ii = 0; 2289 octave_idx_type ii = 0;
2322 2322
2323 lhs = tmp; 2323 lhs = tmp;
2324 } 2324 }
2325 else 2325 else
2326 { 2326 {
2327 Sparse<LT> tmp (1, max_idx, new_nzmx); 2327 Sparse<LT> tmp (1, (max_idx > nc ? max_idx : nc), new_nzmx);
2328 2328
2329 octave_idx_type i = 0; 2329 octave_idx_type i = 0;
2330 octave_idx_type ii = 0; 2330 octave_idx_type ii = 0;
2331 while (ii < nc && c_lhs.cidx(ii+1) <= i) 2331 while (ii < nc && c_lhs.cidx(ii+1) <= i)
2332 ii++; 2332 ii++;
2488 } 2488 }
2489 else 2489 else
2490 { 2490 {
2491 if (rhs_nr == 1 && rhs_nc == 1 && n >= 0 && m >= 0) 2491 if (rhs_nr == 1 && rhs_nc == 1 && n >= 0 && m >= 0)
2492 { 2492 {
2493 // No need to do anything if either of the indices
2494 // are empty.
2495
2496 if (n > 0 && m > 0) 2493 if (n > 0 && m > 0)
2497 { 2494 {
2498 idx_i.sort (true); 2495 idx_i.sort (true);
2499 idx_j.sort (true); 2496 idx_j.sort (true);
2500 2497
2595 stmp.cidx(j+1) = kk; 2592 stmp.cidx(j+1) = kk;
2596 } 2593 }
2597 2594
2598 lhs = stmp; 2595 lhs = stmp;
2599 } 2596 }
2597 else
2598 {
2599 // No need to do anything if either of the indices
2600 // are empty.
2601 if (n > 0)
2602 {
2603 octave_idx_type max_row_idx = idx_i_is_colon ?
2604 rhs_nr : idx_i.max () + 1;
2605 octave_idx_type new_nr = max_row_idx > lhs_nr ?
2606 max_row_idx : lhs_nr;
2607 octave_idx_type new_nc = lhs_nc;
2608
2609 lhs = Sparse<LT> (new_nr, new_nc);
2610 }
2611 else if (m > 0)
2612 {
2613 octave_idx_type max_col_idx = idx_j_is_colon ?
2614 rhs_nc : idx_j.max () + 1;
2615 octave_idx_type new_nr = lhs_nr;
2616 octave_idx_type new_nc = max_col_idx > lhs_nc ?
2617 max_col_idx : lhs_nc;
2618
2619 lhs = Sparse<LT> (new_nr, new_nc);
2620 }
2621 }
2600 } 2622 }
2601 else if (n == rhs_nr && m == rhs_nc) 2623 else if (n == rhs_nr && m == rhs_nc)
2602 { 2624 {
2603 if (n > 0 && m > 0) 2625 if (n > 0 && m > 0)
2604 { 2626 {