def __init__(self, wf):
    Assert(isinstance(wf, WaveFunction), 'wf is not WaveFunction')
    super(DensityMatrix, self).__init__(m=wf.m, n=wf.m, dtype=np.complex128)
    wf_data = wf.data
    ro_data = wf_data.dot(wf_data.getH())
    Assert((np.shape(ro_data) == (self.m, self.n)), 'size mismatch')
    self.data = ro_data
    self.states = wf.states
    self.size = np.shape(self.data)[0]
def __init__(self, wf):
    Assert(isinstance(wf, WaveFunction), 'wf is not WaveFunction')
    super(DensityMatrix, self).__init__(m=wf.m, n=wf.m, dtype=np.complex128)
    wf_data = wf.data
    ro_data = wf_data.dot(wf_data.getH())
    Assert((np.shape(ro_data) == (self.m, self.n)), 'size mismatch')
    self.data = ro_data
    self.states = wf.states
    self.size = np.shape(self.data)[0]