|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
The OP was talking of basic concepts, not efficient linear algebra algorithms.
|
|
#2
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
|
|
#3
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
http://zone.ni.com/reference/en-XX/h...sing_matrices/
Matrices a la LabView. http://www.mathworks.com/help/matlab...nd-arrays.html Matrices a la MatLab. Sometimes arguing about the visual representation of data is basically a course in UI and graphics arts. You can spend literally your entire life arguing which view is the best one. Like any communications - the 'right' one is that one that manages to deliver the right messsage as fast as possible to the audience to which it was intended. |
|
#4
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
I'll try to be clearer: My post had nothing to do with "arguing which view is the best one". It was simply pointing out that there are domains in which a knowledge of how your programming language stores matrix elements is important. |
|
#5
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
I intended to address the topic in general. However to go back to your point, if you consider the computers 'view' of the data you are absolutely correct. Just as it wouldn't make sense to fight little-endian / big-endian it doesn't make any sense to fight the way your language works. http://en.wikipedia.org/wiki/Endianness Quote:
|
|
#6
|
|||
|
|||
|
Re: Quotes from the Chief Engineer and I
Don't forget that OP is in a AP CS course. Java is a tool to teach basic concepts in CS, not just programming, not just a specific language.
It's basically beginning course, in which you are learning the basic building blocks, vocabulary, and conventions. This is how people in the trade communicate with each other. |
|
#7
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
Say you have a matrix that you are representing as a 2D array: |a b c | |d e f | |g h i | C/C++ structures this in row-major order. This means that the elements are physically arranged sequentially in memory in this order: a, b, c, d, e, f, g, h, i Fortran structures this in column-major order. Physically, they are represented as: a, d, g, b, e, h, c, f, i Each element is at a particular "address" in memory, which is usually expressed as a hexadecimal number. The elements of the array will be stored sequentially. This means that if element 'a' is stored at 0x1AFF3114, then (in C/C++) element 'b' will be stored at 0x1AFF3115, 'c' at 0x1AFF3116, and so on. In Fortran, 'd' would be at 0x1AFF3115, 'g' at 0x1AFF3116, 'b' at '0x1AFF3117' and so on. Why does this matter? It is much faster to access elements sequentially than nonsequentially for most physical storage media, sometimes even orders of magnitudes faster. It won't make much of a difference for simple problems with 3x3 or other small matrices, but when dealing with very large matrices with thousands or even millions of elements (which appear in many real engineering problems, for example, the matrices created by FEA software-) it becomes very important. As a result, it is useful to know what order your programming language lays out its multidimensional arrays in memory, and to write your algorithms to access them in sequential order when possible. |
|
#8
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
|
|
#9
|
|||
|
|||
|
Re: Quotes from the Chief Engineer and I
If you have to comment your code out the wazoo, because you are breaking the conventions, you might be doing something wrong...
|
|
#10
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Oh, obviously. Good code should speak for itself! But we were just pointing out if you do something weird there is always the option to comment it!
|
|
#11
|
|||
|
|||
|
Re: Quotes from the Chief Engineer and I
Quote:
And commenting isn't really an option, it's more of a requirement, for anything! Think of it like homework that is assigned, but not collected. Sure, you MIGHT be okay not doing it every now and then, but really, you have to do it. |
|
#12
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
Turns out it ended an if statement. Boy was I tired. |
|
#13
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
|
|
#14
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
I think it really depends on who's going to be reading it. I usually comment as much as I can for teaching examples. But for personal projects I usually write the code and then go back and comment. If what I did doesn't make sense to me I will probably try to rewrite it in a less confusing manner, but if that isn't possible I'll comment it. I try to do this because if it doesn't make sense to me, the author, then it won't make sense to anyone!
|
|
#15
|
||||
|
||||
|
Re: Quotes from the Chief Engineer and I
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|