Skip to content

Instantly share code, notes, and snippets.

@ryana
Created September 27, 2011 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryana/1244393 to your computer and use it in GitHub Desktop.
Save ryana/1244393 to your computer and use it in GitHub Desktop.
ruby-svd seg fault
require 'ruby-svd'
class MiniPca
def self.go
var_count = 300
doc_count = 100
m = SVDMatrix.new(doc_count, var_count)
doc_count.times do |n|
m.set_row(n, (1..var_count).map {|r| rand(30) })
end
decomp_num = var_count
u, w, v = m.decompose(decomp_num)
end
end
ra:pyramidz ryan$ bundle exec irb
ruby-1.9.2-p180 :001 > load 'lib/mini_pca.rb'
=> true
ruby-1.9.2-p180 :002 > MiniPca.go
/Users/ryan/.rvm/gems/ruby-1.9.2-p180@4seg/gems/ruby-svd-0.5.1/lib/svd_matrix.rb:41: [BUG] Segmentation fault
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.4.0]
-- control frame ----------
c:0026 p:---- s:0109 b:0109 l:000108 d:000108 CFUNC :decompose
c:0025 p:0054 s:0103 b:0103 l:000102 d:000102 METHOD /Users/ryan/.rvm/gems/ruby-1.9.2-p180@4seg/gems/ruby-svd-0.5.1/lib/svd_matrix.rb:41
c:0024 p:0064 s:0092 b:0092 l:000091 d:000091 METHOD /Users/ryan/code/pyramidz/lib/mini_pca.rb:15
c:0023 p:0015 s:0082 b:0082 l:0018a8 d:000081 EVAL (irb):2
c:0022 p:---- s:0080 b:0080 l:000079 d:000079 FINISH
c:0021 p:---- s:0078 b:0078 l:000077 d:000077 CFUNC :eval
c:0020 p:0028 s:0071 b:0071 l:000070 d:000070 METHOD /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80
c:0019 p:0033 s:0064 b:0063 l:000062 d:000062 METHOD /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/context.rb:254
c:0018 p:0031 s:0058 b:0058 l:0022d8 d:000057 BLOCK /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:159
c:0017 p:0042 s:0050 b:0050 l:000049 d:000049 METHOD /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:273
c:0016 p:0011 s:0045 b:0045 l:0022d8 d:000044 BLOCK /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:156
c:0015 p:0144 s:0041 b:0041 l:000024 d:000040 BLOCK /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:243
c:0014 p:---- s:0038 b:0038 l:000037 d:000037 FINISH
c:0013 p:---- s:0036 b:0036 l:000035 d:000035 CFUNC :loop
c:0012 p:0009 s:0033 b:0033 l:000024 d:000032 BLOCK /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:229
c:0011 p:---- s:0031 b:0031 l:000030 d:000030 FINISH
c:0010 p:---- s:0029 b:0029 l:000028 d:000028 CFUNC :catch
c:0009 p:0023 s:0025 b:0025 l:000024 d:000024 METHOD /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:228
c:0008 p:0046 s:0022 b:0022 l:0022d8 d:0022d8 METHOD /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:155
c:0007 p:0011 s:0019 b:0019 l:002708 d:000018 BLOCK /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:70
c:0006 p:---- s:0017 b:0017 l:000016 d:000016 FINISH
c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC :catch
c:0004 p:0183 s:0011 b:0011 l:002708 d:002708 METHOD /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:69
c:0003 p:0177 s:0006 b:0006 l:0014f8 d:001e48 EVAL /Users/ryan/.rvm/rubies/ruby-1.9.2-p180/bin/irb:17
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0014f8 d:0014f8 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/bin/irb:17:in `<main>'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:69:in `start'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:69:in `catch'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:70:in `block in start'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb.rb:159:in `block (2 levels) in eval_input'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/context.rb:254:in `evaluate'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
/Users/ryan/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
(irb):2:in `irb_binding'
/Users/ryan/code/pyramidz/lib/mini_pca.rb:15:in `go'
/Users/ryan/.rvm/gems/ruby-1.9.2-p180@4seg/gems/ruby-svd-0.5.1/lib/svd_matrix.rb:41:in `decompose'
/Users/ryan/.rvm/gems/ruby-1.9.2-p180@4seg/gems/ruby-svd-0.5.1/lib/svd_matrix.rb:41:in `decompose'
-- C level backtrace information -------------------------------------------
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
Abort trap
ra:pyramidz ryan$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment