DJ30 Options – US Major Index Begins to Recover

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    Top Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education How To Trade!
    Free Demo Account!
    Big Sign-up Bonus!

  • Binomo
    Binomo

    Good Choice For Experienced Traders!

DJ30 Options – US Major Index Begins to Recover

McKinsey uses cookies to improve site functionality, provide you with a better browsing experience, and to enable our partners to advertise to you. Detailed information on the use of cookies on this Site, and how you can decline them, is provided in our cookie policy. By using this Site or clicking on “OK”, you consent to the use of cookies.

Subscribed to email alerts.

Select topics and stay current with our latest insights

Row-major vs Column-major confusion

I’ve been reading a lot about this, the more I read the more confused I get.

My understanding: In row-major rows are stored contiguously in memory, in column-major columns are stored contiguously in memory. So if we have a sequence of numbers [1, . 9] and we want to store them in a row-major matrix, we get:

while the column-major (correct me if I’m wrong) is:

which is effectively the transpose of the previous matrix.

My confusion: Well, I don’t see any difference. If we iterate on both the matrices (by rows in the first one, and by columns in the second one) we’ll cover the same values in the same order: 1, 2, 3, . 9

Even matrix multiplication is the same, we take the first contiguous elements and multiply them with the second matrix columns. So say we have the matrix M :

If we multiply the previous row-major matrix R with M , that is R x M we’ll get:

If we multiply the column-major matrix C with M , that is C x M by taking the columns of C instead of its rows, we get exactly the same result from R x M

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    Top Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education How To Trade!
    Free Demo Account!
    Big Sign-up Bonus!

  • Binomo
    Binomo

    Good Choice For Experienced Traders!

I’m really confused, if everything is the same, why do these two terms even exist? I mean even in the first matrix R , I could look at the rows and consider them columns.

Am I missing something? What does row-major vs col-major actually imply on my matrix math? I’ve always learned in my Linear Algebra classes that we multiply rows from the first matrix with columns from the second one, does that change if the first matrix was in column-major? do we now have to multiply its columns with columns from the second matrix like I did in my example or was that just flat out wrong?

Any clarifications are really appreciated!

EDIT: One of the other main sources of confusion I’m having is GLM. So I hover over its matrix type and hit F12 to see how it’s implemented, there I see a vector array, so if we have a 3×3 matrix we have an array of 3 vectors. Looking at the type of those vectors I saw ‘col_type’ so I assumed that each one of those vectors represent a column, and thus we have a column-major system right?

Well, I don’t know to be honest. I wrote this print function to compare my translation matrix with glm’s, I see the translation vector in glm at the last row, and mine is at the last column.

This adds nothing but more confusion. You can clearly see that each vector in glmTranslate matrix represents a row in the matrix. So. that means that the matrix is row-major right? What about my matrix? (I’m using a float array[16]) the translation values are in the last column, does that mean my matrix is column-major and I didn’t now it? tries to stop head from spinning

8 Answers 8

Let’s look at algebra first; algebra doesn’t even have a notion of “memory layout” and stuff.

From an algebraic pov, a MxN real matrix can act on a |R^N vector on its right side and yield a |R^M vector.

Thus, if you were sitting in an exam and given a MxN Matrix and a |R^N vector, you could with trivial operations multiply them and get a result – whether that result is right or wrong will not depend on whether the software your professor uses to check your results internally uses column-major or a row-major layout; it will only depend on if you calculated the contraction of each row of the matrix with the (single) column of the vector properly.

To produce a correct output, the software will – by whatever means – essentially have to contract each row of the Matrix with the column vector, just like you did in the exam.

Thus, the difference between software that aligns column-major and software that uses row-major-layout is not what it calculates, but just how.

To put it more pecisely, the difference between those layouts with regard to the topcial single row’s contraction with the column vector is just the means to determine

  • For a row-major-layout it’s the element just in the next bucket in memory
  • For a column-major-layout it’s the element in the bucket M buckets away.

To show you how that column/row magic is summoned in practice:

You haven’t tagged your question with “c++”, but because you mentioned ‘glm‘, I assume that you can get along with C++.

In C++’s standard library there’s an infamous beast called valarray , which, besides other tricky features, has overloads of operator [], one of them can take a std::slice ( which is essentially a very boring thing, consisting of just three integer-type numbers).

This little slice thing however, has everything one would need to access a row-major-storage column-wise or a column-major-storage row-wise – it has a start, a length, and a stride – the latter represents the “distance to next bucket” I mentioned.

I think you are mix up an implementation detail with usage, if you will.

Lets start with a two-dimensional array, or matrix:

The problem is that computer memory is a one-dimensional array of bytes. To make our discussion easier, lets group the single bytes into groups of four, thus we have something looking like this, (each single, +-+ represents a byte, four bytes represents an integer value (assuming 32-bit operating systems) :

Another way of representing

So, the question is how to map a two dimensional structure (our matrix) onto this one dimensional structure (i.e. memory). There are two ways of doing this.

Row-major order: In this order we put the first row in memory first, and then the second, and so on. Doing this, we would have in memory the following:

With this method, we can find a given element of our array by performing the following arithmetic. Suppose we want to access the $M_$ element of the array. If we assume that we have a pointer to the first element of the array, say ptr , and know the number of columns say nCol , we can find any element by:

To see how this works, consider M_ <02>(i.e. first row, third column — remember C is zero based.

So we access the third element of the array.

Column-major ordering: In this order we put the first column in memory first, and then the second, and so or. Doing this we would have in memory the following:

SO, the short answer – row-major and column-major format describe how the two (or higher) dimensional arrays are mapped into a one dimensional array of memory.

Hope this helps. T.

Doesn’t matter what you use: just be consistent!

Row major or column major is just a convention. Doesn’t matter. C uses row major, Fortran uses column. Both work. Use what’s standard in your programming language/environment.

Mismatching the two will [email protected]#$ stuff up

If you use row major addressing on a matrix stored in colum major, you can get the wrong element, read past end of the array, etc.

It’s incorrect to say code to do matrix multiplication is the same for row major and column major

(Of course the math of matrix multiplication is the same.) Imagine you have two arrays in memory:

If matrices are stored in column major then X, Y, and X*Y are:

If matrices are stored in row major then X, Y, and X*Y are:

There’s nothing deep going on here. It’s just two different conventions. It’s like measuring in miles or kilometers. Either works, you just can’t flip back and forth between the two without converting!

You are right. it doesn’t matter if a system stored the data in a row-major structure or a column-major one. It is just like a protocol. Computer : “Hey, human. I’m going to store your array this way. No prob. Huh?” However, when it comes to performance, it matters. consider the following three things.

1. most arrays are accessed in row-major order.

2. When you access memory, it is not directly read from memory. You first store some blocks of data from memory to cache, then you read data from cache to your processor.

3. If the data you want does not exist in cache, cache should re-fetch the data from the memory

When a cache fetches data from memory, locality is important. That is, if you store data sparsely in memory, your cache should fetch data from memory more often. This action corrupts your programs performance because accessing memory is far slower(over 100times!) then accessing cache. The less you access memory, the faster your program. So, this row-major array is more efficient because accessing its data is more likely to be local.

Ok, so given that the word “confusion” is literally in the title I can understand the level of. confusion.

Firstly, this absolutely is a real problem

Never, EVER succumb to the idea that “it is used be but. PC’s nowadays. “

Of the primary issues here are: -Cache eviction strategy (LRU, FIFO, etc.) as @Y.C.Jung was beginning to touch on -Branch prediction -Pipelining (it’s depth, etc) -Actual physical memory layout -Size of memory -Architecture of machine, (ARM, MIPS, Intel, AMD, Motorola, etc.)

This answer will focus on the Harvard architecture, Von Neumann machine as it is most applicable to the current PC.

The memory hierarchy:

Is a juxtaposition of cost versus speed.

For today’s standard PC system this would be something like: SIZE: 500GB HDD > 8GB RAM > L2 Cache > L1 Cache > Registers. SPEED: 500GB HDD

This leads to the idea of Temporal and Spatial locality. One means how your data is organized, (code, working set, etc.), the other means physically where your data is organized in “memory.”

Given that “most” of today’s PC’s are little-endian (Intel) machines as of late, they lay data into memory in a specific little-endian ordering. It does differ from big-endian, fundamentally.

(For the simplicity of this example, I am going to ‘say’ that things happen in single entries, this is incorrect, entire cache blocks are typically accessed and vary drastically my manufacturer, much less model).

So, now that we have that our of the way, if, hypothetically your program demanded 1GB of data from your 500GB HDD , loaded into your 8GB of RAM, then into the cache hierarchy, then eventually registers , where your program went and read the first entry from your freshest cache line just to have your second (in YOUR code) desired entry happen to be sitting in the next cache line, (i.e. the next ROW instead of column you would have a cache MISS.

Assuming the cache is full, because it is small, upon a miss, according to the eviction scheme, a line would be evicted to make room for the line that ‘does’ have the next data you need. If this pattern repeated you would have a MISS on EVERY attempted data retrieval!

Worse, you would be evicting lines that actually have valid data you are about to need, so you will have to retrieve them AGAIN and AGAIN.

The term for this is called: thrashing

https://en.wikipedia.org/wiki/Thrashing_(computer_science) and can indeed crash a poorly written/error prone system. (Think windows BSOD).

On the other hand, if you had laid out the data properly, (i.e. Row major). you WOULD still have misses!

But these misses would only occur at the end of each retrieval, not on EVERY attempted retrieval. This results in orders of magnitude of difference in system and program performance.

Very very simple snippet:

Now, compile with: gcc -g col_maj.c -o col.o

Now, run with: time ./col.o real 0m0.009s user 0m0.003s sys 0m0.004s

Now repeat for ROW major:

Compile: terminal4$ gcc -g row_maj.c -o row.o Run: time ./row.o real 0m0.005s user 0m0.001s sys 0m0.003s

Now, as you can see, the Row Major one was significantly faster.

Not convinced? If you would like to see a more drastic example: Make the matrix 1000000 x 1000000, initialize it, transpose it and print it to stdout. “`

(Note, on a *NIX system you WILL need to set ulimit unlimited)

ISSUES with my answer: -Optimizing compilers, they change a LOT of things! -Type of system -Please point any others out -This system has an Intel i5 processor

★ PSA: You CAN still recover your Premium vehicles in-game. Here’s how. ★

Scorpiany #1 Posted Aug 14 2020 – 02:14

I saw several Threads quite confused about the new Store / Depot interface, and in particular, whether or not you can still recover your Premium vehicles in-game. The answer is that yes, you can still recover your vehicles, but not through the Store interface. Here’s how you do it.

Firstly, go to your Service Record and press the “Vehicles” tab.

Then, find the vehicle you’re trying to recover in the list of your tanks. Click on “Add to comparison“.

Then, on the bottom right corner of your screen, you’ll see the “Comparison List” tab pop up. Click on the “(1) to compare” button.

Next, Right Click on the vehicle from the comparison tab, and then click on “Preview vehicle“.

Now you can recover the tank by pressing the Recover button on the bottom of your screen!

(R.I.P. Credits. I also tested this with my Lorraine 40t and Pz. II D so I’d have enough credits to actually recover a tank under the new interface – This method worked!)

I hope this helps clear up some confusion! I will be uploading a full guide on the new UI (User Interface) soon, and I’ll cover all of the changes they’ve made, including things that they’ve added, moved around or removed completely!

Good luck, both on the battlefield and in real life, tankers!

Edit: The UI guide is finally here! Check it out! [Hyperlinked]

Edited by Scorpiany, Aug 18 2020 – 01:01.

_Gungrave_ #2 Posted Aug 14 2020 – 02:16

When I saw this mentioned in a suggestion thread I nearly fell out of my chair laughing at how stupid this is.

+1

Edited by _Gungrave_, Aug 14 2020 – 02:18.

spud_tuber #3 Posted Aug 14 2020 – 02:26

heavymetal1967 #4 Posted Aug 14 2020 – 02:30

Man I can’t friggin wait to see the next new 2.0 version of what they improve next.

Scorpiany #5 Posted Aug 14 2020 – 02:35

_Gungrave_, on Aug 13 2020 – 17:16, said:

When I saw this mentioned in a suggestion thread I nearly fell out of my chair laughing at how stupid this is.

Why they had to change this, I don’t know – It was much easier being able to recover directly from the Store tab. Not to mention that you can’t buy ammo in bulk anymore!

Edited by Scorpiany, Aug 14 2020 – 02:45.

_Gungrave_ #6 Posted Aug 14 2020 – 02:50

heavymetal1967, on Aug 14 2020 – 02:30, said:

Man I can’t friggin wait to see the next new 2.0 version of what they improve next.

I think they might try to “improve” the tech tree menu since they have a tendency to mess with the menus people use the most.

tod914 #7 Posted Aug 14 2020 – 02:54

Edited by tod914, Aug 14 2020 – 02:54.

Black_Paw #8 Posted Aug 14 2020 – 03:00

RC_1140 #9 Posted Aug 14 2020 – 03:04

riff_ #10 Posted Aug 14 2020 – 03:15

Scorpiany, on Aug 13 2020 – 20:35, said:

Why they had to change this, I don’t know – It was much easier being able to recover directly from the Store tab. Not to mention that you can’t buy ammo in bulk anymore!

Change for change’s sake I guess.

GJ on the post and helping players out OP.

Edited by riff_, Aug 14 2020 – 03:15.

Scorpiany #11 Posted Aug 14 2020 – 03:37

RC_1140, on Aug 13 2020 – 18:04, said:

It helps with managing your credits, if you’re prone to wasting them. Two ways to do this:

1) Buying ammo ahead of time for tanks you plan on playing for longer sessions – Such as if you plan on doing a 3-mark grind in the future. That way, if you waste your credits before then, you’ll still have all of the ammunition you need to 3-mark the tank without having to grind again.

2) Buying the T7 Combat Car ammo to “save” your credits. You can buy and sell it for 1 credit per shell, which means that if you have a bunch of credits lying around, and you want to save them so you don’t waste them, you just buy T7 Car shells.

Because when you have tanks like this in your Service Record.

And the ammo costs for them look like this.

You can imagine how easy it is to waste a lot of credits in a very short period of time.

So by buying ammo ahead of time, or just stocking up on T7 Car ammo, I won’t accidentally waste credits that I’m trying to save up. That way, if I buy 1.5 million T7 Car shells, 1,000 Obj. 260 AP shells and 250 Obj. 260 HEAT shells, then if 3 days later I begin playing tanks like the MT-25, I don’t waste any of those credits / shells.

Then, if I decide to try to 3-mark my Obj. 260, or if I want to buy a new mid-Tier tank, I don’t have to grind credits again – I still have the credits / ammo I had saved up from before, since I won’t have wasted it during my MT-25 sessions.

Edited by Scorpiany, Aug 14 2020 – 04:05.

RC_1140 #12 Posted Aug 14 2020 – 03:46

Scorpiany, on Aug 13 2020 – 18:37, said:

It helps with managing your credits, if you’re prone to wasting them. Two ways to do this:

1) Buying ammo ahead of time for tanks you plan on playing for longer sessions – Such as if you plan on doing a 3-mark grind in the future. That way, if you waste your credits before then, you’ll still have all of the ammunition you need to 3-mark the tank without having to grind again.

2) Buying the T7 Combat Car ammo to “save” your credits. You can buy and sell it for 1 credit per shell, which means that if you have a bunch of credits lying around, and you want to save them so you don’t waste them, you just buy T7 Cars shells.

Because when you have tanks like this in your Service Record.

And the ammo costs for them look like this.

You can imagine how easy it is to waste a lot of credits in a very short period of time.

So by buying ammo ahead of time, or just stocking up on T7 Car ammo, I won’t accidentally waste credits that I’m trying to save up. That way, if I buy 1.5 million T7 Car shells, 1,000 Obj. 260 AP shells and 250 Obj. 260 HEAT shells, then if 3 days later I begin playing tanks like the MT-25, I don’t waste any of those credits / shells. Then, if I decide to try to 3-mark my Obj. 260, or if I want to buy a new mid-Tier tank, I don’t have to grind credits again – I still have the credits / ammo I had saved up from before, since I won’t have wasted it during my MT-25 sessions.

Dang, that’s a really detailed response. I can see how that makes sense. Guess for the credit saving part that’s the same as someone I know who buys 100 half price camo nets to sell when needed.

Oh, and I miss all the fun guns on t6 lights.

Edited by RC_1140, Aug 14 2020 – 03:47.

90210_Hero #13 Posted Aug 14 2020 – 04:04

Edited by 90210_Hero, Aug 14 2020 – 04:07.

HowitzerBlitzer #14 Posted Aug 14 2020 – 04:06

Scorpiany #15 Posted Aug 14 2020 – 04:12

90210_Hero, on Aug 13 2020 – 19:04, said:

That’s really odd. I did specifically try it with a tank I could afford to recover, the Pz. II D, to make sure it worked; and I was able to process the recovery. Are you sure you’re clicking on “Preview Vehicle”? The recovery button is greyed out in the drop-down menu, but when I click on Preview Vehicle, the recovery button works just fine on the preview page itself.

Keep in mind that not all tanks can be recovered in-game at all times – If a tank is currently on sale in the Premium shop, you won’t be able to recover it until the sale ends (If the tank was already available). Otherwise, tanks sold in-game while they’re available in the Premium shop won’t be available beyond the first 2 days at all. You’ll have to send in a Customer Support ticket.

Although I don’t recall the Lorraine 40t going on sale recently, so I’m not sure why it wouldn’t be available for you.

Edited by Scorpiany, Aug 14 2020 – 04:19.

90210_Hero #16 Posted Aug 14 2020 – 04:16

Scorpiany, on Aug 13 2020 – 22:12, said:

That’s really odd. I did specifically try it with a tank I could afford to recover, the Pz. II D, to make sure it worked; and I was able to process the recovery. Are you sure you’re clicking on “Preview Vehicle”? The recovery button is greyed out in the drop-down menu, but when I click on Preview Vehicle, the recovery button works just fine on the preview page itself.

Keep in mind that not all tanks can be recovered in-game at all times – If a tank is currently on sale in the Premium shop, you won’t be able to recover it until the sale ends (If the tank was already available). Otherwise, tanks sold in-game while they’re available in the Premium shop won’t be available beyond the first 2 days at all. You’ll have to send in a Customer Support ticket.

Although I don’t recall the Lorraine 40t going on sale recently, so I’m not sure why it wouldn’t be available for you.

Primo Victoria, Lorraine, M41 90, T-55a, T25 Pilot, Pz 3 K, T34 B, T-34S I can’t even buy back the little TKS tankette WG gave out a couple days ago for those measly 1100 or so credits. Using the button on the tank preview screen and using the 3rd “Recovery” option in the drop down both yield the same underwhelming result. The client does nothing, it doesn’t even hang like it’s pretending to do anything either.

Edited by 90210_Hero, Aug 14 2020 – 04:19.

Best Binary Options Brokers 2020:
  • Binarium
    Binarium

    Top Binary Options Broker 2020!
    Perfect For Beginners and Middle-Leveled Traders!
    Free Education How To Trade!
    Free Demo Account!
    Big Sign-up Bonus!

  • Binomo
    Binomo

    Good Choice For Experienced Traders!

Like this post? Please share to your friends:
Binary Options Trading, Strategies and Robots
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: