search for: gcd

Displaying 20 results from an estimated 76 matches for "gcd".

Did you mean: gcc
2001 May 10
1
outer
I've just begun playing around with defining functions in R and I'm not really sure what's going on in the following situation. I've defined the following function: gcd <- function(x,y) { x <- as.integer(x); y <- as.integer(y) q <- as.integer(x / y) r <- x - q * y if (r==0) y else gcd(y,r) } As expected, it gives the following results: > gcd(3,2) [1] 1 > gcd(2,4) [1] 2 etc. However, the function behaves strangely with outer: > oute...
2011 Aug 31
2
[LLVMdev] How to place call(s) to functions found in other llvm modules ???
Hello Everyone, I am trying to create two modules in LLVM, where first module contains the definition of a function, gcd in this example and another module contains a call to this function. My example is based on the following tutorial, with a few changes. http://llvm.org/releases/2.6/docs/tutorial/JITTutorial2.html When I execute the verifier pass on my modules, it complains that the 'GCDMain' module is...
2011 Aug 31
2
[LLVMdev] How to place call(s) to functions found in other llvm modules ???
Hi, I tried this as well, using the following line to add function declaration to the caller module. Function::Create(FT, Function::ExternalLinkage, "gcd", mod); Where "FT" is the same as before. And the output produced by the PrintModulePass becomes: ; ModuleID = 'GCDMain' declare i32 @gcd(i32, i32) define i32 @main() { EntryBlock: %tmp = call i32 @gcd(i32 30, i32 50) ret i32 %tmp } But it still fails to WriteBitc...
2011 Aug 31
0
[LLVMdev] How to place call(s) to functions found in other llvm modules ???
On Wed, Aug 31, 2011 at 10:54 AM, Mian M. Hamayun <mian-muhammad.hamayun at imag.fr> wrote: > Hi, > > I tried this as well, using the following line to add function declaration > to the caller module. > > Function::Create(FT, Function::ExternalLinkage, "gcd", mod); > > Where "FT" is the same as before. And the output produced by the > PrintModulePass becomes: > > ; ModuleID = 'GCDMain' > > declare i32 @gcd(i32, i32) > > define i32 @main() { > EntryBlock: >  %tmp = call i32 @gcd(i32 30, i32 50) &g...
2005 Mar 08
2
a==0 vs as.integer(a)==0 vs all.equal(a,0)
...s and when not to. In my line I need exact comparisons of large integer-valued arrays, so I often use as.integer(), but the above seems to tell me that doubles might be better. Consider the following R idiom of Euclid's algorithm for the highest common factor of two positive integers: gcd <- function(a, b){ if (b == 0){ return(a)} return(Recall(b, a%%b)) } If I call this with gcd(10,12), for example, then a%%b is not an integer, so the first line of the function, testing b for being zero, isn't legitimate. OK, so I have some options: (1) stick in "a &lt...
2014 Jun 11
2
[LLVMdev] Help regarding ad new functionality in Backend
...d.b\t{$src2, $dst}", [(set GR8:$dst, (*add *GR8:$src, GR8:$src2)), (implicit SRW)]>; Now here I would like the to replace the add(highlighted) by an arbitrary function say 'foo' (foo will use already defined functions. For eg. foo could be the gcd function evaluating the gcd of two operands and likewise). Note: gcd is just an example. How can this be achieved? -- Pratik -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140611/06825cd1/attachment.htm...
2011 Aug 31
0
[LLVMdev] How to place call(s) to functions found in other llvm modules ???
On Wed, Aug 31, 2011 at 10:00 AM, Mian M. Hamayun <mian-muhammad.hamayun at imag.fr> wrote: > Hello Everyone, > > I am trying to create two modules in LLVM, where first module contains the > definition of a function, gcd in this example and another module contains a > call to this function. You can't reference a global in one module in another module. Either stick with one module, or add a declaration of the function in the second module and call that. -Eli
2008 Aug 29
1
[LLVMdev] Dependence Analysis [was: Flow-Sensitive AA]
...various tests, DeltaTest, in lib/Analysis folder. The >> transformation pass does not need to see these details. > > > I believe some low-level tests should actually not be implemented as a > separate Analysis but placed into Support. For instance, DeltaTest > would > use GCD or other tests on a different set of indexes once constraints > are propagated. This means these tests are called on expressions that > are not necessarily present in the code itself. This requires the GCD Analysis test to provide interface to evaluate expression on demand. SCEV also does...
2010 Jul 27
2
[LLVMdev] Failed to build llvm with gcc 4.3.4 on Solaris x86
Hi, You asked for bug reports on failed build/platforms combinations, here is one: —————— . . . llvm[3]: Compiling TestMain.cpp for Debug+Asserts build llvm[3]: Building Debug+Asserts Archive Library libUnitTestMain.a gmake[3]: Leaving directory `/home/jocke/gcd/llvm/utils/unittest/UnitTestMain' gmake[2]: Leaving directory `/home/jocke/gcd/llvm/utils/unittest' gmake[1]: Leaving directory `/home/jocke/gcd/llvm/utils' gmake[1]: Entering directory `/home/jocke/gcd/llvm/lib/VMCore’ llvm[1]: Building Intrinsics.gen.tmp from Intrinsics.td ld.so.1: tb...
2008 Aug 29
0
[LLVMdev] Dependence Analysis [was: Flow-Sensitive AA]
...ng Patel wrote: [...] > - Put various tests, DeltaTest, in lib/Analysis folder. The > transformation pass does not need to see these details. I believe some low-level tests should actually not be implemented as a separate Analysis but placed into Support. For instance, DeltaTest would use GCD or other tests on a different set of indexes once constraints are propagated. This means these tests are called on expressions that are not necessarily present in the code itself. > - DataDependenceAnalysis will select various dependence tests based > on > user selection. We want a in...
2009 Feb 24
3
All the products of common factors
This is a seemingly simple problem - hopefully someone can help. Problem: we have two integers. We want (1) all the common factors, and (2) all the possible products of these factors. We know how to get (1), but can't figure out a general way to get (2). Example: 40 and 80 have these factors: c(1,2,2,2,5) and c(1,2,2,2,2,5). We can use match() to get the common factors c(1,2,2,2,5). What
2015 Feb 04
1
[PATCH v3 18/18] vhost: vhost_scsi_handle_vq() should just use copy_from_user()
...ndif diff --git a/lib/Makefile b/lib/Makefile index 3c3b30b..1071d06 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -24,7 +24,7 @@ obj-y += lockref.o obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ - gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ + gcd.o lcm.o list_sort.o uuid.o flex_array.o clz_ctz.o \ bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o obj-y += string_helpers.o diff --git a/l...
2015 Feb 04
1
[PATCH v3 18/18] vhost: vhost_scsi_handle_vq() should just use copy_from_user()
...ndif diff --git a/lib/Makefile b/lib/Makefile index 3c3b30b..1071d06 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -24,7 +24,7 @@ obj-y += lockref.o obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ - gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ + gcd.o lcm.o list_sort.o uuid.o flex_array.o clz_ctz.o \ bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o obj-y += string_helpers.o diff --git a/l...
2011 Jan 20
1
Generating time progressing line for Google Earth
...#degrees to radians Radians <- function (degree) { radian = degree * (pi/180.0) return(radian) } #radians to degrees Degrees <- function (radian) { degree = radian * (180.0/pi) return(degree) } # Calculates the distance between two points using the # Spherical Law of Cosines gcd.slc <- function(lon1, lat1, lon2, lat2) { R = 6371.0 # Earth mean radius [km] lon1 = Radians(lon1) lat1 = Radians(lat1) lon2 = Radians(lon2) lat2 = Radians(lat2) d = acos(sin(lat1)*sin(lat2) + cos(lat1)*cos(lat2) * cos(lon2-lon1)) * R ret...
2010 Oct 04
3
vectorizing problem
...aa <- unlist(strsplit(as.character(GPL[i,2]),"\\,")) bb <- rep(as.numeric(as.character(GPL[i,1])), length(aa)) cc <- matrix(c(bb,aa),ncol = 2) extGPL <- rbind(extGPL,cc) } Is there a way to vectorize this? Thanks, Dylan Miracle University of Minnesota GCD Department
2016 Feb 04
2
Resampler set_rate improvements
Hi, These patches improve the resampler set_rate function. The first 2 patches do some cleanups in the GCD calculation and avoid an overflow when calculating the new phase. This patch could probably be simplified if we allowed 64bits operations in speexdsp. The 3rd patch avoid rounding errors in the phase calculation. The problem is that the new rate is calculated with the reduced rate, which can cause...
2009 Jun 17
0
[LLVMdev] Segmentation fault - Kaleidoscope
...ts in code that used to work a few days ago (I'm using svn). This may be unrelated to the problem described below, but perhaps it's the same thing. In my case it seems that creating an ExecutionEngine has changed. I used to do Module* Mod = makeLLVMModule(); // basically create a gcd function verifyModule(*Mod, PrintMessageAction); ExecutionEngine *EE; EE = ExecutionEngine::create(Mod); but I now get 0x0 for EE. The compile command I'm using is g++ -O3 -I ~/llvm/include/ -L ~/llvm bug.cpp `llvm-config --cxxflags --ldflags --libs core jit native` -o bug I not...
2008 Aug 29
5
[LLVMdev] Dependence Analysis [was: Flow-Sensitive AA]
On Aug 21, 2008, at 1:37 AM, Wojciech Matyjewicz wrote: > I am investigating what changes are necessary to add support for > first-class structs and arrays and will prepare a version to check > in as > a LLVM project if there still is interest. We want to model this as an analysis and make following changes. - Rename LoopMemDepAnalysis as DataDependenceAnalysis. Various
2017 Jan 10
4
Default hashing function for integers (DenseMapInfo.h)
...to understand the last sentence. Does it mean that this hash function has been criticized before? Do you also think that it can be improved? I am sorry to insist on that, but I don’t see any advantage of using hash(k) = c * k with c being a primer number. What is important is choosing c such that gcd(c, m) = 1 for any size m of the hash table. This is the case for c = 1. As a consequence, I don’t see any benefit in using c = 37 over c = 1. Moreover, all those hash functions are badly considered for a reason : they behave very poorly when the keys are of the form d * k0 + k1. I really think tha...
2009 Jun 17
3
[LLVMdev] Segmentation fault - Kaleidoscope
Hello, Following the tutorial "Kaleidoscope: Adding JIT and Optimizer Support", I found a Segmentation fault when I try to execute it. I am new in the neighbourhood, so I don't know what is wrong. Could you help me with that? I am working with the last version of LLVM (2.5). The code in chapter 2 and 3 works good, but the code in the chapter 4 did not work. Below are the detail of