0

I have to two evenly sized very large vectors (columns) A and B. I would like to divide vector A by vector B. This will give me a large matrix AxB filled with zeros, except the last column. This column contains the values I'm interested in. When I simple divide the vectors in a Matlab script, I run out of memory. Probably because the matrix AxB becomes very large. Probably I can prevent this from happening by repeating the following:

  1. calculating the first row of matrix AxB

  2. filter the last value and put it into another vector C.

  3. delete the used row of matrix AxB

  4. redo step 1-4 for all rows in vector A

How can I make a loop which does this?

2
  • What is B^-1? Are you multiplying A by the element-wise inverse of B? Commented Feb 12, 2013 at 17:45
  • Can you update your question with the code you are using to divide A by B Commented Feb 12, 2013 at 18:59

2 Answers 2

0

You're question doesn't make it clear what you are trying to do, although it sounds like you want to do an element wise division.

Try:

C = A./B
Sign up to request clarification or add additional context in comments.

Comments

0

"Matrix product AxB" and "dividing vectors" are distinct operations. If we understood this correctly, what you do want to calculate is "C = last column from AxB", such that:

lastcolsel=zeros(size(B,2),1)
C=(A*B)*lastcolsel

If that code breaks your memory limit, recall that matrix product is associative (MxN)xP = Mx(NxP). Simplifying your example, we get:

lastcolsel=zeros(size(B,2),1)
simplifier=B*lastcolsel
C=A*simplifier

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.