similar to: Passing lists between functions

Displaying 20 results from an estimated 10000 matches similar to: "Passing lists between functions"

2012 Aug 06
2
Identify points that lie within polygon
I have a complex 2D polygon with thousands of vertices, and I'd like to be able to identify points from a large set contained within the polygon, and was wondering if there might be an efficient way of doing this? Any advice would be useful! Here is a small example of what I mean: # make polygon v1<-c(0,1,1,2,1,3,6,7) v2<-c(1,3,3,5,6,7,8,9) plot(v1, v2, type = "n" )
2012 Feb 09
1
Row-wise kronecker product with Matrix package
I'm trying to calculate the row-wise kronecker product A \Box B of two sparse matrices A and B, and am struggling to find a quick way to do this that takes advantage of sparseness. I thought a good idea would be to use "rep" to construct 2 matrices of the same dimension of the end product, and multiply these two together: library(Matrix) A<-Matrix(c(1,0,0,0,0,1,2,0), 2, 4)
2007 Mar 20
1
Passing Arguments to before_filter
I want to put a before_filter in application.rb, as follows: before_filter :do_something, :except_controller => [:admin] def do_something(options) options.stringify_keys! unless options[:except_controller].include?(controller_name) # do something useful end end Where I''m blocking is on how to get the ''options'' data in the do_something method. I think I
2015 Jul 16
3
[LLVMdev] why LoopUnswitch pass does not constant fold conditional branch and merge blocks
Hi, I have a general question on LoopUnswtich pass. Consider the following IR snippet: define i32 @test(i1 %cond) { br label %loop_begin loop_begin: br i1 %cond, label %loop_body, label %loop_exit loop_body: br label %do_something do_something: call void @some_func() noreturn nounwind br label %loop_begin loop_exit: ret i32 0 } declare void @some_func() noreturn After running
2005 Nov 03
3
newbie graphics question: Two density plots in same frame ?
I swear I've scoured the help files and several texts before posting what feels like a dumb newbie question. How can I draw two kernel density plots in the same frame ? I have similar variables in two separate data frames, and I would like to show their two histograms/densities in a single picture. Same units, scale, range for both, so I'm simply trying to draw one and then add the
2006 May 17
9
Render No Layout?
Hi guys, Am having a problem. I have this def in my index controller that works like this: def do_something $a = variable1 $b = variable2 $c = variable3 $d = ""<script language=\"Javascript\"> \n new Insertion.Bottom(''#{$c}'', ''#{$a} - #{$b}''); \n </script>" $trigger = "1" render(:partial =>
2010 May 04
3
Idiomatic looping over list name, value pairs in R
Considering the python code: for k, v in d.items(): do_something(k); do_something_else(v) I have the following for R: for (i in c(1:length(d))) { do_something(names(d[i])); do_something_else(d[[i]]) } This does not seem seems idiomatic. What is the best way of doing the same with R? Thanks. Luis
2018 Jun 20
2
[RFC] Removing debug locations from ConstantSDNodes
> On Jun 19, 2018, at 6:36 PM, Reid Kleckner <rnk at google.com> wrote: > > On Tue, Jun 19, 2018 at 5:46 PM Vedant Kumar <vsk at apple.com <mailto:vsk at apple.com>> wrote: > Someone (Reid?) mentioned that we could try sinking constants to their point of first use as an alternative, and (IIUC) create new nodes with distinct DebugLocs for each use of a constant. I
2007 Feb 01
4
Automatically Indexing Associated Models
PROBLEM I have two models, Blog and BlogComment. When a blog is initially created, it has no comments. Upon creation, the title and body are automatically added to the ferret index and directly searchable. However, when a comment is added to a blog, that comment does not get added to the index and is therefore not ferretable. The desired behavior is that when a comment is added to a blog, that the
2018 Jun 20
5
[RFC] Removing debug locations from ConstantSDNodes
FWIW: Debug information on constants feels odd to me. They are just values not something that is executed so conceptually I would not expect them to "happen" at a specific time/place in the program. That said most numbers are copied into registers or stored into memory and that is of course an interesting action. So in the original example I would hope to see debug info on whatever
2008 Oct 07
1
using assign with lists
I am performing many permutations on a data-set with each permutation producing a variable number of results. I thought that the best way to keep track of all this in one object would be with a list ('res.lst'). To address these variable results for each permutation I attempted to construct this list using 'assign'. There is even more nesting than indicated below, but this is a
2018 Apr 09
3
InductiveRangeCheckElimination and BranchProbabilityInfo
Hi, extractRangeChecksFromBranch uses BranchProbabilityInfo to decide whether its worth trying the InductiveRangeCheckElimination transformation. For the following example: void split() { for (int i = 0; i < 100; ++i) { if (i < 99) do_something() else do_something_else() } } But the reported BPI is reported as 50/50 to whether do_something will be called, but we
2018 Jul 28
2
re-throwing an interrupt condition
I don't want to return a value, I want to interrupt the computation, that's why I need to re-throw . But before getting back to the user I want to run some cleanup code. G. On Sat, Jul 28, 2018 at 5:59 PM I?aki ?car <i.ucar86 at gmail.com> wrote: > > El s?b., 28 jul. 2018 a las 18:30, G?bor Cs?rdi > (<csardi.gabor at gmail.com>) escribi?: > > > > Anyone
2011 Jun 09
1
Rcpp and Object Factories
Hello, I'm not exactly sure how to ask this question, but let me give it a shot... Is it possible (easy) to use Rcpp Modules in conjunction with object factories? For example what I am trying to do is something like this: // c++ classes class Foo { public: void do_something() {}; }; class Foo_Factory { public: Foo * create_foo() { return new Foo(); } }; ## R Code
2007 Apr 11
4
Feature request... I think...
Folks- I just started using Mocha and I wanted to try something but I couldn''t get it to work. I''m coming from the Java world, so my approach may not be optimal for Ruby. Say I''m testing a.do_something() which calls b.do_other_thing() twice, but I really don''t want to change b.do_other_thing(), just ''expect'' it to be called twice. I know I
2013 Jan 11
3
Access comonents in lists of lists
Dear R users,I have a list of equally structured lists, how can I access e.g. all 2nd compontents in those sub-lists?An example:lst <- list(rep(list(1:3),3), rep(list(4:6),3))> lst[[1]][[1]][[1]][1] 1 2 3[[1]][[2]][1] 1 2 3[[1]][[3]][1] 1 2 3[[2]][[2]][[1]][1] 4 5 6[[2]][[2]][1] 4 5 6[[2]][[3]][1] 4 5 6What I want to get are all second sub-lists, in this case:[[1]][[2]][1] 1 2
2009 Mar 27
0
[LLVMdev] atomic operations for ARM
Hi, I have reworked my previous example and got something which is accepted by tblgen: let isCall = 1, Defs = [R0, R1, R2, R3, R12, LR, D0, D1, D2, D3, D4, D5, D6, D7, CPSR] in { def ARM_ATOMIC_CMP_SWAP : ABXI<0b1011, (outs GPR:$dst), (ins i32imm:$ptr, i32imm:$old, i32imm:$new), "do_something", [(set GPR:$dst, (atomic_cmp_swap_32
2006 Mar 16
2
question about ajax/rjs and redirection
i don''t even know if this is possible, so I''ll just ask. say I have a remote form. the form data gets submitted to the backend via AJAX. if there is a validation error in the form, i handle that on the AJAX side. however, if the form validates, I''d like to redirect the browser to a different page. Will a redirect_to work with an AJAX call or do I have to handle that
2018 Apr 10
0
InductiveRangeCheckElimination and BranchProbabilityInfo
Adding Maxim On Apr 9, 2018, at 10:06 AM, Sam Parker via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: Hi, extractRangeChecksFromBranch uses BranchProbabilityInfo to decide whether its worth trying the InductiveRangeCheckElimination transformation. For the following example: void split() { for (int i = 0; i < 100; ++i) { if (i < 99)
2011 Jun 09
1
Using a function inside a function
I'm trying to run a function inside a function but get an error message. lst <- list(roots = c("car insurance", "auto insurance"), roots2 = c("insurance"), prefix = c("cheap", "budget"), prefix2 = c("low cost"), suffix = c("quote", "quotes"), suffix2 = c("rate", "rates"), suffix3 =