hello people i would like to know how do i get my matrix into a diagonally dominant form, is there a certian script to re arrange my matrix? thank you

0 |

10/8/2010 1:53:04 AM

"Abdullah " <lucker8@live.com> wrote in message <i8lti0$efs$1@fred.mathworks.com>... > hello people > > i would like to know how do i get my matrix into a diagonally dominant form, is there a certian script to re arrange my matrix? > > thank you - - - - - - - - - - What kinds of "rearrangements" do you have in mind? Multiplication on the left and right by unitary matrices as with singular value decomposition can certainly get you to a diagonally dominant form. In fact everything outside the diagonal disappears altogether in that case. Roger Stafford

0 |

10/8/2010 2:43:05 AM

On 10/7/2010 6:53 PM, Abdullah wrote: > hello people > > i would like to know how do i get my matrix into a diagonally dominant form, is there a certian > script to re arrange my matrix? > > thank you May be there is a command to do this. But from definition: http://math.nist.gov/MatrixMarket/glossary.html "Diagonal Dominance A matrix is diagonally dominant if the absolute value of each diagonal element is greater than the sum of the absolute values of the other elements in its row (or column)" Then given a matrix A, you need to just find the max of each row's sum and and each column's sum, and replace the diagonal element by the corresponding maximum of the 2 sums: Given A, this given B which is dominant diagonal matrix with respect to A: (all elements of A remain in B, but the B diagonal is dominant now) A=rand(3,3); B=A; B(eye(size(A))~=0)=0 z=max([sum(B,1)' sum(B,2)],[],2) B(eye(size(B))~=0)=z The above meets an >= not > as per definition, to force the greater than, you can simply add some delta of your choosing, to each entry in z before using it in the last statement above, or some multiple. -- example -------- A = 0.2417 0.1320 0.5752 0.4039 0.9421 0.0598 0.0965 0.9561 0.2348 EDU>> B B = 0.7072 0.1320 0.5752 0.4039 1.0881 0.0598 0.0965 0.9561 1.0526 --Nasser

0 |

10/8/2010 2:57:42 AM

"Nasser M. Abbasi" <nma@12000.org> wrote in message <i8m1b5$8sc$1@speranza.aioe.org>... > ....... > Then given a matrix A, you need to just find the max of each row's sum > and and each column's sum, and replace the diagonal element by the > corresponding maximum of the 2 sums: > ....... - - - - - - - - I've got a simpler way. Multiply the matrix by zero and then add ones to its diagonal! Of course that is ridiculous, but there needs to be some understanding of what operations or rearrangements are to be permitted in this endeavor. I suggest the OP tell us what he has in mind in this respect. Somehow I doubt that arbitrarily adding numbers to a diagonal would be an acceptable operation. Roger Stafford

0 |

10/8/2010 3:16:05 AM

On 10/7/2010 8:16 PM, Roger Stafford wrote: > "Nasser M. Abbasi"<nma@12000.org> wrote in message<i8m1b5$8sc$1@speranza.aioe.org>... >> ....... >> Then given a matrix A, you need to just find the max of each row's sum >> and and each column's sum, and replace the diagonal element by the >> corresponding maximum of the 2 sums: >> ....... > - - - - - - - - > I've got a simpler way. Multiply the matrix by zero and then add ones to its diagonal! > > Of course that is ridiculous, but there needs to be some understanding of what operations >or rearrangements are to be permitted in this endeavor. I suggest the OP tell us >what he has in mind in this respect. Somehow I doubt that arbitrarily adding numbers >to a diagonal would be an acceptable operation. > > Roger Stafford Agree, the OP specs are not clear. But I assumed he just wanted some matrix with some random numbers which happened to be DD to test an algorithm with, that is all. --Nasser

0 |

10/8/2010 3:26:31 AM

"Nasser M. Abbasi" <nma@12000.org> wrote in message <i8m316$bl6$2@speranza.aioe.org>... > Agree, the OP specs are not clear. But I assumed he just wanted some > matrix with some random numbers which happened to be DD to test an > algorithm with, that is all. > > --Nasser - - - - - - - - Yes, perhaps you are right, Nasser. I hadn't thought of that possibility. Roger Stafford

0 |

10/8/2010 3:45:06 AM

"Nasser M. Abbasi" wrote in message <i8m1b5$8sc$1@speranza.aioe.org>... > On 10/7/2010 6:53 PM, Abdullah wrote: > > hello people > > > > i would like to know how do i get my matrix into a diagonally dominant form, is there a certian > > script to re arrange my matrix? > > > > thank you > > May be there is a command to do this. > > But from definition: > > http://math.nist.gov/MatrixMarket/glossary.html > > "Diagonal Dominance > A matrix is diagonally dominant if the absolute value of each > diagonal element is greater than the sum of the absolute values of the > other elements in its row (or column)" > > Then given a matrix A, you need to just find the max of each row's sum > and and each column's sum, and replace the diagonal element by the > corresponding maximum of the 2 sums: > > Given A, this given B which is dominant diagonal matrix with respect to > A: (all elements of A remain in B, but the B diagonal is dominant now) > > A=rand(3,3); > B=A; > B(eye(size(A))~=0)=0 > z=max([sum(B,1)' sum(B,2)],[],2) > B(eye(size(B))~=0)=z > > The above meets an >= not > as per definition, to force the greater > than, you can simply add some delta of your choosing, to each entry in z > before using it in the last statement above, or some multiple. > > -- example -------- > A = > > 0.2417 0.1320 0.5752 > 0.4039 0.9421 0.0598 > 0.0965 0.9561 0.2348 > > EDU>> B > > B = > > 0.7072 0.1320 0.5752 > 0.4039 1.0881 0.0598 > 0.0965 0.9561 1.0526 > > --Nasser Good, what is the effect of this new matrix on "b". the right hand side of the linear equation Ax=b can this approach be modified to give new equation Bx=c that approximates the solution to Ax =B

0 |

3/24/2016 5:08:03 PM

Hello, I am a new beginner of Matlab and I want to create a Diagnoal Matrix with the main diagnoal as (A1,A2,A3,....,Aj) where Aj is also a matrix which is defined as (a11,a12,a13;a21,a22,a23;a31,a32,a33). How can I define Aj as a variable in the m file then create the diagnoal matrix through Aj? Could someone help on this please? Many Thanks in Advance! "Jie " <jz286@cam.ac.uk> wrote in message <h6selu$9ng$1@fred.mathworks.com>... > Hello, > > I am a new beginner of Matlab and I want to create a Diagnoal Matrix with the main diagnoal as (A1,A2,A3,....,Aj) w...

Hi everyone I want to creat a large diagonal matrix.The main diagonal elements of the diagonal matrix is a 3x3 matrix. For example I have a matrix A(3x3),now I should obtain the diagnoal matrix B(300x300),can anybody tell me how to do it? Deeply appreciate your help! Thank you in advance! Nandy Erik wrote: > > > Hi everyone > I want to creat a large diagonal matrix.The main diagonal > elements > of the diagonal matrix is a 3x3 matrix. > For example I have a matrix A(3x3),now I should obtain the diagnoal > matrix B(300x300), >Others I want to know how to create an...

Hi there, I have a code that computes Q'*D(t)*Q many times. Here Q is a fixed mxn matrix with m < n, while the diagonal matrix D depends on the iteration t. Because I have so many iterations that the operation slows done the entire process. I am wondering if there is any way to obtain Q'*D(t)*Q as fast as possible. Maybe from the result of Q'*Q or some kind of decomposition of Q'*Q? Thanks in advance! best, Gongguo "Gongguo Tang" wrote in message <ii7d79$lto$1@fred.mathworks.com>... > Hi there, > > I have a code that compute...

Dear Group members, I'm trying to solve the following algebra problem Consider a skew-symmetric matrix of the form: B=[0,A; -At,0] where 0 stands for a null matrix and At the transpose of matrix A. Is it possible to obtain a transformation of this matrix such as the new matrix in the new coordinates would be a block diagonal matrix of the form: C=[C1,0; 0,C2] with C=Tt * B * T, being T the transformation matrix? If possible how can I obtain such a transformation matrix? Thanks, RV ...

Hello all, I need to create a square matrix that has square block matricies along the diagonal and zeros everywhere else. That is to say, I need to create a block diagonal matrix where each submatrix is different. The overall matrix needs to have the form: M = - - | sm1 0 0 | | 0 sm2 0 | | 0 0 sm3 | - - Any advice would be greatly appreciated. Either post a reply or email me directly(phatphreak74@yahoo.ca). thanks in advance, the phreak phat phreak wrote: > Hello all, > I need to create a square matrix that has square block matricies > along the diagonal and zeros everywhere el...

Hi Suppose i have a matrix A= [1 4 5 8 7 3 6 5 2] I want to have a matrix B such each row of it has a row from A at the diagonal B=[1 4 5 0 0 0 0 0 0 0 0 0 8 7 3 0 0 0 0 0 0 0 0 0 6 5 2] how can i do it. I could do it with blkdiag but it supposes i input each row for the matrix, however i need something general since i need it for bigger matrices Thanks "matlab " <keep_smiling2100@yahoo.fr> wrote in message <jtkrgk$js0$1@newscl01ah.mathworks.com>... > Hi > Suppose i have a matrix A= [1 4 5 > 8 7 3 > 6 5 2] > I want to have a matrix B such each row of it has a row from A at the diagonal > > B=[1 4 5 0 0 0 0 0 0 > 0 0 0 8 7 3 0 0 0 > 0 0 0 0 0 0 6 5 2] > > how can i do it. I could do it with blkdiag but it supposes i input each row for the matrix, however i need something general since i need it for bigger matrices % Method 1 c = num2cell(A,2) B = blkdiag(c{:}) % Method 2 [i j] = find(A); B = accumarray([i (i-1)*size(A,2)+j], A(:)) % Method 3 [i j] = find(A); B = sparse(i, (i-1)*size(A,2)+j, A) % Bruno > % Method 1 > c = num2cell(A,2) > B = blkdiag(c{:}) > > % Method 2 > [i j] = find(A); > B = accumarray([i (i-1)*size(A,2)+j], A(:)) > > % Method 3 > [i j...

Hello, a)I need to create an M*M matrix of all zeros, except for one row on ones in the center. M in the matrix will vary from 16, 32,64,128. b)I need to repeat the above for two rows of ones.Here the two rows of ones should be seperated by four rows of zeros. Thank you, athina shah wrote: > Hello, > > a)I need to create an M*M matrix of all zeros, except for one row on > ones in the center. > > M in the matrix will vary from 16, 32,64,128. it will be pretty difficult, since you can not create the rows number 7.5, 15.5 and so one > b)I need to repeat the above ...

Hi, I have a 200x200 matrix and I wish to write certain values (a vector of 1x200) to its diagonal. Can you suggest a way to do it without using loop? Is there any direct command to write to the diagonal of a matrix? Thanks in advance. Regards, Sandeep "Sandeep " <sandeep.gore@yahoo.com> wrote in message <fj82bo$a8b$1@fred.mathworks.com>... > Hi, > > I have a 200x200 matrix and I wish to write certain values > (a vector of 1x200) to its diagonal. Can you suggest a way > to do it without using loop? Is there any direct command > to write to t...

In the diagonalization operation of a matrix A. [Q Gamma] = eig(A) Q= 1.0000 0 -1.0000 0 0 1.0000 0 -1.0000 0 0 0.0000 0 0 0 0 0.0000 Gamma= -0.0113 0 0 0 0 -0.0253 0 0 0 0 -0.0113 0 0 0 0 -0.0253 "Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.887379e-016." It seems that the eigenvalues are not different and the diagolization is a...

Hi everbody. First of all, I apologize for my English, so please be indulgent with me if my sentences are not grammatically correct. I have some trouble with MATLAB. I have some data in txt files that I catch like that : MFS93A1 = textread('Z:/Fichiers/MFS93.A1.txt','','headerlines',1); MFS93B1 = textread('Z:/Fichiers/MFS93.B1.txt','','headerlines',1); MFM77A1 = textread('Z:/Fichiers/MFM77.A1.txt','','headerlines',1); MFM77C1 = textread('Z:/Fichiers/MFM77.C1.txt','','headerlines',1); Then, in or...

Hi all, Is there a non-loop way of obtaining the digonal elements Aii from a matrix A and put them in a vector? A=rand(60); vd=digonal_elements_of(A) %vd is a vector Thanks, Per Look for the 'diag'-function thomas Per S wrote: > > > Hi all, > > Is there a non-loop way of obtaining the digonal elements Aii from > a > matrix A and put them in a vector? > > A=rand(60); > vd=digonal_elements_of(A) %vd is a vector > > Thanks, > Per thomas wrote: > > > Look for > the 'diag'-function > > thomas Ok thanks, I didn't kn...

I have a matrix of larger 4x4, and I have a smaller matrix of 2x2 and their respective row and column positions in the larger matrix. I want to assign the elements of the smaller matrix to the larger matrix on that specific row and column positions with out using any loop, I am doing so, im = zeros(4,4) r=[1 2; 3 4] c=[1 2; 3 4] indices = sub2ind(size(im),r,c); im1=ones(2,2) im(r, c)=im1(:) but it gives exception of, "Subscripted assignment dimension mismatch". any help in this regard will be appreciated. On 8/22/14, 2:20 PM, javed iqbal wrote: >...

How I can put time value like 10:23:34 in a matrix cell. Like below: a(1,2)= 10:23:34 Regards "M" wrote in message <kehbrk$3pp$1@newscl01ah.mathworks.com>... > How I can put time value like 10:23:34 in a matrix cell. Like below: > a(1,2)= 10:23:34 One approach is to use a cell array and have the entry be a string. E.g., a = cell(1,2); a{1,2} = '10:23:34'; James Tursa On 2/1/2013 3:46 PM, James Tursa wrote: > "M" wrote in message <kehbrk$3pp$1@newscl01ah.mathworks.com>... >> How I can put time value like 10:23:34 in a matrix cell. Like below: >> a(1,2)= 10:23:34 > > One approach is to use a cell array and have the entry be a string. E.g., > > a = cell(1,2); > a{1,2} = '10:23:34'; > And another is to use the fractional portion of a datenum representation-- >> a{1,2}=datenum('10:23:34',upper('hh:mm:ss'))- fix(datenum('10:23:34',upper('hh:mm:ss'))) a = [] [0.4330] >> datestr(a{1,2},'HH:MM:SS') ans = 10:23:34 >> -- ...

Hi, Probably a very silly question, but how can one talk about "two diagonals" of a matrix? I thought the diagonal of a matrix is M(i,i), the one going straight down the middle. Any help greatly appreciated. Bull Dog In addition to other explanations, there is this: <http://mathworld.wolfram.com/Diagonal.html> The diagonal you refer to is the 'main diagonal'. ...

Hi to all, I've encountered a problem using Matlab. As I'm not very familiar with matlab, there are functions which I have not used before. What I would like to know, if there is a way to express a matrix within a matrix. For example, R= [ r1 r2 r3 ... rn] where rn=[xn yn tn] and xn, yn, tn are column of numbers. I used the following code below to express the numbers in rn as coloumns for easy referencing. xn=r(:,1); %represents the columns in the matrix yn=r(:,2); tn=r(:,3); My objective is to be able to retrieve information in the matrix easily and compare their values. Meani...

Hi, I have a survey sample file with some 260 variables, that is repeated for 2= 1 different subgroups (this could go up to 50). Per subgroup, I create a co= rrelation matrix over all 260 variables (yes, that can be useful...). I.e.,= I use the CORR command to write out a matrix file. The goal of my intended analysis is to check the pairwise correlations for = outliers. Outliers are defined in comparison to same variable pairs across = all subgroups. Using VARSTOCASES, I can convert the matrix to long format, making all pair= s of the substantive variables the cases in the new ...

Hi folks, I'm working on parallelizing some machine learning code in MATLAB. I'm using the Parallel Computing Toolbox and the parfor construct; therefore, I have certain restrictions on how I must "slice" into certain data structures accessed within the parfor (parallel for) loop. Basically, I need to reshape my training data from an (N x d) two- dimensional matrix to a fully "slicable" (N/K x d x K) matrix, where K is the number of available parallel threads (which corresponds to the number of "slicable" input data partitions). Here, I would slice among the third dimension, i.e., partitioned_data (:,:,parallel_loop_index_i). (For now, assume N is a multiple of K.) I'm usually very good with reshape, permute, shiftdim, etc., but I am having trouble making this work nicely. I could hack in something like slicable_data_partitions = cat(3, manual_partition_1, manual_partition_2, ..., manual_partition_K) but that's horrible and I was hoping for an efficient one-liner with some combination of reshape, permute, etc. Performance is important, as this will be fairly large scale, i.e., numel(data) on the order of 10^7. Note I can actually get reshape to return output int he desired dimension, however, the d data elements along the second dimension in each of the N rows are no longer in the correct order. Detailed example of desired output: [N x d, 8 x 3]: input_data = reshape(1:24, 3, 8)' % Note transpose input_data = ...

I wanted to create a matrix A from other matrix B using some of its dagonals. I used spdiags() mentioned at page: <http://www.mathworks.com/access/helpdesk/help/techdoc/ref/spdiags.html> I used this kind of instruction : A = spdiags(B,-1:2,A) I have to do this operation thousands of times in my appln and time is a critical factor for me, i m looking out for some alternative to it. can any one suggest some alternate? ...

Hi all: I am new to MATLAB. I am having a problem in matrix operation using MATLAB. My matrix is of size 3 by 8 the form as follows: A = [(1,2,0,0,1,2,0,0); (2,1,0,0,2,3,0,0); (3,2,0,0,2,3,0,0)] what I wanted to do in this matrix is to find the average of values of between zeros in each rows separately and create a separate matrix. I want to exclude all the zeros from the new matrix creating. Then the new matrix will be of size 3 by 2 with form as follows: B = [(1.5, 1.5); (1.5, 2.5); (2.5, 2.5)] This is just a toy example. I would like to do it on a much larger matrix of size 442 by 540. Thanks Finto Can you expanciate further, if your array is say [1 2 0 1 2 3], what will you expect your answer to be, [1.5 1.5 2.5] or something else like [ 1.5 2.5], I mean if there is one zero what happens? "Finto " <fintoa@gmail.com> wrote in message <hadomd$7bh$1@fred.mathworks.com>... > Hi all: > I am new to MATLAB. I am having a problem in matrix operation using MATLAB. My matrix is of size 3 by 8 the form as follows: > > A = [(1,2,0,0,1,2,0,0); (2,1,0,0,2,3,0,0); (3,2,0,0,2,3,0,0)] > > what I wanted to do in this matrix is to find the average of values of between zeros in each rows separately and create a separate matrix. I want to exclude all the zeros from the new matrix creating. Then the new matrix will be of size 3 by 2 with form as follows: > > B = [(1.5, 1.5); (1.5, 2.5); (2.5, 2.5)] > > This is just a toy example. I...

I feel like this should be quite simple, but am having trouble figuring out how to do the following. I would like to be able to change the diagonal of a matrix to whatever I choose; more specifically, I need to create a matrix of random numbers with zeros on the diagonal. I can create the matrix, but I am having trouble finding a function to change the diagonal. Any help would be greatly appreciated! One approach: A = rand(5); A + diag(-diag(A)) Another: N = 6; A = rand(N); A(linspace(1,N^2,N)) = 0 ...

Hi, I have a similar matrix to this: 1 0 0 0 0 3 0 0 0 0 2 0 0 0 0 5 what function in matlab would extract a vector like this: 1 3 2 5 ? In article <ef5ac76.-1@webcrossing.raydaftYaTP>, Paulina <paulia7@hotmail.com> wrote: >I have a similar matrix to this: > 1 0 0 0 > 0 3 0 0 > 0 0 2 0 > 0 0 0 5 >what function in matlab would extract a vector like this: >1 3 2 5 One way: X(sub2ind(size(X),1:size(X,1),1:size(X,2))) Another way: X((1+1:size(X,1)).*(1:size(X:1))/2) -- Is there any thing whereof it may be said, See...

Hi all, Does anybody know what is the most efficient way to cobstruct a diagonal matrix from a vector of entries? For example I want to create: 1 0 0 0 2 0 0 0 3 from: a=1:3; "blkdiag" does not work here since I need to enter the vector elements one by one which I can't since "a" can be very large. Thanks, Elnaz On 9/5/2013 3:16 PM, Elnaz wrote: > Hi all, > > Does anybody know what is the most efficient way to cobstruct a diagonal ?matrix from a vector of entries? > For example I want to create: > 1 0 0 > 0 2 0 > 0 0 3 > from: a=1:3; > "blkdiag" does not work here since I need to enter the vector elements one >by one which I can't since "a" can be very large. > > Thanks, > Elnaz > what is wrong with diag? EDU>> a=1:3; EDU>> diag(a) 1 0 0 0 2 0 0 0 3 ...

hi, everyone! i'm doing a little program, and it would be usefull to know if the matrix the user inputs id diagonal. i know how to do a function that does so, but using a for(...;...;...) and i've seen recently that people defines functions like this: issym=@(x) all(all(x==x.')); tf=issym(mat); (this one checks if the matrix is symetric) so i would aprciate, a function that check if a matrix is diagonal, or at least some explanation for me to build it that way. thanks in advance Perhaps this, isdiag=@(A) ~nnz(A-spdiags(diag(A),0,size(A,1))); "Ma...

I have a "matrix" with dimensions (n,n,M), which can be interpreted as a vector of M n-by-n matrices. Is there a away for me to take the diagonal of all these M matrices at once? I.e. taking the diagonal only with respect to the first two dimensions. Mauro <msmscarlatti@googlemail.com> wrote in message <f13aac49-c83e-432e-8697-60e7a8963834@x42g2000yqx.googlegroups.com>... > I have a "matrix" with dimensions (n,n,M), which can be interpreted as > a vector of M n-by-n matrices. Is there a away for me to take the > diagonal of all these M matrices ...

... developed by Komori Masaharu, an associate professor from Kyoto University. Using a clever wheel-in-wheel system, the buggy can travel diagonally ...

They can now only walk in right angles, and the films may be suffering for it.

Long kitchen utensils and gadgets take up a lot of space. Store them more efficiently and free up some room in your kitchen drawers by creating ...

Willow trees cultivated for 'green energy' can yield up to five times more biofuel if they grow diagonally, compared with those that are allowed ...

... Connected Homes Entertainment Smart Appliances Resources ▲ 🔎 Where to buy LG 55" OLED Smart TV with Cinema 3D (54.6" Diagonally) ...

Times are tough for Nintendo. The Wii U is not selling very well. So maybe it is time to focus on old school games that don’t require a screen. ...

A few months ago, we tested the a prototype of the Synaptics ThinTouch keyboard. Designed for ultrabooks, it incorporated some new and interesting ...

OLED Your first kiss. A baby's first steps. The majesty of a desert sunset. Some things in life defy all explanation and must be experienced ...

Compare Smart TVs similar to LG 55" OLED Smart TV with Cinema 3D (54.6" Diagonally)

Resources last updated: 3/24/2016 8:29:55 PM