I am trying to augment a matrix with an identity matrix of similar dimensions, why is this bit of code not working?

It keeps giving the error 'vector subscript out of range'

```
for (i = 0; i < matrix.size(); i++)
    for (j = matrix.size(); j < 2 * matrix.size(); j++)
        if (i == j % matrix.size())
            matrix[i][j] = 1;
        else
            matrix[i][j] = 0;

```