class Array

Public Instance Methods

to_gplot() click to toggle source
# File ../lib/gsl/gnuplot.rb, line 4
def to_gplot
  if ( self[0].kind_of? Array ) then
    tmp = self[0].zip( *self[1..-1] )
    tmp.collect { |a| a.join(" ") }.join("\n") + "\ne"
  elsif ( self[0].kind_of? Numeric ) then
    s = ""
    self.length.times { |i| s << "#{self[i]}\n" }
    s
  elsif ( self[0].kind_of? GSL::Vector ) then
    tmp = self[0].zip( *self[1..-1] )
    tmp.collect { |a| a.join(" ") }.join("\n") + "\ne"
  else
    self[0].zip( *self[1..-1] ).to_gplot
  end
end
to_gsl_integration_qawo_table() click to toggle source
static VALUE rb_gsl_ary_to_integration_qawo_table(VALUE ary)
{
  gsl_integration_qawo_table *t = NULL;
  t = make_qawo_table(ary);
  return Data_Wrap_Struct(cgsl_integration_qawo_table, 
                          0, gsl_integration_qawo_table_free, t);
}
to_gsl_integration_qaws_table() click to toggle source
static VALUE rb_gsl_ary_to_integration_qaws_table(VALUE ary)
{
  gsl_integration_qaws_table *t = NULL;
  t = make_qaws_table(ary);
  return Data_Wrap_Struct(cgsl_integration_qaws_table, 
                          0, gsl_integration_qaws_table_free, t);
}
Also aliased as: to_qaws_table
to_gsl_vector()
Alias for: to_gv
to_gslv()
Alias for: to_gv
to_gsplot() click to toggle source
# File ../lib/gsl/gnuplot.rb, line 19
def to_gsplot
  f = ""
  
  if ( self[0].kind_of? Array ) then
    x = self[0]
    y = self[1]
    d = self[2]

    x.each_with_index do |xv, i|
      y.each_with_index do |yv, j|
        f << [ xv, yv, d[i][j] ].join(" ") << "\n"
      end
      # f << "\n"
    end
  elsif ( self[0].kind_of? Numeric ) then
    self.length.times do |i| f << "#{self[i]}\n" end
  else
    self[0].zip( *self[1..-1] ).to_gsplot
  end
  
  f
end
to_gv() click to toggle source
VALUE rb_ary_to_gv0(VALUE ary)
{
  gsl_vector *v = NULL;
  size_t i, size;
  size = RARRAY_LEN(ary);
  v = gsl_vector_alloc(size);
  if (v == NULL) rb_raise(rb_eNoMemError, "gsl_vector_alloc failed");
  for (i = 0; i < size; i++) {
    gsl_vector_set(v, i, NUM2DBL(rb_ary_entry(ary, i)));
  }
  return Data_Wrap_Struct(cgsl_vector, 0, gsl_vector_free, v);
}
Also aliased as: to_gslv, to_gsl_vector
to_qaws_table()