From: yang on 13 Jul 2010 19:38 Hi, By ell i mean sum of elements of each vector like (1 0 0 1 1)==>n=5 and ell=1+0+0+1+1=3.
From: Bruno Luong on 13 Jul 2010 20:23 "yang " <macmaster_egypt(a)yahoogroups.com> wrote in message <i1itct$dgn$1(a)fred.mathworks.com>... > Hi, > By ell i mean sum of elements of each vector like (1 0 0 1 1)==>n=5 and ell=1+0+0+1+1=3. r = 5; ell = 3; j = nchoosek(1:r,ell); i = repmat((1:size(j,1))',1,size(j,2)); z = accumarray([i(:) j(:)],1) % Bruno
From: Roger Stafford on 13 Jul 2010 20:41 "yang " <macmaster_egypt(a)yahoogroups.com> wrote in message <i1itct$dgn$1(a)fred.mathworks.com>... > Hi, > By ell i mean sum of elements of each vector like (1 0 0 1 1)==>n=5 and ell=1+0+0+1+1=3. - - - - - - - Yang, in your first posting you said "So we would like to sum over theses z_r's." Subsequently I said "You still haven't made it clear what you mean by 'sum over'." You then said, "By sum over i mean the sum of each row." And later you said "By ell i mean sum of elements of each vector like (1 0 0 1 1)==>n=5 and ell=1+0+0+1+1=3." My question to you is this. If by ell you meant the sum of the elements in the vectors and if these vectors are row vectors, and if by "sum over" you meant the same thing, the sums of the rows, what was your purpose in putting this thread on CSSM? What is it you wanted to find out in the way of summing if ell was already your answer? Roger Stafford
From: Nathan on 14 Jul 2010 14:57 On Jul 13, 5:41 pm, "Roger Stafford" <ellieandrogerxy...(a)mindspring.com.invalid> wrote: > "yang " <macmaster_eg...(a)yahoogroups.com> wrote in message <i1itct$dg...(a)fred.mathworks.com>... > > Hi, > > By ell i mean sum of elements of each vector like (1 0 0 1 1)==>n=5 and ell=1+0+0+1+1=3. > > - - - - - - - > Yang, in your first posting you said "So we would like to sum over theses z_r's." Subsequently I said "You still haven't made it clear what you mean by 'sum over'." You then said, "By sum over i mean the sum of each row." And later you said "By ell i mean sum of elements of each vector like (1 0 0 1 1)==>n=5 and ell=1+0+0+1+1=3." > > My question to you is this. If by ell you meant the sum of the elements in the vectors and if these vectors are row vectors, and if by "sum over" you meant the same thing, the sums of the rows, what was your purpose in putting this thread on CSSM? What is it you wanted to find out in the way of summing if ell was already your answer? > > Roger Stafford If you read the title more clearly, you would notice that he asks "how to generate all vectors of length n" with the sum of ell. He just wants to know, based on a given vector length and sum of 1's, how to generate these vectors. -Nathan
From: Roger Stafford on 14 Jul 2010 15:34 Nathan <ngreco32(a)gmail.com> wrote in message <30247d60-dfed-4069-8172-49c3d6cc6ba4(a)n19g2000prf.googlegroups.com>... > If you read the title more clearly, you would notice that he asks "how > to generate all vectors of length n" with the sum of ell. > He just wants to know, based on a given vector length and sum of 1's, > how to generate these vectors. > > -Nathan - - - - - - - - The subject text I read was "how to generate all vectors of length n with entries are 0's or 1's then sum over" with no mention of summing to ell. However, your explanation, Nathan, is the only one that makes sense, in which case I owe you an apology, Yang. Bruno's suggestion of nchoosek is a valid way to do your problem. Roger Stafford
|
Pages: 1 Prev: path of last imported file Next: Processing 3d point cloud resulted by 3d scanner |