« first day (208 days earlier)      last day (4740 days later) » 

12:52 AM
wow, it's quiet in here
 
hi friends
 
is there any fumction provided for invrese of matrix in math.h header file?
i need to compute the matrix inverse
is there any function for that in math.h?
?
 
ahh that mean i have to compute myself
 
12:54 AM
but google "matrix functions in standard C" and you'll find everything you need
notably IBM's implementation of a matrix library
 
you mean i can use inverse matrix function using C
ok ok let me try
 
or C++
but IBM's version is in C, IIRC
 
ok thanks friend
 
@ronald : i did not find any matrix function in standard C
 
1:05 AM
You didn't find Meschach?
it's written in portable, standard C
 
ahh that looks terrible
i do't know where is that function .. in which library
 
Here is source code for matrix inversion in Boost uBLAS: crystalclearsoftware.com/cgi-bin/boost_wiki/…
Of course, whether it's a good idea to use a fully-general inversion algorithm depends on the size of the matrix…
 
Xeo
1:55 AM
0
Q: Is std::string part of the STL?

XeoWhen I say STL, I'm talking about the template library that revolves around containers, iterators, algorithms and functors. This question came to mind after thinking that a std::string mostly behaves like a normal container, with begin and end functions (including iterator), a size function and t...

Why does it take answers so long to show up under the correct tabs? >_>"
 
2:22 AM
7
Q: Is std::string part of the STL?

XeoWhen I say STL, I'm talking about the template library that revolves around containers, iterators, algorithms and functors. This question came to mind after thinking that a std::string mostly behaves like a normal container, with begin and end functions (including iterator), a size function and t...

STL fight. Go go go!
D'oh... too late
 
Xeo
@Tomalak: You confuse me. First you agree that IOstreams aren't part of the STL in your one answer where I corrected you, and now you claim they are/were part? Or did you mean they are part of the SGI STL ?
 
That's why I said "sorry".
Of course streams weren't in the STL.
That was an error on my part, due to being confused at 3.25am.
The STL was containers, algorithms and iterators.
 
Xeo
Ah, you made another comment already. :)
 
Strings and streams were adopted for C++98, then backwards adopted for the modern SGI STL.
Whether strings are "part of the STL" or not depends on whether you follow logic and reason, or call the standard library "STL" like all those other morons ;)
 
Xeo
@TomalakGeretkal See the little paragraph at the top of my question, that's the meaning I hold. :)
@TomalakGeretkal Hm. Now I'm actually thinking of making a new question asking the same thing, but for streams, so you can say exactly that
 
2:27 AM
That definition is irrelevant.
Lol :)
Gods, Jerry is such a moron.
Night Xeo
 
Xeo
g'night
 
 
3 hours later…
5:06 AM
it will be difficult to get a gold c++0x badge. but once you have it, it's really costly, because over time, questions tagged "c++0x" become more and more rare!
 
 
2 hours later…
6:54 AM
hi all
 
7:33 AM
morning all
wow, no one is here?
 
No/
 
lol
I wonder, on a concurrent queue, can the reader & writer lock be different mutexes?
what if you're reading while another is then writing, won't it cause the queue to look inconsistent?
 
@TonyTheTiger I know this wouldn't work with the pthread model
 
@LucDanton I thought so
 
I've not though about that, but the handling of the "queue empty" state would probably the difficult one.
(with the queue full depending on the underlying data structure)
 
Als
7:48 AM
Hey All
@TonyTheTiger: Just saw this...
-1
A: Why not using var everywhere?

Tony The TigerIt's about implicit and explicit typing. C#.NET is a typed language, meaning that you define what type of data is stored in memory. If you don't define that, you make some operations less safe, so you want to type explicitly as much as possibly. However in some cases the type is really obvious...

lol
 
what's wrong with it? cause it got accepted but downvoted?
 
Als
I think the OP wanted to Upvoteevery answer but did opposite
And then he selected the best answer
 
@Als ugh, so there wasn't talking out of my ass this time?
 
Als
geez...newbi nightmare for you @TonyTheTiger :)
 
@Als what do you mean?
 
Als
7:52 AM
@TonyTheTiger: Lol I dont really know how to talk out of my ass :P
 
I'm not that newbie, or am I?
 
Als
@TonyTheTiger: Not you precious, the OP
 
@Als lol
@Als maybe you should undo that downvote for me?
lulz
 
Als
@TonyTheTiger: Done and done for the other 2 sufferers too :)
 
@Als ok thx
:)
 
Als
7:54 AM
@TonyTheTiger: My Pleasure :)
Doing well on the rep front lately:)
 
is it possible to solve e^single vector of size 14
 
Als
@Miss: I dont understand what you mean or intend!
 
i have a vector of size 14, with name v .. then e^v ..solution is possible or not
as i know we can do e power of any scaler value
but e power of matrix is not posssible
but let say i have a vector v of size 14
now exponent of that vector v is possible or not?
 
@Miss Have you tried google?
 
yes
 
8:03 AM
Right now I'm looking at a definition of a vector exponential
 
hmm..
 
@Als yea, rep not too bad for me :)
 
Als
0
Q: Overloading c++ typecasting (functions)

iammilindUsing C++ style typecastings (all 4) look exactly like some function template. e.g. template<typename TO, typename FROM> TO dynamic_cast (FROM p); will be used as, dynamic_cast<Derived*>(p); // p is Base* Why is it not allowed to overload them by language standard for custom usa...

@TonyTheTiger: What do you make out of this?
 
@Als I'm not sure why you'd want to write your own template for doing casts
it's odd, cause that means you could essentially rewrite what casts are and aren't allowed
which kinda defeats everything the language specifies
then you could write a cast for a cat object to a dog object for example
which is complete rubbish and defeats the type system
 
Als
@TonyTheTiger: Yes, true
but well you could still use conversion operators and acheive teh same mess
 
8:11 AM
@lucdanton thanks
 
@Als yea but you're still doing it using the language, if you wrote your own I think the mess would be worse
 
@Als But conversion operators/constructors are not intrusive
let me rephrase that
 
Als
Please do rephrase
 
With conversion operators you can't enable conversion of a type without rewriting it (forcing a recompilation and so on)
 
Als
My point is it can be acheived using opertor conversion functions...and so you wont need overloading of casing operators
 
8:13 AM
the way the question is asked you could specialize or redefine or whatever static_cast/dynamic_cast for some random type
since the casts look like free functions
 
Als
in short you could convert onething in to anything
assuming both are classes
you could acheive that same using conversion operators
 
Yes, but that has to happen inside the class definition
 
Als
so you dont really need overloading of casting operators to aheive that
@LucDanton: True
 
@Nils Good read
 
8:23 AM
makes me thinking I should to something which is financially rewarding..
 
Als
@Nils: Morning...and good one there
 
@Als ideone.com/8TXK5 The same code snippet behaves differently because of one declaration (fixed a syntax error)
 
@nils./. ahh yes
 
:)
 
8:26 AM
i am doing this matrix exponential first time
 
@Nils arg power series again :(
 
hehe cool
I like pencil and paper math
no long compile times, no syntax errors :D
 
@Nils ... tons of correctness errors, though.
At least myself.
 
yes..
there is a case where you need that to solve a system of first order ode.. but I don't remember
wondering if Khan has a video about it
 
is this a pointer to an r-value reference? innocent_type*&&
 
8:29 AM
No.
The other way around.
There are no pointers to references.
 
what's point of having a reference to a pointer?
 
so have to focus back on work, @Miss good luck with that, be patient :)
 
how many levels of indirection can you add?
 
@nils thanks ..
 
@TonyTheTiger I was forced to do that because the way perfect forwarding is enabled and how it plays with template specialization
Look at the base template
 
8:31 AM
but in c++, we will just use exp function for vector or matrix
right?
 
There might be better ways to go around that but I'm not confident about function template specializations
I just substituted From with the type of interest in that case
I hope the example is motivating enough in showing that no, that's definitely not the same as conversion operators
 
i think vector exponentail can be done using exp function from math.h
 
9:13 AM
accessing a private derived function through a base class ptr assigned to a derived object. why does it work
 
how do you nicely back out of a function that returns void?
 
return;?
 
@MartinhoFernandes of course, duh, why didn't I think of that
 
Is my answer correct?
0
A: Does "friend"ing a class extend to classes declared within that class?

Prasoon SauravThere seems to be some defect in the original standard C++03 As per C++03 [pre CD1] your code should not compile because the wording and the example says that private members of a class(granting friendship) cannot be accessed in the nested member of the friend class. C++11 gives the same examp...

 
@balasbellobas do you have an example?
 
I hate codepad. It's slow as molasses.
 
I can't load that either right now
 
same here
 
#include <iostream>
using namespace std;

class B {
public:
virtual void fn1(void) {cout << "class B : fn one \n"; }
virtual void fn2(void) {cout << "class B : fn two \n"; }
};

class D: public B {
void fn1(void) {cout << "class D : fn one \n"; }
private:
void fn2(void) {cout << "class D : fn two \n"; }
};

int main(void)
{
B *p = new D;

p->fn1();
p->fn2();
}
why does this work . the output is
 
@balasbellobas: B::fn2 is public, p has type B*, p->fn2 is public
 
9:21 AM
but during runtime . it points to D*
and in D, fn2 is private
 
yes, it does. so?
 
class D : fn two
 
@balasbellobas someone asked that on SO yesterday
 
does it not break the hiding concept of oop
 
there is no hiding concept of oop
 
9:23 AM
its cause fn2 is in the vptr table of B and the compiler doesn't care about the access modifiers anymore
 
there is the liskov substitution principle, which would be broken had this worked as you expected
 
@balasbellobas its not good practice to write code like this
 
should it not care about the access modifiers too, when executing the fn2
i completely agree its bad practice.
 
of course it cares about the access modifiers
 
@balasbellobas yea but in base it is public so it will be available to base
 
9:25 AM
and the access modifier that applies is "public": B::fn2 is public
 
i feel fn2 should not execute. i am not able to come to terms with the fact that fn2 is being able to execute
 
Consider:
 
may be a compiler error when the derived class makes a vitrual function as private
 
int main(void)
{
B *p = getD();

p->fn1();
p->fn2();
}
 
9:26 AM
@balasbellobas its cause you created a base pointer and then called fn2 on it, it is public in base, so that's gonna execute
 
@balasbellobas What kind of error can the compiler give for ideone.com/eiuJm ?
 
do you feel it defeats oop
 
@balasbellobas that p->fn2 executes is a cornerstone of OOP
Substitutability is a principle in object-oriented programming. It states that, in a computer program if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may be substitutes for objects of type T), without altering any of the desirable properties of that program (correctness, task performed, etc.). More formally, the Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called (strong) behavioral subtyping, that was initially introduced by Barbara Liskov in a 1987 conference keynote address entitle...
 
okay .
 
6 mins ago, by balas bellobas
may be a compiler error when the derived class makes a vitrual function as private
 
9:32 AM
i remember java/c# doing something like this., when the derived class does not fully implement the base. (ie in our case hiding the base member fn). it will result in a compile error
 
This seems reasonable. I don't see why not at least make it a warning. But I haven't delved into the subclassing part of C++ yet, so I don't know.
 
yeah . thats what i was getting at . atleast a warning.
 
sbi
@balasbellobas C++ in general gives you more leeway than Java, C# and some other languages. Much more.
 
@balasbellobas you don't have hiding, your D::fn2 is overriding B::fn2
 
@sbi that's why it is c++
0
Q: Examples of allocationless programming in c#?

arkinaHi, can someone point me to some examples of allocationless programming in c#? With the idea to prevent garbage collection. I think the general idea is to allocate upfront then reuse - like from a pool of objects. Just wondering if they're any best practices or patterns. thanks

 
9:36 AM
@balasbellobas any compiler is free to issue warnings for any reason. what compilers, lints, and other source analyzers have you looked at to see if they can do this?
 
not sure how this is even possible? programming without allocations? huh?!!
 
Does the java/c# restriction involve abstract methods or something?
 
I like that part in the end mentioning best practices or patterns.
Sure we have those. The best practice to do allocationless programming is not to do any programming at all.
 
@MartinhoFernandes lol :p
 
@LucDanton Not specifically. Regardless of abstract/virtual, it forces you to keep at least the same visibility of the method you're overriding.
 
sbi
9:39 AM
<whining> Someone downvoted my template meta answer from yesterday without leaving a comment. Bastards! </whining>
 
But... In C# you can implement an interface method with a private method.
 
@MartinhoFernandes Isn't that a contradiction?
 
@sbi problem solved
 
sbi
@TonyTheTiger What do you mean, "problem solved"? Did you add that comment explaining the downvote??
 
@sbi no I undid the downvote...
lol
 
9:42 AM
@LucDanton They call it explicit interface implementation. It's there mostly to work around name clashes when implementing multiple interfaces.
 
I didn't downvote
 
@sbi your answer isn't O(1)
 
sbi
@TonyTheTiger No, you didn't. It still has one downvote!
@FredNurk It is - at run-time! :)
 
no, it is not
 
@sbi where do you see the downvote?
 
9:43 AM
it can't even execute at runtime
 
@MartinhoFernandes I see
 
@FredNurk so then it's O(0)
 
sbi
@TonyTheTiger When I click on the number between the up and down arrows.
 
There's no such thing as O(0). That is, unless you're doing allocationless programming.
 
sbi
@FredNurk Come clear! Are you trying to be clever or do you see a real problem?
 
9:45 AM
@MartinhoFernandes exactly! so we have a way to do allocationless programming in C++, its called TMP
 
sbi
@MartinhoFernandes Well, then how would you describe the complexity of source code that compiles to exactly zero machine code instructions, and yet delivers the expected result?
 
@sbi Allocationless programming, just like I said.
 
sbi
@MartinhoFernandes How about an algorithm that does nothing but poking a bunch of literal numbers to a bunch of literal memory addresses (like the screen buffer)? That can be done without any allocations, right?
Still it would take runtime, so it's O(1).
 
Yes, of course. Not all allocationless programming is O(0). But it is the only way to do get O(0).
 
You just need to travel forward in time, get the answer, then go back and hardcode it.
 
9:56 AM
you guys do realize that O(1) and O(0) represent the exact same complexity class, right?
 
@FredNurk Nope.
 
I like O(42) better.
2
 
O(0) = blah blah, f(x) <= 0. O(1) = blah blah, f(x) <= k.
 
No matter the size of the input, it takes no time. That would be an interesting runtime that can pull it off.
 
sbi just gave an example above.
And it's not "no time". It's "no steps" (whatever you want a step to mean).
 
9:59 AM
Depends on the problem domain really
It takes nothing of whatever you're counting
 
sbi
@FredNurk Yes, it's constant complexity.
And you still haven't explained why you consider a piece of source code that compiles to zip machine code not O(1). It is taking zero time to execute, and that's as constant a complexity as they come.
 
@sbi I'm going to say no on that again. O(0) ∈ O(1), but O(1) ∉ O(0). So, O(0) ≠ O(1).
 
@sbi it executes at compile-time
 
sbi
@FredNurk Yeah, I know. So? It's not like he had given a constraint "must compile with O(1) in under x secs".
 
@MartinhoFernandes Nitpick: It's ⊆, not ∈.
 
sbi
10:09 AM
@MartinhoFernandes @FredN was talking about complexity classes. And they both are in the constant complexity class.
 
@sbi so given that you agree that your algorithm executes at compile-time and your claim that it takes no time to execute, which compiler are you using that has perfect compile speed?
 
sbi
@FredNurk Now you're just being obtuse. I quote the comment I just posted in reply to yours:
> Most people, when in search of an O(1) solution, search for a solutions that gives constant run-time. Taking into account compile time is like taking into account the time it takes to create the lookup table for Oli's solution: Yes, that takes time, but usually this is of academic interest.
 
see, I feel the same way: you're being obtuse
executing an O(log n) algorithm at compile-time does not change it into an O(1) algorithm
 
@FredNurk no cause it's O(0)
 
24 mins ago, by Fred Nurk
you guys do realize that O(1) and O(0) represent the exact same complexity class, right?
 
sbi
10:21 AM
@FredNurk Yes, but that's academic. For most programs anyway.
 
@sbi if you want to talk about practicalities ("that's academic"): assuming the input is available as a compile-time constant is way out in left-field
 
sbi
@FredNurk People often don't realize that this is possible, so they don't ask for it, but more often than never input is known at compile-time. Of course, usually that isn't the case, but IMO it is still worth pointing out.
 
@sbi so if all input is available at compile time, we'd write programs that have no instructions... cool! :P
 
it is not a good question; I'd downvote it if I was one to downvote
 
@FredNurk why don't you then?
 
sbi
10:29 AM
@FredNurk I have understood that. However, you utterly fail to explain why.
 
but give a reason
 
but the question does say O(1) and you've neither 1) critiqued the O(1) requirement (a "negative answer", aka "you don't want that"), nor 2) provided an O(1) algorithm
@TonyTheTiger I don't downvote.
 
@FredNurk hmmm, scared to loose rep or just a rebel?
 
excuse me?
 
sbi
@FredNurk Olis table solution requires a lot of memory (4GB for a solution that allows for int). He stated that upfront and nobody complained. My solution requires compile-time constants. I stated that upfront, yet you keep complaining about that. Sorry, that just doesn't make sense and comes across as being rooted in some prejudice.
 
10:31 AM
@FredNurk I was joking
 
@sbi did you read Oli's answer?
 
sbi
@FredNurk excuse me?
 
did you read both what it says in parentheses and the second paragraph?
 
37 mins ago, by Fred Nurk
you guys do realize that O(1) and O(0) represent the exact same complexity class, right?
 
the full range of 0...INT_MAX may not be required; if the range is small enough, a lookup table is very much applicable
 
sbi
10:34 AM
@FredNurk Yes, and I chose to overlook the obvious flaw in what he wrote in the parentheses. (And the second paragraph isn't what I referred to.)
 
No. You could say one is the complexity class DTIME(O(0)), and the other DTIME(O(1)). And the first is a subset of the second, but they're not the same.
 
@sbi then why do you treat my non-critique of his answer to only apply to part of his answer rather than the whole thing? why are you surprised that I'll point out a problem I see in your answer when you post it here to ask about it?
 
sbi
@FredNurk He wrote "for each possible value", which doesn't necessarily need to be a sequence of contiguous values. However, you can't lookup a number in a noncontiguous sequence of numbers with O(1). So a table solution might have to pre-compute a lot more values than just the few required.
 
you can sometimes lookup a number in a noncontiguous sequence in O(1)
A perfect hash function for a set S is a hash function that maps distinct elements in S to distinct integers, with no collisions. A perfect hash function with values in a limited range can be used for efficient lookup operations, by placing keys from S (or other associated values) in a table indexed by the output of the function. A perfect hash function for a specific set S that can be evaluated in constant time, and with values in a small range, can be found by a randomized algorithm in a number of operations that is proportional to the size of S. The minimal size of the description of a ...
 
sbi
@FredNurk His answer has a few "flaws" that are very similar to mine. Yet you keep pointing out what you consider flaws that make in my answer "cheating", ignoring that the chosen solution suffers from the same "flaws".
 
10:39 AM
@sbi is your algorithm O(1) or not?
 
sbi
@FredNurk Yeah. And sometimes you have the values fixed at compile-time. So?
 
as I said in my first comment, "Wasn't my downvote, but this isn't O(1). I bet it was fun, but it doesn't answer the question." I never ignored Oli's solution.
 
sbi
@FredNurk Can Oli pre-compute the entries for his table with an O(1) algorithm?
 
@sbi hey :)
hi all!
 
@sbi what does that have to do with anything?
 
sbi
10:43 AM
@FredNurk My solution needs a pretty low, constant time at run-time by trading compile-time for it. Oli's table solution might, under certain circumstances, need a pretty low (if somewhat higher), constant time at run.-time by trading memory for it. Why is the TMP solution "cheating," and the table solution isn't it?
 
please don't pretend you're ignorant of the time-memory tradeoff
 
sbi
@FredNurk What does have compile-time to do with anything?
 
anybody in here.. gone through "test projects" available under Visual Studio 2010..?
 
sbi
@FredNurk Please don't pretend you're ignorant of the compile-time/run-time tradeoff.
 
4 mins ago, by Fred Nurk
@sbi is your algorithm O(1) or not?
@sbi: if you want to continue, please answer that
 
10:44 AM
o_0
 
hi
 
@D
@DeadMG hi there!
 
listen, I have to ask something
did I ever bitch about changing the cookie type making me sick?
 
sbi
@FredNurk Why would I need to answer that? We all know that there is no algorithm that calculates the highest set bit in any number in O(1). There are, however, practical solutions to the problem at hand. Pre-calculating a table of such numbers is one of them. Pre-calculating only the required numbers another one.
 
especially as you could just build the table from the TMP solution
 
10:49 AM
maybe you should say that in your answer instead of presenting it like you do
as it stands, you don't answer the question, which is what I've said from the very beginning
 
maybe I should come back later~ :(
 
and apparently at least two other people agree with me, given the downvotes
 
sbi
@FredNurk Yeah, and maybe so should all the others. However, none of them did, and and still you pecked on none of the other solutions. So what got you so worked up with my solution?
 
none of the others asked about their answers here in this chat
 
@FredNurk: Given that his answer is +3, I'm guessing that more people agree than disagree
in my opinion, since all the other answers focus on a run-time answer, giving a compile-time answer is just good for diversity
 
10:50 AM
Letting mob rule sort [subtleties] out…using downvotes to cancel out upvotes…is just not good enough. http://bit.ly/iH31aN
 
sbi
1 min ago, by Fred Nurk
and apparently at least two other people agree with me, given the downvotes
 
hi @DeadMG
 
hi
 
sbi
@FredNurk That question currently has 11 answers, two of which got downvotes, one of which got them without any explanation. And when the one who had given the latter asks here what's wrong with his answer, you don't take the context into account? And presumably you find this logical.
I'm sorry for you, @FredN, but you blew this big time.
 
10:55 AM
@DeadMG whats new? besides cookies that annoy you
 
not much, really
 
how boring
 
it's only been 13 hours since we last spoke
12 of which I spent asleep
 
oh I see
so at least you're feeling more awake, I assume
 
yeah
well
these cookies aren't annoying me, per se
I'm just suspicious of them
the last time I got my cookies changed to some similar ones, they made me quite sick
even though these aren't the same as those, I'm still a little suspicious
but I guess there's only one way to know for sure
 
11:04 AM
oh, you're talking about real cookies
I thought you were talking about web cookies
:p
 
rofl
 
"I almost started crying when I saw that!" - friend of mine about Google IO, what a nerd.
 
11:37 AM
mm cookies
 
@Nils why?
@jalf long time no see here... what's new?
 
11:54 AM
@TonyTheTiger oh, lots. Have to move out of my apartment in a couple of days, only just found a new one, which I can move into july 1st
so going to be couch-surfing for 6 weeks until then
so just generally stressed out over that
 

« first day (208 days earlier)      last day (4740 days later) »