def _makeScale(self,<EOL>x,<EOL>scale_identity_multiplier=None,<EOL>scale_diag=None,<EOL>scale_tril=None,<EOL>scale_perturb_factor=None,<EOL>scale_perturb_diag=None):
c = scale_identity_multiplier<EOL>d1 = scale_diag<EOL>tril = scale_tril<EOL>v = scale_perturb_factor<EOL>d2 = scale_perturb_diag<EOL>if v is None and d2 is not None:<EOL><INDENT>return None<EOL><DEDENT>if c is None and d1 is None and tril is None:<EOL><INDENT>c = <NUM_LIT:1.><EOL><DEDENT>matrix = np.float32(<NUM_LIT:0.>)<EOL>if c is not None:<EOL><INDENT>matrix += c * self._matrix_diag(np.ones_like(x))<EOL><DEDENT>if d1 is not None:<EOL><INDENT>matrix += self._matrix_diag(np.array(d1, dtype=np.float32))<EOL><DEDENT>if tril is not None:<EOL><INDENT>matrix += np.array(tril, dtype=np.float32)<EOL><DEDENT>if v is not None:<EOL><INDENT>v = np.array(v, dtype=np.float32)<EOL>if v.ndim < <NUM_LIT:2>:<EOL><INDENT>vt = v.T<EOL><DEDENT>else:<EOL><INDENT>vt = np.swapaxes(v, axis1=v.ndim - <NUM_LIT:2>, axis2=v.ndim - <NUM_LIT:1>)<EOL><DEDENT>if d2 is not None:<EOL><INDENT>d2 = self._matrix_diag(np.array(d2, dtype=np.float32))<EOL>right = np.matmul(d2, vt)<EOL><DEDENT>else:<EOL><INDENT>right = vt<EOL><DEDENT>matrix += np.matmul(v, right)<EOL><DEDENT>return matrix<EOL>
Create a scale matrix. Return None if it can not be created.