|
16 | 16 |
|
17 | 17 | class PGVertex(pgraph.UVertex): |
18 | 18 |
|
19 | | - nvertices = 0 |
| 19 | + nvertices = 0 # reset this before each PGGraph build |
20 | 20 |
|
21 | 21 | def __init__(self, type, **kwargs): |
22 | 22 | super().__init__(**kwargs) |
@@ -160,6 +160,7 @@ def __init__(self, filename, lidar=False, verbose=False): |
160 | 160 |
|
161 | 161 | self.vindex = {} |
162 | 162 | firstlidar = True |
| 163 | + PGVertex.nvertices = 0 # reset vertex counter in PGVertex class |
163 | 164 | for line in f: |
164 | 165 | # for zip file, we get data as bytes not str |
165 | 166 | if isinstance(line, bytes): |
@@ -479,13 +480,19 @@ def linearize_and_solve(self): |
479 | 480 | jslice = slice(j * 3, (j + 1) * 3) |
480 | 481 |
|
481 | 482 | # accumulate the blocks in H and b |
482 | | - H[islice, islice] += Hii |
483 | | - H[jslice, jslice] += Hjj |
484 | | - H[islice, jslice] += Hij |
485 | | - H[jslice, islice] += Hij.T |
486 | | - |
487 | | - b[islice, 0] += bi |
488 | | - b[jslice, 0] += bj |
| 483 | + try: |
| 484 | + H[islice, islice] += Hii |
| 485 | + H[jslice, jslice] += Hjj |
| 486 | + H[islice, jslice] += Hij |
| 487 | + H[jslice, islice] += Hij.T |
| 488 | + |
| 489 | + b[islice, 0] += bi |
| 490 | + b[jslice, 0] += bj |
| 491 | + except ValueError: |
| 492 | + print("linearize_and_solve failed") |
| 493 | + print(v) |
| 494 | + print(H.shape, b.shape, Hii.shape, Hjj.shape, Hij.shape) |
| 495 | + print(islice, jslice) |
489 | 496 |
|
490 | 497 | etotal += np.inner(e, e) |
491 | 498 |
|
|
0 commit comments