Ejemplo n.º 1
0
        private ReferencingVectorParameterExpression <T> CreateScalarLocal <T>(T value, out ILocalNArray array)
        {
            NArray <T> localArray = null;
            var        index      = NextLocalIndex();

            if (typeof(T) == typeof(double))
            {
                localArray = new LocalNArray(index, Convert.ToDouble(value)) as NArray <T>;
            }
            else
            {
                throw new NotImplementedException();
            }
            array = localArray as ILocalNArray;
            var parameter = new ReferencingVectorParameterExpression <T>(localArray.First(), ParameterType.Local, index);

            _localParameters.Add(parameter);
            return(parameter);
        }
Ejemplo n.º 2
0
        private ReferencingVectorParameterExpression <T> CreateLocalOfLength <T>(int length, out ILocalNArray array)
        {
            NArray <T> localArray = null;
            var        index      = NextLocalIndex();

            if (typeof(T) == typeof(double))
            {
                localArray = new LocalNArray(index, length) as NArray <T>;
            }
            else if (typeof(T) == typeof(int))
            {
                localArray = new LocalNArrayInt(index, length) as NArray <T>;
            }
            array = localArray as ILocalNArray;
            var parameter = new ReferencingVectorParameterExpression <T>(localArray, ParameterType.Local, index);

            _localParameters.Add(parameter);
            return(parameter);
        }