@@ -189,12 +189,14 @@ def pretty_print(q) #:nodoc:
189
189
end
190
190
end
191
191
else # dim 2
192
- q . group ( 0 , "\n [\n " , "]" ) do
192
+ q . group ( 0 , "\n [\n " , "]" ) do
193
193
self . each_row . with_index do |row , i |
194
- q . group ( 1 , " [" , "]" ) do
195
- q . seplist ( self . dim > 2 ? row . to_a [ 0 ] : row . to_a , lambda { q . text ", " } , :each_with_index ) { |v , j | q . text v . inspect . rjust ( longest [ j ] ) }
194
+ q . group ( 1 , " [" , "]\n " ) do
195
+ q . seplist ( row . to_a , -> { q . text ", " } , :each_with_index ) do |v , j |
196
+ q . text v . inspect . rjust ( longest [ j ] )
197
+ end
196
198
end
197
- q . breakable
199
+ q . breakable unless i + 1 == self . shape [ 0 ]
198
200
end
199
201
end
200
202
end
@@ -269,14 +271,14 @@ def cols
269
271
end
270
272
271
273
# Return the main diagonal or antidiagonal a matrix. Only works with 2D matrices.
272
- #
274
+ #
273
275
# == Arguments
274
- #
275
- # * +main_diagonal+ - Defaults to true. If passed 'false', then will return the
276
+ #
277
+ # * +main_diagonal+ - Defaults to true. If passed 'false', then will return the
276
278
# antidiagonal of the matrix.
277
- #
279
+ #
278
280
# == References
279
- #
281
+ #
280
282
# * http://en.wikipedia.org/wiki/Main_diagonal
281
283
def diagonal main_diagonal = true
282
284
diag_size = [ cols , rows ] . min
@@ -367,9 +369,9 @@ def complex_dtype?
367
369
368
370
##
369
371
# call-seq:
370
- #
372
+ #
371
373
# object_dtype?() -> Boolean
372
- #
374
+ #
373
375
# Checks if dtype is a ruby object
374
376
def object_dtype?
375
377
dtype == :object
@@ -960,9 +962,9 @@ def inject(sym)
960
962
return self . map_stored . inject ( sym )
961
963
end
962
964
963
- # Returns the index of the first occurence of the specified value. Returns
965
+ # Returns the index of the first occurence of the specified value. Returns
964
966
# an array containing the position of the value, nil in case the value is not found.
965
- #
967
+ #
966
968
def index ( value )
967
969
index = nil
968
970
@@ -972,7 +974,7 @@ def index(value)
972
974
index = yields
973
975
break
974
976
end
975
- end
977
+ end
976
978
977
979
index
978
980
end
@@ -995,7 +997,7 @@ def clone_structure(capacity = nil)
995
997
#
996
998
# call-seq:
997
999
# repeat(count, axis) -> NMatrix
998
- #
1000
+ #
999
1001
# * *Arguments* :
1000
1002
# - +count+ -> how many times NMatrix should be repeated
1001
1003
# - +axis+ -> index of axis along which NMatrix should be repeated
0 commit comments