//using System;
//using System.Security;
//using System.Runtime.InteropServices;

//namespace mkl
//{
//    public unsafe static class IntelMathLib
//    {
//        /** Managed callback function */
//        public static float[] Sin(float[] vector)
//        {
//            float[] returnVector = new float[vector.Length];
//            VML.vsSin(vector.Length, vector, returnVector);
//            return returnVector;
//        }

//        /** Managed callback function */
//        public static float[] Cos(float[] vector)
//        {
//            float[] returnVector = new float[vector.Length];
//            VML.vsCos(vector.Length, vector, returnVector);
//            return returnVector;
//        }

//        public static void SinByRef(ref float[] vector)
//        {
//            VML.vsSin(vector.Length, vector, vector);
//        }

//        /** Managed callback function */
//        public static void CosByRef(float[] vector)
//        {
//            VML.vsCos(vector.Length, vector, vector);
//        }

//        /** Managed callback function */
//        public static void Sin(int length, float* vector, float* result)
//        {
//            VML.vmsSin(length, vector, result);
//        }

//        /** Managed callback function */
//        public static void Cos(int length, float* vector, float* result)
//        {
//            VML.vmsCos(length, vector, result);
//        }

//        /** Managed callback function */
//        public static void Abs(int length, VML_COMPLEX8* complexVector, ref float* result)
//        {
//            VML.vmsAbs(length, complexVector, ref result);
//        }

//        /** Managed callback function */
//        public static void Arg(int length, VML_COMPLEX8* complexVector, ref float* result)
//        {
//            VML.vmcArg(length, complexVector, ref result);
//        }

//        /** Managed callback function */
//        public static void Mult(int length, float* a, float* b, ref float* result)
//        {
//            VML.vmsMul(length, a, b, ref result);
//        }

//        /** Managed callback function */
//        public static void Add(int length, float* a, float* b, ref float* result)
//        {
//            VML.vmsAdd(length, a, b, ref result);
//        }

//        public static float Sin(float val)
//        {
//            float[] valVector = new float[1] { val };
//            VML.vsSin(1, valVector, valVector);
//            return valVector[0];
//        }

//        /** Managed callback function */
//        public static float Cos(float val)
//        {
//            float[] valVector = new float[1] { val };
//            VML.vsCos(1, valVector, valVector);
//            return valVector[0];
//        }

//        /** Managed callback function */
//        public static float Sin_F(float[] vector)
//        {
//            VML.vsSin(vector.Length, vector, vector);
//            return vector[0];
//        }

//        /** Managed callback function */
//        public static float Cos_F(float[] vector)
//        {
//            VML.vsCos(vector.Length, vector, vector);
//            return vector[0];
//        }
//    }

//    public unsafe struct VML_COMPLEX8
//    {
//        public float real;
//        public float image;
//    }

//    public sealed class VML
//    {
//        private VML() { }

//        /** VML vdDiv wrapper */
//        public static void vddiv(int N, double[] A, double[] B, double[] Y)
//        {
//            VMLNative.vdDiv(N, A, B, Y);
//        }

//        public static void vsSin(int N, float[] A, float[] Y)
//        {
//            VMLNative.vsSin(N, A, Y);
//        }

//        public unsafe static void vmsSin(int N, float* A, float* Y)
//        {
//            VMLNative.vmsSin(N, A, Y, 3);
//        }

//        public unsafe static void vmsCos(int N, float* A, float* Y)
//        {
//            VMLNative.vmsCos(N, A, Y, 3);
//        }

//        public unsafe static void vmsAbs(int N, VML_COMPLEX8* A, ref float* Y)
//        {
//            VMLNative.vmcAbs(N, A, Y, 3);
//        }

//        public unsafe static void vmcArg(int N, VML_COMPLEX8* A, ref float* Y)
//        {
//            VMLNative.vmcArg(N, A, Y, 3);
//        }

//        public unsafe static void vmsMul(int N, float* A, float* B, ref float* Y)
//        {
//            VMLNative.vmsMul(N, A, B, Y, 3);
//        }

//        public unsafe static void vmsAdd(int N, float* A, float* B, ref float* Y)
//        {
//            VMLNative.vmsAdd(N, A, B, Y, 3);
//        }

//        public static void vsCos(int N, float[] A, float[] Y)
//        {
//            VMLNative.vsCos(N, A, Y);
//        }

//        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
//        public struct VmlErrorContext
//        {
//            public int iCode;   /* Error status value */
//            public int iIndex;  /* Index for bad array element,
//                                 * or bad array dimension,
//                                 *  or bad array pointer */
//            public double dbA1; /* Error argument 1 */
//            public double dbA2; /* Error argument 2 */
//            public double dbR1; /* Error result 1 */
//            public double dbR2; /* Error result 2 */
//            [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
//            public String cFuncName; /* Function name */
//            int iFuncNameLen;   /* Length of functionname*/
//        }
//        /** VML callback */
//        /** Attribute UnmanagedFunctionPointer requires .NET Framework >=2.0 */
//        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
//        public delegate int
//        vmlDelegateErrorCallBack(ref VmlErrorContext handle);
//        /** VML vmlSetErrorCallBack wrapper */
//        public static vmlDelegateErrorCallBack
//        vmlSetErrorCallBack(vmlDelegateErrorCallBack handle)
//        {
//            return VMLNative.vmlSetErrorCallBack(handle);
//        }
//        /** VML vmlClearErrorCallBack wrapper */
//        public static vmlDelegateErrorCallBack vmlClearErrorCallBack()
//        {
//            return VMLNative.vmlClearErrorCallBack();
//        }
//    }

//    /** VML native declarations */
//    [SuppressUnmanagedCodeSecurity]
//    internal sealed unsafe class VMLNative
//    {
//        private VMLNative() { }

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vdDiv(int N,
//            [In] double[] A, [In] double[] B, [Out] double[] Y);

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vsSin(int N,
//            [In] float[] A, [Out] float[] Y);

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vmsSin(int N,
//            [In] float* A, [Out] float* Y, int mode);

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vmsCos(int N,
//            [In] float* A, [Out] float* Y, int mode);

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vmcAbs(int N,
//            [In] VML_COMPLEX8* A, [Out] float* Y, int mode);

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vmcArg(int N,
//            [In] VML_COMPLEX8* A, [Out] float* Y, int mode);

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vmsMul(int N,
//            [In] float* A, [In] float* B, [Out] float* Y, int mode);

//        /** VML vmsAdd native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vmsAdd(int N,
//            [In] float* A, [In] float* B, [Out] float* Y, int mode);

//        /** VML vdDiv native declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern int vsCos(int N,
//            [In] float[] A, [Out] float[] Y);

//        /** VML Callback */
//        /** VML native vmlSetErrorCallBack declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern VML.vmlDelegateErrorCallBack
//            vmlSetErrorCallBack(VML.vmlDelegateErrorCallBack handle);
//        /** VML native vmlClearErrorCallBack declaration */
//        [DllImport("mkl_rt.dll", CallingConvention = CallingConvention.Cdecl,
//             ExactSpelling = true, SetLastError = false)]
//        internal static extern VML.vmlDelegateErrorCallBack
//            vmlClearErrorCallBack();
//    }
//}
