Exception: KXI::Exceptions::DimensionMismatchException

Inherits:
Exception
  • Object
show all
Defined in:
lib/kxi/exceptions/dimension_mismatch_exception.rb

Overview

Raised when matrices or vectors are of incompatible dimensions during operation

Instance Method Summary collapse

Constructor Details

#initialize(act, ex) ⇒ DimensionMismatchException

Parameters:

  • act (integer)

    Actual dimension

  • ex (integer)

    Expected dimension



22
23
24
25
26
# File 'lib/kxi/exceptions/dimension_mismatch_exception.rb', line 22

def initialize(act, ex)
	@act = act
	@ex  = ex
	super("Expected dimension #{ex} got #{act}!")
end

Instance Method Details

#actualinteger

Gets the actual dimension

Returns:

  • (integer)

    Actual dimension



15
16
17
# File 'lib/kxi/exceptions/dimension_mismatch_exception.rb', line 15

def actual
	@act
end

#expectedinteger

Gets the expected dimension

Returns:

  • (integer)

    Expected dimension



9
10
11
# File 'lib/kxi/exceptions/dimension_mismatch_exception.rb', line 9

def expected
	@ex
end