JacobUb/matrix

Spec Fails in Crystal version 0.34.0

Closed this issue · 3 comments

Trying to use the Matrix shard, running spec causes below fail:
root@ROB-MSI:/mnt/d/Workspace/matrix# crystal spec --error-trace
error in line 1
Error: while requiring "./spec/matrix_spec.cr"
In spec/matrix_spec.cr:245:21
245 | m.determinant.should be_close(1.25922e+45, 1e40)
^-----
Error: instantiating '(Float64 | Int32 | Nil)#should(Spec::CloseExpectation(Float64, Float64))'
In /usr/share/crystal/src/spec/expectations.cr:446:26
446 | unless expectation.match self
^----
Error: instantiating 'Spec::CloseExpectation(Float64, Float64)#match(Nil)'

In /usr/share/crystal/src/spec/expectations.cr:127:21
127 | (actual_value - @expected_value).abs <= @delta
^
Error: undefined method '-' for Nil

Nil trace:
/usr/share/crystal/src/spec/expectations.cr:127
(actual_value - @expected_value).abs <= @delta

/usr/share/crystal/src/spec/expectations.cr:126
def match(actual_value)

Also seeing a similar error in the transpose function as well.

Running the specs one at a time, there are 3 determinant, 3 rank, and 4 transpose tests that fail all point to line 613 in matrix.cr.
613 | m[i, j] = (pivot * m[i, j] - m[i, k] * m[k, j]) / previous_pivot
^
Error: no overload matches 'Matrix(Int32)#[]=' with types Int32, Int32, Float64
Overloads are:

  • Matrix(T)#[]=(row : Int, column : Int, value : T)
  • Matrix(T)#[]=(index : Int, value : T)

Fixed in 4adb7c9. Thank you for the heads-up.