def test_copy_missing_vector(): nobs = 5 k_endog = 3 missing = np.zeros((k_endog, nobs)) missing[0, 0] = 1 missing[:2, 1] = 1 missing[0, 2] = 1 missing[2, 2] = 1 missing[1, 3] = 1 missing[2, 4] = 1 A = np.zeros((k_endog, nobs)) for t in range(nobs): n = int(k_endog - np.sum(missing[:, t])) A[:n, t] = 1. B = np.zeros((k_endog, nobs), order='F') missing = np.asfortranarray(missing.astype(np.int32)) tools.copy_missing_vector(A, B, missing, inplace=True) assert_equal(B, A)
def test_copy_missing_vector(): nobs = 5 k_endog = 3 missing = np.zeros((k_endog, nobs)) missing[0, 0] = 1 missing[:2, 1] = 1 missing[0, 2] = 1 missing[2, 2] = 1 missing[1, 3] = 1 missing[2, 4] = 1 A = np.zeros((k_endog, nobs)) for t in range(nobs): n = int(k_endog - np.sum(missing[:, t])) A[:n, t] = 1. B = np.zeros((k_endog, nobs), order='F') missing = np.asfortranarray(missing.astype(np.int32)) tools.copy_missing_vector(A, B, missing, inplace=True) assert_equal(B, A)