コード例 #1
0
ファイル: WalshTransform.cs プロジェクト: VisuMap/OpenVisuMap
        public static INumberTable Filter(INumberTable inTable, double lowFreq, double highFreq, int dimension, INumberTable baseTable)
        {
            int        lowIdx  = (int)(lowFreq * dimension);
            int        hiIdx   = (int)(highFreq * dimension);
            List <int> columns = new List <int>();

            for (int i = 0; i < dimension; i++)
            {
                if ((i >= lowIdx) && (i <= hiIdx))
                {
                    columns.Add(i);
                }
            }

            INumberTable B        = baseTable.SelectColumns(columns);
            INumberTable Bt       = B.Transpose2();
            int          b        = B.Columns;
            int          r        = inTable.Rows;
            int          m        = inTable.Columns;
            INumberTable outTable = null;

            //Depending on the size of m relative to r and b, we can
            //optimize the calculation by arrange the matrix multiplication.
            if (2 * r * b < m * (r + b))
            {
                // The complexity in this arrangement is 2*m*r*b.
                outTable = FourierTransform.MatrixProduct(FourierTransform.MatrixProduct(inTable, B), Bt);
            }
            else
            {
                // The complexity in this arrangement is m*m*(r+b).
                outTable = FourierTransform.MatrixProduct(inTable, FourierTransform.MatrixProduct(B, Bt));
            }

            IList <IColumnSpec> oSpecList = outTable.ColumnSpecList;
            IList <IColumnSpec> iSpecList = inTable.ColumnSpecList;

            for (int col = 0; col < outTable.Columns; col++)
            {
                oSpecList[col].CopyFrom(iSpecList[col]);
            }

            return(outTable);
        }
コード例 #2
0
 public INumberTable Transform(INumberTable inTable)
 {
     return(FourierTransform.MatrixProduct(inTable, haar));
 }