Skip to content

Instantly share code, notes, and snippets.

View MpoMp's full-sized avatar

Michalis Bogdanos MpoMp

View GitHub Profile
@MpoMp
MpoMp / yale_column_sum.rb
Created March 14, 2014 10:47
Usage of inject on yale NMatrix
require 'nmatrix'
b = NMatrix.new([4, 3], [1, 2, 3, 4, 5, 6, 7, 7, 7, 8, 9, 10])
c = NMatrix.new([4, 3], stype: :yale, default: 0)
c[0,0] = 1
c[1,1] = 2
c[2,2] = 4
c[3,2] = 8
puts b
@MpoMp
MpoMp / norm @ math.rb
Created March 8, 2014 15:24
First attempt @ norm implementation
#
# call-seq:
# norm -> Numeric
#
# Calculates the selected norm (defaults to Frobenius norm) of a 2D matrix.
#
# This should be used for small or medium sized matrices.
# For greater matrices, there should be a separate implementation where
# the norm is estimated, not computed.
#
@MpoMp
MpoMp / Gem install log (failed)
Created March 8, 2014 08:40
Failed nmatrix gem installation
have_library: checking for main() in -llapack... -------------------- yes
"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -Wall -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall -fno-strict-aliasing -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -rdynamic -Wl,-export-dynamic -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */