Statistical programming, matrix languages, and more

matrix vectorization

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

matrix vectorization

How to perform matrix vectorization in PROC IML?

I would like to find vec(C). for example: 

C=  [1     2
     3     4]

vec(C)` = [1      3      2      4]  

 


Accepted Solutions
Solution
‎07-12-2017 04:40 AM
Frequent Contributor
Posts: 147

Re: matrix vectorization

Posted in reply to ducman1611

Take a look at the documentation for the SHAPECOL and SHAPE functions.   For example:

 

proc iml;
c = {1 2,
     3 4};
d = shapecol(c, 1, 4);
print d;

View solution in original post


All Replies
Solution
‎07-12-2017 04:40 AM
Frequent Contributor
Posts: 147

Re: matrix vectorization

Posted in reply to ducman1611

Take a look at the documentation for the SHAPECOL and SHAPE functions.   For example:

 

proc iml;
c = {1 2,
     3 4};
d = shapecol(c, 1, 4);
print d;
Occasional Contributor
Posts: 19

Re: matrix vectorization

Posted in reply to IanWakeling

Thanks, 

I found another way which also works:

vec_c= colvec(c`);
print vec_c;
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 305 views
  • 6 likes
  • 2 in conversation