-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move place * hack move_place -- to basically ignore the 'move' part * remove _is_constant_index
- Loading branch information
1 parent
c4841c3
commit 2cf8d06
Showing
4 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#[path = "../../lib/rvec.rs"] | ||
mod rvec; | ||
use rvec::RVec; | ||
|
||
#[flux::sig(fn(vec: &mut RVec<_>[100]))] | ||
pub fn test(vec: &mut RVec<RVec<i32>>) { | ||
vec[0] = RVec::new(); | ||
} | ||
|
||
#[flux::sig(fn(&RVec<f32>[@n], usize) -> RVec<f32>[n])] | ||
fn normal(x: &RVec<f32>, w: usize) -> RVec<f32> { | ||
let mut i = 0; | ||
let mut res = RVec::new(); | ||
while i < x.len() { | ||
res.push(x[i] / (w as f32)); | ||
i += 1; | ||
} | ||
res | ||
} | ||
|
||
#[flux::sig(fn (n: usize, centers: &mut RVec<RVec<f32>[n]>[@k], new_centers: RVec<(usize{v: v < k}, (RVec<f32>, usize))>))] | ||
pub fn update_centers_bad( | ||
_n: usize, | ||
centers: &mut RVec<RVec<f32>>, | ||
new_centers: RVec<(usize, (RVec<f32>, usize))>, | ||
) { | ||
for (i, (x, size)) in new_centers { | ||
centers[i] = normal(&x, size) //~ ERROR refinement type | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#[path = "../../lib/rvec.rs"] | ||
mod rvec; | ||
use rvec::RVec; | ||
|
||
#[flux::sig(fn(vec: &mut RVec<_>[100]))] | ||
pub fn test(vec: &mut RVec<RVec<i32>>) { | ||
vec[0] = RVec::new(); | ||
} | ||
|
||
#[flux::sig(fn(&RVec<f32>[@n], usize) -> RVec<f32>[n])] | ||
fn normal(x: &RVec<f32>, w: usize) -> RVec<f32> { | ||
let mut i = 0; | ||
let mut res = RVec::new(); | ||
while i < x.len() { | ||
res.push(x[i] / (w as f32)); | ||
i += 1; | ||
} | ||
res | ||
} | ||
|
||
#[flux::sig(fn (n: usize, centers: &mut RVec<RVec<f32>[n]>[@k], new_centers: RVec<(usize{v: v < k}, (RVec<f32>[n], usize))>))] | ||
pub fn update_centers( | ||
_n: usize, | ||
centers: &mut RVec<RVec<f32>>, | ||
new_centers: RVec<(usize, (RVec<f32>, usize))>, | ||
) { | ||
for (i, (x, size)) in new_centers { | ||
centers[i] = normal(&x, size) | ||
} | ||
} |