243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
# File 'lib/csrmatrix.rb', line 243
def build(type, data, = nil)
case type
when "matrix"
self.build_from_matrix(data)
when "row", "rows"
self.build_from_rows(data)
when "array"
self.build_from_array(data)
when "column", "columns"
self.build_from_columns(data)
when "identity", "i", "unit"
if != nil
self.build_identity_matrix(data, )
else
self.build_identity_matrix(data)
end
when "zero"
self.build_zero_matrix(data)
when "csr"
self.build_from_csr(data[0], data[1], data[2], data[3], data[4])
else
raise MatrixTypeException.new, "Bad build type, no build response."
return false;
end
return true;
end
|