def build_index( cutoff=0.75 )
return unless needs_rebuild?
make_word_list
doc_list = @items.values
tda = doc_list.collect { |node| node.raw_vector_with( @word_list ) }
if $GSL
tdm = GSL::Matrix.alloc(*tda).trans
ntdm = build_reduced_matrix(tdm, cutoff)
ntdm.size[1].times do |col|
vec = GSL::Vector.alloc( ntdm.column(col) ).row
doc_list[col].lsi_vector = vec
doc_list[col].lsi_norm = vec.normalize
end
else
tdm = Matrix.rows(tda).trans
ntdm = build_reduced_matrix(tdm, cutoff)
ntdm.row_size.times do |col|
doc_list[col].lsi_vector = ntdm.column(col) if doc_list[col]
doc_list[col].lsi_norm = ntdm.column(col).normalize if doc_list[col]
end
end
@built_at_version = @version
end