class AHProcess::AHPMatrix
Attributes
matrix[R]
Public Class Methods
new(matrix = [])
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 11 def initialize(matrix = []) @matrix = Matrix[*matrix] end
Public Instance Methods
<=>(other)
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 15 def <=>(other) @matrix <=> other.matrix end
column_sum()
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 27 def column_sum Vector[*(column_vectors.map { |v| v.inject(:+) })] end
consistency_index()
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 35 def consistency_index (lambda_max - row_count) / (row_count - 1) end
consistency_ratio(random_consistency_index)
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 39 def consistency_ratio(random_consistency_index) consistency_index / random_consistency_index end
lambda_max()
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 31 def lambda_max preference_vector.inner_product column_sum end
normalize()
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 19 def normalize AHPMatrix.new(Matrix.columns(column_vectors.map { |cv| cv / cv.inject(:+).to_f })) end
preference_vector()
click to toggle source
# File lib/ahprocess/ahp_matrix.rb, line 23 def preference_vector Vector[*(normalize.row_vectors.map { |rv| rv.inject(:+).to_f / rv.size })] end