expand a dense matrix
问题 What would be the most efficient way to expand a dense matrix with new columns in FORTRAN? Say T is a dense matrix m by n and I would like to make it m by n+1. One strategy I could think of : Reallocate at each step and assign the last column or would there be some better ways, such as allocating some space before and checking if that is sufficient and if not do the reallocation kind of stuff? Any ideas? 回答1: Assuming m and n are in some sense not exceedingly large, so that your matrices fit