annotate trunk/matlab/bmm/carfac/CARFAC_Cross_Couple.m @ 704:e9855b95cd04

Small cleanup of eigen usage in SAI implementation.
author ronw@google.com
date Tue, 16 Jul 2013 19:56:11 +0000
parents 933cf18d9a59
children
rev   line source
dicklyon@561 1 function ears = CARFAC_Cross_Couple(ears);
dicklyon@559 2
dicklyon@561 3 n_ears = length(ears);
dicklyon@560 4 if n_ears > 1
alexbrandmeyer@668 5 n_stages = ears(1).AGC_coeffs(1).n_AGC_stages;
dicklyon@560 6 % now cross-ear mix the stages that updated (leading stages at phase 0):
dicklyon@561 7 for stage = 1:n_stages
alexbrandmeyer@668 8 if ears(1).AGC_state(stage).decim_phase > 0
dicklyon@560 9 break % all recently updated stages are finished
dicklyon@560 10 else
alexbrandmeyer@668 11 mix_coeff = ears(1).AGC_coeffs(stage).AGC_mix_coeffs;
dicklyon@560 12 if mix_coeff > 0 % Typically stage 1 has 0 so no work on that one.
dicklyon@560 13 this_stage_sum = 0;
dicklyon@560 14 % sum up over the ears and get their mean:
dicklyon@560 15 for ear = 1:n_ears
alexbrandmeyer@668 16 stage_state = ears(ear).AGC_state(stage).AGC_memory;
dicklyon@560 17 this_stage_sum = this_stage_sum + stage_state;
dicklyon@560 18 end
dicklyon@560 19 this_stage_mean = this_stage_sum / n_ears;
dicklyon@560 20 % now move them all toward the mean:
dicklyon@560 21 for ear = 1:n_ears
alexbrandmeyer@668 22 stage_state = ears(ear).AGC_state(stage).AGC_memory;
alexbrandmeyer@668 23 ears(ear).AGC_state(stage).AGC_memory = ...
dicklyon@560 24 stage_state + mix_coeff * (this_stage_mean - stage_state);
dicklyon@560 25 end
dicklyon@559 26 end
dicklyon@559 27 end
dicklyon@559 28 end
dicklyon@559 29 end