@@ -28,14 +28,14 @@ def initialize
28
28
end
29
29
30
30
class ErrOperationNotDefined < StandardError
31
- def initialize ( op , sc , oc )
32
- super ( "Operation(#{ op } ) can\\ 't be defined: #{ sc } op #{ oc } " )
31
+ def initialize ( vals )
32
+ super ( "Operation(#{ vals [ 0 ] } ) can\\ 't be defined: #{ vals [ 1 ] } op #{ vals [ 2 ] } " )
33
33
end
34
34
end
35
35
36
36
class ErrOperationNotImplemented < StandardError
37
- def initialize ( op , sc , oc )
38
- super ( "Sorry, Operation(#{ op } ) not implemented: #{ sc } op #{ oc } " )
37
+ def initialize ( vals )
38
+ super ( "Sorry, Operation(#{ vals [ 0 ] } ) not implemented: #{ vals [ 1 ] } op #{ vals [ 2 ] } " )
39
39
end
40
40
end
41
41
end
@@ -1066,7 +1066,7 @@ def *(m) # m is matrix or vector or number
1066
1066
def +( m )
1067
1067
case m
1068
1068
when Numeric
1069
- raise ErrOperationNotDefined , "+" , self . class , m . class
1069
+ raise ErrOperationNotDefined , [ "+" , self . class , m . class ]
1070
1070
when Vector
1071
1071
m = self . class . column_vector ( m )
1072
1072
when Matrix
@@ -1093,7 +1093,7 @@ def +(m)
1093
1093
def -( m )
1094
1094
case m
1095
1095
when Numeric
1096
- raise ErrOperationNotDefined , "-" , self . class , m . class
1096
+ raise ErrOperationNotDefined , [ "-" , self . class , m . class ]
1097
1097
when Vector
1098
1098
m = self . class . column_vector ( m )
1099
1099
when Matrix
@@ -1226,7 +1226,7 @@ def **(other)
1226
1226
v , d , v_inv = eigensystem
1227
1227
v * self . class . diagonal ( *d . each ( :diagonal ) . map { |e | e ** other } ) * v_inv
1228
1228
else
1229
- raise ErrOperationNotDefined , "**" , self . class , other . class
1229
+ raise ErrOperationNotDefined , [ "**" , self . class , other . class ]
1230
1230
end
1231
1231
end
1232
1232
@@ -2129,7 +2129,7 @@ def *(x)
2129
2129
when Matrix
2130
2130
Matrix . column_vector ( self ) * x
2131
2131
when Vector
2132
- raise ErrOperationNotDefined , "*" , self . class , x . class
2132
+ raise ErrOperationNotDefined , [ "*" , self . class , x . class ]
2133
2133
else
2134
2134
apply_through_coercion ( x , __method__ )
2135
2135
end
@@ -2180,7 +2180,7 @@ def /(x)
2180
2180
els = @elements . collect { |e | e / x }
2181
2181
self . class . elements ( els , false )
2182
2182
when Matrix , Vector
2183
- raise ErrOperationNotDefined , "/" , self . class , x . class
2183
+ raise ErrOperationNotDefined , [ "/" , self . class , x . class ]
2184
2184
else
2185
2185
apply_through_coercion ( x , __method__ )
2186
2186
end
0 commit comments