Class: Algebra::MatrixAlgebraQuint

Inherits:
MatrixAlgebraTriplet show all
Defined in:
lib/algebra/matrix-algebra-triplet.rb

Instance Attribute Summary collapse

Attributes inherited from MatrixAlgebraTriplet

#body, #ground, #left, #right

Instance Method Summary collapse

Methods inherited from MatrixAlgebraTriplet

#[], #csize, #display, #each_i, #each_j, #left_eliminate!, #row!, #rsize

Methods included from ElementaryDivisor

#_coeff, #e_diagonalize, #e_diagonalize!, #e_inverse, #el_sweep!, #el_sweep_old!, #elementary_divisor, factorize, #horizontal_sweep!, #sq_find_nondiv, #vertical_sweep!

Methods included from GaussianElimination

#divide_c, #divide_r, #kernel_basis, #left_eliminate!, #left_eliminate_euclidian!, #left_inverse, #left_sweep, #mix_c, #mix_r, #multiply_c, #multiply_r, #step_matrix?, #swap_c, #swap_r

Constructor Details

#initialize(matrix, left = nil, right = nil, lefti = nil, righti = nil) ⇒ MatrixAlgebraQuint

Returns a new instance of MatrixAlgebraQuint.



200
201
202
203
204
# File 'lib/algebra/matrix-algebra-triplet.rb', line 200

def initialize(matrix, left = nil, right = nil, lefti = nil, righti = nil)
  super(matrix, left, right)
  @lefti = lefti ? lefti : @left_type.unity
  @righti = righti ? righti : @right_type.unity
end

Instance Attribute Details

#leftiObject (readonly)

Returns the value of attribute lefti.



199
200
201
# File 'lib/algebra/matrix-algebra-triplet.rb', line 199

def lefti
  @lefti
end

#rightiObject (readonly)

Returns the value of attribute righti.



199
200
201
# File 'lib/algebra/matrix-algebra-triplet.rb', line 199

def righti
  @righti
end

Instance Method Details

#divide_c!(j, c) ⇒ Object



257
258
259
260
# File 'lib/algebra/matrix-algebra-triplet.rb', line 257

def divide_c!(j, c)
  @righti.multiply_r!(j, c)
  super
end

#divide_r!(i, c) ⇒ Object



252
253
254
255
# File 'lib/algebra/matrix-algebra-triplet.rb', line 252

def divide_r!(i, c)
  @lefti.multiply_c!(i, c)
  super
end

#dupObject



212
213
214
# File 'lib/algebra/matrix-algebra-triplet.rb', line 212

def dup
  self.class.new(body.dup, left.dup, right.dup, lefti.dup, righti.dup)
end

#mix_c!(i, j, c = nil) ⇒ Object



267
268
269
270
# File 'lib/algebra/matrix-algebra-triplet.rb', line 267

def mix_c!(i, j, c = nil)
  @righti.mix_r!(j, i, c ? -c : -1)
  super
end

#mix_r!(i, j, c = nil) ⇒ Object



262
263
264
265
# File 'lib/algebra/matrix-algebra-triplet.rb', line 262

def mix_r!(i, j, c = nil)
  @lefti.mix_c!(j, i, c ? -c : -1)
  super
end

#multiply_c!(j, c) ⇒ Object



247
248
249
250
# File 'lib/algebra/matrix-algebra-triplet.rb', line 247

def multiply_c!(j, c)
  @righti.divide_r!(j, c)
  super
end

#multiply_r!(i, c) ⇒ Object



242
243
244
245
# File 'lib/algebra/matrix-algebra-triplet.rb', line 242

def multiply_r!(i, c)
  @lefti.divide_c!(i, c)
  super
end

#replace(other) ⇒ Object



221
222
223
224
# File 'lib/algebra/matrix-algebra-triplet.rb', line 221

def replace(other)
  initialize(other.body, other.left, other.right, other.lefti, other.righti)
  self
end

#sswap_r!(i, j) ⇒ Object

ElementaryOpeartion



227
228
229
230
# File 'lib/algebra/matrix-algebra-triplet.rb', line 227

def sswap_r!(i, j)
  @lefti.swap_c!(i, j) # sswap_c doesn't exist
  super
end

#swap_c!(i, j) ⇒ Object



237
238
239
240
# File 'lib/algebra/matrix-algebra-triplet.rb', line 237

def swap_c!(i, j)
  @righti.swap_r!(i, j)
  super
end

#swap_r!(i, j) ⇒ Object



232
233
234
235
# File 'lib/algebra/matrix-algebra-triplet.rb', line 232

def swap_r!(i, j)
  @lefti.swap_c!(i, j)
  super
end

#to_aryObject Also known as: to_a



206
207
208
# File 'lib/algebra/matrix-algebra-triplet.rb', line 206

def to_ary
  [body, left, right, lefti, righti]
end

#transposeObject



216
217
218
219
# File 'lib/algebra/matrix-algebra-triplet.rb', line 216

def transpose
  self.class.new(body.transpose, right.transpose, left.transpose,
                 righti.transpose, lefti.transpose)
end