This page describes the Hama Shell.
Commands
No Format |
---|
Load load the matrix from the matrix file using user specified !MapReduce class.
for example:
hama> a = load "fileA" as Matrix using MyMapReduce.class MAP 10 REDUCE 1;
hama> b = load "fileB" as Matrix using MyMapReduce.class;
Add the matrix addition.
such as :
hama> c = a + b.
Multiply the matrix multiplication.
such as :
hama> d = a * b.
Save save the matrix as a file.
such as :
hama> save c as "fileC".
|
Examples
No Format |
---|
hama > a = load 'fileA' as matrix using bulkload.class map 10;
hama > b = load 'fileB' as matrix;
hama > c = a;
hama > d = (a+b) * (c+a) map 20 reduce 1;
hama > save d as 'fileD'
|
Grammar
No Format |
---|
<hamaexpression> := <expr> ";"
<expr> := <IDENTIFIER> "=" <basicoperation> ["MAP" <integer>] ["REDUCE" <integer>] | "SAVE" <IDENTIFIER> "AS" <filename>
<basicoperation> := <algebraop> | <loadop> | <randmatrixop>
<loadop> := "LOAD" <filename> "AS" <typename> "USING" <classname>
<randmatrixop> := "MATRIX.RANDOM" <integer> <integer>
<algebraop> := <additiveop>
<additiveop> := <multiplicationop> ( ( "+" | "-" ) <multiplicationop> )*
<multiplicationop> := <unaryop> ( "*" <unaryop> )*
<unaryop> := "(" <additiveop> ")" | <IDENTIFIER>
<typename> := "matrix"
<filename> := <quotedstring>
<classname> := <quotedstring>
<quotedstring> := "'"<string>"'"
|
_ Still in work..._