def compute_diffusion_maps(lapl_type, diffusion_map, lambdas, diffusion_time):
<EOL>if lapl_type not in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>warnings.warn("<STR_LIT>")<EOL><DEDENT>vectors = diffusion_map.copy()<EOL>psi = vectors/vectors[:,[<NUM_LIT:0>]]<EOL>diffusion_times = diffusion_time<EOL>if diffusion_time == <NUM_LIT:0>:<EOL><INDENT>lambdas = np.abs(lambdas)<EOL>diffusion_times = np.exp(<NUM_LIT:1.> -  np.log(<NUM_LIT:1> - lambdas[<NUM_LIT:1>:])/np.log(lambdas[<NUM_LIT:1>:]))<EOL>lambdas = lambdas / (<NUM_LIT:1> - lambdas)<EOL><DEDENT>else:<EOL><INDENT>lambdas = np.abs(lambdas)<EOL>lambdas = lambdas ** float(diffusion_time)<EOL><DEDENT>diffusion_map = psi * lambdas<EOL>return diffusion_map<EOL>
Credit to Satrajit Ghosh (http://satra.cogitatum.org/) for final steps