public static JuliaArray <T> Create2D(int nr, int nc) { var type = typeof(T); if (!TypePair.ContainsKey(type.Name)) { throw new ArgumentException("仅支持基本数据类型"); } var arrartype = JuliaNative.ApplyArrayType(TypePair[type.Name], (size_t)2); var x = JuliaNative.AllocArray2D(arrartype, (size_t)nr, (size_t)nc); return(new JuliaArray <T>(x)); }
public static JuliaArray <T> Create1D(int n) { var type = typeof(T); if (!TypePair.ContainsKey(type.Name)) { throw new ArgumentException("仅支持基本数据类型"); } var arrartype = JuliaNative.ApplyArrayType(TypePair[type.Name], (UIntPtr)1); var x = JuliaNative.AllocArray1D(arrartype, (UIntPtr)n); return(new JuliaArray <T>(x)); }
private static JuliaValue <T> Box(double value) { var p = JuliaNative.BoxFloat64(value); return(new JuliaValue <T>(p)); }
private static JuliaValue <T> Box(long value) { var p = JuliaNative.BoxInt64(value); return(new JuliaValue <T>(p)); }
public double GetFloat64() { return(JuliaNative.UnboxFloat64(handle)); }
public long GetInt64() { return(JuliaNative.UnboxInt64(handle)); }