Sha256: 7853b97e5434bb1d0db8b2d7b141838e6e1d7afdf947594c1c98d4abaeb66ebf

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

module CsrMatrix
    module Operations
        def get_value(index)
            return @val[index]
        end

        def print_full()
            (0...@col_ind.length).each do |iter|
                (0...@col_ind.length).each do |col|
                    if (iter == @row_ptr[iter] and col == @col_ind[iter])
                        print "#{get_value(iter)}  "
                    else
                        print "0  "
                    end
                end
                puts ""
            end    
        end

        def print_sparse()
            (0...@col_ind.length).each do |iter|
                (0...@col_ind.length).each do |col|
                    if (iter == @row_ptr[iter] and col == @col_ind[iter])
                        print "#{get_value(iter)}  "
                    else
                        print "0  "
                    end
                end
                puts ""
            end
        end    
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
csrmatrix-1.0.0 lib/csrmatrix/operations.rb