コード例 #1
0
#!/usr/bin/env python

import numpy
import util

cm = util.CommandManager()
norms = [[], [], []]
for j in xrange(3):
    for i in xrange(17):
        if j == 0:
            mat = 'Stability_caqr_%d_Q' % i
        elif j == 1:
            mat = 'Stability_caqr_%d_IR_Q' % i
        elif j == 2:
            mat = 'Stability_full_%d_3' % i
        mat += '-ata'
        local_store = mat + '_local'
        cm.copy_from_hdfs(mat, local_store + '.mseq')
        cm.parse_seq_file(local_store + '.mseq', local_store + '.txt')
        data = []
        for line in util.parse_matrix_txt(local_store + '.txt'):
            data.append(line)
        matrix = numpy.mat(data) - numpy.identity(10)
        norm = numpy.linalg.norm(matrix, 2)
        print norm
        norms[j].append(norm)

for norm_list in norms:
    print norm_list

コード例 #2
0
ファイル: run_tsqr_ir.py プロジェクト: renderdude/mrsimform
    help='comma separated list of number of map tasks to use for' +
    ' the three jobs')
parser.add_option('-H',
                  '--hadoop',
                  dest='hadoop',
                  default='',
                  help='name of hadoop for Dumbo')
parser.add_option('-q',
                  '--quiet',
                  action='store_false',
                  dest='verbose',
                  default=True,
                  help='turn off some statement printing')

(options, args) = parser.parse_args()
cm = util.CommandManager(verbose=options.verbose)

# Store options in the appropriate variables
in1 = options.input
if in1 == '':
    cm.error('no input matrix provided, use --input')

out = options.out
if out == '':
    # TODO(arbenson): make sure in1 is clean
    out = in1 + '-qir'

sched = options.sched
try:
    sched = [int(s) for s in sched.split(',')]
    sched[1]