public bool RemoveRToDotNetConverter(SymbolicExpressionType type) { if (_logger.IsDebugEnabled && _converters.ContainsKey(type)) { _logger.DebugFormat("Remove converter R -> .Net, Type: {0}", type); } return(_converters.Remove(type)); }
/// <summary> /// Creates a new matrix with the specified values. /// </summary> /// <param name="engine">The <see cref="REngine"/> handling this instance.</param> /// <param name="type">The element type.</param> /// <param name="matrix">The values.</param> public Matrix(REngine engine, SymbolicExpressionType type, T[,] matrix) : base(engine, engine.GetFunction <Rf_allocMatrix>()(type, matrix.GetLength(0), matrix.GetLength(1))) { int rowCount = RowCount; int columnCount = ColumnCount; //InitMatrixWithIndexers(matrix, rowCount, columnCount); InitMatrixFast(matrix); }
/// <summary> /// Creates a new vector with the specified size. /// </summary> /// <param name="engine">The <see cref="REngine"/> handling this instance.</param> /// <param name="type">The element type.</param> /// <param name="length">The length of vector.</param> protected Vector(REngine engine, SymbolicExpressionType type, int length) : base(engine, engine.GetFunction <Rf_allocVector>()(type, length)) { if (length <= 0) { throw new ArgumentOutOfRangeException("length"); } var empty = new byte[length * DataSize]; Marshal.Copy(empty, 0, DataPointer, empty.Length); }
public void SetupRToDotNetConverter(SymbolicExpressionType type, Func <SymbolicExpression, IConverter> factory) { if (_logger.IsDebugEnabled) { _logger.DebugFormat( _converters.ContainsKey(type) ? "Override converter R -> .Net, Type: {0}" : "Setup converter R -> .Net, Type: {0}", type); } _converters[type] = factory; }
/// <summary> /// Creates a new matrix with the specified size. /// </summary> /// <param name="engine">The engine.</param> /// <param name="type">The element type.</param> /// <param name="rowCount">The size of row.</param> /// <param name="columnCount">The size of column.</param> protected Matrix(REngine engine, SymbolicExpressionType type, int rowCount, int columnCount) : base(engine, engine.GetFunction <Rf_allocMatrix>()(type, rowCount, columnCount)) { if (rowCount <= 0) { throw new ArgumentOutOfRangeException("rowCount"); } if (columnCount <= 0) { throw new ArgumentOutOfRangeException("columnCount"); } var empty = new byte[rowCount * columnCount * DataSize]; Marshal.Copy(empty, 0, DataPointer, empty.Length); }
public Func <SymbolicExpression, IConverter> GetRToDotNetConverter(SymbolicExpressionType type) { _converters.TryGetValue(type, out var factory); return(factory); }
/// <summary> /// Creates a new vector with the specified values. /// </summary> /// <param name="engine">The <see cref="REngine"/> handling this instance.</param> /// <param name="type">The element type.</param> /// <param name="vector">The elements of vector.</param> protected Vector(REngine engine, SymbolicExpressionType type, IEnumerable <T> vector) : base(engine, engine.GetFunction <Rf_allocVector>()(type, vector.Count())) { SetVector(vector.ToArray()); }