Module: CA

Defined in:
lib/carray/io/csv.rb,
lib/carray/io/csv.rb,
lib/carray/io/table.rb,
lib/carray/base/basic.rb,
lib/carray/base/struct.rb,
lib/carray/base/autoload.rb,
lib/carray/autoload/autoload_base.rb,
lib/carray/autoload/autoload_io_csv.rb,
lib/carray/autoload/autoload_math_interp.rb

Defined Under Namespace

Modules: TableMethods Classes: CSVReader, CSVWriter, Gnuplot, Interp, Struct, Union

Class Method Summary collapse

Class Method Details

.each_load_path(name) ⇒ Object

:nodoc:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/carray/base/autoload.rb', line 58

def self.each_load_path (name) # :nodoc:
  autoload_dirs = $:.clone
  if defined? Gem
    autoload_dirs.push File.expand_path(File.join(__FILE__,"..","..",".."))
    accounted = {}
    Gem::Specification.each do |spec|
      if accounted.has_key?(spec.name)
        next
      end
      if spec.name =~ /carray\-/
        spec.require_paths.each do |path|
          if path !~ /^\//
            path = File.join(spec.full_gem_path, path)
          end
          autoload_dirs.push(path)                
        end
        accounted[spec.name] = true
      end
    end
  end
  autoload_dirs.each do |path|
    dir = File.join(path, name)
    if File.directory?(dir)
      Dir.chdir(dir) {
        yield
      }
    end
  end
end

.gnuplot(*argv, &block) ⇒ Object



19
20
21
# File 'lib/carray/graphics/gnuplot.rb', line 19

def CA.gnuplot (*argv, &block)
  CA::Gnuplot.new(*argv, &block)
end

.interp(*argv) ⇒ Object



47
48
49
# File 'lib/carray/math/interp.rb', line 47

def CA.interp (*argv)
  return CA::Interp.new(*argv)
end

.meshgrid(*args) ⇒ Object



1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
# File 'lib/carray/base/basic.rb', line 1077

def self.meshgrid (*args)
  dim = args.map(&:size)
  out = []
  args.each_with_index do |arg, i|
    newdim = dim.dup
    newdim[i] = :%
    out[i] = arg[*newdim].to_ca
  end
  return *out
end

.struct(opt = {}, &block) ⇒ Object



277
278
279
# File 'lib/carray/base/struct.rb', line 277

def self.struct (opt={}, &block)
  return Struct::Builder.new(:struct, opt).define(&block)
end

.union(opt = {}, &block) ⇒ Object



281
282
283
# File 'lib/carray/base/struct.rb', line 281

def self.union (opt={}, &block)
  return Struct::Builder.new(:union, opt).define(&block)
end