Module: Eigen::MatrixCommon

Included in:
MatrixComplex, MatrixDouble, MatrixFloat
Defined in:
lib/eigen.rb

Instance Method Summary collapse

Instance Method Details

#[](i, j) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/eigen.rb', line 100

def [](i,j)
  return __get_item__(i,j) if i.is_a?(Numeric) and j.is_a?(Numeric)

  if i == true
    i0, row_size = 0, rows()
  else
    i0, row_size = row_range(i)
  end
  if j == true
    j0, col_size = 0, cols()
  else
    j0, col_size = col_range(j)
  end

  return __get_block__(i0, j0, row_size, col_size)
end

#ref(range0, range1) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/eigen.rb', line 117

def ref(range0, range1)
  if range0 == true
    i0, row_size = 0, rows()
  else
    i0, row_size = row_range(range0)
  end
  if range1 == true
    j0, col_size = 0, cols()
  else
    j0, col_size = col_range(range1)
  end

  return __ref__(i0, j0, row_size, col_size)
end

#to_aObject



132
133
134
135
136
137
138
# File 'lib/eigen.rb', line 132

def to_a
  ret = Array.new(rows())
  (0..(rows()-1)).each{|i|
    ret[i] = __get_row_array__(i)
  }
  ret
end