예제 #1
0
        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));
        }
예제 #2
0
        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));
        }