Skip to content

zero divide when using grad rho #572

@DLWoodruff

Description

@DLWoodruff

Ryan is getting zero divide in this code:

            rhos = np.fromiter(
                (
                    abs(costs[s][ndn, i]/loc_denom[s][ndn, i])
                    for i, v in enumerate(node.nonant_vardata_list)
                ),
                dtype="d",
                count=nlens[ndn],
            )

File "/storage/project/r-dmolzahn6-0/rpiansky3/venvs/ph_batts_py310/src/mpi-sppy/mpisppy/extensions/grad_rho.py", line 211, in
abs(costs[s][ndn, i]/loc_denom[s][ndn, i])

Unless someone has a better idea, I am inclined to do an out=np.xxxx with a where=loc_denom[s][ndn, i] != 0

for xxxx, I am inclined to use np.ones(1), but I can see how one might think a large value makes more sense.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions