0
votes

I have a problem about overflowing memory in Matlab. I am working in channel coding using Ludy code. The encoding symbol y is created as following

y=x*G

where G is matrix n-by-m and x is input symbol that size 1-by-n

My problem is that I want to work with number of input symbols is large. Hence, I must allocate a G matrix that its size is very large. However, it occurs overflow memory problem. I am using Matlab 2012a to do it. Could you suggest to me some method to resolve my problem

For example my G matrix is 40000-by-60000 This is my code

function G = gen_matrix(n,m)
    G = zeros(n,m);
    for i=1:m
        d=randi(n/2);
        column = [ones(1,d) zeros(1,n-d)];
        column = column(randperm(n));
        G(:,i) = column';
    end
end

This is my memory information

[userview systemview] = memory;

systemview.VirtualAddressSpace

ans = 

    Available: 1.4074e+14
        Total: 1.4074e+14
1
Have you read: mathworks.com/help/matlab/matlab_prog/… and mathworks.com/help/matlab/matlab_prog/…? Also are your matrices suitable candidates to be sparse (i.e. contain a lot of zeros) - Dan
Well, do it otherwise (see @Dan 's answers) or buy more RAM ;) - Ander Biguri
@AnderBiguri more RAM might not help if yu don't read those articles. Matlab (32bit) by default only lets you access 2GB of RAM no matter how much you have. - Dan
@user8264 What OS are you using and is it 32 or 64 bit? Is your Matlab 32 or 64 bit? Upgrading might help... - Dan
@Dan Definetly. Memory issues are way comples than "buy more RAM", I know. But unless the OP nows that vector will be his/her upper boundary in memory, then he needs to find another way of doing it. - Ander Biguri

1 Answers

1
votes

Try using a sparse matrix:

function G = gen_matrix(n,m)
    G = sparse(zeros(n,m));
    for i=1:m
        d=randi(n/2);
        column = [ones(1,d) sparse(zeros(1,n-d))];
        column = column(randperm(n));
        G(:,i) = column';
    end
end