def testGram(test):
instance, reference=test[TEST.INSTANCE], test[TEST.REFERENCE]
# usually expect the normalized matrix to be promoted in type complexity
# due to division by column-norm during the process. However there exist
# matrices that treat the problem differently. Exclude the expected pro-
# motion for them.
query=({} if isinstance(instance, (Diag, Eye, Zero))
else {TEST.TYPE_PROMOTION: np.float32})
# account for "extra computation stage" in gram
query[TEST.TOL_POWER]=test.get(TEST.TOL_POWER, 1.) * 2
query[TEST.RESULT_OUTPUT]=instance.gram.array
query[TEST.RESULT_REF]=reference.astype(
np.promote_types(np.float32, reference.dtype)).T.conj().dot(reference)
# ignore actual type of generated gram:
query[TEST.CHECK_DATATYPE]=False
return compareResults(test, query)
################################################## test: T (property)
评论列表
文章目录