Sha256: a2cedf40797cbd7a86748b25ffc2695ba79d89fe4ee6777e23ca1a9ee1a947b2

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

require_relative "../gen/erbpp_gsl"

class DefPdf < DefGslModule
  def lookup(h)
    case h
    when FM(name:/_dirichlet_(ln)?pdf$/);       "dirichlet"
    when FM(name:/_multinomial_(ln)?pdf$/);     "multinomial"
    when FM(name:/_discrete_pdf$/);             false
    when FM(name:/_multivariate_gaussian(_log)?_pdf$/); false
    when FM(name:/_pdf$/);                      "mod_func_noloop"
    end
  end

  def define_method(t,**h)
    PdfMethod.new(self, t, **h)
  end

  def to_method_name(s)
    s.sub(/^gsl_ran_(\w+[^_])_?pdf$/,'\1')
  end
end

class PdfMethod < DefGslModuleFunction

  PARAM_DESC = {}
  PARAM_NAMES =
    {
     "double" => %w[a b p n mu nu nu1 nu2 sigma sigma_x sigma_y rho zeta],
     "unsigned int" => %w[n n1 n2 t],
     "size_t" => true,
    }

  def argument_property(type,name)
    if    name == "return";     {output:true, narray:true, pass: :return}
    elsif name == "K";          {} # ignore array size
    elsif /\[\]$/ =~ name;      {input:true, narray:true, pass: :array}
    elsif is_param(type,name);  {input:true, param:true}
    elsif /\*$/ =~ type;        {output:true, narray:true, pass: :pointer}
    else;                       {input:true, narray:true}
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numo-gsl-0.1.2 ext/numo/gsl/pdf/parse_pdf.rb
numo-gsl-0.1.1 ext/numo/gsl/pdf/parse_pdf.rb
numo-gsl-0.1.0 ext/numo/gsl/pdf/parse_pdf.rb