Or I guess that should be broadcast_slices(best_response_dimension, player_dimension, payoff_matrix, players)
On Saturday, September 24, 2016 at 9:38:55 PM UTC-4, Brandon Taylor wrote: > > I guess, but I'm trying to write a generic program where I don't know the > size of the array? I'm trying to find Nash Equilibrium for an n dimensional > array, where the player strategies are along dimensions 1:n-1, and the > players are along dimension n. So: > > equals_max(x) = x .== maximum(x) > > best_response_dimension(payoff_matrix, dimension) = > mapslices(equals_max, payoff_matrix, dimension) > > I'd want to do something like this: > > player_dimension = ndims(payoff_matrix) > other_dimensions = repeat([1], inner = player_dimension - 1) > number_of_players = size(payoff_matrix)[player_dimension] > > > players = reshape(1:number_of_players, other_dimensions..., > number_of_players) > > broadcast_slices(best_response_dimension, payoff_matrix, players) > > On Thursday, September 22, 2016 at 9:00:51 PM UTC-4, Steven G. Johnson > wrote: >> >> At some point, it is simpler to just write loops than to try and express >> a complicated operation in terms of higher-order functions like broadcast. >> >