示例#1
0
        /// <summary>
        /// This returns a read-only vector of a <see cref="INumericColumn" />, but the data are copyied before. Thus, if you change the data
        /// into the numeric column, the data of the returned vector is not influenced.
        /// </summary>
        /// <param name="col">The column to wrap.</param>
        /// <returns>A read-only vector which contains data copied from the numeric column.</returns>
        public static IROVector ToROVectorCopy(DataColumn col)
        {
            if (!(col is INumericColumn))
            {
                throw new ArgumentException("Argument col can not be wrapped to a vector because it is not a numeric column");
            }

            INumericColumn ncol = col as INumericColumn;

            double[] vec = new double[col.Count];
            for (int i = col.Count - 1; i >= 0; i--)
            {
                vec[i] = ncol[i];
            }

            return(VectorMath.ToROVector(vec));
        }
示例#2
0
 /// <summary>
 /// Returns a wrapper object, so that the returned vector is read only. Please note, that changes to the elements
 /// of the underlying array in DoubleVector are reflected in the wrapper object, whereas when the array itself is changing,
 /// the wrapper object will not reflect the changed.
 /// </summary>
 /// <returns></returns>
 public IROVector <double> ToROVector()
 {
     return(VectorMath.ToROVector(_array, _array.Length));
 }