!=============================================================================== ! RPL/2 (R) version 4.0.13 ! Copyright (C) 1989-2010 Dr. BERTRAND Joël ! ! This file is part of RPL/2. ! ! RPL/2 is free software; you can redistribute it and/or modify it ! under the terms of the CeCILL V2 License as published by the french ! CEA, CNRS and INRIA. ! ! RPL/2 is distributed in the hope that it will be useful, but WITHOUT ! ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ! FITNESS FOR A PARTICULAR PURPOSE. See the CeCILL V2 License ! for more details. ! ! You should have received a copy of the CeCILL License ! along with RPL/2. If not, write to info@cecill.info. !=============================================================================== #include "rplftypes.conv.inc" !=============================================================================== ! Fonction renvoyant la valeur de la combinaison C(n,k) !=============================================================================== ! Entrées : ! integer*8 N ! integer*8 K !------------------------------------------------------------------------------- ! Sortie : ! real*8 donnant C(N, K) !------------------------------------------------------------------------------- ! Effets de bord : néant !=============================================================================== subroutine F90COMBINAISON(N, K, RESULTAT) bind(C, name='f90combinaison') use iso_c_binding implicit none integer(rpl_integer8), intent(in) :: K integer(rpl_integer8), intent(in) :: N real(rpl_real8), intent(out) :: RESULTAT real(rpl_real8) GAMMA_LN1 real(rpl_real8) GAMMA_LN2 real(rpl_real8) GAMMA_LN3 interface subroutine F90GAMMALN(X, RESULTAT, SIGNE, ERREUR) use iso_c_binding implicit none real(rpl_real8), intent(in) :: X integer(rpl_integer8), intent(out), optional :: ERREUR real(rpl_real8), intent(out) :: RESULTAT real(rpl_real8), intent(out), optional :: SIGNE end subroutine end interface call F90GAMMALN(dble(N + 1), GAMMA_LN1) call F90GAMMALN(dble(K + 1), GAMMA_LN2) call F90GAMMALN(dble(N - K + 1), GAMMA_LN3) RESULTAT = exp(GAMMA_LN1 - GAMMA_LN2 - GAMMA_LN3) return end subroutine !=============================================================================== ! Fonction renvoyant la valeur de l'arrangement A(n,k) !=============================================================================== ! Entrées : ! integer*8 N ! integer*8 K !------------------------------------------------------------------------------- ! Sortie : ! real*8 donnant A(N, K) !------------------------------------------------------------------------------- ! Effets de bord : néant !=============================================================================== subroutine F90ARRANGEMENT(N, K, RESULTAT) bind(C, name='f90arrangement') use iso_c_binding implicit none integer(rpl_integer8), intent(in) :: K integer(rpl_integer8), intent(in) :: N real(rpl_real8), intent(out) :: RESULTAT real(rpl_real8) GAMMA_LN1 real(rpl_real8) GAMMA_LN2 interface subroutine F90GAMMALN(X, RESULTAT, SIGNE, ERREUR) use iso_c_binding implicit none real(rpl_real8), intent(in) :: X integer(rpl_integer8), intent(out), optional :: ERREUR real(rpl_real8), intent(out) :: RESULTAT real(rpl_real8), intent(out), optional :: SIGNE end subroutine end interface call F90GAMMALN(dble(N + 1), GAMMA_LN1) call F90GAMMALN(dble(N - K + 1), GAMMA_LN2) RESULTAT = exp(GAMMA_LN1 - GAMMA_LN2) return end subroutine ! vim: ts=4