Module: Statsample::NamedMatrix

Includes:
Summarizable
Included in:
CovariateMatrix
Defined in:
lib/statsample/matrix.rb

Overview

Module to add names to X and Y fields

Instance Method Summary collapse

Methods included from Summarizable

#summary

Instance Method Details

#fieldsObject



181
182
183
184
# File 'lib/statsample/matrix.rb', line 181

def fields
raise "Should be square" if !square?
fields_x
end

#fields=(v) ⇒ Object



185
186
187
188
189
# File 'lib/statsample/matrix.rb', line 185

def fields=(v)
raise "Matrix should be square" if !square?
@fields_x=v
@fields_y=v
end

#fields_xObject



198
199
200
# File 'lib/statsample/matrix.rb', line 198

def fields_x
@fields_x||=row_size.times.collect {|i| _("X%d") % i}
end

#fields_x=(v) ⇒ Object



190
191
192
193
# File 'lib/statsample/matrix.rb', line 190

def fields_x=(v)
raise "Size of fields != row_size" if v.size!=row_size
@fields_x=v
end

#fields_yObject



201
202
203
# File 'lib/statsample/matrix.rb', line 201

def fields_y
@fields_y||=column_size.times.collect {|i| _("Y%d") % i}
end

#fields_y=(v) ⇒ Object



194
195
196
197
# File 'lib/statsample/matrix.rb', line 194

def fields_y=(v)
raise "Size of fields != column_size" if v.size!=column_size
@fields_y=v
end

#get_new_nameObject



211
212
213
214
215
# File 'lib/statsample/matrix.rb', line 211

def get_new_name
  @@named_matrix||=0
  @@named_matrix+=1
  _("Matrix %d") % @@named_matrix
end

#nameObject



205
206
207
# File 'lib/statsample/matrix.rb', line 205

def name
  @name||=get_new_name
end

#name=(v) ⇒ Object



208
209
210
# File 'lib/statsample/matrix.rb', line 208

def name=(v)
  @name=v
end