Summary of Automatic Resizing of Matrix Objects

When you perform a matrix object assignment, EViews will resize, where possible, the destination object to accommodate the contents of the source matrix. This resizing will occur if the destination object type can be modified and sized appropriately and if the values of the destination may be assigned without ambiguity. You can, for example, assign a matrix to a vector and vice versa, you can assign a scalar to a matrix, but you cannot assign a matrix to a scalar since EViews does not permit scalar resizing.

The following table summarizes the rules for resizing of matrix objects as a result of declarations of the form

object_type y = x

where object_type is an EViews object type, or is the result of an assignment statement for Y after an initial declaration, as in:

object_type y

y = x

Each row of the table corresponds to the specified type of the destination object, Y. Each column represents the type and size of the source object, X. Each cell of the table shows the type and size of object that results from the declaration or assignment.

Object type and size for source X | ||

Object type for Y | coef(p) | matrix(p,q) |

coef(k) | coef(p) | invalid |

matrix(n,k) | matrix(p,1) | matrix(p,q) |

rowvector(k) | rowvector(p) | invalid |

scalar | invalid | invalid |

sym(k) | invalid | sym(p) if p=q |

vector(n) | vector(p) | invalid |

Object type and size for source X | ||

Object type for Y | rowvector(q) | scalar |

coef(k) | coef(q) | coef(k) |

matrix(n,k) | matrix(1,q) | matrix(n,k) |

rowvector(k) | rowvector(q) | rowvector(k) |

scalar | invalid | scalar |

sym(k) | invalid | invalid |

vector(n) | rowvector(q) | vector(n) |

Object type and size for source X | ||

Object type for Y | sym(p) | vector(p) |

coef(k) | invalid | coef(p) |

matrix(n,k) | matrix(p,p) | matrix(p,1) |

rowvector(k) | invalid | vector(p) |

scalar | invalid | invalid |

sym(k) | sym(p) | invalid |

vector(n) | invalid | vector(p) |

For example, consider the command

matrix(500,4) y = x

where X is a coef of size 50. The object type is given by examining the table entry corresponding to row “matrix Y” (), and column “coef X” (). The entry reads “matrix()”, so that the result Y is a matrix.

Similarly, the command:

vector(30) y = x

where X is a 10 element rowvector, yields the 10 element rowvector Y. In essence, EViews first creates the 30 element rowvector Y, then resizes it to match the size of X, then finally assigns the values of X to the corresponding elements of Y.