Exemplo n.º 1
0
 public static Value Make(Value v)
 {
     if (v is ArrayDouble)
     {
         return(v);
     }
     else if (v is ArrayValue)
     {
         ArrayValue  arr = v as ArrayValue;
         int         cols = arr.Cols, rows = arr.Rows;
         ArrayDouble result = new ArrayDouble(cols, rows);
         for (int r = 0; r < rows; r++)
         {
             for (int c = 0; c < cols; c++)
             {
                 result.matrix[r, c] = Value.ToDoubleOrNan(arr[c, r]);
             }
         }
         return(result);
     }
     else
     {
         return(ErrorValue.argTypeError);
     }
 }
Exemplo n.º 2
0
		public static Value Make(Value v) {
			if (v is ArrayDouble) {
				return v;
			}
			else if (v is ArrayValue) {
				ArrayValue arr = v as ArrayValue;
				int cols = arr.Cols, rows = arr.Rows;
				ArrayDouble result = new ArrayDouble(cols, rows);
				for (int r = 0; r < rows; r++) {
					for (int c = 0; c < cols; c++) {
						result.matrix[r, c] = Value.ToDoubleOrNan(arr[c, r]);
					}
				}
				return result;
			}
			else {
				return ErrorValue.argTypeError;
			}
		}