counter_key Subroutine

public pure subroutine counter_key(seed, counter, state_seed, stream)

seed と counter から PCG64 の (初期状態 seed, stream) を作る。

Arguments

Type IntentOptional Attributes Name
integer(kind=i32), intent(in) :: seed
integer(kind=i64), intent(in) :: counter(:)
integer(kind=i64), intent(out) :: state_seed
integer(kind=i64), intent(out) :: stream

Called by

proc~~counter_key~~CalledByGraph proc~counter_key counter_key proc~counter_uniform counter_uniform proc~counter_uniform->proc~counter_key proc~seed_random_stream seed_random_stream proc~seed_random_stream->proc~counter_key proc~sample_photo_emission_velocity sample_photo_emission_velocity proc~sample_photo_emission_velocity->proc~counter_uniform proc~secondary_emission_count secondary_emission_count proc~secondary_emission_count->proc~counter_uniform proc~seed_rng seed_rng proc~seed_rng->proc~seed_random_stream proc~sample_photo_ray_slot sample_photo_ray_slot proc~sample_photo_ray_slot->proc~sample_photo_emission_velocity proc~seed_particles_from_config seed_particles_from_config proc~seed_particles_from_config->proc~seed_rng proc~load_or_init_run_state load_or_init_run_state proc~load_or_init_run_state->proc~seed_particles_from_config program~main main program~main->proc~load_or_init_run_state

Source Code

  pure subroutine counter_key(seed, counter, state_seed, stream)
    integer(i32), intent(in) :: seed
    integer(i64), intent(in) :: counter(:)
    integer(i64), intent(out) :: state_seed, stream
    integer(i64) :: lanes(4)
    integer :: lane

    do lane = 1, 4
      lanes(lane) = murmur3_tuple(lane_seed(lane), int(seed, i64), counter)
    end do
    state_seed = ior(ishft(lanes(1), 32), lanes(2))
    stream = ior(ishft(lanes(3), 32), lanes(4))
  end subroutine counter_key