Print

Print


Yunkai Zhou writes:

 > I ran into "Segmentation fault" for big "n"...
 > the results I got are all correct for "n" not too big...
 > my other observation is:
 >     if I change A, Q, S into allocatable arrays, with dimension
 >     (n, n), n from user input, then there seems not any problem
 >     (to save your trouble of typing, I also attached the code using 
 >      allocatable array at the end)

Sounds like implementation-dependent stack limits.  The implementation
probably allocates the arrays on a stack when they are statically
dimensioned, but on a heap when they are allocatable.

This is not really a language issue at all, but a symptom of some
particular implementation and environment choices.

The easiest solution is usually just to increase your heap limit.
Details depend on your operating system and shell.  Often something
like "limit stack u" (for unlimitted stack size), preferably in
your .cshrc or some such file so that its automatically done for you.
Details *do* vary, so check for your system in particular.

-- 
Richard Maine
[log in to unmask]



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%