In any programming language, I think you just do it with a pair of nested loops for loops like this:
Given:
Vector R; // I will use parentheses R (3) to denote the third element. // (which is stored in memory cell R [2] in languages ββwith zero arrays) int N;
Matrix M = matrix (N, N); // new instance of your matrix object, or you can just use arrays.
int i,j,k; k=1; for(i=1;i<N;i++) { M(i,i)=1; for(j=i+1,j<=N;j++) { M(i,j)=M(j,i)=R[k]; k=k+1; } }
Here, I assumed that you know what N is, and that you have basic objects such as available vectors and matrices. (If not, this is a big problem with a pattern for writing your first "objects"). Complex data structures, such as vectors, matrices, complex numbers, and histograms, create ideal objects. The right approach to object-oriented programming for scientific work is that you use objects to teach your compiler to understand the high-level data types that you want to use in your real work ... Objects are used to create a custom programming language perfect for your type of work. Everything that is usually useful should be included in the object, as these objects will grow and develop in order to be your reusable code base.
Top-level code can be either a very powerful, easy to read, and clean application (since most of the detailed work is done in objects). Also, for fast and dirty coding, the top-level code is where you put all the fragile hacks. Because it is not intended to be reused.
Once you get something like this debugged, you simply create a matrix constructor that takes the correlation vector and N as arguments, and initializes the matrix for you.
Of course, if you use some kind of high-level graphical mathematical program that has strong opinions about what you can and cannot do with matrices and vectors, then you will need to multiply the vector by N matrices to generate each of the columnar vectors of a finite matrix. (or read the manual)
At least you will need to tell us what is called a mathematical program ... :)