Hello, I am attempting to port the R code which is an answer to https://codegolf.stackexchange.com/questions/194229/implement-the-2d-hadamard-transform
function(M){for(i in 1:log2(nrow(M)))T=T%x%matrix(1-2*!3:0,2)/2; print(T); T%*%M%*%T} The code, 3 inputs and the corresponding outputs are shown in https://tio.run/##PYyxCsIwFEX3fkUcAu@VV7WvcSl2dOwi8QNqNSXQJhAqrYjfHoOIwz3D4XBDNOJYiGgerp@td9Diy/gAVlgnynr0A4MLfkkeUTdarnLq5mBXKAvON1W9J8YdZ1rmsk3T72jgV/TAVBHTAROYrs/00@jz5YSY/aOSFKmvGP1yD9sk4Wa7ARSSRowf These are the inputs. f(matrix(c(2,3,2,5),2,2,byrow=TRUE)) f(matrix(1,4,4)) f(lower.tri(diag(4),T)) My attempt to port this R code to another framework(Tensorflow) was only partially successful because I didn't fully understand the cryptic R code. The second input shown above works after hacking Tensorflow for a long time. My question is this. Can anyone code this in a clear way so that I can understand ? I understand Kronecker Product and matrix multiplication and can port that code but I am missing something as the same ported code does not work for all inputs. Thanks, Mohan [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.