Matlab or C function [closed] - c

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I am doing raytracing. I have not measured any performance numbers. I am thinking of making a separate C function for raytracing and then calling it from my matlab code.
Does it make the program perform better if instead of writing Matlab code?

If it is a well-written MATLAB code (meaning it takes advantage of matrix multiplication wherever possible) than MATLAB usually performs better than C. I remember a professor in college showing us MATLAB could beat even FORTRAN in calculating eigenvectors.
This is speaking typically though; there may be parts of your program that C could perform faster than MATLAB, although typically speaking MATLAB does just as well for well-written code. Here's an example of some very specific benchmarking done at MIT: http://www.ll.mit.edu/HPEC/agendas/proc03/pdfs/nehrbass.pdf

Related

Do objects and instances mean something else for an imperative language like C compared to an object-oriented? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I read that a running C program can be referred to as an "instance".
Is this really correct? The word instance is usually used for OOP.
And C also has "objects" hasn't it, but it's not the same as in OOP.
An "object" in C is just something in memory like a union with some value could be called an object can't it?
An "object" in C is just something in memory, but that's also true of all computer languages.
An object in real life is a thing that physically exists. Being in memory is the closest something in a program can come to physical existence, so we apply the same term.
An instance in real life is a specific example of a generic concept. The term has similar generality in computers. When you tell the computer to run a program, it generates an instance of that program, among many potential instances of running that program. Again, nothing specific to C, this terminology usually occurs in operating systems (which manage running of programs, and define what a "program" is).

Does vector in ARGV mean one-dimensional array? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Just curious about the term vector in programming field?
Yes, here "vector" means a one-dimensional array. This is a bit confusing because to represent a mathematical vector also uses a one-dimensional array, to store the coordinates in each of the dimensions, but this is a different usage. In this case, "vector" bring up an image of all of the elements of the array laid out in a line.
If you're referring to C, C++ or Perl (all of which use the term "argv", though Perl is the only one in which it's usually capitalized as "ARGV"): yes, it means a one-dimensional array.
The term "vector" has other uses, but they're usually pretty close to "one-dimensional array" too. For instance, the C++ standard library defines a family of vector types, which behave like extensible arrays.
(There are other uses -- for instance, "interrupt vectors" -- that have nothing to do with this. I assume you aren't interested in those.)

sending variables to procedures in c and pascal [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
for sending variables to procedures what we should do in c and(or) pascal?
as i searched this work has to be done by BP( base pointer)
or rather i should say that BP do it,and one more thing is that C and Pascal are opposite of each other.
You question is entirely unclear. It would appear that you might be asking about C and Pascal calling conventions on the x86 architecture (at least your mention of BP hints at this).
If that's the case, I'd recommend you study the Wikipedia page on x86 calling conventions, and come back when you have specific questions.
edit You might also want to check out X86 Assembly/High-Level Languages along with the "Further Reading" links therein.

Why is C function so long? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I'm coming from a script guy, used to functions within 50 lines.
And when I see frequently functions over 200 lines,I'm really having a hard time reading it.
Is this normal at all?
There is nothing in the language that makes functions "long" - you can write long functions in any reasonable language, and, ideally, should refactor them into smaller, more understandable and maintainable functions in most languages.

how to build a calculator in GTK+? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
what's the logic behind the calculator widget. i want to build it in gtk+.
First, don't listen to anyone who says that this is trivial.
Second, I'm going to assume that you really mean something like "How do I convert the user input to an internal expression structure which I can use to calculate the answer?". Well, Wikipedia has a good article (here) on converting infix (human readable) notation, which is what most modern calculators use (e.g you can write 1 + 2 instead of + 1 2), to the more computer appropriate polish (prefix) notation.
Third, if you don't know GTK+ yet, start here.
Hope this helps.

Resources