Project

General

Profile

Bug #7777 ยป matrix.rb.raise.patch

pypypy567 (py _), 02/04/2013 12:28 AM

View differences:

lib/matrix.rb (working copy)
156 156
    end
157 157
    size = (rows[0] || []).size
158 158
    rows.each do |row|
159
      Matrix.Raise ErrDimensionMismatch, "row size differs (#{row.size} should be #{size})" unless row.size == size
159
      raise ErrDimensionMismatch, "row size differs (#{row.size} should be #{size})" unless row.size == size
160 160
    end
161 161
    new rows, size
162 162
  end
......
286 286
  #     => Matrix[[0, 0, 0], [0, 0, 0]]
287 287
  #
288 288
  def Matrix.empty(row_count = 0, column_count = 0)
289
    Matrix.Raise ArgumentError, "One size must be 0" if column_count != 0 && row_count != 0
290
    Matrix.Raise ArgumentError, "Negative size" if column_count < 0 || row_count < 0
289
    raise ArgumentError, "One size must be 0" if column_count != 0 && row_count != 0
290
    raise ArgumentError, "Negative size" if column_count < 0 || row_count < 0
291 291

  
292 292
    new([[]]*row_count, column_count)
293 293
  end
......
446 446
        end
447 447
      end
448 448
    else
449
      Matrix.Raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
449
      raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
450 450
    end
451 451
    self
452 452
  end
......
508 508
        end
509 509
      end
510 510
    else
511
      Matrix.Raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
511
      raise ArgumentError, "expected #{which.inspect} to be one of :all, :diagonal, :off_diagonal, :lower, :strict_lower, :strict_upper or :upper"
512 512
    end
513 513
    self
514 514
  end
......
579 579
      from_row += row_count if from_row < 0
580 580
      from_col += column_count if from_col < 0
581 581
    else
582
      Matrix.Raise ArgumentError, param.inspect
582
      raise ArgumentError, param.inspect
583 583
    end
584 584

  
585 585
    return nil if from_row > row_count || from_col > column_count || from_row < 0 || from_col < 0