This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'matrix' | |
require './matrix_block_mixin' | |
require './map_reduce' | |
def pair_up(key, value) | |
inputs = [] | |
a = value[:a] | |
b = value[:b] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'matrix' | |
require './matrix_block_mixin' | |
require './map_reduce' | |
require 'benchmark' | |
def map(key, value) | |
inputs = [] | |
a = value[:a] | |
b = value[:b] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Matrix | |
def block(block_row, block_column) | |
raise "Non 2^n matrix" if (row_size & (row_size - 1)) != 0 || (column_size & (column_size - 1)) != 0 | |
lower_order = row_size/2 | |
start_row = block_row * lower_order | |
start_column = block_column * lower_order | |
b = [] | |
lower_order.times do |r| | |
row = [] | |
lower_order.times do |c| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def join(left_block, right_block) | |
rows = [] | |
lower_order = left_block.row_size | |
lower_order.times do |t| | |
rows << left_block.row(t).to_a + right_block.row(t).to_a | |
end | |
rows | |
end | |
def product(a,b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
Gem.clear_paths | |
ENV['GEM_HOME'] = '/home/avishek/jruby/jruby-1.6.4/lib/ruby/gems/1.8' | |
ENV['GEM_PATH'] = '/home/avishek/jruby/jruby-1.6.4/lib/ruby/gems/1.8' | |
require 'basis_processing' | |
class BoxPlotSketch < Processing::App | |
def setup | |
@screen_height = 900 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
Gem.clear_paths | |
ENV['GEM_HOME'] = '/home/avishek/jruby/jruby-1.6.4/lib/ruby/gems/1.8' | |
ENV['GEM_PATH'] = '/home/avishek/jruby/jruby-1.6.4/lib/ruby/gems/1.8' | |
require 'basis_processing' | |
class Demo < Processing::App | |
app = self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
Gem.clear_paths | |
ENV['GEM_HOME'] = '/home/avishek/jruby/jruby-1.6.4/lib/ruby/gems/1.8' | |
ENV['GEM_PATH'] = '/home/avishek/jruby/jruby-1.6.4/lib/ruby/gems/1.8' | |
require 'basis_processing' | |
class Demo < Processing::App | |
app = self |