mirror of
https://github.com/xythrez/RustMP.git
synced 2025-09-04 21:52:36 +00:00
Added in potential using keyword and full matrix multiplication example
This commit is contained in:
parent
ab10c5fef3
commit
416b694ef3
2 changed files with 59 additions and 25 deletions
|
@ -40,21 +40,22 @@ fn main() {
|
|||
println!("{:?}", num);
|
||||
}
|
||||
|
||||
let a:Vec<Vec<i32>> = vec![vec![1,2,3],vec![4,5,6],vec![7,8,9]];
|
||||
let a = vec![vec![1,2,3],vec![4,5,6],vec![7,8,9]];
|
||||
let b = vec![vec![3,2,1],vec![6,5,4],vec![9,8,7]];
|
||||
let n = a.len();
|
||||
let mut c = vec![vec![0;n];n];
|
||||
let mut x = 0;
|
||||
par_for! {
|
||||
// I feel like we shouldn't need to capture a here
|
||||
for k in 0..n, capturing a, reduction x#+, {
|
||||
critical! {
|
||||
read a;
|
||||
x += a[1][k]*a[k][0];
|
||||
for i in 0..n {
|
||||
for j in 0..n {
|
||||
let mut x = 0;
|
||||
par_for! {
|
||||
for k in 0..n, using a b, reducing x#+, {
|
||||
x += a[i][k]*b[k][j];
|
||||
}
|
||||
}
|
||||
c[i][j] = x;
|
||||
}
|
||||
}
|
||||
c[1][0] = x;
|
||||
println!("{:?}", c[1][0]);
|
||||
println!("{:?}", c);
|
||||
// let mut local = 0;
|
||||
// par_for! {
|
||||
// for i in 1..32, blocksize 1, capturing numbers, private local, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue