Created
April 24, 2013 17:20
-
-
Save pnkfelix/5453865 to your computer and use it in GitHub Desktop.
PJS ParallelMatrix: examples at js shell repl
This file contains hidden or 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
| js> print(new ParallelMatrix([5,5], (i,j) => i+j)) | |
| [[0, 1, 2, 3, 4], | |
| [1, 2, 3, 4, 5], | |
| [2, 3, 4, 5, 6], | |
| [3, 4, 5, 6, 7], | |
| [4, 5, 6, 7, 8]] | |
| js> print(new ParallelMatrix([5,5], (i,j) => i+j).map((n) => 10+n)) | |
| [[10, 11, 12, 13, 14], | |
| [11, 12, 13, 14, 15], | |
| [12, 13, 14, 15, 16], | |
| [13, 14, 15, 16, 17], | |
| [14, 15, 16, 17, 18]] | |
| js> print(new ParallelMatrix([5], [5], (i) => [0,1,2,3,4])) | |
| [[0, 1, 2, 3, 4], | |
| [0, 1, 2, 3, 4], | |
| [0, 1, 2, 3, 4], | |
| [0, 1, 2, 3, 4], | |
| [0, 1, 2, 3, 4]] | |
| js> print(new ParallelMatrix([5,5], (i,j) => 1000+10*i+j)) | |
| [[1000, 1001, 1002, 1003, 1004], | |
| [1010, 1011, 1012, 1013, 1014], | |
| [1020, 1021, 1022, 1023, 1024], | |
| [1030, 1031, 1032, 1033, 1034], | |
| [1040, 1041, 1042, 1043, 1044]] | |
| js> print(new ParallelMatrix([5,5,"int8"], (i,j) => 1000+10*i+j)) | |
| typein:10:0 RangeError: invalid ParallelArray data type specification ("int8") should only occur in grain argument argument | |
| js> print(new ParallelMatrix([5,5], ["int8"], (i,j) => 1000+10*i+j)) | |
| [[-24, -23, -22, -21, -20], | |
| [-14, -13, -12, -11, -10], | |
| [-4, -3, -2, -1, 0], | |
| [6, 7, 8, 9, 10], | |
| [16, 17, 18, 19, 20]] | |
| js> print(new ParallelMatrix([5], [5, "int8"], (i) => new ParallelMatrix([5], (j)=>1000+10*i+j))) | |
| typein:12:0 RangeError: invalid ParallelArray mismatched submatrix returned with shape: [5,any]; expected submatrix with shape: [5,int8] argument | |
| js> print(new ParallelMatrix([5], [5, "int8"], (i) => new ParallelMatrix([5,"int8"], (j)=>1000+10*i+j))) | |
| typein:13:50 RangeError: invalid ParallelArray data type specification ("int8") should only occur in grain argument argument | |
| js> print(new ParallelMatrix([5], [5, "int8"], (i) => new ParallelMatrix([5],["int8"], (j)=>1000+10*i+j))) | |
| print(new ParallelMatrix([5], [5, "int8"], (i) => new ParallelMatrix([5],["int8"], (j)=>1000+10*i+j))) | |
| Assertion failure: pred->stackPosition_ == stackPosition_ + popped, at /Users/fklock/Dev/Mozilla/iontrail-wip/js/src/ion/MIRGraph.cpp:703 | |
| Process js segmentation fault: 11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment