Modify for mutliple levels of indexing.
This commit is contained in:
parent
33d3e34908
commit
619b627d54
@ -51,7 +51,7 @@ fn bench_eval_array_large_set(bench: &mut Bencher) {
|
|||||||
let script = r#"let x = [ 1, 2.345, "hello", true,
|
let script = r#"let x = [ 1, 2.345, "hello", true,
|
||||||
[ 1, 2, 3, [ "hey", [ "deeply", "nested" ], "jude" ] ]
|
[ 1, 2, 3, [ "hey", [ "deeply", "nested" ], "jude" ] ]
|
||||||
];
|
];
|
||||||
x[4] = 42
|
x[4][3][1][1] = 42
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
let mut engine = Engine::new();
|
let mut engine = Engine::new();
|
||||||
|
@ -16,9 +16,7 @@ fn mat_gen(n) {
|
|||||||
|
|
||||||
for i in range(0, n) {
|
for i in range(0, n) {
|
||||||
for j in range(0, n) {
|
for j in range(0, n) {
|
||||||
let foo = m[i];
|
m[i][j] = tmp * (i.to_float() - j.to_float()) * (i.to_float() + j.to_float());
|
||||||
foo[j] = tmp * (i.to_float() - j.to_float()) * (i.to_float() + j.to_float());
|
|
||||||
m[i] = foo;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,9 +32,7 @@ fn mat_mul(a, b) {
|
|||||||
|
|
||||||
for i in range(0, n) {
|
for i in range(0, n) {
|
||||||
for j in range(0, p) {
|
for j in range(0, p) {
|
||||||
let foo = b2[j];
|
b2[j][i] = b[i][j];
|
||||||
foo[i] = b[i][j];
|
|
||||||
b2[j] = foo;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user