how to perform Many to one mapping
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
hello,
i am having a bit string (say 'a') of size 756*1...and another bit string (say b) of size 576*1...now, i want many to one mapping to be performed on this bit string..
for example: the operation to be performed is shown below
b(k)= a(j) j=1....756, k= j mod 576...
댓글 수: 1
Guillaume
2017년 3월 20일
k cannot be j mod 576 as this would produce zero indices. k could be ((j-1) mod 576)+1
채택된 답변
Walter Roberson
2017년 3월 20일
0 개 추천
Afterwards, should b(1) be assigned the value of a(1), or should it be assigned the value of a(577) ?
댓글 수: 17
Jyothi Alugolu
2017년 3월 20일
it's many to one mapping,means same index will be mapped to more than one element..i.e a(1) and a(577) both must be mapped to b(1)...
Walter Roberson
2017년 3월 20일
Is it correct that b(1) would somehow have to store both a(1) and a(577) distinctly? In any particular order? How would the user indicate which of the "many" to access?
Are you trying to create a hash table? If you are then what is your collision strategy?
Jyothi Alugolu
2017년 3월 20일
편집: Walter Roberson
2017년 3월 20일
A binary string {b(j)} j=1..756.. To achieve many-to-one mapping, we now need to apply the modulo operation to the index j of the binary string {b(j)}, i.e., j mod 576... We then map the elements of {b(j)} to a new (shortened) binary string {b(k)} as follows:
b(k) =b(j), k = j mod 576, j = 1, · · · , 756 , k=1...576...
Walter Roberson
2017년 3월 20일
편집: Walter Roberson
2017년 3월 20일
No, that definition does not work. That requires that the original b(1) and the original b(577) are both at b(1) in some undefined way.
Jyothi Alugolu
2017년 3월 20일
for example: if j=1..10 and s=5,then k=j mod s..which means a(1) and a(6) which has same mod values must store in b(k)...
Yes, but which one? If you start with (say)
b = [1 1 1 1 1 0 0 0 0 0]
and s = 5, then after the mapping, b(1) would have to be both 0 and 1, but which one?
Jyothi Alugolu
2017년 3월 20일
both 0 and 1...if,suppose a(1) has bit value 0 and a(6) has bit value 1,then b(1) must have both 0 and 1
Jyothi Alugolu
2017년 3월 21일
a(1) and a(6) bit values must be mapped to b(1) (since a(1) and a(6) has mode value 1,so both a(1) and a(6) map to b(1))...
for suppose..a(1)=1 mod 5 = 1 and a(6)=6 mod 5 = 1.....so a(1) and a(6) has same mod values.now a(1) and a(6) must map to b(1) since they have mod value 1..b(1) contains a(1) and a(6) values...i am not worried about the it values..i just want many to one mapping..b(1) must contain both bit values of a(1) and a(6)...
new_len = 576;
old_len = length(a);
mapped_index = 1 + mod((1:old_len) - 1, new_len);
b = accumarray( mapped_index(:), a(:), [new_len 1], @(L) {unique(L.')} ) .';
You would then need to reference b{1} to get the various numbers stored at location b(1)
Guillaume
2017년 3월 21일
Isn't this more or less the same as what I proposed over a day ago and has been completely ignored?
Walter Roberson
2017년 3월 21일
Yup. I generalized slightly. I also arranged the bits in a different order that seemed more natural. But the biggest change is unique() the bits to emphasize that many-to-one mappings are unordered unless order is specifically requested (in which case it becomes a different scenario.)
Jyothi Alugolu
2017년 3월 22일
Thank you Walter Roberson and Guilaume....
Jyothi Alugolu
2017년 3월 27일
Hello, i have one more question...now how to apply FFT on b( above generated bit string)...
Jyothi Alugolu
2017년 3월 27일
while applying FFT on 'b', there was an error "Undefined function 'fft' for input arguments of type 'cell'"...can u tell me how to apply FFT on dis 'b'...
Guillaume
2017년 3월 27일
I would suggest you start a new question, explaining in a lot more details what it is you want to do.
Applying a fft on a bit string does not make much sense. Applying a fft on your multi-valued b makes absolutely no sense.
Jyothi Alugolu
2017년 3월 27일
Normally we have to apply FFT on binary string 'b' which is of double,but our generated binary string is of type cell..so,we used cell2mat function to convert input argument of type cell to double..but,there is a problem i.e., the cell with 2 values of generated binary string is being splitted (like if a cell(be 4) in 'b' has [0,1] values,then after using Cell2mat function the 4th cell is having 0 value and 5th cell is having 1 value)...but, i dont want these 2 values to be splitted...i want these 2 values to be within a cell to apply FFT..if it is not possible to apply FFT on this 'b' without using cell2mat function,can you please tell me how to overcome this problem...
Walter Roberson
2017년 3월 27일
What you ask for is not possible. It is meaningless to apply fft to a many-to-one mapping.
추가 답변 (1개)
Guillaume
2017년 3월 20일
Is this what you're after? (I'm unclear on the result you want to obtain)
a = randi([0 1], 756, 1); %random demo data
b = randi([0 1], 576, 1); %does the content of b matter?
b = accumarray(mod(0:numel(a)-1, numel(b))'+1, a, [], @(bits) {bits})
카테고리
도움말 센터 및 File Exchange에서 Tables에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
