Mercurial > hg > aimc
changeset 600:b1cbc2617c7f
Updated Matrix resizing and Zeroing using rif@google's suggestions.
author | flatmax |
---|---|
date | Tue, 26 Feb 2013 10:43:26 +0000 |
parents | b4323584c9fa |
children | b8a27b613867 |
files | trunk/C++/CAR.C trunk/C++/codeblocks/CARFAC.layout |
diffstat | 2 files changed, 11 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/C++/CAR.C Wed Feb 20 22:34:13 2013 +0000 +++ b/trunk/C++/CAR.C Tue Feb 26 10:43:26 2013 +0000 @@ -34,11 +34,11 @@ void CAR::designFilters(FP_TYPE fs, int n_ch) { // don't really need these zero arrays, but it's a clue to what fields // and types are need in ohter language implementations: - coeff.r1_coeffs.resize(n_ch, 1); coeff.r1_coeffs-=coeff.r1_coeffs; // resize and zero - coeff.a0_coeffs.resize(n_ch, 1); coeff.a0_coeffs-=coeff.a0_coeffs; - coeff.c0_coeffs.resize(n_ch, 1); coeff.c0_coeffs-=coeff.c0_coeffs; - coeff.h_coeffs.resize(n_ch, 1); coeff.h_coeffs-=coeff.h_coeffs; - coeff.g0_coeffs.resize(n_ch, 1); coeff.g0_coeffs-=coeff.g0_coeffs; + coeff.r1_coeffs=Matrix<FP_TYPE, Dynamic, 1>::Zero(n_ch,1); // resize and zero + coeff.a0_coeffs=Matrix<FP_TYPE, Dynamic, 1>::Zero(n_ch,1); + coeff.c0_coeffs=Matrix<FP_TYPE, Dynamic, 1>::Zero(n_ch,1); + coeff.h_coeffs=Matrix<FP_TYPE, Dynamic, 1>::Zero(n_ch,1); + coeff.g0_coeffs=Matrix<FP_TYPE, Dynamic, 1>::Zero(n_ch,1); // zr_coeffs is not zeroed ... perhaps it should be ? // zero_ratio comes in via h. In book's circuit D, zero_ratio is 1/sqrt(a), @@ -76,12 +76,11 @@ // for unity gain at min damping, radius r; only used in CARFAC_Init: Array<FP_TYPE, Dynamic,1> relative_undamping(n_ch, 1); - relative_undamping=(relative_undamping-=relative_undamping).cos();// what is an efficient way to set a matrix to 1. ? As this is in a design phase, I will leave it for now + relative_undamping=Array<FP_TYPE, Dynamic, 1>::Zero(n_ch, 1).cos(); // this function needs to take CAR_coeffs even if we haven't finished // constucting it by putting in the g0_coeffs: coeff.g0_coeffs = stageG(relative_undamping); - } Array<FP_TYPE, Dynamic, 1> CAR::stageG(Array<FP_TYPE, Dynamic, 1> &relative_undamping) {
--- a/trunk/C++/codeblocks/CARFAC.layout Wed Feb 20 22:34:13 2013 +0000 +++ b/trunk/C++/codeblocks/CARFAC.layout Tue Feb 26 10:43:26 2013 +0000 @@ -25,8 +25,8 @@ <File name="../AGCState.H" open="0" top="0" tabpos="9"> <Cursor position="94" topLine="0" /> </File> - <File name="../CAR.C" open="1" top="0" tabpos="1"> - <Cursor position="3569" topLine="65" /> + <File name="../CAR.C" open="1" top="1" tabpos="1"> + <Cursor position="3388" topLine="65" /> </File> <File name="../CAR.H" open="1" top="0" tabpos="2"> <Cursor position="1679" topLine="26" /> @@ -35,7 +35,7 @@ <Cursor position="94" topLine="0" /> </File> <File name="../CARCoeff.H" open="1" top="0" tabpos="8"> - <Cursor position="1536" topLine="20" /> + <Cursor position="1171" topLine="20" /> </File> <File name="../CARFACCommon.H" open="1" top="0" tabpos="7"> <Cursor position="2156" topLine="46" /> @@ -58,8 +58,8 @@ <File name="../Coefficients.H" open="1" top="0" tabpos="10"> <Cursor position="1139" topLine="12" /> </File> - <File name="../Ear.C" open="1" top="1" tabpos="3"> - <Cursor position="2174" topLine="25" /> + <File name="../Ear.C" open="1" top="0" tabpos="3"> + <Cursor position="1709" topLine="40" /> </File> <File name="../Ear.H" open="1" top="0" tabpos="4"> <Cursor position="1086" topLine="18" />