I have a problem. The result that i want to obtain is a matrix 2x2(note C). The parameter that i give to calculate the matrix C are a(n),b(n). So I want to obtains n matrix. What is the idea to do i?
Thank of avance
Sorry but I’m not quite sure what you’re asking. Are “a” and “b” linearized 2-D arrays where n=2 (2x2)? If so, then just take the normal matrix multiply algorithm and instead of accessing using a_[j], use a computed index “idx=i*2+j”.
I’m sorry, I ased a question not clear. Example, I have n couple (a(i),b(i)),i=1,n. I want to calcul matrix A(mxk) n time. Example, at 1-th step, i have
at n-th step, i have
The results which I want to obtains are n matrix A(mxk)
Thank you of avance.
What is k? There is no occurrence of k in the definitions of A(i,j) that you gave. Given that i=1:m and j=1:n, according to the definitions A is m x n, not m x k, unless k=n.
I am reminded of what one of my mathematics teachers used to drill into his students: “A problem well defined is a problem half solved”.
A is a matrix of size mxk, then j=1,…,k. I had a mistake.
Sorry, still not quite understanding what question you’re asking. Do you need to sum A(i,j) n times?
do i=1,m do j=1,k A(i,j) = 0.0 do n=1,n A(i,j)=A(i,j) + a(n)**i * b(n)**j enddo enddo enddo
Thank you very much; I solved my problem.