Mercurial > repos > laurenmarazzi > netisce_test
view tools/myTools/bin/sfa/analysis/random/structure.py @ 1:7e5c71b2e71f draft default tip
Uploaded
author | laurenmarazzi |
---|---|
date | Wed, 22 Dec 2021 16:00:34 +0000 |
parents | |
children |
line wrap: on
line source
# -*- coding: utf-8 -*- import sfa from .base import BaseRandomBatchSimulator class RandomStructureBatchSimulator(BaseRandomBatchSimulator): def __init__(self, *args, nswap=10, nflip=10, noself=True, **kwargs): super().__init__(*args, **kwargs) self._nswap = nswap self._nflip = nflip self._noself = noself def _randomize(self): B = sfa.rand_flip(self._A, self._nflip) B = sfa.rand_swap(B, self._nswap, self._noself) ir, ic = B.nonzero() self._W[ir, ic] = B[ir, ic] # end of class