« first day (554 days earlier)      last day (4620 days later) » 

14:00
That's really the most occurring C++ question on Stack Overflow.
@classdaknokt nvm misunderstood
@KonradRudolph well sieving is faster than trial division
problem is memory
@JohnSmith Not if you only try relevant factors in the first place
Well that is what I was saying earlier with primes<sqrt(n)
but I am trying to figure it out
What you need to do
Is build a human
14:02
any number between 1 and N will have factors only involving numbers below sqrt(N) and at most 1 other prime >sqrt(n)
How does Wolfram|Alpha do it?
well i am doing this for several numbers over a large range
@KianMayne probably parallelized with a giant cache.
> The fastest-known fully proven deterministic algorithm is the Pollard-Strassen method (Pomerance 1982; Hardy et al. 1990).
14:05
yeah i just looked that up but others claim the sieve is best
yeah
my numbers aren't that large though
i am just trying to get at the number of distinct prime factors for each n over 1<=x<=10^12
currently I use a segmented sieve approach but it's taking way too long
It can discover factors of N in O(N^(1/4))
14:09
isn't integer factorization an NP-Hard problem?
i am not familiar with runtimes of that; for 1<=x<=10^12 is that reasonable?
@DeadMG Yes
in that case, expect a very slow runtime for non-trivial numbers
@JohnSmith Recommended Reading: Prime Numbers: A Computational Perspective
There's a £30 hardback used copy on Amazon
looking at the chapter synopses i am not sure this is what i need
my range is very large
and i am doing them all; it's not like it's a problem of trying to factor one really big number
14:12
Does anybody here know how the libstc++ shipping with GCC 4.1 implement std::vector? According to Alain on the question above its size is 28 bytes on a 32 bit system and that is just plain weird
since a straightforward implementation should use only 12 bytes, or 24 at a maximum
(and in fact that’s what other implementations do use)
I don't even know why anyone would use >12 bytes
@JohnSmith I'm sure it would still be an interesting read
@DeadMG Well, you could force size_t to 64 bit. But this isn’t the case here since the max_size uses a 32 bit number. And even then you’d have 24 bytes, not 28.
how about this: given all primes <sqrtN, is there an efficient way to iterate through all combinations of those primes (in terms of exponents) while testing them with primes >sqrtN (only one >sqrtN at most per combination below sqrtN)
as you'd never have two primes >sqrtN multiplied against each other obviously
but you could have a bunch of <sqrtN * one >sqrtN factor
14:20
In other news, I plant my sunflowers soon
@JohnSmith Iterate through all combinations? Now you're in NP territory by default.
sorry not familiar with the NP stuff
but what I mean is that all factorizations from 1 to N can be done with a unique combination of primes
it means "Will take 9999999 years to execute"
every valid combination will ultimately go through all numbers of N
there are exponential numbers of combinations
14:23
only those with a product <=N
i.e., whatever you do, there is no known algorithm that will not take forever for integer factorization
is what i mean
if you could invent one, you would get a Nobel Prize for it
so I'd just steal the best known from Wikipedia or something
well I mean 70+ have done it so far: tinyurl.com/89vh67c
all problems are doable in under a minute
f(n) is actually equivalent to oeis.org/A018892
notice the tau(), hence this divisor stuff
well, what I'd suggest is that that problem is not actually particularly related to integer factorization at all
the reason they give you g(10^6) is because you're supposed to find a shortcut to g(10^12) from there
14:27
10^6 is sqrt of 10^12
usually they give interim values as a way to test your algorithm
so you know you're on the right track
they don't necessarily have any inherent or fundamental relevance to the full thing
right
it has to be related to integer factorization because... there's really no other viable approach honestly
if there is i'd love to know, haha
but there are many ways of approaching it and they all involve factorization
integer factorization is an NP-hard problem, exponential in the input
the equation in that OEIS was part of an earlier problem and that too involved factorization, but smaller range/different context etc
15:02
does gcc 4.8 have thread_local storage?
yeah, there is no info about 4.8
GCC 4.8 hasn't even been released yet, so how can we know?
:3402002 [~/learn/gtk/hello]
$ sudo apt-get install g++
Reading package lists... Done
Building dependency tree
Reading state information... Done
g++ is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 304 not upgraded.
[~/learn/gtk/hello]
$ g++ --version | grep "++"
g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
[~/learn/gtk/hello]
$ _
^ This is probably VERY dumb q, but how do I upgrade to g++ 4.7 in Ubuntu?
build yourself
@classdaknok_t arent there dev snapshots?
@bamboon I don't know, I don't use GCC.
@classdaknok_t sounds complex (read: time consuming)
Then wait for the 4.7 package to appear.
Oh wait that's even more time consuming. :P
@CheersandhthAlf Try sudo apt-get install g++-4.7 but there's no guarantee there are no conflicts.
Btw you can try tab-completion (unless the default dotfile for that is stupid or whatever), so sudo apt-get install g++<TAB> will give you suggestions.
In case it's of interest of you, g++ is in your case a virtual package (think symlink) to package g++-4.6.
@LucDanton will try...
g++                                 g++-4.6
g++-4.4                             g++-4.6-arm-linux-gnueabi
g++-4.4-arm-linux-gnueabi           g++-4.6-arm-linux-gnueabihf
g++-4.4-arm-linux-gnueabihf         g++-4.6-multilib
g++-4.4-multilib                    g++-4.6-multilib-arm-linux-gnueabi
g++-4.5                             g++-arm-linux-gnueabi
g++-4.5-arm-linux-gnueabi           g++-arm-linux-gnueabihf
g++-4.5-arm-linux-gnueabihf         g++-multilib
g++-4.5-multilib
he he. but no 4.7 there
Oops, I might have access to it from a Debian repository then.
That is indeed the case.
Then I think you have to go with the aforementioned PPA.
fuck me, I am on a roll today
fixed MOST OF THE BUGS
We'd rather not.
And I haven't done a thing today!
15:22
eckk
@CatPlusPlus well I've added the ppa and done apt-get update. tab completion still doesn't show g++ 4.7, and the help says just "now you're ready to install software from the ppa!" -- but how do i do that?
apt-get install g++-4.7
Or gcc-4.7.
$ sudo apt-get install g++-4.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package g++-4.7
E: Couldn't find any package by regex 'g++-4.7'
[~/learn/gtk/hello]
$
?
note to anybody: i haven't worked in *nix-land since like 1986 or thereabouts, disregarding the net surfing on Unix terminal I had in my office in the 90's
Package is called gcc-4.7.
oh let me try... :-)
15:31
@CatPlusPlus Sure?
2
Q: Where can I find a g++ 4.7 package?

GriwesSome time ago, I managed to find PPA featuring g++-4.7 build. However, I had to reinstall everything on my machine and I lost name of that PPA. Could anyone point me to it? I tried to find it again, but without any luck. I'm on Ubuntu 11.10 installation.

ah, same solution :)
argh it no work
@CheersandhthAlf You first need to add the repository … see link above
7 mins ago, by Cheers and hth. - Alf
@CatPlusPlus well I've added the ppa and done apt-get update. tab completion still doesn't show g++ 4.7, and the help says just "now you're ready to install software from the ppa!" -- but how do i do that?
15:33
hm, ok
that’s what I get for interrupting in the middle of a conversation
I did
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
it seemed to work, it responded with text and a question
sudo apt-get update && sudo apt-get install gcc-4.7 should really be it after that.
You are about to add the following PPA to your system:
 Toolchain test builds
 Toolchain test builds; see wiki.ubuntu.com/ToolChain

 More info: launchpad.net/~ubuntu-toolchain-r/+archive/test
Press [ENTER] to continue or ctrl-c to cancel adding it

Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /tmp/tmp.4oyBMp0k4W --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://keyserver.ubuntu.com:80/ --recv 60C317803A41BA51845E371A1E9377A2BA9EF27F
Did you press Enter?
yes
i now tried your command
15:36
That's when you ended with "now you're ready to install software from the ppa!" then I suppose.
Ign ppa.launchpad.net oneiric/main Translation-en_US
Ign ppa.launchpad.net oneiric/main Translation-en
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gcc-4.7
E: Couldn't find any package by regex 'gcc-4.7'
[~/learn/gtk/hello]
$
It's not fetching information from the PPA.
@LucDanton no that's in the popup box on the web page
I'm not sure how to diagnose failures of apt-get update.
Hm, I'll just have to wait till that package somehow appears wherever it is that my apt-get looks, then
Probably
15:41
In this case the relevant bit is that Ign which means the software source (here the PPA) was ignored.
I usually see that when network failures are involved.
I can do an update again and post the full list on pastebin?
^ Not a new command, it's the same as I pasted end of
It seems that network works ok
@cat: very thanks for the PPA anyway! & I learned some stuff
@young skywalker: & thanks for the guidance ;-)
@CheersandhthAlf I think you've done all the steps correctly. I don't know why the packages don't appear, or aren't there.
^ he he, people don't like missing xp support in msvc 11.0!
idea!
i need some help on this
15:51
would there be a way to use a sort of binary search/cost function
@JohnSmith code please
lets say i want to find the prime factorization of x
i can list out, given x, all necessary primes
for instance, consider 100
at best, it'll use some combination of primes from [2,3,5,7] and, at most, one prime from [11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97]
so the idea is to test exponents until we get our 100
would there be some way to use a sort of binary cost function
by saying "well these exponents suck" so let's tweak these by this much
test that result, etc.
until we get closer and closer to 100
am i making sense at all
yeah, but i don't think that is possible
primes display very few patterns or system
the most i know about is called "Ulam's rose", you can look it up
so iterative will in general not work
if it did, it think it could be used to break current crypto systems
well 70 people have done it so far
so there must be a way
i think the puppy's advice is probably right on here. that there must be some mathematical more direct way. and that the given info is like a stepping stone for that.
16:01
i don't think so... current evidence overwhelmingly points towards factorization
Thank you all for your answers! @Tony The Lion I see what you are saying but I think you're not going towards my problem: I want to create a matrix, represented by a value (the length in number of rows) and a pointer to a vector of pointers (i think it is what I'm doing in my "EmptyS" function). Then I want each of these pointers to point to my rows, meaning position 0 of the vector of pointers points to the first row, position 1 to the second and so on. If I try to allocate memory for my vectors (the rows) won't they be pointers? Because Eclipse tells me I have to cast the memory in a pointer — Pedro Lourenço 1 min ago
can anybody even figure out what OP's saying here?
^ Just a square spiral of prime numbers, IIRC.
lol
there has to be a way to tackle this problem
@CheersandhthAlf weak_ptr would be fine there
conveys exactly what that pointer ownership should be, and if the callers are using auto it shouldn't require any re-writing of client code
Oh, that's a factory.. didn't catch that
16:54
@DeadMG small string optimization
@FredOverflow In a std::vector?
@DeadMG Oh, I thought we were talking about std::string lol
Small vector optimization!
i dont see how else to do this problem
it has to be about factorizations
16:57
FACTORIZE ALL THE THINGS
pretty much
in fact pretty much exactly
@TonyTheLion except for the primes, factorizing those is boring
sbi
sbi
@TonyTheLion I think I read a while ago that this is a real problem in China. So bad that the government is actually trying to educate their people about sex.
@sbi Do the Chinese also say "sleep together"? Then it makes total sense, doesn't it? :)
sbi
sbi
@FredOverflow TBH, I forgot most about the reasons I read about. (This is not my problem at all, you know.) I just remember it was a problem. ISTR it being more of a social problem, though, now that I think about. Like the society being rather strict about pre-marriage sex, plus not talking about it. Something like this. ICBWT.
17:00
I didn't know mods get separate notifications for flags. cool.
sbi
sbi
@IntermediateHacker I don't think they do.
Cant tell if error .. or just that many flags. #stackoverflow http://t.co/bFgpFLN8
the mod bar in the pic
So confused
the link just goes back to the status for me
look closely under the text
^ here
@IntermediateHacker I am terrible, that just blended in
didn't take a second look at it
17:05
lol
anyway, what is that? Is it like the admin panel in facebook pages? Can mods control everything?
sbi
sbi
So these two sons of mine spend all afternoon making an animated movie using LEGO and a camera. Now I am stuck with 89 individual JPEG files and a request to turn them into a movie. Does anybody know a tool I could use for this?
Someone on youtube says this: monkeyjam.org
ffmpeg can do that.
If it's only 89 then that crappy Windows Movie Maker should work
Though 89 frames won't make a very long movie.
17:14
@CatPlusPlus Not if they're .1 FPS
Actually,that's still pretty short :(
sbi
sbi
@CatPlusPlus Certainly not. But hey, those are two kids, and it was their own idea.
@sbi If you finish it could you show us?
sbi
sbi
@Pubby Oh, should it? I never had a look at that thing. Does it even come with Win7? Rummages through start menu.
It's part of Live
sbi
sbi
17:16
@CatPlusPlus It hasn't been part of my life so far. (SCNR.)
@sbi IIRC I put together a 200 frame video with it. Don't remember much of the process though.
sbi
sbi
@Pubby I can't seem to find it in Win7.
Well don't bother looking, just use that other software
You have to install Windows Live for Movie Maker.
17:18
I've used EditStudio for video editing before, but trial version puts a watermark on the output.
sbi
sbi
Thanks everybody. I guess I'll have a look at MonkeyJam later tonight. Let's see if I get this to work.
17:37
Rawrrrr, I have a cold and I have a bug. What could get worse!
I am naming a class and I do not know what is the most appropiate to say: Driving log or travel log? It is a log where you will write down where, when etc you have driven
So long as the name is descriptive enough to make sense, it's good.
Yes, but what is the most appropriate? I am not english
does anyone know a better way to tackle this problem
is it better to say travel log or driving log
17:44
Hrm, would you be including other expenses as well? I know that when I travel for work I need to fill out an expenseLog
@JohnSmith what problem is that?
@Viper Driving log if you're just recording where you drive
PE 379
it's about factorization/number of divisors
Call it MyClass.
AbstractSingletonLogFactoryFactoryManager.
@JohnSmith Find some divisor, recursively call the division function, memoizing the primes as you find them?
17:45
MyAbstractSingletonLogFactoryFactoryManager1
tried that Collin but there are way too many
1<=x<=10**12
@Collin It will include the duration, distance etc too....still name it drivinglog?
0
Q: C++ style for header files

synaptikQuestion 1 Suppose I have the following files: main.cpp routine.cpp routine.h Suppose further that main.cpp calls a function routine() that is defined in routine.cpp, but routine.cpp also contains functions that are only used by the routine() function. In other words, routine.cpp contains b...

vote to close?
@JohnSmith Push the divisible things into a queue, adding primes to a list, loop until the queue is empty?
i don't understand
there are too many things to memorize to do it this way
17:47
@PaulManta thanks to you I'm currently writing a data visualization library. :P
Anyone willing to help me with a quick Java Code review? I have an error that I can't pin down.
i am pretty sure the solution involves sieving
because checking for divisors is too costly
if it's ultimately trial and error
sieving is very direct
problem is that the range is huge
@Collin No, not Code Review!
Code Review is for working code.
Bugs are on good old Stack Overflow (after a nearby debugger, of course).
17:49
Yeah. And we're not Java room.
I know that as well, Java room is always barren, and aside from my Syntax all my code is C-like.
@RMartinhoFernandes Ah ok
@HunderingThooves C-like is NOT equal to C, and this is NOT the C room either
so your argument is invalid
Post you question to www.stackoverflow.com
@HunderingThooves Java? C-like? That are the two things here we hate the most.
Well, our C++ code syntax is Pascal-like, so we can't help you.
The issue is too localized and would be removed from SO as such.
My C++ code syntax isn't Pascal-like, more Malbolge-like (or Perl-like, but that's the same).
@HunderingThooves Give it a shot on SO
17:54
@classdaknok_t Again, Code Review is for working code . Don't tell people to post their question on a site that will get it closed.
It's right there on the FAQ.
Whoops, I didn't read the "I have an error that I can't pin down" part.
Nobody will want to debug 1000 lines of code for you on any site.
I will.
If I get a million bucks.
I won't promise that I'll succeed, though.
lol "lol" is an palindrome.
17:58
No kidding.
I'm not kidding.

« first day (554 days earlier)      last day (4620 days later) »