search for: to_vec

Displaying 20 results from an estimated 20 matches for "to_vec".

Did you mean: iovec
2024 Jun 16
2
slowness when I use a list comprehension
...:length(S_diff2)){ ? sum_squares <- 0 ? for( i in 1:length(vec2)){ ??? sum_squares = sum_squares + ((vec1[(i-1)*ratio_sampling+j] - vec2[i])**2) ? } ? S_diff2[j] <- sum_squares } toc() ## 0.22 sec elapsed which.max(S_diff2) ## 7857 ## 2. with the lists comprehension tic() S_diff2 <- to_vec(for( j in 1:length(S_diff2)) sum(to_vec(for( i in 1:length(vec2)) ((vec1[(i-1)*ratio_sampling+j] - vec2[i])**2)))) toc() ## 25.09 sec elapsed which.max(S_diff2) ## 7857
2024 Jun 16
1
slowness when I use a list comprehension
...(vec2)){ > sum_squares = sum_squares + ((vec1[(i-1)*ratio_sampling+j] - > vec2[i])**2) > } > S_diff2[j] <- sum_squares > } > toc() > ## 0.22 sec elapsed > which.max(S_diff2) > ## 7857 > > ## 2. with the lists comprehension > tic() > S_diff2 <- to_vec(for( j in 1:length(S_diff2)) sum(to_vec(for( i in > 1:length(vec2)) ((vec1[(i-1)*ratio_sampling+j] - vec2[i])**2)))) > toc() > ## 25.09 sec elapsed > which.max(S_diff2) > ## 7857 > > ______________________________________________ > R-help at r-project.org mailing list -- To...
2024 Jun 16
1
slowness when I use a list comprehension
...erse packages that mostly are not base R but sort of a grafted-on other language. So what? Purists don't necessarily do well in the real world. On the topic at hand and speed, I went an looked at the comprehenr package and it is no wonder it is slower. Here is the code Laurent used in calling to_vec: > to_vec function (expr, recursive = TRUE, use.names = FALSE) { res = eval.parent(substitute(comprehenr::to_list(expr))) unlist(res, recursive = recursive, use.names = use.names) }' It does a few things and then calls to_list() to do the actual work. This extra layer may slow it...
2024 Jun 16
1
slowness when I use a list comprehension
...in 1:length(vec2)){ > sum_squares = sum_squares + ((vec1[(i-1)*ratio_sampling+j] - >vec2[i])**2) > } > S_diff2[j] <- sum_squares >} >toc() >## 0.22 sec elapsed >which.max(S_diff2) >## 7857 > >## 2. with the lists comprehension >tic() >S_diff2 <- to_vec(for( j in 1:length(S_diff2)) sum(to_vec(for( i in >1:length(vec2)) ((vec1[(i-1)*ratio_sampling+j] - vec2[i])**2)))) >toc() >## 25.09 sec elapsed >which.max(S_diff2) >## 7857 > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBS...
2024 Jun 16
1
slowness when I use a list comprehension
...:length(S_diff2)){ sum_squares <- 0 for( i in 1:length(vec2)){ sum_squares = sum_squares + ((vec1[(i-1)*ratio_sampling+j] - vec2[i])**2) } S_diff2[j] <- sum_squares } toc() ## 0.22 sec elapsed which.max(S_diff2) ## 7857 ## 2. with the lists comprehension tic() S_diff2 <- to_vec(for( j in 1:length(S_diff2)) sum(to_vec(for( i in 1:length(vec2)) ((vec1[(i-1)*ratio_sampling+j] - vec2[i])**2)))) toc() ## 25.09 sec elapsed which.max(S_diff2) ## 7857 ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat...
2019 Jun 27
0
Re: [PATCH 08/11] Rust bindings: Fix memory management and format the file
...r "s.to_str()?.to_string()\n"; indent 4; - pr "s.to_str().unwrap().to_string()\n"; - indent 3; pr "},\n" | n, FBuffer -> pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n @@ -308,43 +380,129 @@ impl UUID { | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> pr "%s: (*raw).%s,\n" n n | n, FOptPercent -> - pr "%s: if (*raw).%s < 0.0 { None } else { Some((*raw).%s) },\n" n n...
2019 Jun 27
0
[PATCH 4/9] Rust bindings: Add generator of structs
...i::CStr::from_ptr((*raw).%s);\n" n; + indent 4; + pr "s.to_str().unwrap().to_string()\n"; + indent 3; + pr "},\n" + | n, FBuffer -> + pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n + | n, FUUID -> + pr "%s: UUID::new((*raw).%s),\n" n n + | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> + pr "%s: (*raw).%s,\n" n n + | n, FOptPercent -> + pr "%s: if (*raw).%s &lt...
2019 Jun 27
4
Re: [PATCH 9/9] Rust bindings: Complete bindings
Patch 9 is a kind of dumping ground of all kinds of stuff. It may be better to spend some time with git rebase -i trying to work this into more coherent patches. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live
2019 Jun 27
0
[PATCH 9/9] Rust bindings: Complete bindings
...r "s.to_str()?.to_string()\n"; indent 4; - pr "s.to_str().unwrap().to_string()\n"; - indent 3; pr "},\n" | n, FBuffer -> pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n @@ -349,9 +380,14 @@ impl UUID { | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> pr "%s: (*raw).%s,\n" n n | n, FOptPercent -> - pr "%s: if (*raw).%s < 0.0 { None } else { Some((*raw).%s) },\n" n n n...
2019 Jun 27
16
[PATCH 1/9] Rust bindings: Add Rust bindings
From: Hiroyuki_Katsura <hiroyuki.katsura.0513@gmail.com> --- Makefile.am | 4 ++++ configure.ac | 3 +++ generator/Makefile.am | 3 +++ generator/bindtests.ml | 3 +++ generator/bindtests.mli | 1 + generator/main.ml | 5 +++++ generator/rust.ml | 34 ++++++++++++++++++++++++++++++++++ generator/rust.mli | 19 +++++++++++++++++++
2019 Jul 02
16
[PATCH] Add Rust bindings
I fixed the patch I submitted before based on comments, and there are some commits which are merged or divided. So, I will re-send all the patches. Regards, Hiroyuki Katsura
2019 Jun 27
0
[PATCH 7/9] Rust bindings: Complete actions
...mel_name_of_struct n in + pr "struct_list::<Raw%s, %s>(r)" n n + | RHashtable _ -> + (* TODO: free r *) + pr "hashmap(r)" + | RBufferOut _ -> + (* TODO: free r *) + pr "unsafe { slice::from_raw_parts(r, size) }.to_vec()" + ); + pr ")\n"; pr " }\n\n" ) (actions |> external_functions |> sort); pr "}\n" -- 2.20.1 (Apple Git-117)
2019 Jul 20
0
[PATCH] Rust bindings: Add Rust bindings
...t s = ffi::CStr::from_ptr((*raw).%s);\n" n; + indent 5; + pr "s.to_str()?.to_string()\n"; + indent 4; + pr "},\n" + | n, FBuffer -> + pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n + | n, FUUID -> + pr "%s: UUID::new((*raw).%s),\n" n n + | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> + pr "%s: (*raw).%s,\n" n n + | n, FOptPercent -> + pr "%s: if (*raw).%s &lt...
2019 Jul 23
2
Re: [PATCH] Rust bindings: Add Rust bindings
...);\n" n; > + indent 5; > + pr "s.to_str()?.to_string()\n"; > + indent 4; > + pr "},\n" > + | n, FBuffer -> > + pr "%s: slice::from_raw_parts((*raw).%s as *const u8, > (*raw).%s_len).to_vec(),\n" n n n > + | n, FUUID -> > + pr "%s: UUID::new((*raw).%s),\n" n n > + | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> > + pr "%s: (*raw).%s,\n" n n > + | n, FOptPercent -> > +...
2019 Jul 23
0
Re: [PATCH] Rust bindings: Add Rust bindings
...| n, FChar -> + pr "%s: (*raw).%s as i8,\n" n n; + | n, FString -> + pr "%s: char_ptr_to_string((*raw).%s)?,\n" n n; + | n, FBuffer -> + pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n + | n, FUUID -> + pr "%s: UUID::new((*raw).%s),\n" n n + | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> + pr "%s: (*raw).%s,\n" n n + | n, FOptPercent -> + pr "%s: if (*raw).%s &lt...
2019 Jul 20
2
Re: [PATCH] Rust bindings: Add Rust bindings
> Is this just trying if the guestfs can be linked with? Yes. In OCaml bindings, there is the corresponding test( https://github.com/libguestfs/libguestfs/blob/master/ocaml/t/guestfs_010_load.ml). I just mimicked it. If it is not required, I will remove it. divided the generated files and handmade files in rust/src/ directory. I'll send this fixed patch to this mailing list. I'm not
2019 Jul 08
2
Re: [PATCH] Add Rust bindings
On Mon, Jul 08, 2019 at 10:04:57AM +0100, Richard W.M. Jones wrote: >On Mon, Jul 08, 2019 at 10:49:55AM +0200, Martin Kletzander wrote: >> On Mon, Jul 08, 2019 at 10:10:10AM +0200, Pino Toscano wrote: >> >On Saturday, 6 July 2019 13:03:24 CEST Martin Kletzander wrote: >> >>Just one thing, the Cargo.toml includes a version under which the crate would be >>
2019 Jul 29
1
Re: [PATCH] Rust bindings: Add Rust bindings
...| n, FChar -> + pr "%s: (*raw).%s as i8,\n" n n; + | n, FString -> + pr "%s: char_ptr_to_string((*raw).%s)?,\n" n n; + | n, FBuffer -> + pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n + | n, FUUID -> + pr "%s: UUID::new((*raw).%s),\n" n n + | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> + pr "%s: (*raw).%s,\n" n n + | n, FOptPercent -> + pr "%s: if (*raw).%s &lt...
2019 Jul 17
2
[PATCH] Rust bindings: Add Rust bindings
...t s = ffi::CStr::from_ptr((*raw).%s);\n" n; + indent 5; + pr "s.to_str()?.to_string()\n"; + indent 4; + pr "},\n" + | n, FBuffer -> + pr "%s: slice::from_raw_parts((*raw).%s as *const u8, (*raw).%s_len).to_vec(),\n" n n n + | n, FUUID -> + pr "%s: UUID::new((*raw).%s),\n" n n + | n, (FUInt32 | FInt32 | FUInt64 | FInt64 | FBytes) -> + pr "%s: (*raw).%s,\n" n n + | n, FOptPercent -> + pr "%s: if (*raw).%s &lt...
2019 Jul 26
4
Re: [PATCH] Rust bindings: Add Rust bindings
Hi Hiroyuki, sorry for the late reply. Most of the work is definitely nice! There are few notes below, although they are not big issues. I will check this patch once more on monday, especially the rust parts. Otherwise, I'd say that we are close to merging this :) On Tuesday, 23 July 2019 10:37:17 CEST Hiroyuki Katsura wrote: > From: Hiroyuki_Katsura